1
- /* $OpenBSD: ecx_methods.c,v 1.2 2022/11/19 07:00:57 tb Exp $ */
1
+ /* $OpenBSD: ecx_methods.c,v 1.3 2022/11/23 07:37:06 tb Exp $ */
2
2
/*
3
3
* Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
4
4
*
@@ -511,18 +511,18 @@ ecx_sign_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
511
511
static int
512
512
ecx_set_priv_key (EVP_PKEY * pkey , const uint8_t * priv , size_t len )
513
513
{
514
- struct ecx_key_st * ecx_key ;
514
+ struct ecx_key_st * ecx_key = NULL ;
515
515
int ret = 0 ;
516
516
517
517
if (priv == NULL || len != ecx_key_len (pkey -> ameth -> pkey_id )) {
518
518
ECerror (EC_R_INVALID_ENCODING );
519
- return 0 ;
519
+ goto err ;
520
520
}
521
521
522
522
if ((ecx_key = ecx_key_new (pkey -> ameth -> pkey_id )) == NULL )
523
- return 0 ;
523
+ goto err ;
524
524
if (!ecx_key_set_priv (ecx_key , priv , len ))
525
- return 0 ;
525
+ goto err ;
526
526
if (!EVP_PKEY_assign (pkey , pkey -> ameth -> pkey_id , ecx_key ))
527
527
goto err ;
528
528
ecx_key = NULL ;
@@ -538,18 +538,18 @@ ecx_set_priv_key(EVP_PKEY *pkey, const uint8_t *priv, size_t len)
538
538
static int
539
539
ecx_set_pub_key (EVP_PKEY * pkey , const uint8_t * pub , size_t len )
540
540
{
541
- struct ecx_key_st * ecx_key ;
541
+ struct ecx_key_st * ecx_key = NULL ;
542
542
int ret = 0 ;
543
543
544
544
if (pub == NULL || len != ecx_key_len (pkey -> ameth -> pkey_id )) {
545
545
ECerror (EC_R_INVALID_ENCODING );
546
- return 0 ;
546
+ goto err ;
547
547
}
548
548
549
549
if ((ecx_key = ecx_key_new (pkey -> ameth -> pkey_id )) == NULL )
550
- return 0 ;
550
+ goto err ;
551
551
if (!ecx_key_set_pub (ecx_key , pub , len ))
552
- return 0 ;
552
+ goto err ;
553
553
if (!EVP_PKEY_assign (pkey , pkey -> ameth -> pkey_id , ecx_key ))
554
554
goto err ;
555
555
ecx_key = NULL ;
0 commit comments