Add md/shaXXX_clone() API

Will be used in the SSL/TLS modules
This commit is contained in:
Manuel Pégourié-Gonnard 2015-07-06 15:26:26 +02:00
parent b9d64e5bbe
commit 16d412f465
14 changed files with 105 additions and 0 deletions

View File

@ -66,6 +66,15 @@ void mbedtls_md2_init( mbedtls_md2_context *ctx );
*/
void mbedtls_md2_free( mbedtls_md2_context *ctx );
/**
* \brief Clone (the state of) an MD2 context
*
* \param dst The destination context
* \param src The context to be cloned
*/
void mbedtls_md2_clone( mbedtls_md2_context *dst,
const mbedtls_md2_context *src );
/**
* \brief MD2 context setup
*

View File

@ -66,6 +66,15 @@ void mbedtls_md4_init( mbedtls_md4_context *ctx );
*/
void mbedtls_md4_free( mbedtls_md4_context *ctx );
/**
* \brief Clone (the state of) an MD4 context
*
* \param dst The destination context
* \param src The context to be cloned
*/
void mbedtls_md4_clone( mbedtls_md4_context *dst,
const mbedtls_md4_context *src );
/**
* \brief MD4 context setup
*

View File

@ -66,6 +66,15 @@ void mbedtls_md5_init( mbedtls_md5_context *ctx );
*/
void mbedtls_md5_free( mbedtls_md5_context *ctx );
/**
* \brief Clone (the state of) an MD5 context
*
* \param dst The destination context
* \param src The context to be cloned
*/
void mbedtls_md5_clone( mbedtls_md5_context *dst,
const mbedtls_md5_context *src );
/**
* \brief MD5 context setup
*

View File

@ -66,6 +66,15 @@ void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx );
*/
void mbedtls_ripemd160_free( mbedtls_ripemd160_context *ctx );
/**
* \brief Clone (the state of) an RIPEMD-160 context
*
* \param dst The destination context
* \param src The context to be cloned
*/
void mbedtls_ripemd160_clone( mbedtls_ripemd160_context *dst,
const mbedtls_ripemd160_context *src );
/**
* \brief RIPEMD-160 context setup
*

View File

@ -66,6 +66,15 @@ void mbedtls_sha1_init( mbedtls_sha1_context *ctx );
*/
void mbedtls_sha1_free( mbedtls_sha1_context *ctx );
/**
* \brief Clone (the state of) a SHA-1 context
*
* \param dst The destination context
* \param src The context to be cloned
*/
void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
const mbedtls_sha1_context *src );
/**
* \brief SHA-1 context setup
*

View File

@ -67,6 +67,15 @@ void mbedtls_sha256_init( mbedtls_sha256_context *ctx );
*/
void mbedtls_sha256_free( mbedtls_sha256_context *ctx );
/**
* \brief Clone (the state of) a SHA-256 context
*
* \param dst The destination context
* \param src The context to be cloned
*/
void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
const mbedtls_sha256_context *src );
/**
* \brief SHA-256 context setup
*

View File

@ -67,6 +67,15 @@ void mbedtls_sha512_init( mbedtls_sha512_context *ctx );
*/
void mbedtls_sha512_free( mbedtls_sha512_context *ctx );
/**
* \brief Clone (the state of) a SHA-512 context
*
* \param dst The destination context
* \param src The context to be cloned
*/
void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
const mbedtls_sha512_context *src );
/**
* \brief SHA-512 context setup
*

View File

@ -97,6 +97,12 @@ void mbedtls_md2_free( mbedtls_md2_context *ctx )
mbedtls_zeroize( ctx, sizeof( mbedtls_md2_context ) );
}
void mbedtls_md2_clone( mbedtls_md2_context *dst,
const mbedtls_md2_context *src )
{
*dst = *src;
}
/*
* MD2 context setup
*/

View File

@ -90,6 +90,12 @@ void mbedtls_md4_free( mbedtls_md4_context *ctx )
mbedtls_zeroize( ctx, sizeof( mbedtls_md4_context ) );
}
void mbedtls_md4_clone( mbedtls_md4_context *dst,
const mbedtls_md4_context *src )
{
*dst = *src;
}
/*
* MD4 context setup
*/

View File

@ -89,6 +89,12 @@ void mbedtls_md5_free( mbedtls_md5_context *ctx )
mbedtls_zeroize( ctx, sizeof( mbedtls_md5_context ) );
}
void mbedtls_md5_clone( mbedtls_md5_context *dst,
const mbedtls_md5_context *src )
{
*dst = *src;
}
/*
* MD5 context setup
*/

View File

@ -88,6 +88,12 @@ void mbedtls_ripemd160_free( mbedtls_ripemd160_context *ctx )
mbedtls_zeroize( ctx, sizeof( mbedtls_ripemd160_context ) );
}
void mbedtls_ripemd160_clone( mbedtls_ripemd160_context *dst,
const mbedtls_ripemd160_context *src )
{
*dst = *src;
}
/*
* RIPEMD-160 context setup
*/

View File

@ -89,6 +89,12 @@ void mbedtls_sha1_free( mbedtls_sha1_context *ctx )
mbedtls_zeroize( ctx, sizeof( mbedtls_sha1_context ) );
}
void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
const mbedtls_sha1_context *src )
{
*dst = *src;
}
/*
* SHA-1 context setup
*/

View File

@ -89,6 +89,12 @@ void mbedtls_sha256_free( mbedtls_sha256_context *ctx )
mbedtls_zeroize( ctx, sizeof( mbedtls_sha256_context ) );
}
void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
const mbedtls_sha256_context *src )
{
*dst = *src;
}
/*
* SHA-256 context setup
*/

View File

@ -150,6 +150,12 @@ void mbedtls_sha512_free( mbedtls_sha512_context *ctx )
mbedtls_zeroize( ctx, sizeof( mbedtls_sha512_context ) );
}
void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
const mbedtls_sha512_context *src )
{
*dst = *src;
}
/*
* SHA-512 context setup
*/