X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Frsa%2Frsa_ssl.c;h=ea72629494cffd952d15eff4098b3f554c9ff723;hb=75d44c0452e8807dcd9dd126390dd8df35c57efa;hp=42ee076800ec48c99048a3c7bd16e6f479ca029d;hpb=dfeab0689f69c0b4bd3480ffd37a9cacc2f17d9c;p=oweals%2Fopenssl.git diff --git a/crypto/rsa/rsa_ssl.c b/crypto/rsa/rsa_ssl.c index 42ee076800..ea72629494 100644 --- a/crypto/rsa/rsa_ssl.c +++ b/crypto/rsa/rsa_ssl.c @@ -58,15 +58,12 @@ #include #include "cryptlib.h" -#include "bn.h" -#include "rsa.h" -#include "rand.h" +#include +#include +#include -int RSA_padding_add_SSLv23(to,tlen,from,flen) -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; @@ -85,12 +82,14 @@ int flen; /* 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);