mirror of https://github.com/ARMmbed/mbed-os.git
Update Mbed TLS HW acceleration partner code to new hashing API
parent
cf5065c312
commit
876a3b1a74
|
@ -103,37 +103,40 @@ void mbedtls_sha1_clone(mbedtls_sha1_context *dst,
|
|||
/*
|
||||
* SHA-1 context setup
|
||||
*/
|
||||
void mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
|
||||
int mbedtls_sha1_starts_ret(mbedtls_sha1_context *ctx)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha1_hw_starts(&ctx->hw_ctx);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha1_sw_starts(&ctx->sw_ctx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 process buffer
|
||||
*/
|
||||
void mbedtls_sha1_update(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
|
||||
int mbedtls_sha1_update_ret(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha1_hw_update(&ctx->hw_ctx, input, ilen);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha1_sw_update(&ctx->sw_ctx, input, ilen);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 final digest
|
||||
*/
|
||||
void mbedtls_sha1_finish(mbedtls_sha1_context *ctx, unsigned char output[20])
|
||||
int mbedtls_sha1_finish_ret(mbedtls_sha1_context *ctx, unsigned char output[20])
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha1_hw_finish(&ctx->hw_ctx, output);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha1_sw_finish(&ctx->sw_ctx, output);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64])
|
||||
|
|
|
@ -66,8 +66,10 @@ void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
|
|||
* \brief SHA-1 context setup
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
|
||||
int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 process buffer
|
||||
|
@ -75,16 +77,20 @@ void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
|
|||
* \param ctx SHA-1 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 final digest
|
||||
*
|
||||
* \param ctx SHA-1 context
|
||||
* \param output SHA-1 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] );
|
||||
int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx, unsigned char output[20] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[64] );
|
||||
|
|
|
@ -104,37 +104,40 @@ void mbedtls_sha256_clone(mbedtls_sha256_context *dst,
|
|||
/*
|
||||
* SHA-256 context setup
|
||||
*/
|
||||
void mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224)
|
||||
int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha256_hw_starts(&ctx->hw_ctx, is224);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha256_sw_starts(&ctx->sw_ctx, is224);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-256 process buffer
|
||||
*/
|
||||
void mbedtls_sha256_update(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen)
|
||||
int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha256_hw_update(&ctx->hw_ctx, input, ilen);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha256_sw_update(&ctx->sw_ctx, input, ilen);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-256 final digest
|
||||
*/
|
||||
void mbedtls_sha256_finish(mbedtls_sha256_context *ctx, unsigned char output[32])
|
||||
int mbedtls_sha256_finish_ret(mbedtls_sha256_context *ctx, unsigned char output[32])
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha256_hw_finish(&ctx->hw_ctx, output);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha256_sw_finish(&ctx->sw_ctx, output);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64])
|
||||
|
|
|
@ -67,8 +67,10 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
|||
*
|
||||
* \param ctx context to be initialized
|
||||
* \param is224 0 = use SHA256, 1 = use SHA224
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 );
|
||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 process buffer
|
||||
|
@ -76,17 +78,21 @@ void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 );
|
|||
* \param ctx SHA-256 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||
size_t ilen );
|
||||
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 final digest
|
||||
*
|
||||
* \param ctx SHA-256 context
|
||||
* \param output SHA-224/256 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] );
|
||||
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, unsigned char output[32] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[64] );
|
||||
|
|
|
@ -105,37 +105,40 @@ void mbedtls_sha512_clone(mbedtls_sha512_context *dst,
|
|||
/*
|
||||
* SHA-512 context setup
|
||||
*/
|
||||
void mbedtls_sha512_starts(mbedtls_sha512_context *ctx, int is384)
|
||||
int mbedtls_sha512_starts_ret(mbedtls_sha512_context *ctx, int is384)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha512_hw_starts(&ctx->hw_ctx, is384);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha512_sw_starts(&ctx->sw_ctx, is384);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-512 process buffer
|
||||
*/
|
||||
void mbedtls_sha512_update(mbedtls_sha512_context *ctx, const unsigned char *input, size_t ilen)
|
||||
int mbedtls_sha512_update_ret(mbedtls_sha512_context *ctx, const unsigned char *input, size_t ilen)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha512_hw_update(&ctx->hw_ctx, input, ilen);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha512_sw_update(&ctx->sw_ctx, input, ilen);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-512 final digest
|
||||
*/
|
||||
void mbedtls_sha512_finish(mbedtls_sha512_context *ctx, unsigned char output[64])
|
||||
int mbedtls_sha512_finish_ret(mbedtls_sha512_context *ctx, unsigned char output[64])
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha512_hw_finish(&ctx->hw_ctx, output);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha512_sw_finish(&ctx->sw_ctx, output);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha512_process(mbedtls_sha512_context *ctx, const unsigned char data[128])
|
||||
|
|
|
@ -67,8 +67,10 @@ void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
|
|||
*
|
||||
* \param ctx context to be initialized
|
||||
* \param is384 0 = use SHA512, 1 = use SHA384
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 );
|
||||
int mbedtls_sha512_starts_ret( mbedtls_sha512_context *ctx, int is384 );
|
||||
|
||||
/**
|
||||
* \brief SHA-512 process buffer
|
||||
|
@ -76,17 +78,21 @@ void mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 );
|
|||
* \param ctx SHA-512 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha512_update( mbedtls_sha512_context *ctx, const unsigned char *input,
|
||||
size_t ilen );
|
||||
int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx, const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-512 final digest
|
||||
*
|
||||
* \param ctx SHA-512 context
|
||||
* \param output SHA-384/512 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char output[64] );
|
||||
int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx, unsigned char output[64] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_sha512_process( mbedtls_sha512_context *ctx, const unsigned char data[128] );
|
||||
|
|
|
@ -103,37 +103,40 @@ void mbedtls_sha1_clone(mbedtls_sha1_context *dst,
|
|||
/*
|
||||
* SHA-1 context setup
|
||||
*/
|
||||
void mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
|
||||
int mbedtls_sha1_starts_ret(mbedtls_sha1_context *ctx)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha1_hw_starts(&ctx->hw_ctx);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha1_sw_starts(&ctx->sw_ctx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 process buffer
|
||||
*/
|
||||
void mbedtls_sha1_update(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
|
||||
int mbedtls_sha1_update_ret(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha1_hw_update(&ctx->hw_ctx, input, ilen);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha1_sw_update(&ctx->sw_ctx, input, ilen);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 final digest
|
||||
*/
|
||||
void mbedtls_sha1_finish(mbedtls_sha1_context *ctx, unsigned char output[20])
|
||||
int mbedtls_sha1_finish_ret(mbedtls_sha1_context *ctx, unsigned char output[20])
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha1_hw_finish(&ctx->hw_ctx, output);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha1_sw_finish(&ctx->sw_ctx, output);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64])
|
||||
|
|
|
@ -66,8 +66,10 @@ void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
|
|||
* \brief SHA-1 context setup
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
|
||||
int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 process buffer
|
||||
|
@ -75,16 +77,20 @@ void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
|
|||
* \param ctx SHA-1 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 final digest
|
||||
*
|
||||
* \param ctx SHA-1 context
|
||||
* \param output SHA-1 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] );
|
||||
int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx, unsigned char output[20] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[64] );
|
||||
|
|
|
@ -104,37 +104,40 @@ void mbedtls_sha256_clone(mbedtls_sha256_context *dst,
|
|||
/*
|
||||
* SHA-256 context setup
|
||||
*/
|
||||
void mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224)
|
||||
int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha256_hw_starts(&ctx->hw_ctx, is224);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha256_sw_starts(&ctx->sw_ctx, is224);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-256 process buffer
|
||||
*/
|
||||
void mbedtls_sha256_update(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen)
|
||||
int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen)
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha256_hw_update(&ctx->hw_ctx, input, ilen);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha256_sw_update(&ctx->sw_ctx, input, ilen);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-256 final digest
|
||||
*/
|
||||
void mbedtls_sha256_finish(mbedtls_sha256_context *ctx, unsigned char output[32])
|
||||
int mbedtls_sha256_finish_ret(mbedtls_sha256_context *ctx, unsigned char output[32])
|
||||
{
|
||||
if (ctx->active_ctx == &ctx->hw_ctx) {
|
||||
mbedtls_sha256_hw_finish(&ctx->hw_ctx, output);
|
||||
} else if (ctx->active_ctx == &ctx->sw_ctx) {
|
||||
mbedtls_sha256_sw_finish(&ctx->sw_ctx, output);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64])
|
||||
|
|
|
@ -67,8 +67,10 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
|||
*
|
||||
* \param ctx context to be initialized
|
||||
* \param is224 0 = use SHA256, 1 = use SHA224
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 );
|
||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 process buffer
|
||||
|
@ -76,17 +78,21 @@ void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 );
|
|||
* \param ctx SHA-256 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||
size_t ilen );
|
||||
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 final digest
|
||||
*
|
||||
* \param ctx SHA-256 context
|
||||
* \param output SHA-224/256 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] );
|
||||
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, unsigned char output[32] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[64] );
|
||||
|
|
|
@ -90,12 +90,11 @@ void mbedtls_md5_clone( mbedtls_md5_context *dst,
|
|||
*dst = *src;
|
||||
}
|
||||
|
||||
void mbedtls_md5_starts( mbedtls_md5_context *ctx )
|
||||
int mbedtls_md5_starts_ret( mbedtls_md5_context *ctx )
|
||||
{
|
||||
/* HASH IP initialization */
|
||||
if (HAL_HASH_DeInit(&ctx->hhash_md5) != 0) {
|
||||
// error found to be returned
|
||||
return;
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED;
|
||||
}
|
||||
|
||||
/* HASH Configuration */
|
||||
|
@ -103,32 +102,35 @@ void mbedtls_md5_starts( mbedtls_md5_context *ctx )
|
|||
/* clear CR ALGO value */
|
||||
HASH->CR &= ~HASH_CR_ALGO_Msk;
|
||||
if (HAL_HASH_Init(&ctx->hhash_md5) != 0) {
|
||||
// return error code
|
||||
return;
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED;
|
||||
}
|
||||
if (st_md5_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_md5_process( mbedtls_md5_context *ctx, const unsigned char data[ST_MD5_BLOCK_SIZE] )
|
||||
int mbedtls_md5_process( mbedtls_md5_context *ctx, const unsigned char data[ST_MD5_BLOCK_SIZE] )
|
||||
{
|
||||
if (st_md5_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
if (HAL_HASH_MD5_Accumulate(&ctx->hhash_md5, (uint8_t *)data, ST_MD5_BLOCK_SIZE) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED;
|
||||
}
|
||||
if (st_md5_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, size_t ilen )
|
||||
int mbedtls_md5_update_ret( mbedtls_md5_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
size_t currentlen = ilen;
|
||||
if (st_md5_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
// store mechanism to accumulate ST_MD5_BLOCK_SIZE bytes (512 bits) in the HW
|
||||
if (currentlen == 0){ // only change HW status is size if 0
|
||||
|
@ -146,12 +148,14 @@ void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, s
|
|||
// fill buffer and process it
|
||||
memcpy(ctx->sbuf + ctx->sbuf_len, input, (ST_MD5_BLOCK_SIZE - ctx->sbuf_len));
|
||||
currentlen -= (ST_MD5_BLOCK_SIZE - ctx->sbuf_len);
|
||||
mbedtls_md5_process(ctx, ctx->sbuf);
|
||||
if( mbedtls_md5_process(ctx, ctx->sbuf) != 0) {
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED;
|
||||
}
|
||||
// Process every input as long as it is %64 bytes, ie 512 bits
|
||||
size_t iter = currentlen / ST_MD5_BLOCK_SIZE;
|
||||
if (iter !=0) {
|
||||
if (HAL_HASH_MD5_Accumulate(&ctx->hhash_md5, (uint8_t *)(input + ST_MD5_BLOCK_SIZE - ctx->sbuf_len), (iter * ST_MD5_BLOCK_SIZE)) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED;
|
||||
}
|
||||
}
|
||||
// sbuf is completely accumulated, now copy up to 63 remaining bytes
|
||||
|
@ -161,18 +165,20 @@ void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, s
|
|||
}
|
||||
}
|
||||
if (st_md5_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_md5_finish( mbedtls_md5_context *ctx, unsigned char output[16] )
|
||||
int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx, unsigned char output[16] )
|
||||
{
|
||||
if (st_md5_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
if (ctx->sbuf_len > 0) {
|
||||
if (HAL_HASH_MD5_Accumulate(&ctx->hhash_md5, ctx->sbuf, ctx->sbuf_len) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Accumulation error
|
||||
}
|
||||
}
|
||||
mbedtls_zeroize( ctx->sbuf, ST_MD5_BLOCK_SIZE);
|
||||
|
@ -183,8 +189,10 @@ void mbedtls_md5_finish( mbedtls_md5_context *ctx, unsigned char output[16] )
|
|||
// error code to be returned
|
||||
}
|
||||
if (st_md5_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_MD5_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_MD5_ALT */
|
||||
|
|
|
@ -79,8 +79,10 @@ void mbedtls_md5_clone( mbedtls_md5_context *dst,
|
|||
* \brief MD5 context setup
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_md5_starts( mbedtls_md5_context *ctx );
|
||||
int mbedtls_md5_starts_ret( mbedtls_md5_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief MD5 process buffer
|
||||
|
@ -88,19 +90,23 @@ void mbedtls_md5_starts( mbedtls_md5_context *ctx );
|
|||
* \param ctx MD5 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, size_t ilen );
|
||||
int mbedtls_md5_update_ret( mbedtls_md5_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief MD5 final digest
|
||||
*
|
||||
* \param ctx MD5 context
|
||||
* \param output MD5 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_md5_finish( mbedtls_md5_context *ctx, unsigned char output[16] );
|
||||
int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx, unsigned char output[16] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_md5_process( mbedtls_md5_context *ctx, const unsigned char data[ST_MD5_BLOCK_SIZE] );
|
||||
int mbedtls_md5_process( mbedtls_md5_context *ctx, const unsigned char data[ST_MD5_BLOCK_SIZE] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -88,12 +88,11 @@ void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
|
|||
*dst = *src;
|
||||
}
|
||||
|
||||
void mbedtls_sha1_starts( mbedtls_sha1_context *ctx )
|
||||
int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx )
|
||||
{
|
||||
/* Deinitializes the HASH peripheral */
|
||||
if (HAL_HASH_DeInit(&ctx->hhash_sha1) == HAL_ERROR) {
|
||||
// error found to be returned
|
||||
return;
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED;
|
||||
}
|
||||
|
||||
/* HASH Configuration */
|
||||
|
@ -101,33 +100,36 @@ void mbedtls_sha1_starts( mbedtls_sha1_context *ctx )
|
|||
/* clear CR ALGO value */
|
||||
HASH->CR &= ~HASH_CR_ALGO_Msk;
|
||||
if (HAL_HASH_Init(&ctx->hhash_sha1) == HAL_ERROR) {
|
||||
// error found to be returned
|
||||
return;
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED;
|
||||
}
|
||||
if (st_sha1_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[ST_SHA1_BLOCK_SIZE] )
|
||||
int mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[ST_SHA1_BLOCK_SIZE] )
|
||||
{
|
||||
if (st_sha1_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
if (HAL_HASH_SHA1_Accumulate(&ctx->hhash_sha1, (uint8_t *) data, ST_SHA1_BLOCK_SIZE) != 0) {
|
||||
return; // Return error code
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED;
|
||||
}
|
||||
|
||||
if (st_sha1_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen )
|
||||
int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
size_t currentlen = ilen;
|
||||
if (st_sha1_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
// store mechanism to accumulate ST_SHA1_BLOCK_SIZE bytes (512 bits) in the HW
|
||||
|
@ -146,11 +148,14 @@ void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input,
|
|||
// fill buffer and process it
|
||||
memcpy(ctx->sbuf + ctx->sbuf_len, input, (ST_SHA1_BLOCK_SIZE - ctx->sbuf_len));
|
||||
currentlen -= (ST_SHA1_BLOCK_SIZE - ctx->sbuf_len);
|
||||
mbedtls_sha1_process(ctx, ctx->sbuf);
|
||||
if( mbedtls_sha1_process(ctx, ctx->sbuf) != 0 ) {
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED;
|
||||
}
|
||||
|
||||
// Process every input as long as it is %64 bytes, ie 512 bits
|
||||
size_t iter = currentlen / ST_SHA1_BLOCK_SIZE;
|
||||
if (HAL_HASH_SHA1_Accumulate(&ctx->hhash_sha1, (uint8_t *)(input + ST_SHA1_BLOCK_SIZE - ctx->sbuf_len), (iter * ST_SHA1_BLOCK_SIZE)) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED;
|
||||
}
|
||||
// sbuf is completely accumulated, now copy up to 63 remaining bytes
|
||||
ctx->sbuf_len = currentlen % ST_SHA1_BLOCK_SIZE;
|
||||
|
@ -159,19 +164,21 @@ void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input,
|
|||
}
|
||||
}
|
||||
if (st_sha1_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] )
|
||||
int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx, unsigned char output[20] )
|
||||
{
|
||||
if (st_sha1_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
if (ctx->sbuf_len > 0) {
|
||||
if (HAL_HASH_SHA1_Accumulate(&ctx->hhash_sha1, ctx->sbuf, ctx->sbuf_len) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED;
|
||||
}
|
||||
}
|
||||
mbedtls_zeroize(ctx->sbuf, ST_SHA1_BLOCK_SIZE);
|
||||
|
@ -179,11 +186,13 @@ void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] )
|
|||
__HAL_HASH_START_DIGEST();
|
||||
|
||||
if (HAL_HASH_SHA1_Finish(&ctx->hhash_sha1, output, 10) != 0){
|
||||
return; // error code to be returned
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED;
|
||||
}
|
||||
if (st_sha1_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /*MBEDTLS_SHA1_ALT*/
|
||||
|
|
|
@ -79,8 +79,10 @@ void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
|
|||
* \brief SHA-1 context setup
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
|
||||
int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 process buffer
|
||||
|
@ -88,19 +90,23 @@ void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
|
|||
* \param ctx SHA-1 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 final digest
|
||||
*
|
||||
* \param ctx SHA-1 context
|
||||
* \param output SHA-1 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] );
|
||||
int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx, unsigned char output[20] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[ST_SHA1_BLOCK_SIZE] );
|
||||
int mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[ST_SHA1_BLOCK_SIZE] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -88,12 +88,11 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
|||
*dst = *src;
|
||||
}
|
||||
|
||||
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 )
|
||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 )
|
||||
{
|
||||
/* HASH IP initialization */
|
||||
if (HAL_HASH_DeInit(&ctx->hhash_sha256) == HAL_ERROR) {
|
||||
// error found to be returned
|
||||
return;
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
|
||||
ctx->is224 = is224;
|
||||
|
@ -102,39 +101,42 @@ void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 )
|
|||
/* clear CR ALGO value */
|
||||
HASH->CR &= ~HASH_CR_ALGO_Msk;
|
||||
if (HAL_HASH_Init(&ctx->hhash_sha256) == HAL_ERROR) {
|
||||
// error found to be returned
|
||||
return;
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
if (st_sha256_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[ST_SHA256_BLOCK_SIZE] )
|
||||
int mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[ST_SHA256_BLOCK_SIZE] )
|
||||
{
|
||||
if (st_sha256_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
if (ctx->is224 == 0) {
|
||||
if (HAL_HASHEx_SHA256_Accumulate(&ctx->hhash_sha256, (uint8_t *) data, ST_SHA256_BLOCK_SIZE) != 0) {
|
||||
return; // Return error code
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
} else {
|
||||
if (HAL_HASHEx_SHA224_Accumulate(&ctx->hhash_sha256, (uint8_t *) data, ST_SHA256_BLOCK_SIZE) != 0) {
|
||||
return; // Return error code
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (st_sha256_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen )
|
||||
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
size_t currentlen = ilen;
|
||||
if (st_sha256_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
// store mechanism to accumulate ST_SHA256_BLOCK_SIZE bytes (512 bits) in the HW
|
||||
|
@ -157,17 +159,19 @@ void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *in
|
|||
// fill buffer and process it
|
||||
memcpy(ctx->sbuf + ctx->sbuf_len, input, (ST_SHA256_BLOCK_SIZE - ctx->sbuf_len));
|
||||
currentlen -= (ST_SHA256_BLOCK_SIZE - ctx->sbuf_len);
|
||||
mbedtls_sha256_process(ctx, ctx->sbuf);
|
||||
if( mbedtls_sha256_process(ctx, ctx->sbuf) != 0) {
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
// Process every input as long as it is %64 bytes, ie 512 bits
|
||||
size_t iter = currentlen / ST_SHA256_BLOCK_SIZE;
|
||||
if (iter !=0) {
|
||||
if (ctx->is224 == 0) {
|
||||
if (HAL_HASHEx_SHA256_Accumulate(&ctx->hhash_sha256, (uint8_t *)(input + ST_SHA256_BLOCK_SIZE - ctx->sbuf_len), (iter * ST_SHA256_BLOCK_SIZE)) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
} else {
|
||||
if (HAL_HASHEx_SHA224_Accumulate(&ctx->hhash_sha256, (uint8_t *)(input + ST_SHA256_BLOCK_SIZE - ctx->sbuf_len), (iter * ST_SHA256_BLOCK_SIZE)) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -178,23 +182,25 @@ void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *in
|
|||
}
|
||||
}
|
||||
if (st_sha256_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] )
|
||||
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, unsigned char output[32] )
|
||||
{
|
||||
if (st_sha256_restore_hw_context(ctx) != 1) {
|
||||
return; // Return HASH_BUSY timout error here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
if (ctx->sbuf_len > 0) {
|
||||
if (ctx->is224 == 0) {
|
||||
if (HAL_HASHEx_SHA256_Accumulate(&ctx->hhash_sha256, ctx->sbuf, ctx->sbuf_len) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
} else {
|
||||
if (HAL_HASHEx_SHA224_Accumulate(&ctx->hhash_sha256, ctx->sbuf, ctx->sbuf_len) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,16 +210,18 @@ void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32
|
|||
|
||||
if (ctx->is224 == 0) {
|
||||
if (HAL_HASHEx_SHA256_Finish(&ctx->hhash_sha256, output, 10) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
} else {
|
||||
if (HAL_HASHEx_SHA224_Finish(&ctx->hhash_sha256, output, 10) != 0) {
|
||||
return; // Return error code here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED;
|
||||
}
|
||||
}
|
||||
if (st_sha256_save_hw_context(ctx) != 1) {
|
||||
return; // return HASH_BUSY timeout Error here
|
||||
return MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED; // Hash busy timeout
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /*MBEDTLS_SHA256_ALT*/
|
||||
|
|
|
@ -80,8 +80,10 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
|||
*
|
||||
* \param ctx context to be initialized
|
||||
* \param is224 0 = use SHA256, 1 = use SHA224
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 );
|
||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 process buffer
|
||||
|
@ -89,8 +91,10 @@ void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 );
|
|||
* \param ctx SHA-256 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
|
@ -98,11 +102,13 @@ void mbedtls_sha256_update( mbedtls_sha256_context *ctx, const unsigned char *in
|
|||
*
|
||||
* \param ctx SHA-256 context
|
||||
* \param output SHA-224/256 checksum result
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, unsigned char output[32] );
|
||||
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, unsigned char output[32] );
|
||||
|
||||
/* Internal use */
|
||||
void mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[ST_SHA256_BLOCK_SIZE] );
|
||||
int mbedtls_sha256_process( mbedtls_sha256_context *ctx, const unsigned char data[ST_SHA256_BLOCK_SIZE] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue