X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Frsa%2Frsa_ssl.c;h=ea72629494cffd952d15eff4098b3f554c9ff723;hp=e1bbbe794902f4f598ad87bde929f46232e5532e;hb=42ba5d2329a2705d45417db3dd374c677eb47e05;hpb=6b691a5c85ddc4e407e32781841fee5c029506cd diff --git a/crypto/rsa/rsa_ssl.c b/crypto/rsa/rsa_ssl.c index e1bbbe7949..ea72629494 100644 --- a/crypto/rsa/rsa_ssl.c +++ b/crypto/rsa/rsa_ssl.c @@ -58,12 +58,12 @@ #include #include "cryptlib.h" -#include "bn.h" -#include "rsa.h" -#include "rand.h" +#include +#include +#include -int RSA_padding_add_SSLv23(unsigned char *to, int tlen, unsigned char *from, - int flen) +int RSA_padding_add_SSLv23(unsigned char *to, int tlen, + const unsigned char *from, int flen) { int i,j; unsigned char *p; @@ -82,12 +82,14 @@ int RSA_padding_add_SSLv23(unsigned char *to, int tlen, unsigned char *from, /* pad out with non-zero random data */ j=tlen-3-8-flen; - RAND_bytes(p,j); + if (RAND_bytes(p,j) <= 0) + return(0); for (i=0; i tlen) + { + RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,RSA_R_DATA_TOO_LARGE); + return(-1); + } memcpy(to,p,(unsigned int)j); return(j);