forked from wolfSSL/wolfssl
more fixes for implicit casts, mostly asn=original.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -528,11 +528,15 @@ int wc_Hash(enum wc_HashType hash_type, const byte* data,
|
|||||||
word32 data_len, byte* hash, word32 hash_len)
|
word32 data_len, byte* hash, word32 hash_len)
|
||||||
{
|
{
|
||||||
int ret = HASH_TYPE_E; /* Default to hash type error */
|
int ret = HASH_TYPE_E; /* Default to hash type error */
|
||||||
word32 dig_size;
|
int dig_size;
|
||||||
|
|
||||||
/* Validate hash buffer size */
|
/* Validate hash buffer size */
|
||||||
dig_size = (word32)wc_HashGetDigestSize(hash_type);
|
dig_size = wc_HashGetDigestSize(hash_type);
|
||||||
if (hash_len < dig_size) {
|
if (dig_size < 0) {
|
||||||
|
return dig_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hash_len < (word32)dig_size) {
|
||||||
return BUFFER_E;
|
return BUFFER_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3820,7 +3820,7 @@ static int wc_PKCS7_VerifyContentMessageDigest(PKCS7* pkcs7,
|
|||||||
|
|
||||||
/* compare generated to hash in messageDigest attribute */
|
/* compare generated to hash in messageDigest attribute */
|
||||||
if ((innerAttribSz != digestSz) ||
|
if ((innerAttribSz != digestSz) ||
|
||||||
(XMEMCMP(attrib->value + idx, digestBuf, (word32)digestSz) != 0)) {
|
(XMEMCMP(attrib->value + idx, digestBuf, (size_t)digestSz) != 0)) {
|
||||||
WOLFSSL_MSG("Content digest does not match messageDigest attrib value");
|
WOLFSSL_MSG("Content digest does not match messageDigest attrib value");
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(digest, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(digest, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
@@ -4845,7 +4845,7 @@ WOLFSSL_TEST_SUBROUTINE int hash_test(void)
|
|||||||
|
|
||||||
for (i = 0; i < (int)(sizeof(typesHashBad)/sizeof(*typesHashBad)); i++) {
|
for (i = 0; i < (int)(sizeof(typesHashBad)/sizeof(*typesHashBad)); i++) {
|
||||||
ret = wc_Hash(typesHashBad[i], data, sizeof(data), out, sizeof(out));
|
ret = wc_Hash(typesHashBad[i], data, sizeof(data), out, sizeof(out));
|
||||||
if (ret != BAD_FUNC_ARG && ret != BUFFER_E)
|
if ((ret != BAD_FUNC_ARG) && (ret != BUFFER_E) && (ret != HASH_TYPE_E))
|
||||||
return WC_TEST_RET_ENC_I(i);
|
return WC_TEST_RET_ENC_I(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user