From: Ulf Möller Date: Wed, 6 Jun 2001 17:24:03 +0000 (+0000) Subject: as in head X-Git-Tag: OpenSSL_0_9_6b~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=afd7b5affef28e3b2e4b04467fd88e64325a8699;p=oweals%2Fopenssl.git as in head --- diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c index 4f3209f021..164cd0df32 100644 --- a/crypto/rsa/rsa_oaep.c +++ b/crypto/rsa/rsa_oaep.c @@ -85,6 +85,14 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, return (-1); } + lzero = num - flen; + if (lzero < 0) + { + RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); + return (-1); + } + maskeddb = from - lzero + SHA_DIGEST_LENGTH; + dblen = num - SHA_DIGEST_LENGTH; db = OPENSSL_malloc(dblen); if (db == NULL) @@ -93,14 +101,6 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, return (-1); } - lzero = num - flen; - if (lzero < 0) - { - RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); - return (-1); - } - maskeddb = from - lzero + SHA_DIGEST_LENGTH; - MGF1(seed, SHA_DIGEST_LENGTH, maskeddb, dblen); for (i = lzero; i < SHA_DIGEST_LENGTH; i++) seed[i] ^= from[i - lzero];