diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/p5_pbev2.c')
-rw-r--r-- | src/lib/libcrypto/asn1/p5_pbev2.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 76872a8dec..64924d9b38 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p5_pbev2.c,v 1.35 2024/03/26 07:03:10 tb Exp $ */ | 1 | /* $OpenBSD: p5_pbev2.c,v 1.38 2025/05/24 02:57:14 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999-2004. | 3 | * project 1999-2004. |
4 | */ | 4 | */ |
@@ -61,12 +61,18 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
64 | #include <openssl/err.h> | ||
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
66 | #include "err_local.h" | ||
67 | #include "evp_local.h" | 67 | #include "evp_local.h" |
68 | #include "x509_local.h" | 68 | #include "x509_local.h" |
69 | 69 | ||
70 | /* | ||
71 | * RFC 8018, sections 6.2 and 4 specify at least 64 bits for PBES2, apparently | ||
72 | * FIPS will require at least 128 bits in the future, OpenSSL does that. | ||
73 | */ | ||
74 | #define PKCS5_PBE2_SALT_LEN 16 | ||
75 | |||
70 | /* PKCS#5 v2.0 password based encryption structures */ | 76 | /* PKCS#5 v2.0 password based encryption structures */ |
71 | 77 | ||
72 | static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { | 78 | static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = { |
@@ -187,7 +193,7 @@ PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt, | |||
187 | int saltlen) | 193 | int saltlen) |
188 | { | 194 | { |
189 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; | 195 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; |
190 | int prf_nid = NID_hmacWithSHA1; | 196 | int prf_nid = NID_hmacWithSHA256; |
191 | int alg_nid, keylen; | 197 | int alg_nid, keylen; |
192 | EVP_CIPHER_CTX ctx; | 198 | EVP_CIPHER_CTX ctx; |
193 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 199 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
@@ -292,7 +298,7 @@ PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid, | |||
292 | kdf->salt->type = V_ASN1_OCTET_STRING; | 298 | kdf->salt->type = V_ASN1_OCTET_STRING; |
293 | 299 | ||
294 | if (!saltlen) | 300 | if (!saltlen) |
295 | saltlen = PKCS5_SALT_LEN; | 301 | saltlen = PKCS5_PBE2_SALT_LEN; |
296 | if (!(osalt->data = malloc (saltlen))) | 302 | if (!(osalt->data = malloc (saltlen))) |
297 | goto merr; | 303 | goto merr; |
298 | 304 | ||