summaryrefslogtreecommitdiffstats
path: root/crypto/rsa/rsa_oaep.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-06-19 22:30:40 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-06-19 22:30:40 +0000
commit323f289c480b0a8eb15ed3be2befbcc0f86e8904 (patch)
treea8f18dde28ce3c77b7bff50c2b45a44c556dfed4 /crypto/rsa/rsa_oaep.c
parenta45e4a5537e009761652db0d9aa1ef28b1ce8937 (diff)
Change all calls to low level digest routines in the library and
applications to use EVP. Add missing calls to HMAC_cleanup() and don't assume HMAC_CTX can be copied using memcpy(). Note: this is almost identical to the patch submitted to openssl-dev by Verdon Walker <VWalker@novell.com> except some redundant EVP_add_digest_()/EVP_cleanup() calls were removed and some changes made to avoid compiler warnings.
Diffstat (limited to 'crypto/rsa/rsa_oaep.c')
-rw-r--r--crypto/rsa/rsa_oaep.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c
index a489639259..8da765e4d7 100644
--- a/crypto/rsa/rsa_oaep.c
+++ b/crypto/rsa/rsa_oaep.c
@@ -24,7 +24,7 @@
#include "cryptlib.h"
#include <openssl/bn.h>
#include <openssl/rsa.h>
-#include <openssl/sha.h>
+#include <openssl/evp.h>
#include <openssl/rand.h>
int MGF1(unsigned char *mask, long len,
@@ -62,7 +62,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
seed = to + 1;
db = to + SHA_DIGEST_LENGTH + 1;
- SHA1(param, plen, db);
+ EVP_Digest((void *)param, plen, db, NULL, EVP_sha1());
memset(db + SHA_DIGEST_LENGTH, 0,
emlen - flen - 2 * SHA_DIGEST_LENGTH - 1);
db[emlen - flen - SHA_DIGEST_LENGTH - 1] = 0x01;
@@ -120,7 +120,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
for (i = 0; i < dblen; i++)
db[i] ^= maskeddb[i];
- SHA1(param, plen, phash);
+ EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1());
if (memcmp(db, phash, SHA_DIGEST_LENGTH) != 0)
goto decoding_err;
@@ -159,24 +159,24 @@ int MGF1(unsigned char *mask, long len,
{
long i, outlen = 0;
unsigned char cnt[4];
- SHA_CTX c;
+ EVP_MD_CTX c;
unsigned char md[SHA_DIGEST_LENGTH];
for (i = 0; outlen < len; i++)
{
cnt[0] = (i >> 24) & 255, cnt[1] = (i >> 16) & 255,
cnt[2] = (i >> 8) & 255, cnt[3] = i & 255;
- SHA1_Init(&c);
- SHA1_Update(&c, seed, seedlen);
- SHA1_Update(&c, cnt, 4);
+ EVP_DigestInit(&c,EVP_sha1());
+ EVP_DigestUpdate(&c, seed, seedlen);
+ EVP_DigestUpdate(&c, cnt, 4);
if (outlen + SHA_DIGEST_LENGTH <= len)
{
- SHA1_Final(mask + outlen, &c);
+ EVP_DigestFinal(&c, mask + outlen, NULL);
outlen += SHA_DIGEST_LENGTH;
}
else
{
- SHA1_Final(md, &c);
+ EVP_DigestFinal(&c, md, NULL);
memcpy(mask + outlen, md, len - outlen);
outlen = len;
}