File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -673,13 +673,17 @@ static int _ifc_pairwise_consistency_test(RsaKey* key, WC_RNG* rng)
673673
674674int wc_CheckRsaKey (RsaKey * key )
675675{
676- DECL_MP_INT_SIZE_DYN (tmp , mp_bitsused (& key -> n ), RSA_MAX_SIZE );
677676#ifdef WOLFSSL_SMALL_STACK
678677 WC_RNG * rng = NULL ;
679678#else
680679 WC_RNG rng [1 ];
681680#endif
682681 int ret = 0 ;
682+ DECL_MP_INT_SIZE_DYN (tmp , (key )? mp_bitsused (& key -> n ) : 0 , RSA_MAX_SIZE );
683+
684+ if (key == NULL ) {
685+ return BAD_FUNC_ARG ;
686+ }
683687
684688#ifdef WOLFSSL_CAAM
685689 /* can not perform these checks on an encrypted key */
@@ -711,11 +715,6 @@ int wc_CheckRsaKey(RsaKey* key)
711715 ret = MP_INIT_E ;
712716 }
713717
714- if (ret == 0 ) {
715- if (key == NULL )
716- ret = BAD_FUNC_ARG ;
717- }
718-
719718 if (ret == 0 )
720719 ret = _ifc_pairwise_consistency_test (key , rng );
721720
You can’t perform that action at this time.
0 commit comments