summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-03-02 10:20:27 +0000
committertb <>2024-03-02 10:20:27 +0000
commitb4541fab5e606187b51e789c26e6065cfc57ded0 (patch)
treefbf01f5453b712e42063e482a28304a6a55892cd
parentfdfad9e1701882b4e72b41155a9c8e4ef338ddbf (diff)
downloadopenbsd-b4541fab5e606187b51e789c26e6065cfc57ded0.tar.gz
openbsd-b4541fab5e606187b51e789c26e6065cfc57ded0.tar.bz2
openbsd-b4541fab5e606187b51e789c26e6065cfc57ded0.zip
Remove more PBE stuff from the public API
This is still needed internally for CMS and its predecessors. This removal will enable disentangling some of its innards. ok jsing
-rw-r--r--src/lib/libcrypto/Symbols.list7
-rw-r--r--src/lib/libcrypto/evp/evp.h7
-rw-r--r--src/lib/libcrypto/evp/evp_local.h5
-rw-r--r--src/lib/libcrypto/evp/evp_pbe.c8
-rw-r--r--src/lib/libcrypto/pkcs12/p12_add.c3
-rw-r--r--src/lib/libcrypto/x509/x509.h16
-rw-r--r--src/lib/libcrypto/x509/x509_local.h13
7 files changed, 24 insertions, 35 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index 7a27d6d1a3..de97306613 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -1952,15 +1952,8 @@ PKCS12_unpack_p7data
1952PKCS12_unpack_p7encdata 1952PKCS12_unpack_p7encdata
1953PKCS12_verify_mac 1953PKCS12_verify_mac
1954PKCS1_MGF1 1954PKCS1_MGF1
1955PKCS5_PBE_keyivgen
1956PKCS5_PBKDF2_HMAC 1955PKCS5_PBKDF2_HMAC
1957PKCS5_PBKDF2_HMAC_SHA1 1956PKCS5_PBKDF2_HMAC_SHA1
1958PKCS5_pbe2_set
1959PKCS5_pbe2_set_iv
1960PKCS5_pbe_set
1961PKCS5_pbe_set0_algor
1962PKCS5_pbkdf2_set
1963PKCS5_v2_PBE_keyivgen
1964PKCS7_ATTR_SIGN_it 1957PKCS7_ATTR_SIGN_it
1965PKCS7_ATTR_VERIFY_it 1958PKCS7_ATTR_VERIFY_it
1966PKCS7_DIGEST_free 1959PKCS7_DIGEST_free
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index 28b095ffd4..9e203b086d 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp.h,v 1.130 2024/03/02 10:13:13 tb Exp $ */ 1/* $OpenBSD: evp.h,v 1.131 2024/03/02 10:20:27 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -870,17 +870,12 @@ int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
870int EVP_CIPHER_type(const EVP_CIPHER *ctx); 870int EVP_CIPHER_type(const EVP_CIPHER *ctx);
871 871
872/* PKCS5 password based encryption */ 872/* PKCS5 password based encryption */
873int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
874 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de);
875int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, 873int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
876 const unsigned char *salt, int saltlen, int iter, int keylen, 874 const unsigned char *salt, int saltlen, int iter, int keylen,
877 unsigned char *out); 875 unsigned char *out);
878int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt, 876int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt,
879 int saltlen, int iter, const EVP_MD *digest, int keylen, 877 int saltlen, int iter, const EVP_MD *digest, int keylen,
880 unsigned char *out); 878 unsigned char *out);
881int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
882 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
883 int en_de);
884 879
885#define ASN1_PKEY_ALIAS 0x1 880#define ASN1_PKEY_ALIAS 0x1
886#define ASN1_PKEY_DYNAMIC 0x2 881#define ASN1_PKEY_DYNAMIC 0x2
diff --git a/src/lib/libcrypto/evp/evp_local.h b/src/lib/libcrypto/evp/evp_local.h
index bce6a87a1e..dad2cec81e 100644
--- a/src/lib/libcrypto/evp/evp_local.h
+++ b/src/lib/libcrypto/evp/evp_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_local.h,v 1.18 2024/03/02 10:08:29 tb Exp $ */ 1/* $OpenBSD: evp_local.h,v 1.19 2024/03/02 10:20:27 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 2000. 3 * project 2000.
4 */ 4 */
@@ -340,9 +340,6 @@ struct evp_pkey_method_st {
340 340
341void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); 341void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);
342 342
343int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
344 ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_MD *md, int en_de);
345
346/* EVP_AEAD represents a specific AEAD algorithm. */ 343/* EVP_AEAD represents a specific AEAD algorithm. */
347struct evp_aead_st { 344struct evp_aead_st {
348 unsigned char key_len; 345 unsigned char key_len;
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c
index a9f5b8fb12..532c924a9e 100644
--- a/src/lib/libcrypto/evp/evp_pbe.c
+++ b/src/lib/libcrypto/evp/evp_pbe.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pbe.c,v 1.45 2024/03/02 10:17:37 tb Exp $ */ 1/* $OpenBSD: evp_pbe.c,v 1.46 2024/03/02 10:20:27 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 */
@@ -73,9 +73,15 @@
73#include "x509_local.h" 73#include "x509_local.h"
74 74
75/* Password based encryption (PBE) functions */ 75/* Password based encryption (PBE) functions */
76int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
77 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de);
78int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
79 ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_MD *md, int en_de);
76int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 80int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
77 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type, 81 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type,
78 int en_de); 82 int en_de);
83int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
84 ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_MD *md, int en_de);
79 85
80static const struct pbe_config { 86static const struct pbe_config {
81 int pbe_nid; 87 int pbe_nid;
diff --git a/src/lib/libcrypto/pkcs12/p12_add.c b/src/lib/libcrypto/pkcs12/p12_add.c
index dd72c99985..f6f42c558c 100644
--- a/src/lib/libcrypto/pkcs12/p12_add.c
+++ b/src/lib/libcrypto/pkcs12/p12_add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_add.c,v 1.24 2024/03/02 10:15:16 tb Exp $ */ 1/* $OpenBSD: p12_add.c,v 1.25 2024/03/02 10:20:27 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 */
@@ -62,6 +62,7 @@
62#include <openssl/pkcs12.h> 62#include <openssl/pkcs12.h>
63 63
64#include "pkcs12_local.h" 64#include "pkcs12_local.h"
65#include "x509_local.h"
65 66
66/* Pack an object into an OCTET STRING and turn into a safebag */ 67/* Pack an object into an OCTET STRING and turn into a safebag */
67 68
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h
index bd8497d9c4..66752f34e9 100644
--- a/src/lib/libcrypto/x509/x509.h
+++ b/src/lib/libcrypto/x509/x509.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509.h,v 1.104 2024/03/02 10:17:37 tb Exp $ */ 1/* $OpenBSD: x509.h,v 1.105 2024/03/02 10:20:27 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1018,20 +1018,6 @@ X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name);
1018 1018
1019extern const ASN1_ITEM PBEPARAM_it; 1019extern const ASN1_ITEM PBEPARAM_it;
1020 1020
1021int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
1022 const unsigned char *salt, int saltlen);
1023
1024X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
1025 const unsigned char *salt, int saltlen);
1026X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
1027 unsigned char *salt, int saltlen);
1028X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
1029 unsigned char *salt, int saltlen,
1030 unsigned char *aiv, int prf_nid);
1031
1032X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
1033 int prf_nid, int keylen);
1034
1035/* PKCS#8 utilities */ 1021/* PKCS#8 utilities */
1036 1022
1037PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void); 1023PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void);
diff --git a/src/lib/libcrypto/x509/x509_local.h b/src/lib/libcrypto/x509/x509_local.h
index 1e813797e1..4ac99da2bd 100644
--- a/src/lib/libcrypto/x509/x509_local.h
+++ b/src/lib/libcrypto/x509/x509_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_local.h,v 1.19 2024/03/02 10:17:37 tb Exp $ */ 1/* $OpenBSD: x509_local.h,v 1.20 2024/03/02 10:20:27 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 2013. 3 * project 2013.
4 */ 4 */
@@ -391,6 +391,17 @@ PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, const unsigned char **in, long len
391int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **out); 391int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **out);
392extern const ASN1_ITEM PBKDF2PARAM_it; 392extern const ASN1_ITEM PBKDF2PARAM_it;
393 393
394int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
395 const unsigned char *salt, int saltlen);
396X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
397 unsigned char *salt, int saltlen);
398X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
399 unsigned char *salt, int saltlen, unsigned char *aiv, int prf_nid);
400X509_ALGOR *PKCS5_pbe_set(int alg, int iter, const unsigned char *salt,
401 int saltlen);
402X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
403 int prf_nid, int keylen);
404
394__END_HIDDEN_DECLS 405__END_HIDDEN_DECLS
395 406
396#endif /* !HEADER_X509_LOCAL_H */ 407#endif /* !HEADER_X509_LOCAL_H */