diff options
| author | tb <> | 2024-03-27 01:26:30 +0000 |
|---|---|---|
| committer | tb <> | 2024-03-27 01:26:30 +0000 |
| commit | 166a6bfa8f606bc3a79bfa2d9d661cb0d4072a04 (patch) | |
| tree | cd55a6bfa91ef5f5520977f545fb7dc464a9183b /src/lib/libc | |
| parent | 34e2ca7d2d0a0fb4722dfa5e884d5657ea45d8f8 (diff) | |
| download | openbsd-166a6bfa8f606bc3a79bfa2d9d661cb0d4072a04.tar.gz openbsd-166a6bfa8f606bc3a79bfa2d9d661cb0d4072a04.tar.bz2 openbsd-166a6bfa8f606bc3a79bfa2d9d661cb0d4072a04.zip | |
Use dh for DH function arguments.
No need for a variety of r, d, ...
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/dh/dh_lib.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index 98cc6e77ba..86503bc4e0 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_lib.c,v 1.44 2024/03/27 01:22:30 tb Exp $ */ | 1 | /* $OpenBSD: dh_lib.c,v 1.45 2024/03/27 01:26:30 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 | * |
| @@ -140,37 +140,35 @@ DH_new_method(ENGINE *engine) | |||
| 140 | LCRYPTO_ALIAS(DH_new_method); | 140 | LCRYPTO_ALIAS(DH_new_method); |
| 141 | 141 | ||
| 142 | void | 142 | void |
| 143 | DH_free(DH *r) | 143 | DH_free(DH *dh) |
| 144 | { | 144 | { |
| 145 | int i; | 145 | if (dh == NULL) |
| 146 | |||
| 147 | if (r == NULL) | ||
| 148 | return; | 146 | return; |
| 149 | i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_DH); | 147 | |
| 150 | if (i > 0) | 148 | if (CRYPTO_add(&dh->references, -1, CRYPTO_LOCK_DH) > 0) |
| 151 | return; | 149 | return; |
| 152 | 150 | ||
| 153 | if (r->meth != NULL && r->meth->finish != NULL) | 151 | if (dh->meth != NULL && dh->meth->finish != NULL) |
| 154 | r->meth->finish(r); | 152 | dh->meth->finish(dh); |
| 155 | 153 | ||
| 156 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data); | 154 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, dh, &dh->ex_data); |
| 157 | 155 | ||
| 158 | BN_free(r->p); | 156 | BN_free(dh->p); |
| 159 | BN_free(r->g); | 157 | BN_free(dh->g); |
| 160 | BN_free(r->q); | 158 | BN_free(dh->q); |
| 161 | BN_free(r->j); | 159 | BN_free(dh->j); |
| 162 | free(r->seed); | 160 | free(dh->seed); |
| 163 | BN_free(r->counter); | 161 | BN_free(dh->counter); |
| 164 | BN_free(r->pub_key); | 162 | BN_free(dh->pub_key); |
| 165 | BN_free(r->priv_key); | 163 | BN_free(dh->priv_key); |
| 166 | free(r); | 164 | free(dh); |
| 167 | } | 165 | } |
| 168 | LCRYPTO_ALIAS(DH_free); | 166 | LCRYPTO_ALIAS(DH_free); |
| 169 | 167 | ||
| 170 | int | 168 | int |
| 171 | DH_up_ref(DH *r) | 169 | DH_up_ref(DH *dh) |
| 172 | { | 170 | { |
| 173 | return CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DH) > 1; | 171 | return CRYPTO_add(&dh->references, 1, CRYPTO_LOCK_DH) > 1; |
| 174 | } | 172 | } |
| 175 | LCRYPTO_ALIAS(DH_up_ref); | 173 | LCRYPTO_ALIAS(DH_up_ref); |
| 176 | 174 | ||
| @@ -184,16 +182,16 @@ DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
| 184 | LCRYPTO_ALIAS(DH_get_ex_new_index); | 182 | LCRYPTO_ALIAS(DH_get_ex_new_index); |
| 185 | 183 | ||
| 186 | int | 184 | int |
| 187 | DH_set_ex_data(DH *d, int idx, void *arg) | 185 | DH_set_ex_data(DH *dh, int idx, void *arg) |
| 188 | { | 186 | { |
| 189 | return CRYPTO_set_ex_data(&d->ex_data, idx, arg); | 187 | return CRYPTO_set_ex_data(&dh->ex_data, idx, arg); |
| 190 | } | 188 | } |
| 191 | LCRYPTO_ALIAS(DH_set_ex_data); | 189 | LCRYPTO_ALIAS(DH_set_ex_data); |
| 192 | 190 | ||
| 193 | void * | 191 | void * |
| 194 | DH_get_ex_data(DH *d, int idx) | 192 | DH_get_ex_data(DH *dh, int idx) |
| 195 | { | 193 | { |
| 196 | return CRYPTO_get_ex_data(&d->ex_data, idx); | 194 | return CRYPTO_get_ex_data(&dh->ex_data, idx); |
| 197 | } | 195 | } |
| 198 | LCRYPTO_ALIAS(DH_get_ex_data); | 196 | LCRYPTO_ALIAS(DH_get_ex_data); |
| 199 | 197 | ||
