summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/p5_pbe.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index 582d2d9a9b..668bf5d7c1 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_pbe.c,v 1.28 2024/07/08 14:48:49 beck Exp $ */ 1/* $OpenBSD: p5_pbe.c,v 1.30 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. 3 * project 1999.
4 */ 4 */
@@ -61,11 +61,14 @@
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 "x509_local.h" 67#include "x509_local.h"
68 68
69/* RFC 8018, section 6.1 specifies an eight-octet salt for PBES1. */
70#define PKCS5_PBE1_SALT_LEN 8
71
69/* PKCS#5 password based encryption structure */ 72/* PKCS#5 password based encryption structure */
70 73
71static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = { 74static const ASN1_TEMPLATE PBEPARAM_seq_tt[] = {
@@ -139,7 +142,7 @@ PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
139 goto err; 142 goto err;
140 } 143 }
141 if (!saltlen) 144 if (!saltlen)
142 saltlen = PKCS5_SALT_LEN; 145 saltlen = PKCS5_PBE1_SALT_LEN;
143 if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) { 146 if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) {
144 ASN1error(ERR_R_MALLOC_FAILURE); 147 ASN1error(ERR_R_MALLOC_FAILURE);
145 goto err; 148 goto err;