diff --git a/crypto/sha2/include/crypt_sha2.h b/crypto/sha2/include/crypt_sha2.h index 9c352c32..e8fff61d 100644 --- a/crypto/sha2/include/crypt_sha2.h +++ b/crypto/sha2/include/crypt_sha2.h @@ -387,7 +387,10 @@ void CRYPT_SHA256x2_Compress(uint32_t state1[CRYPT_SHA256_STATE_SIZE], uint32_t * @brief SHA256 multi-buffer one-shot hashing. * * Notes: - * - Currently only supports num == 2. + * - This API is intended for internal acceleration paths. + * - Callers must ensure all parameters are valid (data, digest arrays and their elements + * must not be NULL; outlen must point to a valid uint32_t; *outlen >= 32 bytes). + * - Currently only supports num == 2 on AArch64 with SHA2-ASM. * - nbytes is the same length for all lanes in this one-shot API. * * @param data [IN] Input pointer array. data[i] is message pointer for lane i. @@ -397,9 +400,7 @@ void CRYPT_SHA256x2_Compress(uint32_t state1[CRYPT_SHA256_STATE_SIZE], uint32_t * @param num [IN] Number of lanes/messages. * * @retval #CRYPT_SUCCESS Success. - * @retval #CRYPT_NULL_INPUT Invalid input pointer. * @retval #CRYPT_NOT_SUPPORT Not supported (e.g. num != 2 or platform capability missing). - * @retval Other error codes, see crypt_errno.h. */ int32_t CRYPT_SHA256_MB(const uint8_t *data[], uint32_t nbytes, uint8_t *digest[], uint32_t *outlen, uint32_t num); diff --git a/crypto/util/crypt_utils.c b/crypto/util/crypt_utils.c index 736f849d..0d925dff 100644 --- a/crypto/util/crypt_utils.c +++ b/crypto/util/crypt_utils.c @@ -92,7 +92,7 @@ const BSL_Param *EAL_FindConstParam(const BSL_Param *param, int32_t key) return NULL; } int32_t index = 0; - while (param[index].key != 0 && index < PARAM_MAX_NUMBER) { + while (index < PARAM_MAX_NUMBER && param[index].key != 0) { if (param[index].key == key) { return ¶m[index]; } @@ -112,7 +112,7 @@ BSL_Param *EAL_FindParam(BSL_Param *param, int32_t key) return NULL; } int32_t index = 0; - while (param[index].key != 0 && index < PARAM_MAX_NUMBER) { + while (index < PARAM_MAX_NUMBER && param[index].key != 0) { if (param[index].key == key) { return ¶m[index]; }