aboutsummaryrefslogtreecommitdiff
path: root/openssl/crypto/rsa/rsa_oaep.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-30 08:46:36 +0200
committermarha <marha@users.sourceforge.net>2011-09-30 08:46:36 +0200
commit73d82f7ac0d1add2697128c2e26c2432ffe172a5 (patch)
treec6436b57a2191c57320396c37449109ebad745ec /openssl/crypto/rsa/rsa_oaep.c
parent4a9e1f51655e03da1507dabce7c4c3960e7ca607 (diff)
parent60adbfdea1ee754341d64454274e7aa83bae8971 (diff)
downloadvcxsrv-73d82f7ac0d1add2697128c2e26c2432ffe172a5.tar.gz
vcxsrv-73d82f7ac0d1add2697128c2e26c2432ffe172a5.tar.bz2
vcxsrv-73d82f7ac0d1add2697128c2e26c2432ffe172a5.zip
Merge remote-tracking branch 'origin/released'
Conflicts: openssl/Makefile
Diffstat (limited to 'openssl/crypto/rsa/rsa_oaep.c')
-rw-r--r--openssl/crypto/rsa/rsa_oaep.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/openssl/crypto/rsa/rsa_oaep.c b/openssl/crypto/rsa/rsa_oaep.c
index e238d10e5..18d307ea9 100644
--- a/openssl/crypto/rsa/rsa_oaep.c
+++ b/openssl/crypto/rsa/rsa_oaep.c
@@ -189,34 +189,40 @@ int PKCS1_MGF1(unsigned char *mask, long len,
EVP_MD_CTX c;
unsigned char md[EVP_MAX_MD_SIZE];
int mdlen;
+ int rv = -1;
EVP_MD_CTX_init(&c);
mdlen = EVP_MD_size(dgst);
if (mdlen < 0)
- return -1;
+ goto err;
for (i = 0; outlen < len; i++)
{
cnt[0] = (unsigned char)((i >> 24) & 255);
cnt[1] = (unsigned char)((i >> 16) & 255);
cnt[2] = (unsigned char)((i >> 8)) & 255;
cnt[3] = (unsigned char)(i & 255);
- EVP_DigestInit_ex(&c,dgst, NULL);
- EVP_DigestUpdate(&c, seed, seedlen);
- EVP_DigestUpdate(&c, cnt, 4);
+ if (!EVP_DigestInit_ex(&c,dgst, NULL)
+ || !EVP_DigestUpdate(&c, seed, seedlen)
+ || !EVP_DigestUpdate(&c, cnt, 4))
+ goto err;
if (outlen + mdlen <= len)
{
- EVP_DigestFinal_ex(&c, mask + outlen, NULL);
+ if (!EVP_DigestFinal_ex(&c, mask + outlen, NULL))
+ goto err;
outlen += mdlen;
}
else
{
- EVP_DigestFinal_ex(&c, md, NULL);
+ if (!EVP_DigestFinal_ex(&c, md, NULL))
+ goto err;
memcpy(mask + outlen, md, len - outlen);
outlen = len;
}
}
+ rv = 0;
+ err:
EVP_MD_CTX_cleanup(&c);
- return 0;
+ return rv;
}
static int MGF1(unsigned char *mask, long len, const unsigned char *seed,