Skip to content

Commit c330222

Browse files
authored
Merge pull request #708 from ejohnstown/sign-h-rsa
Sign H Casting
2 parents 79ef513 + 4281ee4 commit c330222

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/internal.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -11005,24 +11005,32 @@ static int SignHRsa(WOLFSSH* ssh, byte* sig, word32* sigSz,
1100511005
}
1100611006

1100711007
if (ret == WS_SUCCESS) {
11008-
encSigSz = wc_EncodeSignature(encSig, digest, digestSz,
11008+
ret = wc_EncodeSignature(encSig, digest, digestSz,
1100911009
wc_HashGetOID(hashId));
11010-
if (encSigSz <= 0) {
11010+
if (ret <= 0) {
1101111011
WLOG(WS_LOG_DEBUG, "SignHRsa: Bad Encode Sig");
1101211012
ret = WS_CRYPTO_FAILED;
1101311013
}
11014+
else {
11015+
encSigSz = (word32)ret;
11016+
ret = WS_SUCCESS;
11017+
}
1101411018
}
1101511019

1101611020
if (ret == WS_SUCCESS) {
1101711021
WLOG(WS_LOG_INFO, "Signing hash with %s.",
1101811022
IdToName(ssh->handshake->pubKeyId));
11019-
*sigSz = wc_RsaSSL_Sign(encSig, encSigSz, sig,
11023+
ret = wc_RsaSSL_Sign(encSig, encSigSz, sig,
1102011024
KEX_SIG_SIZE, &sigKey->sk.rsa.key,
1102111025
ssh->rng);
11022-
if (*sigSz <= 0) {
11026+
if (ret <= 0) {
1102311027
WLOG(WS_LOG_DEBUG, "SignHRsa: Bad RSA Sign");
1102411028
ret = WS_RSA_E;
1102511029
}
11030+
else {
11031+
*sigSz = (word32)ret;
11032+
ret = WS_SUCCESS;
11033+
}
1102611034
}
1102711035

1102811036
if (ret == WS_SUCCESS) {

0 commit comments

Comments
 (0)