@@ -9691,6 +9691,7 @@ static void FreeDcv13Args(WOLFSSL* ssl, void* pArgs)
96919691}
96929692
96939693#ifdef WOLFSSL_DUAL_ALG_CERTS
9694+ #ifndef NO_RSA
96949695/* ssl->peerCert->sapkiDer is the alternative public key. Hopefully it is a
96959696 * RSA public key. Convert it into a usable public key. */
96969697static int decodeRsaKey (WOLFSSL * ssl )
@@ -9714,7 +9715,9 @@ static int decodeRsaKey(WOLFSSL* ssl)
97149715
97159716 return 0 ;
97169717}
9718+ #endif /* !NO_RSA */
97179719
9720+ #ifdef HAVE_ECC
97189721/* ssl->peerCert->sapkiDer is the alternative public key. Hopefully it is a
97199722 * ECC public key. Convert it into a usable public key. */
97209723static int decodeEccKey (WOLFSSL * ssl )
@@ -9738,7 +9741,9 @@ static int decodeEccKey(WOLFSSL* ssl)
97389741
97399742 return 0 ;
97409743}
9744+ #endif /* HAVE_ECC */
97419745
9746+ #ifdef HAVE_DILITHIUM
97429747/* ssl->peerCert->sapkiDer is the alternative public key. Hopefully it is a
97439748 * dilithium public key. Convert it into a usable public key. */
97449749static int decodeDilithiumKey (WOLFSSL * ssl , int level )
@@ -9767,7 +9772,9 @@ static int decodeDilithiumKey(WOLFSSL* ssl, int level)
97679772
97689773 return 0 ;
97699774}
9775+ #endif /* HAVE_DILITHIUM */
97709776
9777+ #ifdef HAVE_FALCON
97719778/* ssl->peerCert->sapkiDer is the alternative public key. Hopefully it is a
97729779 * falcon public key. Convert it into a usable public key. */
97739780static int decodeFalconKey (WOLFSSL * ssl , int level )
@@ -9795,6 +9802,7 @@ static int decodeFalconKey(WOLFSSL* ssl, int level)
97959802
97969803 return 0 ;
97979804}
9805+ #endif /* HAVE_FALCON */
97989806#endif /* WOLFSSL_DUAL_ALG_CERTS */
97999807
98009808/* handle processing TLS v1.3 certificate_verify (15) */
@@ -9947,12 +9955,17 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
99479955 sa = args -> altSigAlgo ;
99489956
99499957 switch (sa ) {
9958+ #ifndef NO_RSA
99509959 case rsa_pss_sa_algo :
99519960 ret = decodeRsaKey (ssl );
99529961 break ;
9962+ #endif
9963+ #ifdef HAVE_ECC
99539964 case ecc_dsa_sa_algo :
99549965 ret = decodeEccKey (ssl );
99559966 break ;
9967+ #endif
9968+ #ifdef HAVE_DILITHIUM
99569969 case dilithium_level2_sa_algo :
99579970 ret = decodeDilithiumKey (ssl , 2 );
99589971 break ;
@@ -9962,12 +9975,15 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
99629975 case dilithium_level5_sa_algo :
99639976 ret = decodeDilithiumKey (ssl , 5 );
99649977 break ;
9978+ #endif
9979+ #ifdef HAVE_FALCON
99659980 case falcon_level1_sa_algo :
99669981 ret = decodeFalconKey (ssl , 1 );
99679982 break ;
99689983 case falcon_level5_sa_algo :
99699984 ret = decodeFalconKey (ssl , 5 );
99709985 break ;
9986+ #endif
99719987 default :
99729988 ERROR_OUT (PEER_KEY_ERROR , exit_dcv );
99739989 }
@@ -9978,17 +9994,22 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
99789994 if (* ssl -> sigSpec == WOLFSSL_CKS_SIGSPEC_ALTERNATIVE ) {
99799995 /* Now swap in the alternative by removing the native.
99809996 * sa contains the alternative signature type. */
9997+ #ifndef NO_RSA
99819998 if (ssl -> peerRsaKeyPresent && sa != rsa_pss_sa_algo ) {
99829999 FreeKey (ssl , DYNAMIC_TYPE_RSA ,
998310000 (void * * )& ssl -> peerRsaKey );
998410001 ssl -> peerRsaKeyPresent = 0 ;
998510002 }
10003+ #endif
10004+ #ifdef HAVE_ECC
998610005 else if (ssl -> peerEccDsaKeyPresent &&
998710006 sa != ecc_dsa_sa_algo ) {
998810007 FreeKey (ssl , DYNAMIC_TYPE_ECC ,
998910008 (void * * )& ssl -> peerEccDsaKey );
999010009 ssl -> peerEccDsaKeyPresent = 0 ;
999110010 }
10011+ #endif
10012+ #ifdef HAVE_DILITHIUM
999210013 else if (ssl -> peerDilithiumKeyPresent &&
999310014 sa != dilithium_level2_sa_algo &&
999410015 sa != dilithium_level3_sa_algo &&
@@ -9997,13 +10018,16 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
999710018 (void * * )& ssl -> peerDilithiumKey );
999810019 ssl -> peerDilithiumKeyPresent = 0 ;
999910020 }
10021+ #endif
10022+ #ifdef HAVE_FALCON
1000010023 else if (ssl -> peerFalconKeyPresent &&
1000110024 sa != falcon_level1_sa_algo &&
1000210025 sa != falcon_level5_sa_algo ) {
1000310026 FreeKey (ssl , DYNAMIC_TYPE_FALCON ,
1000410027 (void * * )& ssl -> peerFalconKey );
1000510028 ssl -> peerFalconKeyPresent = 0 ;
1000610029 }
10030+ #endif
1000710031 else {
1000810032 ERROR_OUT (PEER_KEY_ERROR , exit_dcv );
1000910033 }
0 commit comments