summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_ssl.c
diff options
context:
space:
mode:
authorbeck <>2000-03-19 11:13:58 +0000
committerbeck <>2000-03-19 11:13:58 +0000
commit796d609550df3a33fc11468741c5d2f6d3df4c11 (patch)
tree6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/rsa/rsa_ssl.c
parent5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff)
downloadopenbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2 if you are using the ssl26 packages for ssh and other things to work you will need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_ssl.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_ssl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ssl.c b/src/lib/libcrypto/rsa/rsa_ssl.c
index 1050844f8d..81a857c813 100644
--- a/src/lib/libcrypto/rsa/rsa_ssl.c
+++ b/src/lib/libcrypto/rsa/rsa_ssl.c
@@ -82,12 +82,14 @@ int RSA_padding_add_SSLv23(unsigned char *to, int tlen, unsigned char *from,
82 /* pad out with non-zero random data */ 82 /* pad out with non-zero random data */
83 j=tlen-3-8-flen; 83 j=tlen-3-8-flen;
84 84
85 RAND_bytes(p,j); 85 if (RAND_bytes(p,j) <= 0)
86 return(0);
86 for (i=0; i<j; i++) 87 for (i=0; i<j; i++)
87 { 88 {
88 if (*p == '\0') 89 if (*p == '\0')
89 do { 90 do {
90 RAND_bytes(p,1); 91 if (RAND_bytes(p,1) <= 0)
92 return(0);
91 } while (*p == '\0'); 93 } while (*p == '\0');
92 p++; 94 p++;
93 } 95 }
@@ -140,6 +142,11 @@ int RSA_padding_check_SSLv23(unsigned char *to, int tlen, unsigned char *from,
140 142
141 i++; /* Skip over the '\0' */ 143 i++; /* Skip over the '\0' */
142 j-=i; 144 j-=i;
145 if (j > tlen)
146 {
147 RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,RSA_R_DATA_TOO_LARGE);
148 return(-1);
149 }
143 memcpy(to,p,(unsigned int)j); 150 memcpy(to,p,(unsigned int)j);
144 151
145 return(j); 152 return(j);