summaryrefslogtreecommitdiffstats
path: root/crypto/rsa/rsa_oaep.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2009-06-27 01:14:39 +0200
committerDr. Stephen Henson <steve@openssl.org>2009-06-27 01:14:39 +0200
commita5f78bf3ba24e1486a6885b302580bb9d59c83e5 (patch)
treea3534ec8eeffd7222dafab18c931e7d6828860d6 /crypto/rsa/rsa_oaep.c
parentUpdate from 0.9.8-stable. (diff)
downloadopenssl-a5f78bf3ba24e1486a6885b302580bb9d59c83e5.tar.xz
openssl-a5f78bf3ba24e1486a6885b302580bb9d59c83e5.zip
Fix from 0.9.8-stable.
Diffstat (limited to 'crypto/rsa/rsa_oaep.c')
-rw-r--r--crypto/rsa/rsa_oaep.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c
index 70bacf850e..e238d10e5c 100644
--- a/crypto/rsa/rsa_oaep.c
+++ b/crypto/rsa/rsa_oaep.c
@@ -52,13 +52,6 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
return 0;
}
- dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH);
- if (dbmask == NULL)
- {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
- return 0;
- }
-
to[0] = 0;
seed = to + 1;
db = to + SHA_DIGEST_LENGTH + 1;
@@ -76,6 +69,13 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
20);
#endif
+ dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH);
+ if (dbmask == NULL)
+ {
+ RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+
if (MGF1(dbmask, emlen - SHA_DIGEST_LENGTH, seed, SHA_DIGEST_LENGTH) < 0)
return 0;
for (i = 0; i < emlen - SHA_DIGEST_LENGTH; i++)