@@ -647,6 +647,7 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
647647 r = mp_read_unsigned_bin (& temp1 , srp -> k , digestSz );
648648 if (!r ) r = mp_iszero (& temp1 ) == MP_YES ? SRP_BAD_KEY_E : 0 ;
649649 if (!r ) r = mp_exptmod (& srp -> g , & srp -> auth , & srp -> N , & temp2 );
650+ optimistic_yield (1000 );
650651 if (!r ) r = mp_mulmod (& temp1 , & temp2 , & srp -> N , & s );
651652 if (!r ) r = mp_read_unsigned_bin (& temp2 , serverPubKey , serverPubKeySz );
652653 if (!r ) r = mp_iszero (& temp2 ) == MP_YES ? SRP_BAD_KEY_E : 0 ;
@@ -659,10 +660,12 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
659660
660661 /* secret = temp1 ^ temp2 % N */
661662 if (!r ) r = mp_exptmod (& temp1 , & temp2 , & srp -> N , & s );
663+ optimistic_yield (1000 );
662664
663665 } else if (!r && srp -> side == SRP_SERVER_SIDE ) {
664666 /* temp1 = v ^ u % N */
665667 r = mp_exptmod (& srp -> auth , & u , & srp -> N , & temp1 );
668+ optimistic_yield (1000 );
666669
667670 /* temp2 = A * temp1 % N; rejects A == 0, A >= N */
668671 if (!r ) r = mp_read_unsigned_bin (& s , clientPubKey , clientPubKeySz );
@@ -678,6 +681,7 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
678681
679682 /* secret = temp2 * b % N */
680683 if (!r ) r = mp_exptmod (& temp2 , & srp -> priv , & srp -> N , & s );
684+ optimistic_yield (1000 );
681685 }
682686
683687 /* building session key from secret */
0 commit comments