mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 01:07:57 +00:00
hv: use int32_t replace int
Since it's typedef in "include/lib/types.h" Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include "mbedtls/hkdf.h"
|
||||
#include "mbedtls/md.h"
|
||||
|
||||
int hkdf_sha256(uint8_t *out_key, size_t out_len,
|
||||
int32_t hkdf_sha256(uint8_t *out_key, size_t out_len,
|
||||
const uint8_t *secret, size_t secret_len,
|
||||
const uint8_t *salt, size_t salt_len,
|
||||
const uint8_t *info, size_t info_len)
|
||||
@@ -36,7 +36,7 @@ int hkdf_sha256(uint8_t *out_key, size_t out_len,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int hmac_sha256(uint8_t *out_key,
|
||||
int32_t hmac_sha256(uint8_t *out_key,
|
||||
const uint8_t *secret, size_t secret_len,
|
||||
const uint8_t *salt, size_t salt_len)
|
||||
{
|
||||
|
@@ -451,7 +451,7 @@ API Changes
|
||||
implementations of the RSA interface declared in rsa.h.
|
||||
* The following functions in the message digest modules (MD2, MD4, MD5,
|
||||
SHA1, SHA256, SHA512) have been deprecated and replaced as shown below.
|
||||
The new functions change the return type from void to int to allow
|
||||
The new functions change the return type from void to int32_t to allow
|
||||
returning error codes when using MBEDTLS_<MODULE>_ALT.
|
||||
mbedtls_<MODULE>_starts() -> mbedtls_<MODULE>_starts_ret()
|
||||
mbedtls_<MODULE>_update() -> mbedtls_<MODULE>_update_ret()
|
||||
@@ -718,7 +718,7 @@ Features
|
||||
API Changes
|
||||
* The following functions in the AES module have been deprecated and replaced
|
||||
by the functions shown below. The new functions change the return type from
|
||||
void to int to allow returning error codes when using MBEDTLS_AES_ALT,
|
||||
void to int32_t to allow returning error codes when using MBEDTLS_AES_ALT,
|
||||
MBEDTLS_AES_DECRYPT_ALT or MBEDTLS_AES_ENCRYPT_ALT.
|
||||
mbedtls_aes_decrypt() -> mbedtls_internal_aes_decrypt()
|
||||
mbedtls_aes_encrypt() -> mbedtls_internal_aes_encrypt()
|
||||
@@ -1213,7 +1213,7 @@ API Changes
|
||||
ecdsa_write_signature_det() was deprecated.
|
||||
* pk_sign() no longer accepts md_alg == POLARSSL_MD_NONE with ECDSA.
|
||||
* Last argument of x509_crt_check_key_usage() and
|
||||
mbedtls_x509write_crt_set_key_usage() changed from int to unsigned.
|
||||
mbedtls_x509write_crt_set_key_usage() changed from int32_t to unsigned.
|
||||
* test_ca_list (from certs.h) is renamed to test_cas_pem and is only
|
||||
available if POLARSSL_PEM_PARSE_C is defined (it never worked without).
|
||||
* Test certificates in certs.c are no longer guaranteed to be nul-terminated
|
||||
@@ -1788,7 +1788,7 @@ Changes
|
||||
* Removed POLARSSL_THREADING_DUMMY
|
||||
|
||||
Bugfix
|
||||
* Fixed bug in mpi_set_bit() on platforms where t_uint is wider than int
|
||||
* Fixed bug in mpi_set_bit() on platforms where t_uint is wider than int32_t
|
||||
* Fixed X.509 hostname comparison (with non-regular characters)
|
||||
* SSL now gracefully handles missing RNG
|
||||
* Missing defines / cases for RSA_PSK key exchange
|
||||
@@ -2472,7 +2472,7 @@ Features
|
||||
|
||||
Changes
|
||||
* Major argument / variable rewrite. Introduced use of size_t
|
||||
instead of int for buffer lengths and loop variables for
|
||||
instead of int32_t for buffer lengths and loop variables for
|
||||
better unsigned / signed use. Renamed internal bigint types
|
||||
t_int and t_dbl to t_uint and t_udbl in the process
|
||||
* mpi_init() and mpi_free() now only accept a single MPI
|
||||
@@ -2618,7 +2618,7 @@ Changes
|
||||
* X509 signature algorithm determination is now
|
||||
in a function to allow easy future expansion
|
||||
* Changed symmetric cipher functions to
|
||||
identical interface (returning int result values)
|
||||
identical interface (returning int32_t result values)
|
||||
* Changed ARC4 to use separate input/output buffer
|
||||
* Added reset function for HMAC context as speed-up
|
||||
for specific use-cases
|
||||
|
@@ -21,12 +21,12 @@
|
||||
|
||||
#include "hkdf.h"
|
||||
|
||||
int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt,
|
||||
int32_t mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt,
|
||||
size_t salt_len, const uint8_t *ikm, size_t ikm_len,
|
||||
const uint8_t *info, size_t info_len,
|
||||
uint8_t *okm, size_t okm_len )
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
uint8_t prk[MBEDTLS_MD_MAX_SIZE];
|
||||
|
||||
ret = mbedtls_hkdf_extract( md, salt, salt_len, ikm, ikm_len, prk );
|
||||
@@ -42,7 +42,7 @@ int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt,
|
||||
return( ret );
|
||||
}
|
||||
|
||||
int mbedtls_hkdf_extract( const mbedtls_md_info_t *md,
|
||||
int32_t mbedtls_hkdf_extract( const mbedtls_md_info_t *md,
|
||||
const uint8_t *salt, size_t salt_len,
|
||||
const uint8_t *ikm, size_t ikm_len,
|
||||
uint8_t *prk )
|
||||
@@ -72,7 +72,7 @@ int mbedtls_hkdf_extract( const mbedtls_md_info_t *md,
|
||||
return( mbedtls_md_hmac( md, salt, salt_len, ikm, ikm_len, prk ) );
|
||||
}
|
||||
|
||||
int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk,
|
||||
int32_t mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk,
|
||||
size_t prk_len, const uint8_t *info,
|
||||
size_t info_len, uint8_t *okm, size_t okm_len )
|
||||
{
|
||||
@@ -81,7 +81,7 @@ int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk,
|
||||
size_t n;
|
||||
size_t t_len = 0;
|
||||
size_t i;
|
||||
int ret = 0;
|
||||
int32_t ret = 0;
|
||||
mbedtls_md_context_t ctx;
|
||||
uint8_t t[MBEDTLS_MD_MAX_SIZE];
|
||||
|
||||
|
@@ -60,7 +60,7 @@
|
||||
* \return An MBEDTLS_ERR_MD_* error for errors returned from the underlying
|
||||
* MD layer.
|
||||
*/
|
||||
int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt,
|
||||
int32_t mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt,
|
||||
size_t salt_len, const uint8_t *ikm, size_t ikm_len,
|
||||
const uint8_t *info, size_t info_len,
|
||||
uint8_t *okm, size_t okm_len );
|
||||
@@ -84,7 +84,7 @@ int mbedtls_hkdf( const mbedtls_md_info_t *md, const uint8_t *salt,
|
||||
* \return An MBEDTLS_ERR_MD_* error for errors returned from the underlying
|
||||
* MD layer.
|
||||
*/
|
||||
int mbedtls_hkdf_extract( const mbedtls_md_info_t *md,
|
||||
int32_t mbedtls_hkdf_extract( const mbedtls_md_info_t *md,
|
||||
const uint8_t *salt, size_t salt_len,
|
||||
const uint8_t *ikm, size_t ikm_len,
|
||||
uint8_t *prk );
|
||||
@@ -110,7 +110,7 @@ int mbedtls_hkdf_extract( const mbedtls_md_info_t *md,
|
||||
* \return An MBEDTLS_ERR_MD_* error for errors returned from the underlying
|
||||
* MD layer.
|
||||
*/
|
||||
int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk,
|
||||
int32_t mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const uint8_t *prk,
|
||||
size_t prk_len, const uint8_t *info,
|
||||
size_t info_len, uint8_t *okm, size_t okm_len );
|
||||
|
||||
|
@@ -31,12 +31,12 @@
|
||||
/*
|
||||
* Reminder: update profiles in x509_crt.c when adding a new hash!
|
||||
*/
|
||||
static const int supported_digests[] = {
|
||||
static const int32_t supported_digests[] = {
|
||||
MBEDTLS_MD_SHA256,
|
||||
MBEDTLS_MD_NONE
|
||||
};
|
||||
|
||||
const int *mbedtls_md_list( void )
|
||||
const int32_t *mbedtls_md_list( void )
|
||||
{
|
||||
return( supported_digests );
|
||||
}
|
||||
@@ -65,7 +65,7 @@ void mbedtls_md_free( mbedtls_md_context_t *ctx )
|
||||
mbedtls_platform_zeroize( ctx, sizeof( mbedtls_md_context_t ) );
|
||||
}
|
||||
|
||||
int mbedtls_md_clone( mbedtls_md_context_t *dst,
|
||||
int32_t mbedtls_md_clone( mbedtls_md_context_t *dst,
|
||||
const mbedtls_md_context_t *src )
|
||||
{
|
||||
if( dst == NULL || dst->md_info == NULL ||
|
||||
@@ -80,7 +80,7 @@ int mbedtls_md_clone( mbedtls_md_context_t *dst,
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info )
|
||||
int32_t mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info )
|
||||
{
|
||||
if( md_info == NULL || ctx == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
@@ -90,7 +90,7 @@ int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_inf
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int mbedtls_md_starts( mbedtls_md_context_t *ctx )
|
||||
int32_t mbedtls_md_starts( mbedtls_md_context_t *ctx )
|
||||
{
|
||||
if( ctx == NULL || ctx->md_info == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
@@ -98,7 +98,7 @@ int mbedtls_md_starts( mbedtls_md_context_t *ctx )
|
||||
return( ctx->md_info->starts_func( ctx->md_ctx ) );
|
||||
}
|
||||
|
||||
int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen )
|
||||
int32_t mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen )
|
||||
{
|
||||
if( ctx == NULL || ctx->md_info == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
@@ -106,7 +106,7 @@ int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t i
|
||||
return( ctx->md_info->update_func( ctx->md_ctx, input, ilen ) );
|
||||
}
|
||||
|
||||
int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output )
|
||||
int32_t mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output )
|
||||
{
|
||||
if( ctx == NULL || ctx->md_info == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
@@ -114,7 +114,7 @@ int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output )
|
||||
return( ctx->md_info->finish_func( ctx->md_ctx, output ) );
|
||||
}
|
||||
|
||||
int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen,
|
||||
int32_t mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen,
|
||||
uint8_t *output )
|
||||
{
|
||||
if( md_info == NULL )
|
||||
@@ -123,9 +123,9 @@ int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t i
|
||||
return( md_info->digest_func( input, ilen, output ) );
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key, size_t keylen )
|
||||
int32_t mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key, size_t keylen )
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
uint8_t sum[MBEDTLS_MD_MAX_SIZE];
|
||||
uint8_t *ipad, *opad;
|
||||
size_t i;
|
||||
@@ -170,7 +170,7 @@ cleanup:
|
||||
return( ret );
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen )
|
||||
int32_t mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen )
|
||||
{
|
||||
if( ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
@@ -178,9 +178,9 @@ int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input, siz
|
||||
return( ctx->md_info->update_func( ctx->md_ctx, input, ilen ) );
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output )
|
||||
int32_t mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output )
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
uint8_t tmp[MBEDTLS_MD_MAX_SIZE];
|
||||
uint8_t *opad;
|
||||
|
||||
@@ -202,9 +202,9 @@ int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output )
|
||||
return( ctx->md_info->finish_func( ctx->md_ctx, output ) );
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx )
|
||||
int32_t mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx )
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
uint8_t *ipad;
|
||||
|
||||
if( ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL )
|
||||
@@ -218,13 +218,13 @@ int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx )
|
||||
ctx->md_info->block_size ) );
|
||||
}
|
||||
|
||||
int mbedtls_md_hmac( const mbedtls_md_info_t *md_info,
|
||||
int32_t mbedtls_md_hmac( const mbedtls_md_info_t *md_info,
|
||||
const uint8_t *key, size_t keylen,
|
||||
const uint8_t *input, size_t ilen,
|
||||
uint8_t *output )
|
||||
{
|
||||
mbedtls_md_context_t ctx;
|
||||
int ret;
|
||||
int32_t ret;
|
||||
|
||||
if( md_info == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
@@ -247,7 +247,7 @@ cleanup:
|
||||
return( ret );
|
||||
}
|
||||
|
||||
int mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data )
|
||||
int32_t mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data )
|
||||
{
|
||||
if( ctx == NULL || ctx->md_info == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
|
@@ -80,7 +80,7 @@ typedef struct {
|
||||
* message-digest enumeration #mbedtls_md_type_t.
|
||||
* The last entry is 0.
|
||||
*/
|
||||
const int *mbedtls_md_list( void );
|
||||
const int32_t *mbedtls_md_list( void );
|
||||
|
||||
/**
|
||||
* \brief This function returns the message-digest information
|
||||
@@ -135,7 +135,7 @@ void mbedtls_md_free( mbedtls_md_context_t *ctx );
|
||||
* failure.
|
||||
* \return #MBEDTLS_ERR_MD_ALLOC_FAILED on memory-allocation failure.
|
||||
*/
|
||||
int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info );
|
||||
int32_t mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info );
|
||||
|
||||
/**
|
||||
* \brief This function clones the state of an message-digest
|
||||
@@ -156,7 +156,7 @@ int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_inf
|
||||
* \return \c 0 on success.
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification failure.
|
||||
*/
|
||||
int mbedtls_md_clone( mbedtls_md_context_t *dst,
|
||||
int32_t mbedtls_md_clone( mbedtls_md_context_t *dst,
|
||||
const mbedtls_md_context_t *src );
|
||||
|
||||
/**
|
||||
@@ -194,7 +194,7 @@ mbedtls_md_type_t mbedtls_md_get_type( const mbedtls_md_info_t *md_info );
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_starts( mbedtls_md_context_t *ctx );
|
||||
int32_t mbedtls_md_starts( mbedtls_md_context_t *ctx );
|
||||
|
||||
/**
|
||||
* \brief This function feeds an input buffer into an ongoing
|
||||
@@ -212,7 +212,7 @@ int mbedtls_md_starts( mbedtls_md_context_t *ctx );
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen );
|
||||
int32_t mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief This function finishes the digest operation,
|
||||
@@ -232,7 +232,7 @@ int mbedtls_md_update( mbedtls_md_context_t *ctx, const uint8_t *input, size_t i
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output );
|
||||
int32_t mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output );
|
||||
|
||||
/**
|
||||
* \brief This function calculates the message-digest of a buffer,
|
||||
@@ -252,7 +252,7 @@ int mbedtls_md_finish( mbedtls_md_context_t *ctx, uint8_t *output );
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen,
|
||||
int32_t mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t ilen,
|
||||
uint8_t *output );
|
||||
|
||||
/**
|
||||
@@ -273,7 +273,7 @@ int mbedtls_md( const mbedtls_md_info_t *md_info, const uint8_t *input, size_t i
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key,
|
||||
int32_t mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key,
|
||||
size_t keylen );
|
||||
|
||||
/**
|
||||
@@ -295,7 +295,7 @@ int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const uint8_t *key,
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input,
|
||||
int32_t mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
@@ -316,7 +316,7 @@ int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, const uint8_t *input,
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output);
|
||||
int32_t mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output);
|
||||
|
||||
/**
|
||||
* \brief This function prepares to authenticate a new message with
|
||||
@@ -333,7 +333,7 @@ int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, uint8_t *output);
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx );
|
||||
int32_t mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx );
|
||||
|
||||
/**
|
||||
* \brief This function calculates the full generic HMAC
|
||||
@@ -357,11 +357,11 @@ int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx );
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
*/
|
||||
int mbedtls_md_hmac( const mbedtls_md_info_t *md_info, const uint8_t *key, size_t keylen,
|
||||
int32_t mbedtls_md_hmac( const mbedtls_md_info_t *md_info, const uint8_t *key, size_t keylen,
|
||||
const uint8_t *input, size_t ilen,
|
||||
uint8_t *output );
|
||||
|
||||
/* Internal use */
|
||||
int mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data );
|
||||
int32_t mbedtls_md_process( mbedtls_md_context_t *ctx, const uint8_t *data );
|
||||
|
||||
#endif /* MBEDTLS_MD_H */
|
||||
|
@@ -44,29 +44,29 @@ struct mbedtls_md_info_t
|
||||
const char * name;
|
||||
|
||||
/** Output length of the digest function in bytes */
|
||||
int size;
|
||||
int32_t size;
|
||||
|
||||
/** Block length of the digest function in bytes */
|
||||
int block_size;
|
||||
int32_t block_size;
|
||||
|
||||
/** Digest initialisation function */
|
||||
int (*starts_func)( void *ctx );
|
||||
int32_t (*starts_func)( void *ctx );
|
||||
|
||||
/** Digest update function */
|
||||
int (*update_func)( void *ctx, const uint8_t *input, size_t ilen );
|
||||
int32_t (*update_func)( void *ctx, const uint8_t *input, size_t ilen );
|
||||
|
||||
/** Digest finalisation function */
|
||||
int (*finish_func)( void *ctx, uint8_t *output );
|
||||
int32_t (*finish_func)( void *ctx, uint8_t *output );
|
||||
|
||||
/** Generic digest function */
|
||||
int (*digest_func)( const uint8_t *input, size_t ilen,
|
||||
int32_t (*digest_func)( const uint8_t *input, size_t ilen,
|
||||
uint8_t *output );
|
||||
|
||||
/** Clone state from a context */
|
||||
void (*clone_func)( void *dst, const void *src );
|
||||
|
||||
/** Internal use only */
|
||||
int (*process_func)( void *ctx, const uint8_t *input );
|
||||
int32_t (*process_func)( void *ctx, const uint8_t *input );
|
||||
};
|
||||
|
||||
extern const mbedtls_md_info_t mbedtls_sha256_info;
|
||||
|
@@ -32,14 +32,14 @@
|
||||
* Wrappers for generic message digests
|
||||
*/
|
||||
|
||||
static int sha256_update_wrap( void *ctx, const uint8_t *input,
|
||||
static int32_t sha256_update_wrap( void *ctx, const uint8_t *input,
|
||||
size_t ilen )
|
||||
{
|
||||
return( mbedtls_sha256_update_ret( (mbedtls_sha256_context *) ctx,
|
||||
input, ilen ) );
|
||||
}
|
||||
|
||||
static int sha256_finish_wrap( void *ctx, uint8_t *output )
|
||||
static int32_t sha256_finish_wrap( void *ctx, uint8_t *output )
|
||||
{
|
||||
return( mbedtls_sha256_finish_ret( (mbedtls_sha256_context *) ctx,
|
||||
output ) );
|
||||
@@ -51,18 +51,18 @@ static void sha256_clone_wrap( void *dst, const void *src )
|
||||
(const mbedtls_sha256_context *) src );
|
||||
}
|
||||
|
||||
static int sha256_process_wrap( void *ctx, const uint8_t *data )
|
||||
static int32_t sha256_process_wrap( void *ctx, const uint8_t *data )
|
||||
{
|
||||
return( mbedtls_internal_sha256_process( (mbedtls_sha256_context *) ctx,
|
||||
data ) );
|
||||
}
|
||||
|
||||
static int sha256_starts_wrap( void *ctx )
|
||||
static int32_t sha256_starts_wrap( void *ctx )
|
||||
{
|
||||
return( mbedtls_sha256_starts_ret( (mbedtls_sha256_context *) ctx, 0 ) );
|
||||
}
|
||||
|
||||
static int sha256_wrap( const uint8_t *input, size_t ilen,
|
||||
static int32_t sha256_wrap( const uint8_t *input, size_t ilen,
|
||||
uint8_t *output )
|
||||
{
|
||||
return( mbedtls_sha256_ret( input, ilen, output, 0 ) );
|
||||
|
@@ -73,7 +73,7 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
||||
/*
|
||||
* SHA-256 context setup
|
||||
*/
|
||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 )
|
||||
int32_t mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int32_t is224 )
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
@@ -153,7 +153,7 @@ static const uint32_t K[] =
|
||||
d += temp1; h = temp1 + temp2; \
|
||||
}
|
||||
|
||||
int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
||||
int32_t mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
||||
const uint8_t data[64] )
|
||||
{
|
||||
uint32_t temp1, temp2, W[64];
|
||||
@@ -199,11 +199,11 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
||||
/*
|
||||
* SHA-256 process buffer
|
||||
*/
|
||||
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
||||
int32_t mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
||||
const uint8_t *input,
|
||||
size_t ilen )
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
size_t fill;
|
||||
uint32_t left;
|
||||
|
||||
@@ -249,10 +249,10 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
||||
/*
|
||||
* SHA-256 final digest
|
||||
*/
|
||||
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
||||
int32_t mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
||||
uint8_t output[32] )
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
uint32_t used;
|
||||
uint32_t high, low;
|
||||
|
||||
@@ -312,12 +312,12 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
||||
/*
|
||||
* output = SHA-256( input buffer )
|
||||
*/
|
||||
int mbedtls_sha256_ret( const uint8_t *input,
|
||||
int32_t mbedtls_sha256_ret( const uint8_t *input,
|
||||
size_t ilen,
|
||||
uint8_t output[32],
|
||||
int is224 )
|
||||
int32_t is224 )
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
mbedtls_sha256_context ctx;
|
||||
|
||||
mbedtls_sha256_init( &ctx );
|
||||
|
@@ -43,7 +43,7 @@ typedef struct
|
||||
uint32_t total[2]; /*!< The number of Bytes processed. */
|
||||
uint32_t state[8]; /*!< The intermediate digest state. */
|
||||
uint8_t buffer[64]; /*!< The data block being processed. */
|
||||
int is224; /*!< Determines which function to use:
|
||||
int32_t is224; /*!< Determines which function to use:
|
||||
0: Use SHA-256, or 1: Use SHA-224. */
|
||||
}
|
||||
mbedtls_sha256_context;
|
||||
@@ -81,7 +81,7 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
|
||||
int32_t mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int32_t is224 );
|
||||
|
||||
/**
|
||||
* \brief This function feeds an input buffer into an ongoing
|
||||
@@ -93,7 +93,7 @@ int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
||||
int32_t mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
||||
const uint8_t *input,
|
||||
size_t ilen );
|
||||
|
||||
@@ -106,7 +106,7 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
||||
int32_t mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
||||
uint8_t output[32] );
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
||||
int32_t mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
||||
const uint8_t data[64] );
|
||||
|
||||
/**
|
||||
@@ -138,9 +138,9 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
||||
* \param is224 Determines which function to use:
|
||||
* 0: Use SHA-256, or 1: Use SHA-224.
|
||||
*/
|
||||
int mbedtls_sha256_ret( const uint8_t *input,
|
||||
int32_t mbedtls_sha256_ret( const uint8_t *input,
|
||||
size_t ilen,
|
||||
uint8_t output[32],
|
||||
int is224 );
|
||||
int32_t is224 );
|
||||
|
||||
#endif /* mbedtls_sha256.h */
|
||||
|
@@ -259,7 +259,7 @@ void free(const void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
void *memchr(const void *void_s, int c, size_t n)
|
||||
void *memchr(const void *void_s, int32_t c, size_t n)
|
||||
{
|
||||
uint8_t val = (uint8_t)c;
|
||||
uint8_t *ptr = (uint8_t *)void_s;
|
||||
|
@@ -37,7 +37,7 @@ long strtol_deci(const char *nptr)
|
||||
const char *s = nptr;
|
||||
char c;
|
||||
uint64_t acc, cutoff, cutlim;
|
||||
int neg = 0, any;
|
||||
int32_t neg = 0, any;
|
||||
uint64_t base = 10UL;
|
||||
|
||||
/*
|
||||
@@ -117,7 +117,7 @@ uint64_t strtoul_hex(const char *nptr)
|
||||
char c, digit;
|
||||
uint64_t acc, cutoff, cutlim;
|
||||
uint64_t base = 16UL;
|
||||
int any;
|
||||
int32_t any;
|
||||
|
||||
/*
|
||||
* See strtol for comments as to the logic used.
|
||||
@@ -157,9 +157,9 @@ uint64_t strtoul_hex(const char *nptr)
|
||||
return acc;
|
||||
}
|
||||
|
||||
int atoi(const char *str)
|
||||
int32_t atoi(const char *str)
|
||||
{
|
||||
return (int)strtol_deci(str);
|
||||
return (int32_t)strtol_deci(str);
|
||||
}
|
||||
|
||||
char *strchr(char *s_arg, char ch)
|
||||
@@ -377,7 +377,7 @@ size_t strnlen_s(const char *str_arg, size_t maxlen_arg)
|
||||
return count;
|
||||
}
|
||||
|
||||
int strcmp(const char *s1_arg, const char *s2_arg)
|
||||
int32_t strcmp(const char *s1_arg, const char *s2_arg)
|
||||
{
|
||||
const char *s1 = s1_arg;
|
||||
const char *s2 = s2_arg;
|
||||
@@ -389,7 +389,7 @@ int strcmp(const char *s1_arg, const char *s2_arg)
|
||||
return *s1 - *s2;
|
||||
}
|
||||
|
||||
int strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg)
|
||||
int32_t strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg)
|
||||
{
|
||||
const char *s1 = s1_arg;
|
||||
const char *s2 = s2_arg;
|
||||
|
Reference in New Issue
Block a user