summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p5_crpt2.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-08-07 14:29:00 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-08-07 14:29:00 +1000
commit5ccada09aae0cf846d3381a161d3eb20d4d9abfd (patch)
tree39fc4e655a53c146bc6a8fcde3f0746c56a97a1c /crypto/evp/p5_crpt2.c
parent64827f407b0b603f585d7fadfd7e61a60ed7a45b (diff)
Add evp_test fixes.
Changed many tests so they also test fips (and removed 'availablein = default' from some tests). Seperated the monolithic evppkey.txt file into smaller maintainable groups. Changed the availablein option so it must be first - this then skips the entire test before any fetching happens. Changed the code so that all the OPENSSL_NO_XXXX tests are done in code via methods such as is_cipher_disabled(alg), before the fetch happens. Added missing libctx's found by adding a libctx to test_evp. Broke up large data files for cipher, kdf's and mac's into smaller pieces so they no longer need 'AvailableIn = default' Added missing algorithm aliases for cipher/digests to the providers. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12236)
Diffstat (limited to 'crypto/evp/p5_crpt2.c')
-rw-r--r--crypto/evp/p5_crpt2.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c
index 6e89ffd999..7b8f99d511 100644
--- a/crypto/evp/p5_crpt2.c
+++ b/crypto/evp/p5_crpt2.c
@@ -19,9 +19,11 @@
#include "crypto/evp.h"
#include "evp_local.h"
-int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
- const unsigned char *salt, int saltlen, int iter,
- const EVP_MD *digest, int keylen, unsigned char *out)
+int pkcs5_pbkdf2_hmac_with_libctx(const char *pass, int passlen,
+ const unsigned char *salt, int saltlen,
+ int iter, const EVP_MD *digest, int keylen,
+ unsigned char *out,
+ OPENSSL_CTX *libctx, const char *propq)
{
const char *empty = "";
int rv = 1, mode = 1;
@@ -40,7 +42,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
if (salt == NULL && saltlen == 0)
salt = (unsigned char *)empty;
- kdf = EVP_KDF_fetch(NULL, OSSL_KDF_NAME_PBKDF2, NULL);
+ kdf = EVP_KDF_fetch(libctx, OSSL_KDF_NAME_PBKDF2, propq);
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
if (kctx == NULL)
@@ -78,6 +80,15 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
return rv;
}
+int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt,
+ int saltlen, int iter, const EVP_MD *digest, int keylen,
+ unsigned char *out)
+{
+ return pkcs5_pbkdf2_hmac_with_libctx(pass, passlen, salt, saltlen, iter,
+ digest, keylen, out, NULL, NULL);
+}
+
+
int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
const unsigned char *salt, int saltlen, int iter,
int keylen, unsigned char *out)