Skip to content

Commit

Permalink
Merge pull request #708 from ejohnstown/sign-h-rsa
Browse files Browse the repository at this point in the history
Sign H Casting
  • Loading branch information
dgarske authored Jun 3, 2024
2 parents 79ef513 + 4281ee4 commit c330222
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -11005,24 +11005,32 @@ static int SignHRsa(WOLFSSH* ssh, byte* sig, word32* sigSz,
}

if (ret == WS_SUCCESS) {
encSigSz = wc_EncodeSignature(encSig, digest, digestSz,
ret = wc_EncodeSignature(encSig, digest, digestSz,
wc_HashGetOID(hashId));
if (encSigSz <= 0) {
if (ret <= 0) {
WLOG(WS_LOG_DEBUG, "SignHRsa: Bad Encode Sig");
ret = WS_CRYPTO_FAILED;
}
else {
encSigSz = (word32)ret;
ret = WS_SUCCESS;
}
}

if (ret == WS_SUCCESS) {
WLOG(WS_LOG_INFO, "Signing hash with %s.",
IdToName(ssh->handshake->pubKeyId));
*sigSz = wc_RsaSSL_Sign(encSig, encSigSz, sig,
ret = wc_RsaSSL_Sign(encSig, encSigSz, sig,
KEX_SIG_SIZE, &sigKey->sk.rsa.key,
ssh->rng);
if (*sigSz <= 0) {
if (ret <= 0) {
WLOG(WS_LOG_DEBUG, "SignHRsa: Bad RSA Sign");
ret = WS_RSA_E;
}
else {
*sigSz = (word32)ret;
ret = WS_SUCCESS;
}
}

if (ret == WS_SUCCESS) {
Expand Down

0 comments on commit c330222

Please sign in to comment.