diff options
author | Richard Levitte <levitte@openssl.org> | 2015-11-27 14:17:50 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-12-07 17:36:57 +0100 |
commit | 77a01145be26ceeefa6870e1e9dd7f99ac123fa3 (patch) | |
tree | 5b2426456e3a7f4b8fd4790462ebf7068b547622 /crypto/evp/evp_key.c | |
parent | 7638370ca6cb1d89eba5d891f522776b9da3d6e7 (diff) |
Have other crypto/evp files include evp_locl.h
Note: this does not include the files in crypto/evp that are just
instanciations of EVP_MD.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/evp/evp_key.c')
-rw-r--r-- | crypto/evp/evp_key.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c index 3e2c989954..231c06b86e 100644 --- a/crypto/evp/evp_key.c +++ b/crypto/evp/evp_key.c @@ -123,7 +123,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, int datal, int count, unsigned char *key, unsigned char *iv) { - EVP_MD_CTX c; + EVP_MD_CTX *c; unsigned char md_buf[EVP_MAX_MD_SIZE]; int niv, nkey, addmd = 0; unsigned int mds = 0, i; @@ -136,27 +136,29 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, if (data == NULL) return (nkey); - EVP_MD_CTX_init(&c); + c = EVP_MD_CTX_create(); + if (c == NULL) + goto err; for (;;) { - if (!EVP_DigestInit_ex(&c, md, NULL)) + if (!EVP_DigestInit_ex(c, md, NULL)) goto err; if (addmd++) - if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) + if (!EVP_DigestUpdate(c, &(md_buf[0]), mds)) goto err; - if (!EVP_DigestUpdate(&c, data, datal)) + if (!EVP_DigestUpdate(c, data, datal)) goto err; if (salt != NULL) - if (!EVP_DigestUpdate(&c, salt, PKCS5_SALT_LEN)) + if (!EVP_DigestUpdate(c, salt, PKCS5_SALT_LEN)) goto err; - if (!EVP_DigestFinal_ex(&c, &(md_buf[0]), &mds)) + if (!EVP_DigestFinal_ex(c, &(md_buf[0]), &mds)) goto err; for (i = 1; i < (unsigned int)count; i++) { - if (!EVP_DigestInit_ex(&c, md, NULL)) + if (!EVP_DigestInit_ex(c, md, NULL)) goto err; - if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) + if (!EVP_DigestUpdate(c, &(md_buf[0]), mds)) goto err; - if (!EVP_DigestFinal_ex(&c, &(md_buf[0]), &mds)) + if (!EVP_DigestFinal_ex(c, &(md_buf[0]), &mds)) goto err; } i = 0; @@ -189,7 +191,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, } rv = type->key_len; err: - EVP_MD_CTX_cleanup(&c); + EVP_MD_CTX_destroy(c); OPENSSL_cleanse(md_buf, sizeof(md_buf)); return rv; } |