Skip to content

Commit aa0b37a

Browse files
authored
Merge pull request #9384 from night1rider/crypto-callback-return-fix
Reset Return to Success if fallback to software Copy Callbacks Sha
2 parents fe69a7c + 572776e commit aa0b37a

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

wolfcrypt/src/sha.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,7 @@ int wc_ShaCopy(wc_Sha* src, wc_Sha* dst)
11691169
return ret;
11701170
/* fall-through when unavailable */
11711171
}
1172+
ret = 0; /* Reset ret to 0 to avoid returning the callback error code */
11721173
#endif /* WOLF_CRYPTO_CB && WOLF_CRYPTO_CB_COPY */
11731174

11741175
XMEMCPY(dst, src, sizeof(wc_Sha));

wolfcrypt/src/sha256.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,6 +2569,7 @@ int wc_Sha224_Grow(wc_Sha224* sha224, const byte* in, int inSz)
25692569
return ret;
25702570
/* fall-through when unavailable */
25712571
}
2572+
ret = 0; /* Reset ret to 0 to avoid returning the callback error code */
25722573
#endif /* WOLF_CRYPTO_CB && WOLF_CRYPTO_CB_COPY */
25732574

25742575
XMEMCPY(dst, src, sizeof(wc_Sha224));
@@ -2709,6 +2710,7 @@ int wc_Sha256Copy(wc_Sha256* src, wc_Sha256* dst)
27092710
return ret;
27102711
/* fall-through when unavailable */
27112712
}
2713+
ret = 0; /* Reset ret to 0 to avoid returning the callback error code */
27122714
#endif /* WOLF_CRYPTO_CB && WOLF_CRYPTO_CB_COPY */
27132715

27142716
XMEMCPY(dst, src, sizeof(wc_Sha256));

wolfcrypt/src/sha3.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,7 @@ static int wc_Sha3Copy(wc_Sha3* src, wc_Sha3* dst)
12301230
return ret;
12311231
/* fall-through when unavailable */
12321232
}
1233+
ret = 0; /* Reset ret to 0 to avoid returning the callback error code */
12331234
#endif /* WOLF_CRYPTO_CB && WOLF_CRYPTO_CB_COPY */
12341235

12351236
XMEMCPY(dst, src, sizeof(wc_Sha3));

wolfcrypt/src/sha512.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,6 +2214,7 @@ int wc_Sha512Copy(wc_Sha512* src, wc_Sha512* dst)
22142214
return ret;
22152215
/* fall-through when unavailable */
22162216
}
2217+
ret = 0; /* Reset ret to 0 to avoid returning the callback error code */
22172218
#endif /* WOLF_CRYPTO_CB && WOLF_CRYPTO_CB_COPY */
22182219

22192220
XMEMCPY(dst, src, sizeof(wc_Sha512));
@@ -2642,6 +2643,7 @@ int wc_Sha384Copy(wc_Sha384* src, wc_Sha384* dst)
26422643
return ret;
26432644
/* fall-through when unavailable */
26442645
}
2646+
ret = 0; /* Reset ret to 0 to avoid returning the callback error code */
26452647
#endif /* WOLF_CRYPTO_CB && WOLF_CRYPTO_CB_COPY */
26462648

26472649
XMEMCPY(dst, src, sizeof(wc_Sha384));

0 commit comments

Comments
 (0)