@@ -5013,7 +5013,8 @@ int ConvertHashPss(int hashAlgo, enum wc_HashType* hashType, int* mgf)
50135013}
50145014#endif
50155015
5016- #if !defined(NO_WOLFSSL_SERVER) || !defined(WOLFSSL_NO_CLIENT_AUTH)
5016+ #if (!defined(NO_WOLFSSL_SERVER) || !defined(WOLFSSL_NO_CLIENT_AUTH)) && \
5017+ (!defined(WOLFSSL_RSA_PUBLIC_ONLY) && !defined(WOLFSSL_RSA_VERIFY_ONLY))
50175018int RsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out,
50185019 word32* outSz, int sigAlgo, int hashAlgo, RsaKey* key,
50195020 DerBuffer* keyBufInfo)
@@ -5317,7 +5318,8 @@ int VerifyRsaSign(WOLFSSL* ssl, byte* verifySig, word32 sigSz,
53175318
53185319#ifndef WOLFSSL_NO_TLS12
53195320
5320- #if !defined(NO_WOLFSSL_SERVER) || !defined(WOLFSSL_NO_CLIENT_AUTH)
5321+ #if (!defined(NO_WOLFSSL_SERVER) || !defined(WOLFSSL_NO_CLIENT_AUTH)) && \
5322+ !defined(WOLFSSL_RSA_PUBLIC_ONLY)
53215323int RsaDec(WOLFSSL* ssl, byte* in, word32 inSz, byte** out, word32* outSz,
53225324 RsaKey* key, DerBuffer* keyBufInfo)
53235325{
@@ -5382,6 +5384,7 @@ int RsaDec(WOLFSSL* ssl, byte* in, word32 inSz, byte** out, word32* outSz,
53825384}
53835385#endif /* !NO_WOLFSSL_SERVER) || !WOLFSSL_NO_CLIENT_AUTH */
53845386
5387+ #ifndef WOLFSSL_RSA_VERIFY_ONLY
53855388int RsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out, word32* outSz,
53865389 RsaKey* key, buffer* keyBufInfo)
53875390{
@@ -5441,6 +5444,7 @@ int RsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out, word32* outSz,
54415444
54425445 return ret;
54435446}
5447+ #endif
54445448
54455449#endif /* !WOLFSSL_NO_TLS12 */
54465450
@@ -33912,7 +33916,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
3391233916 {
3391333917 switch(ssl->specs.kea)
3391433918 {
33915- #ifndef NO_RSA
33919+ #if !defined( NO_RSA) && !defined(WOLFSSL_RSA_VERIFY_ONLY)
3391633920 case rsa_kea:
3391733921 {
3391833922 ret = RsaEnc(ssl,
@@ -33928,7 +33932,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
3392833932
3392933933 break;
3393033934 }
33931- #endif /* !NO_RSA */
33935+ #endif /* !NO_RSA && !WOLFSSL_RSA_VERIFY_ONLY */
3393233936 #ifndef NO_DH
3393333937 case diffie_hellman_kea:
3393433938 {
@@ -34759,7 +34763,8 @@ int SendCertificateVerify(WOLFSSL* ssl)
3475934763 );
3476034764 }
3476134765 #endif /* HAVE_ED448 && !NO_ED448_CLIENT_AUTH */
34762- #ifndef NO_RSA
34766+ #if !defined(NO_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \
34767+ !defined(WOLFSSL_RSA_VERIFY_ONLY)
3476334768 if (ssl->hsType == DYNAMIC_TYPE_RSA) {
3476434769 RsaKey* key = (RsaKey*)ssl->hsKey;
3476534770
@@ -34773,7 +34778,7 @@ int SendCertificateVerify(WOLFSSL* ssl)
3477334778 ssl->buffers.key
3477434779 );
3477534780 }
34776- #endif /* !NO_RSA */
34781+ #endif /* !NO_RSA && !WOLFSSL_RSA_PUBLIC_ONLY && !WOLFSSL_RSA_VERIFY_ONLY */
3477734782
3477834783 /* Check for error */
3477934784 if (ret != 0) {
@@ -36837,7 +36842,9 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3683736842 /* Sign hash to create signature */
3683836843 switch (ssl->options.sigAlgo)
3683936844 {
36840- #ifndef NO_RSA
36845+ #if !defined(NO_RSA) && \
36846+ !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \
36847+ !defined(WOLFSSL_RSA_VERIFY_ONLY)
3684136848 #ifdef WC_RSA_PSS
3684236849 case rsa_pss_sa_algo:
3684336850 #endif
@@ -36856,7 +36863,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3685636863 );
3685736864 break;
3685836865 }
36859- #endif /* !NO_RSA */
36866+ #endif /* !NO_RSA && !WOLFSSL_RSA_PUBLIC_ONLY
36867+ && !WOLFSSL_RSA_VERIFY_ONLY */
3686036868 #ifdef HAVE_ECC
3686136869 #if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3)
3686236870 case sm2_sa_algo:
@@ -36950,7 +36958,9 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3695036958 /* Sign hash to create signature */
3695136959 switch (ssl->options.sigAlgo)
3695236960 {
36953- #ifndef NO_RSA
36961+ #if !defined(NO_RSA) && \
36962+ !defined(WOLFSSL_RSA_PUBLIC_ONLY) && \
36963+ !defined(WOLFSSL_RSA_VERIFY_ONLY)
3695436964 #ifdef WC_RSA_PSS
3695536965 case rsa_pss_sa_algo:
3695636966 #endif
@@ -36973,7 +36983,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3697336983 );
3697436984 break;
3697536985 }
36976- #endif /* NO_RSA */
36986+ #endif /* !NO_RSA && !WOLFSSL_RSA_PUBLIC_ONLY
36987+ && !WOLFSSL_RSA_VERIFY_ONLY */
3697736988 default:
3697836989 break;
3697936990 } /* switch (ssl->options.sigAlgo) */
@@ -41653,7 +41664,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
4165341664 case TLS_ASYNC_DO:
4165441665 {
4165541666 switch (ssl->specs.kea) {
41656- #ifndef NO_RSA
41667+ #if !defined( NO_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)
4165741668 case rsa_kea:
4165841669 {
4165941670 RsaKey* key = (RsaKey*)ssl->hsKey;
@@ -41689,7 +41700,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
4168941700 ret = 0;
4169041701 break;
4169141702 } /* rsa_kea */
41692- #endif /* !NO_RSA */
41703+ #endif /* !NO_RSA && !WOLFSSL_RSA_PUBLIC_ONLY */
4169341704 #ifndef NO_PSK
4169441705 case psk_kea:
4169541706 {
0 commit comments