summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ec/ec_lib.c
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-06-25 18:52:28 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-06-25 18:52:28 +0000
commit5f86020193f4fc93d53e42a3a43ac3289b0913b0 (patch)
treee44b8ce6ae5cd89ad9a475b6fe047df32cc1c188 /lib/libcrypto/ec/ec_lib.c
parent1fd084807df3f81c694a999929fd4877c68291cd (diff)
Remove EC_EXTRA_DATA
With the ecdh_check() and ecdsa_check() abominations gone, we can finally get rid of EC_EXTRA_DATA and EC_KEY_{get,insert}_key_method_data(). The EC_EX_DATA_*() handlers, (which fortunately have always had "'package' level visibility") join the ride to the great bit bucket in the sky. Thanks to op for making this possible. ok jsing
Diffstat (limited to 'lib/libcrypto/ec/ec_lib.c')
-rw-r--r--lib/libcrypto/ec/ec_lib.c154
1 files changed, 1 insertions, 153 deletions
diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c
index cb581f6e1c1..2e180e96618 100644
--- a/lib/libcrypto/ec/ec_lib.c
+++ b/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec_lib.c,v 1.60 2023/06/24 18:21:07 jsing Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.61 2023/06/25 18:52:27 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
@@ -651,158 +651,6 @@ ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx)
return group->meth->blind_coordinates(group, p, ctx);
}
-/* this has 'package' visibility */
-int
-EC_EX_DATA_set_data(EC_EXTRA_DATA ** ex_data, void *data,
- void *(*dup_func) (void *),
- void (*free_func) (void *),
- void (*clear_free_func) (void *))
-{
- EC_EXTRA_DATA *d;
-
- if (ex_data == NULL)
- return 0;
-
- for (d = *ex_data; d != NULL; d = d->next) {
- if (d->dup_func == dup_func && d->free_func == free_func &&
- d->clear_free_func == clear_free_func) {
- ECerror(EC_R_SLOT_FULL);
- return 0;
- }
- }
-
- if (data == NULL)
- /* no explicit entry needed */
- return 1;
-
- d = malloc(sizeof *d);
- if (d == NULL)
- return 0;
-
- d->data = data;
- d->dup_func = dup_func;
- d->free_func = free_func;
- d->clear_free_func = clear_free_func;
-
- d->next = *ex_data;
- *ex_data = d;
-
- return 1;
-}
-
-/* this has 'package' visibility */
-void *
-EC_EX_DATA_get_data(const EC_EXTRA_DATA *ex_data,
- void *(*dup_func) (void *),
- void (*free_func) (void *),
- void (*clear_free_func) (void *))
-{
- const EC_EXTRA_DATA *d;
-
- for (d = ex_data; d != NULL; d = d->next) {
- if (d->dup_func == dup_func && d->free_func == free_func && d->clear_free_func == clear_free_func)
- return d->data;
- }
-
- return NULL;
-}
-
-/* this has 'package' visibility */
-void
-EC_EX_DATA_free_data(EC_EXTRA_DATA ** ex_data,
- void *(*dup_func) (void *),
- void (*free_func) (void *),
- void (*clear_free_func) (void *))
-{
- EC_EXTRA_DATA **p;
-
- if (ex_data == NULL)
- return;
-
- for (p = ex_data; *p != NULL; p = &((*p)->next)) {
- if ((*p)->dup_func == dup_func &&
- (*p)->free_func == free_func &&
- (*p)->clear_free_func == clear_free_func) {
- EC_EXTRA_DATA *next = (*p)->next;
-
- (*p)->free_func((*p)->data);
- free(*p);
-
- *p = next;
- return;
- }
- }
-}
-
-/* this has 'package' visibility */
-void
-EC_EX_DATA_clear_free_data(EC_EXTRA_DATA ** ex_data,
- void *(*dup_func) (void *),
- void (*free_func) (void *),
- void (*clear_free_func) (void *))
-{
- EC_EXTRA_DATA **p;
-
- if (ex_data == NULL)
- return;
-
- for (p = ex_data; *p != NULL; p = &((*p)->next)) {
- if ((*p)->dup_func == dup_func &&
- (*p)->free_func == free_func &&
- (*p)->clear_free_func == clear_free_func) {
- EC_EXTRA_DATA *next = (*p)->next;
-
- (*p)->clear_free_func((*p)->data);
- free(*p);
-
- *p = next;
- return;
- }
- }
-}
-
-/* this has 'package' visibility */
-void
-EC_EX_DATA_free_all_data(EC_EXTRA_DATA ** ex_data)
-{
- EC_EXTRA_DATA *d;
-
- if (ex_data == NULL)
- return;
-
- d = *ex_data;
- while (d) {
- EC_EXTRA_DATA *next = d->next;
-
- d->free_func(d->data);
- free(d);
-
- d = next;
- }
- *ex_data = NULL;
-}
-
-/* this has 'package' visibility */
-void
-EC_EX_DATA_clear_free_all_data(EC_EXTRA_DATA ** ex_data)
-{
- EC_EXTRA_DATA *d;
-
- if (ex_data == NULL)
- return;
-
- d = *ex_data;
- while (d) {
- EC_EXTRA_DATA *next = d->next;
-
- d->clear_free_func(d->data);
- free(d);
-
- d = next;
- }
- *ex_data = NULL;
-}
-
EC_POINT *
EC_POINT_new(const EC_GROUP *group)
{