@@ -8761,6 +8761,10 @@ typedef struct Scv13Args {
87618761 byte sigAlgo ;
87628762 byte * sigData ;
87638763 word16 sigDataSz ;
8764+ #ifndef NO_RSA
8765+ byte * toSign ; /* not allocated */
8766+ word32 toSignSz ;
8767+ #endif
87648768#ifdef WOLFSSL_DUAL_ALG_CERTS
87658769 byte altSigAlgo ;
87668770 word32 altSigLen ; /* Only used in the case of both native and alt. */
@@ -9315,7 +9319,17 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl)
93159319 #endif /* HAVE_DILITHIUM */
93169320 #ifndef NO_RSA
93179321 if (ssl -> hsType == DYNAMIC_TYPE_RSA ) {
9318- ret = RsaSign (ssl , rsaSigBuf -> buffer , (word32 )rsaSigBuf -> length ,
9322+ args -> toSign = rsaSigBuf -> buffer ;
9323+ args -> toSignSz = (word32 )rsaSigBuf -> length ;
9324+ #if defined(HAVE_PK_CALLBACKS ) && \
9325+ defined(TLS13_RSA_PSS_SIGN_CB_NO_PREHASH )
9326+ /* Pass full data to sign (args->sigData), not hash of */
9327+ if (ssl -> ctx -> RsaPssSignCb ) {
9328+ args -> toSign = args -> sigData ;
9329+ args -> toSignSz = args -> sigDataSz ;
9330+ }
9331+ #endif
9332+ ret = RsaSign (ssl , (const byte * )args -> toSign , args -> toSignSz ,
93199333 sigOut , & args -> sigLen , args -> sigAlgo ,
93209334 ssl -> options .hashAlgo , (RsaKey * )ssl -> hsKey ,
93219335 ssl -> buffers .key );
@@ -9359,10 +9373,20 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl)
93599373 #endif /* HAVE_ECC */
93609374 #ifndef NO_RSA
93619375 if (ssl -> hsAltType == DYNAMIC_TYPE_RSA ) {
9362- ret = RsaSign (ssl , rsaSigBuf -> buffer ,
9363- (word32 )rsaSigBuf -> length , sigOut ,
9364- & args -> altSigLen , args -> altSigAlgo ,
9365- ssl -> options .hashAlgo , (RsaKey * )ssl -> hsAltKey ,
9376+ args -> toSign = rsaSigBuf -> buffer ;
9377+ args -> toSignSz = (word32 )rsaSigBuf -> length ;
9378+ #if defined(HAVE_PK_CALLBACKS ) && \
9379+ defined(TLS13_RSA_PSS_SIGN_CB_NO_PREHASH )
9380+ /* Pass full data to sign (args->altSigData), not hash of */
9381+ if (ssl -> ctx -> RsaPssSignCb ) {
9382+ args -> toSign = args -> altSigData ;
9383+ args -> toSignSz = (word32 )args -> altSigDataSz ;
9384+ }
9385+ #endif
9386+ ret = RsaSign (ssl , (const byte * )args -> toSign ,
9387+ args -> toSignSz , sigOut , & args -> altSigLen ,
9388+ args -> altSigAlgo , ssl -> options .hashAlgo ,
9389+ (RsaKey * )ssl -> hsAltKey ,
93669390 ssl -> buffers .altKey );
93679391
93689392 if (ret == 0 ) {
0 commit comments