summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-04-09 19:10:23 +0000
committertb <>2023-04-09 19:10:23 +0000
commitc6d2fd4172ff9d967c8568f18bee3e3fbb7c4d96 (patch)
tree4e68c064d1e2a087f3d85418eec7158852b63be6
parent716f7ee66553ba43368106520df77e5efdddef94 (diff)
downloadopenbsd-c6d2fd4172ff9d967c8568f18bee3e3fbb7c4d96.tar.gz
openbsd-c6d2fd4172ff9d967c8568f18bee3e3fbb7c4d96.tar.bz2
openbsd-c6d2fd4172ff9d967c8568f18bee3e3fbb7c4d96.zip
Move a few functions out of OPENSSL_NO_DEPRECATED
Geoff Thorpe added OPENSSL_NO_DEPRECATED nearly two decades ago. The hope was that at some point some functions can be dropped. Most of the functions marked deprecated are actually unused nowadays but unfortunately some of them are still used in the ecosystem. Move them out of OPENSSL_NO_DEPRECATED so we can define it without breaking the consumers in the next bump. ERR_remove_state() is still used by a dozen or so ports. This isn't a big deal since it is just a stupid wrapper for the not quite as deprecated ERR_remove_thread_state(). It's not worth patching these ports. Annoyingly, {DH,DSA}_generate_parameters() and RSA_generate_key() are still used. They "make use" of the old-style BN_GENCB callback, which is therefore more difficult to remove - in case you don't know know: that's the thing responsible for printing pretty '.', '+' and '*' when you generate keys. Most annoyingly, DH_generate_parameters() was added to rust-openssl in 2020 for "advanced DH support". This is very unfortunate since cargo bundles a rust-openssl and updates it only every few years or so. As a consequence we're going to be stuck with this nonsense for a good while. ok beck jsing
-rw-r--r--src/lib/libcrypto/dh/dh.h9
-rw-r--r--src/lib/libcrypto/dh/dh_depr.c4
-rw-r--r--src/lib/libcrypto/dsa/dsa.h6
-rw-r--r--src/lib/libcrypto/dsa/dsa_depr.c4
-rw-r--r--src/lib/libcrypto/err/err.c4
-rw-r--r--src/lib/libcrypto/err/err.h7
-rw-r--r--src/lib/libcrypto/rsa/rsa.h9
-rw-r--r--src/lib/libcrypto/rsa/rsa_depr.c5
8 files changed, 19 insertions, 29 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 7b226a70c8..402ef6e17b 100644
--- a/src/lib/libcrypto/dh/dh.h
+++ b/src/lib/libcrypto/dh/dh.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.h,v 1.35 2022/07/12 14:42:49 kn Exp $ */ 1/* $OpenBSD: dh.h,v 1.36 2023/04/09 19:10:23 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 *
@@ -162,11 +162,12 @@ void DH_set_flags(DH *dh, int flags);
162long DH_get_length(const DH *dh); 162long DH_get_length(const DH *dh);
163int DH_set_length(DH *dh, long length); 163int DH_set_length(DH *dh, long length);
164 164
165/* Deprecated version */ 165/*
166#ifndef OPENSSL_NO_DEPRECATED 166 * Wrapped in OPENSSL_NO_DEPRECATED in 0.9.8, added to rust-openssl in 2020,
167 * for "advanced DH support".
168 */
167DH * DH_generate_parameters(int prime_len,int generator, 169DH * DH_generate_parameters(int prime_len,int generator,
168 void (*callback)(int,int,void *),void *cb_arg); 170 void (*callback)(int,int,void *),void *cb_arg);
169#endif /* !defined(OPENSSL_NO_DEPRECATED) */
170 171
171/* New version */ 172/* New version */
172int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb); 173int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
diff --git a/src/lib/libcrypto/dh/dh_depr.c b/src/lib/libcrypto/dh/dh_depr.c
index 3c4804a133..b8a3dd2ff7 100644
--- a/src/lib/libcrypto/dh/dh_depr.c
+++ b/src/lib/libcrypto/dh/dh_depr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_depr.c,v 1.8 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: dh_depr.c,v 1.9 2023/04/09 19:10:23 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -64,7 +64,6 @@
64 64
65#include "bn_local.h" 65#include "bn_local.h"
66 66
67#ifndef OPENSSL_NO_DEPRECATED
68DH * 67DH *
69DH_generate_parameters(int prime_len, int generator, 68DH_generate_parameters(int prime_len, int generator,
70 void (*callback)(int, int, void *), void *cb_arg) 69 void (*callback)(int, int, void *), void *cb_arg)
@@ -82,4 +81,3 @@ DH_generate_parameters(int prime_len, int generator,
82 DH_free(ret); 81 DH_free(ret);
83 return NULL; 82 return NULL;
84} 83}
85#endif
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h
index 1fa5fc3132..c1ff3d7de7 100644
--- a/src/lib/libcrypto/dsa/dsa.h
+++ b/src/lib/libcrypto/dsa/dsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa.h,v 1.40 2023/03/04 20:47:04 tb Exp $ */ 1/* $OpenBSD: dsa.h,v 1.41 2023/04/09 19:10:23 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 *
@@ -165,13 +165,11 @@ DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
165int i2d_DSAparams(const DSA *a,unsigned char **pp); 165int i2d_DSAparams(const DSA *a,unsigned char **pp);
166extern const ASN1_ITEM DSAparams_it; 166extern const ASN1_ITEM DSAparams_it;
167 167
168/* Deprecated version */ 168/* Wrapped in OPENSSL_NO_DEPRECATED in 0.9.8. Still used in 2023. */
169#ifndef OPENSSL_NO_DEPRECATED
170DSA * DSA_generate_parameters(int bits, 169DSA * DSA_generate_parameters(int bits,
171 unsigned char *seed,int seed_len, 170 unsigned char *seed,int seed_len,
172 int *counter_ret, unsigned long *h_ret,void 171 int *counter_ret, unsigned long *h_ret,void
173 (*callback)(int, int, void *),void *cb_arg); 172 (*callback)(int, int, void *),void *cb_arg);
174#endif /* !defined(OPENSSL_NO_DEPRECATED) */
175 173
176/* New version */ 174/* New version */
177int DSA_generate_parameters_ex(DSA *dsa, int bits, 175int DSA_generate_parameters_ex(DSA *dsa, int bits,
diff --git a/src/lib/libcrypto/dsa/dsa_depr.c b/src/lib/libcrypto/dsa/dsa_depr.c
index 790db6685a..b3f7ec0413 100644
--- a/src/lib/libcrypto/dsa/dsa_depr.c
+++ b/src/lib/libcrypto/dsa/dsa_depr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_depr.c,v 1.10 2022/11/26 16:08:52 tb Exp $ */ 1/* $OpenBSD: dsa_depr.c,v 1.11 2023/04/09 19:10:23 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -70,7 +70,6 @@
70 70
71#include "bn_local.h" 71#include "bn_local.h"
72 72
73#ifndef OPENSSL_NO_DEPRECATED
74DSA * 73DSA *
75DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len, 74DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
76 int *counter_ret, unsigned long *h_ret, void (*callback)(int, int, void *), 75 int *counter_ret, unsigned long *h_ret, void (*callback)(int, int, void *),
@@ -91,4 +90,3 @@ DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
91 return NULL; 90 return NULL;
92} 91}
93#endif 92#endif
94#endif
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index 2eca16d77c..365eae0e90 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.51 2023/03/27 09:15:45 jan Exp $ */ 1/* $OpenBSD: err.c,v 1.52 2023/04/09 19:10:23 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 *
@@ -1040,13 +1040,11 @@ ERR_remove_thread_state(const CRYPTO_THREADID *id)
1040 ERRFN(thread_del_item)(&tmp); 1040 ERRFN(thread_del_item)(&tmp);
1041} 1041}
1042 1042
1043#ifndef OPENSSL_NO_DEPRECATED
1044void 1043void
1045ERR_remove_state(unsigned long pid) 1044ERR_remove_state(unsigned long pid)
1046{ 1045{
1047 ERR_remove_thread_state(NULL); 1046 ERR_remove_thread_state(NULL);
1048} 1047}
1049#endif
1050 1048
1051ERR_STATE * 1049ERR_STATE *
1052ERR_get_state(void) 1050ERR_get_state(void)
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h
index 24708c5b1a..b61599d508 100644
--- a/src/lib/libcrypto/err/err.h
+++ b/src/lib/libcrypto/err/err.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.h,v 1.28 2022/08/29 06:49:24 jsing Exp $ */ 1/* $OpenBSD: err.h,v 1.29 2023/04/09 19:10:23 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 *
@@ -395,9 +395,8 @@ void ERR_load_crypto_strings(void);
395void ERR_free_strings(void); 395void ERR_free_strings(void);
396 396
397void ERR_remove_thread_state(const CRYPTO_THREADID *tid); 397void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
398#ifndef OPENSSL_NO_DEPRECATED 398/* Wrapped in OPENSSL_NO_DEPRECATED in 0.9.8. Still used in 2023. */
399void ERR_remove_state(unsigned long pid); /* if zero we look it up */ 399void ERR_remove_state(unsigned long pid);
400#endif
401ERR_STATE *ERR_get_state(void); 400ERR_STATE *ERR_get_state(void);
402 401
403#ifndef OPENSSL_NO_LHASH 402#ifndef OPENSSL_NO_LHASH
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 73ec9d5a42..fa98f9cf76 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa.h,v 1.58 2022/07/12 14:42:50 kn Exp $ */ 1/* $OpenBSD: rsa.h,v 1.59 2023/04/09 19:10:23 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 *
@@ -240,11 +240,12 @@ RSA *RSA_new_method(ENGINE *engine);
240int RSA_bits(const RSA *rsa); 240int RSA_bits(const RSA *rsa);
241int RSA_size(const RSA *rsa); 241int RSA_size(const RSA *rsa);
242 242
243/* Deprecated version */ 243/*
244#ifndef OPENSSL_NO_DEPRECATED 244 * Wrapped in OPENSSL_NO_DEPRECATED in 0.9.8. Still used for libressl bindings
245 * in rust-openssl.
246 */
245RSA *RSA_generate_key(int bits, unsigned long e, 247RSA *RSA_generate_key(int bits, unsigned long e,
246 void (*callback)(int, int, void *), void *cb_arg); 248 void (*callback)(int, int, void *), void *cb_arg);
247#endif /* !defined(OPENSSL_NO_DEPRECATED) */
248 249
249/* New version */ 250/* New version */
250int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); 251int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
diff --git a/src/lib/libcrypto/rsa/rsa_depr.c b/src/lib/libcrypto/rsa/rsa_depr.c
index 8a432b348b..2d8d55a693 100644
--- a/src/lib/libcrypto/rsa/rsa_depr.c
+++ b/src/lib/libcrypto/rsa/rsa_depr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_depr.c,v 1.10 2022/11/26 16:08:54 tb Exp $ */ 1/* $OpenBSD: rsa_depr.c,v 1.11 2023/04/09 19:10:23 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -66,8 +66,6 @@
66 66
67#include "bn_local.h" 67#include "bn_local.h"
68 68
69#ifndef OPENSSL_NO_DEPRECATED
70
71RSA * 69RSA *
72RSA_generate_key(int bits, unsigned long e_value, 70RSA_generate_key(int bits, unsigned long e_value,
73 void (*callback)(int, int, void *), void *cb_arg) 71 void (*callback)(int, int, void *), void *cb_arg)
@@ -100,4 +98,3 @@ err:
100 98
101 return 0; 99 return 0;
102} 100}
103#endif