diff options
author | tb <> | 2023-06-25 18:45:56 +0000 |
---|---|---|
committer | tb <> | 2023-06-25 18:45:56 +0000 |
commit | 1f1e97550126828f07750399c2a4acd3af28df1b (patch) | |
tree | 827bc6c6e367e27b583030a88f63ac80be6f976b /src/lib/libcrypto/ecdh | |
parent | 5119a6bbd2e88876fc335ff3b50913e87b9d734f (diff) | |
download | openbsd-1f1e97550126828f07750399c2a4acd3af28df1b.tar.gz openbsd-1f1e97550126828f07750399c2a4acd3af28df1b.tar.bz2 openbsd-1f1e97550126828f07750399c2a4acd3af28df1b.zip |
Remove {ecdh,ecdsa}_check() and {ECDH,ECDSA}_DATA
This is now unused code. Removing it will free us up to remove some
other ugliness in the ec directory.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/ecdh')
-rw-r--r-- | src/lib/libcrypto/ecdh/ech_lib.c | 97 | ||||
-rw-r--r-- | src/lib/libcrypto/ecdh/ech_local.h | 14 |
2 files changed, 2 insertions, 109 deletions
diff --git a/src/lib/libcrypto/ecdh/ech_lib.c b/src/lib/libcrypto/ecdh/ech_lib.c index 6e12126034..f062ec3fdc 100644 --- a/src/lib/libcrypto/ecdh/ech_lib.c +++ b/src/lib/libcrypto/ecdh/ech_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ech_lib.c,v 1.18 2023/06/25 18:27:38 tb Exp $ */ | 1 | /* $OpenBSD: ech_lib.c,v 1.19 2023/06/25 18:45:56 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -81,10 +81,6 @@ | |||
81 | 81 | ||
82 | static const ECDH_METHOD *default_ECDH_method = NULL; | 82 | static const ECDH_METHOD *default_ECDH_method = NULL; |
83 | 83 | ||
84 | static void *ecdh_data_new(void); | ||
85 | static void *ecdh_data_dup(void *); | ||
86 | static void ecdh_data_free(void *); | ||
87 | |||
88 | void | 84 | void |
89 | ECDH_set_default_method(const ECDH_METHOD *meth) | 85 | ECDH_set_default_method(const ECDH_METHOD *meth) |
90 | { | 86 | { |
@@ -106,97 +102,6 @@ ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth) | |||
106 | return 0; | 102 | return 0; |
107 | } | 103 | } |
108 | 104 | ||
109 | static ECDH_DATA * | ||
110 | ECDH_DATA_new_method(ENGINE *engine) | ||
111 | { | ||
112 | ECDH_DATA *ret; | ||
113 | |||
114 | ret = malloc(sizeof(ECDH_DATA)); | ||
115 | if (ret == NULL) { | ||
116 | ECDHerror(ERR_R_MALLOC_FAILURE); | ||
117 | return (NULL); | ||
118 | } | ||
119 | |||
120 | ret->init = NULL; | ||
121 | |||
122 | ret->meth = ECDH_get_default_method(); | ||
123 | ret->engine = engine; | ||
124 | #ifndef OPENSSL_NO_ENGINE | ||
125 | if (!ret->engine) | ||
126 | ret->engine = ENGINE_get_default_ECDH(); | ||
127 | if (ret->engine) { | ||
128 | ret->meth = ENGINE_get_ECDH(ret->engine); | ||
129 | if (ret->meth == NULL) { | ||
130 | ECDHerror(ERR_R_ENGINE_LIB); | ||
131 | ENGINE_finish(ret->engine); | ||
132 | free(ret); | ||
133 | return NULL; | ||
134 | } | ||
135 | } | ||
136 | #endif | ||
137 | |||
138 | ret->flags = ret->meth->flags; | ||
139 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data); | ||
140 | return (ret); | ||
141 | } | ||
142 | |||
143 | static void * | ||
144 | ecdh_data_new(void) | ||
145 | { | ||
146 | return (void *)ECDH_DATA_new_method(NULL); | ||
147 | } | ||
148 | |||
149 | static void * | ||
150 | ecdh_data_dup(void *data) | ||
151 | { | ||
152 | ECDH_DATA *r = (ECDH_DATA *)data; | ||
153 | |||
154 | /* XXX: dummy operation */ | ||
155 | if (r == NULL) | ||
156 | return NULL; | ||
157 | |||
158 | return (void *)ecdh_data_new(); | ||
159 | } | ||
160 | |||
161 | void | ||
162 | ecdh_data_free(void *data) | ||
163 | { | ||
164 | ECDH_DATA *r = (ECDH_DATA *)data; | ||
165 | |||
166 | #ifndef OPENSSL_NO_ENGINE | ||
167 | ENGINE_finish(r->engine); | ||
168 | #endif | ||
169 | |||
170 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, r, &r->ex_data); | ||
171 | |||
172 | freezero(r, sizeof(ECDH_DATA)); | ||
173 | } | ||
174 | |||
175 | ECDH_DATA * | ||
176 | ecdh_check(EC_KEY *key) | ||
177 | { | ||
178 | ECDH_DATA *ecdh_data; | ||
179 | |||
180 | void *data = EC_KEY_get_key_method_data(key, ecdh_data_dup, | ||
181 | ecdh_data_free, ecdh_data_free); | ||
182 | if (data == NULL) { | ||
183 | ecdh_data = (ECDH_DATA *)ecdh_data_new(); | ||
184 | if (ecdh_data == NULL) | ||
185 | return NULL; | ||
186 | data = EC_KEY_insert_key_method_data(key, (void *)ecdh_data, | ||
187 | ecdh_data_dup, ecdh_data_free, ecdh_data_free); | ||
188 | if (data != NULL) { | ||
189 | /* Another thread raced us to install the key_method | ||
190 | * data and won. */ | ||
191 | ecdh_data_free(ecdh_data); | ||
192 | ecdh_data = (ECDH_DATA *)data; | ||
193 | } | ||
194 | } else | ||
195 | ecdh_data = (ECDH_DATA *)data; | ||
196 | |||
197 | return ecdh_data; | ||
198 | } | ||
199 | |||
200 | int | 105 | int |
201 | ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 106 | ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
202 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | 107 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) |
diff --git a/src/lib/libcrypto/ecdh/ech_local.h b/src/lib/libcrypto/ecdh/ech_local.h index c8cb518249..fefa817b1c 100644 --- a/src/lib/libcrypto/ecdh/ech_local.h +++ b/src/lib/libcrypto/ecdh/ech_local.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ech_local.h,v 1.3 2023/06/25 08:12:23 tb Exp $ */ | 1 | /* $OpenBSD: ech_local.h,v 1.4 2023/06/25 18:45:56 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -68,18 +68,6 @@ struct ecdh_method { | |||
68 | char *app_data; | 68 | char *app_data; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | typedef struct ecdh_data_st { | ||
72 | /* EC_KEY_METH_DATA part */ | ||
73 | int (*init)(EC_KEY *); | ||
74 | /* method specific part */ | ||
75 | ENGINE *engine; | ||
76 | int flags; | ||
77 | const ECDH_METHOD *meth; | ||
78 | CRYPTO_EX_DATA ex_data; | ||
79 | } ECDH_DATA; | ||
80 | |||
81 | ECDH_DATA *ecdh_check(EC_KEY *); | ||
82 | |||
83 | /* | 71 | /* |
84 | * ECDH Key Derivation Function as defined in ANSI X9.63. | 72 | * ECDH Key Derivation Function as defined in ANSI X9.63. |
85 | */ | 73 | */ |