diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/evp/p_lib.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index 39c6adcde0..2e78d7e5cd 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p_lib.c,v 1.48 2023/12/25 21:51:57 tb Exp $ */ | 1 | /* $OpenBSD: p_lib.c,v 1.49 2023/12/25 21:55:31 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 | * |
| @@ -193,19 +193,19 @@ EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | |||
| 193 | EVP_PKEY * | 193 | EVP_PKEY * |
| 194 | EVP_PKEY_new(void) | 194 | EVP_PKEY_new(void) |
| 195 | { | 195 | { |
| 196 | EVP_PKEY *ret; | 196 | EVP_PKEY *pkey; |
| 197 | 197 | ||
| 198 | if ((ret = calloc(1, sizeof(*ret))) == NULL) { | 198 | if ((pkey = calloc(1, sizeof(*pkey))) == NULL) { |
| 199 | EVPerror(ERR_R_MALLOC_FAILURE); | 199 | EVPerror(ERR_R_MALLOC_FAILURE); |
| 200 | return NULL; | 200 | return NULL; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | ret->type = EVP_PKEY_NONE; | 203 | pkey->type = EVP_PKEY_NONE; |
| 204 | ret->save_type = EVP_PKEY_NONE; | 204 | pkey->save_type = EVP_PKEY_NONE; |
| 205 | ret->references = 1; | 205 | pkey->references = 1; |
| 206 | ret->save_parameters = 1; | 206 | pkey->save_parameters = 1; |
| 207 | 207 | ||
| 208 | return ret; | 208 | return pkey; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | int | 211 | int |
| @@ -282,27 +282,27 @@ EVP_PKEY * | |||
| 282 | EVP_PKEY_new_raw_private_key(int type, ENGINE *engine, | 282 | EVP_PKEY_new_raw_private_key(int type, ENGINE *engine, |
| 283 | const unsigned char *private_key, size_t len) | 283 | const unsigned char *private_key, size_t len) |
| 284 | { | 284 | { |
| 285 | EVP_PKEY *ret; | 285 | EVP_PKEY *pkey; |
| 286 | 286 | ||
| 287 | if ((ret = EVP_PKEY_new()) == NULL) | 287 | if ((pkey = EVP_PKEY_new()) == NULL) |
| 288 | goto err; | 288 | goto err; |
| 289 | 289 | ||
| 290 | if (!EVP_PKEY_set_type(ret, type)) | 290 | if (!EVP_PKEY_set_type(pkey, type)) |
| 291 | goto err; | 291 | goto err; |
| 292 | 292 | ||
| 293 | if (ret->ameth->set_priv_key == NULL) { | 293 | if (pkey->ameth->set_priv_key == NULL) { |
| 294 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 294 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |
| 295 | goto err; | 295 | goto err; |
| 296 | } | 296 | } |
| 297 | if (!ret->ameth->set_priv_key(ret, private_key, len)) { | 297 | if (!pkey->ameth->set_priv_key(pkey, private_key, len)) { |
| 298 | EVPerror(EVP_R_KEY_SETUP_FAILED); | 298 | EVPerror(EVP_R_KEY_SETUP_FAILED); |
| 299 | goto err; | 299 | goto err; |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | return ret; | 302 | return pkey; |
| 303 | 303 | ||
| 304 | err: | 304 | err: |
| 305 | EVP_PKEY_free(ret); | 305 | EVP_PKEY_free(pkey); |
| 306 | 306 | ||
| 307 | return NULL; | 307 | return NULL; |
| 308 | } | 308 | } |
| @@ -311,27 +311,27 @@ EVP_PKEY * | |||
| 311 | EVP_PKEY_new_raw_public_key(int type, ENGINE *engine, | 311 | EVP_PKEY_new_raw_public_key(int type, ENGINE *engine, |
| 312 | const unsigned char *public_key, size_t len) | 312 | const unsigned char *public_key, size_t len) |
| 313 | { | 313 | { |
| 314 | EVP_PKEY *ret; | 314 | EVP_PKEY *pkey; |
| 315 | 315 | ||
| 316 | if ((ret = EVP_PKEY_new()) == NULL) | 316 | if ((pkey = EVP_PKEY_new()) == NULL) |
| 317 | goto err; | 317 | goto err; |
| 318 | 318 | ||
| 319 | if (!EVP_PKEY_set_type(ret, type)) | 319 | if (!EVP_PKEY_set_type(pkey, type)) |
| 320 | goto err; | 320 | goto err; |
| 321 | 321 | ||
| 322 | if (ret->ameth->set_pub_key == NULL) { | 322 | if (pkey->ameth->set_pub_key == NULL) { |
| 323 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 323 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |
| 324 | goto err; | 324 | goto err; |
| 325 | } | 325 | } |
| 326 | if (!ret->ameth->set_pub_key(ret, public_key, len)) { | 326 | if (!pkey->ameth->set_pub_key(pkey, public_key, len)) { |
| 327 | EVPerror(EVP_R_KEY_SETUP_FAILED); | 327 | EVPerror(EVP_R_KEY_SETUP_FAILED); |
| 328 | goto err; | 328 | goto err; |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | return ret; | 331 | return pkey; |
| 332 | 332 | ||
| 333 | err: | 333 | err: |
| 334 | EVP_PKEY_free(ret); | 334 | EVP_PKEY_free(pkey); |
| 335 | 335 | ||
| 336 | return NULL; | 336 | return NULL; |
| 337 | } | 337 | } |
| @@ -372,15 +372,15 @@ EVP_PKEY * | |||
| 372 | EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, size_t len, | 372 | EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, size_t len, |
| 373 | const EVP_CIPHER *cipher) | 373 | const EVP_CIPHER *cipher) |
| 374 | { | 374 | { |
| 375 | EVP_PKEY *ret = NULL; | 375 | EVP_PKEY *pkey = NULL; |
| 376 | CMAC_CTX *cmctx = NULL; | 376 | CMAC_CTX *cmctx = NULL; |
| 377 | 377 | ||
| 378 | if ((ret = EVP_PKEY_new()) == NULL) | 378 | if ((pkey = EVP_PKEY_new()) == NULL) |
| 379 | goto err; | 379 | goto err; |
| 380 | if ((cmctx = CMAC_CTX_new()) == NULL) | 380 | if ((cmctx = CMAC_CTX_new()) == NULL) |
| 381 | goto err; | 381 | goto err; |
| 382 | 382 | ||
| 383 | if (!EVP_PKEY_set_type(ret, EVP_PKEY_CMAC)) | 383 | if (!EVP_PKEY_set_type(pkey, EVP_PKEY_CMAC)) |
| 384 | goto err; | 384 | goto err; |
| 385 | 385 | ||
| 386 | if (!CMAC_Init(cmctx, priv, len, cipher, NULL)) { | 386 | if (!CMAC_Init(cmctx, priv, len, cipher, NULL)) { |
| @@ -388,13 +388,14 @@ EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, size_t len, | |||
| 388 | goto err; | 388 | goto err; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | ret->pkey.ptr = cmctx; | 391 | pkey->pkey.ptr = cmctx; |
| 392 | 392 | ||
| 393 | return ret; | 393 | return pkey; |
| 394 | 394 | ||
| 395 | err: | 395 | err: |
| 396 | EVP_PKEY_free(ret); | 396 | EVP_PKEY_free(pkey); |
| 397 | CMAC_CTX_free(cmctx); | 397 | CMAC_CTX_free(cmctx); |
| 398 | |||
| 398 | return NULL; | 399 | return NULL; |
| 399 | } | 400 | } |
| 400 | 401 | ||
