summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto_ex_data.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/crypto_ex_data.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/libcrypto/crypto_ex_data.c b/src/lib/libcrypto/crypto_ex_data.c
index ceb3a92e51..233905f888 100644
--- a/src/lib/libcrypto/crypto_ex_data.c
+++ b/src/lib/libcrypto/crypto_ex_data.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_ex_data.c,v 1.4 2024/08/03 07:45:26 tb Exp $ */ 1/* $OpenBSD: crypto_ex_data.c,v 1.6 2025/06/15 15:58:56 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -52,7 +52,7 @@ crypto_ex_data_classes_init(void)
52 return 1; 52 return 1;
53 53
54 if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT, 54 if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT,
55 sizeof(struct crypto_ex_data_index))) == NULL) 55 sizeof(*classes_new))) == NULL)
56 return 0; 56 return 0;
57 57
58 CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); 58 CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA);
@@ -100,11 +100,10 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
100 goto err; 100 goto err;
101 101
102 if ((class = classes[class_index]) == NULL) { 102 if ((class = classes[class_index]) == NULL) {
103 if ((new_class = calloc(1, 103 if ((new_class = calloc(1, sizeof(*new_class))) == NULL)
104 sizeof(struct crypto_ex_data_class))) == NULL)
105 goto err; 104 goto err;
106 if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX, 105 if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX,
107 sizeof(struct crypto_ex_data_index *))) == NULL) 106 sizeof(*new_class->indexes))) == NULL)
108 goto err; 107 goto err;
109 new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX; 108 new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX;
110 new_class->next_index = 1; 109 new_class->next_index = 1;
@@ -119,7 +118,7 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
119 class = classes[class_index]; 118 class = classes[class_index];
120 } 119 }
121 120
122 if ((index = calloc(1, sizeof(struct crypto_ex_data_index))) == NULL) 121 if ((index = calloc(1, sizeof(*index))) == NULL)
123 goto err; 122 goto err;
124 123
125 index->new_func = new_func; 124 index->new_func = new_func;
@@ -200,12 +199,12 @@ crypto_ex_data_init(CRYPTO_EX_DATA *exdata)
200 if (exdata->sk != NULL) 199 if (exdata->sk != NULL)
201 goto err; 200 goto err;
202 201
203 if ((ced = calloc(1, sizeof(struct crypto_ex_data))) == NULL) 202 if ((ced = calloc(1, sizeof(*ced))) == NULL)
204 goto err; 203 goto err;
205 204
206 ced->class_index = -1; 205 ced->class_index = -1;
207 206
208 if ((ced->slots = calloc(CRYPTO_EX_DATA_MAX_INDEX, sizeof(void *))) == NULL) 207 if ((ced->slots = calloc(CRYPTO_EX_DATA_MAX_INDEX, sizeof(*ced->slots))) == NULL)
209 goto err; 208 goto err;
210 ced->slots_len = CRYPTO_EX_DATA_MAX_INDEX; 209 ced->slots_len = CRYPTO_EX_DATA_MAX_INDEX;
211 210