summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-01-04 16:50:53 +0000
committertb <>2024-01-04 16:50:53 +0000
commit6ac39f8daa6e59d602f970b08d9bc152a63fd7a5 (patch)
treedbc47be79833bc857f83cf6b074b024839aaaf43 /src
parent7a63cf228d8c89efdb78c641551b9bac57739698 (diff)
downloadopenbsd-6ac39f8daa6e59d602f970b08d9bc152a63fd7a5.tar.gz
openbsd-6ac39f8daa6e59d602f970b08d9bc152a63fd7a5.tar.bz2
openbsd-6ac39f8daa6e59d602f970b08d9bc152a63fd7a5.zip
Neuter the remainder of the ameth lib
The few pieces of the ameth lib that will stay in libcrypto were moved to p_lib.c recently. The functions that still are in ameth_lib.c will be removed in the next major bump. With disabled EVP_PKEY_asn1_add{0,_alias}() API they are completely useless now and they are getting in the way of more ameth surgery. Rip out their guts and turn them into stubs that do nothing but push an error onto the stack. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/ameth_lib.c78
1 files changed, 13 insertions, 65 deletions
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c
index ccde1e8ecb..35fcb8ea08 100644
--- a/src/lib/libcrypto/asn1/ameth_lib.c
+++ b/src/lib/libcrypto/asn1/ameth_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ameth_lib.c,v 1.41 2023/12/29 19:00:31 tb Exp $ */ 1/* $OpenBSD: ameth_lib.c,v 1.42 2024/01/04 16:50:53 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 2006. 3 * project 2006.
4 */ 4 */
@@ -71,60 +71,20 @@
71EVP_PKEY_ASN1_METHOD* 71EVP_PKEY_ASN1_METHOD*
72EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, const char *info) 72EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, const char *info)
73{ 73{
74 EVP_PKEY_ASN1_METHOD *ameth; 74 EVPerror(ERR_R_DISABLED);
75
76 if ((ameth = calloc(1, sizeof(EVP_PKEY_ASN1_METHOD))) == NULL)
77 return NULL;
78
79 ameth->pkey_id = id;
80 ameth->pkey_base_id = id;
81 ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC;
82
83 if (info != NULL) {
84 if ((ameth->info = strdup(info)) == NULL)
85 goto err;
86 }
87
88 if (pem_str != NULL) {
89 if ((ameth->pem_str = strdup(pem_str)) == NULL)
90 goto err;
91 }
92
93 return ameth;
94
95 err:
96 EVP_PKEY_asn1_free(ameth);
97 return NULL; 75 return NULL;
98} 76}
99 77
100void 78void
101EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, const EVP_PKEY_ASN1_METHOD *src) 79EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, const EVP_PKEY_ASN1_METHOD *src)
102{ 80{
103 EVP_PKEY_ASN1_METHOD preserve; 81 EVPerror(ERR_R_DISABLED);
104
105 preserve.pkey_id = dst->pkey_id;
106 preserve.pkey_base_id = dst->pkey_base_id;
107 preserve.pkey_flags = dst->pkey_flags;
108 preserve.pem_str = dst->pem_str;
109 preserve.info = dst->info;
110
111 *dst = *src;
112
113 dst->pkey_id = preserve.pkey_id;
114 dst->pkey_base_id = preserve.pkey_base_id;
115 dst->pkey_flags = preserve.pkey_flags;
116 dst->pem_str = preserve.pem_str;
117 dst->info = preserve.info;
118} 82}
119 83
120void 84void
121EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) 85EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth)
122{ 86{
123 if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { 87 EVPerror(ERR_R_DISABLED);
124 free(ameth->pem_str);
125 free(ameth->info);
126 free(ameth);
127 }
128} 88}
129 89
130void 90void
@@ -137,12 +97,7 @@ EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
137 int (*pkey_size)(const EVP_PKEY *pk), 97 int (*pkey_size)(const EVP_PKEY *pk),
138 int (*pkey_bits)(const EVP_PKEY *pk)) 98 int (*pkey_bits)(const EVP_PKEY *pk))
139{ 99{
140 ameth->pub_decode = pub_decode; 100 EVPerror(ERR_R_DISABLED);
141 ameth->pub_encode = pub_encode;
142 ameth->pub_cmp = pub_cmp;
143 ameth->pub_print = pub_print;
144 ameth->pkey_size = pkey_size;
145 ameth->pkey_bits = pkey_bits;
146} 101}
147 102
148void 103void
@@ -152,9 +107,7 @@ EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
152 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, 107 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
153 ASN1_PCTX *pctx)) 108 ASN1_PCTX *pctx))
154{ 109{
155 ameth->priv_decode = priv_decode; 110 EVPerror(ERR_R_DISABLED);
156 ameth->priv_encode = priv_encode;
157 ameth->priv_print = priv_print;
158} 111}
159 112
160void 113void
@@ -167,54 +120,49 @@ EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
167 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, 120 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
168 ASN1_PCTX *pctx)) 121 ASN1_PCTX *pctx))
169{ 122{
170 ameth->param_decode = param_decode; 123 EVPerror(ERR_R_DISABLED);
171 ameth->param_encode = param_encode;
172 ameth->param_missing = param_missing;
173 ameth->param_copy = param_copy;
174 ameth->param_cmp = param_cmp;
175 ameth->param_print = param_print;
176} 124}
177 125
178void 126void
179EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, 127EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
180 void (*pkey_free)(EVP_PKEY *pkey)) 128 void (*pkey_free)(EVP_PKEY *pkey))
181{ 129{
182 ameth->pkey_free = pkey_free; 130 EVPerror(ERR_R_DISABLED);
183} 131}
184 132
185void 133void
186EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, 134EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
187 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)) 135 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2))
188{ 136{
189 ameth->pkey_ctrl = pkey_ctrl; 137 EVPerror(ERR_R_DISABLED);
190} 138}
191 139
192void 140void
193EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, 141EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
194 int (*pkey_security_bits)(const EVP_PKEY *pkey)) 142 int (*pkey_security_bits)(const EVP_PKEY *pkey))
195{ 143{
196 ameth->pkey_security_bits = pkey_security_bits; 144 EVPerror(ERR_R_DISABLED);
197} 145}
198 146
199void 147void
200EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, 148EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
201 int (*pkey_check)(const EVP_PKEY *pk)) 149 int (*pkey_check)(const EVP_PKEY *pk))
202{ 150{
203 ameth->pkey_check = pkey_check; 151 EVPerror(ERR_R_DISABLED);
204} 152}
205 153
206void 154void
207EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, 155EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,
208 int (*pkey_public_check)(const EVP_PKEY *pk)) 156 int (*pkey_public_check)(const EVP_PKEY *pk))
209{ 157{
210 ameth->pkey_public_check = pkey_public_check; 158 EVPerror(ERR_R_DISABLED);
211} 159}
212 160
213void 161void
214EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, 162EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,
215 int (*pkey_param_check)(const EVP_PKEY *pk)) 163 int (*pkey_param_check)(const EVP_PKEY *pk))
216{ 164{
217 ameth->pkey_param_check = pkey_param_check; 165 EVPerror(ERR_R_DISABLED);
218} 166}
219 167
220int 168int