Import mbedtls-3.6.2
Imports Mbed TLS 3.6.2 from https://github.com/Mbed-TLS/mbedtls.git
tags mbedtls-3.6.2, v3.6.2
Files that are not needed are removed:
cd lib/libmbedtls
rm -rf mbedtls
cp -R path/to/mbedtls-3.6.2/mbedtls .
cd mbedtls
rm CMakeLists.txt DartConfiguration.tcl Makefile
rm .gitignore .travis.yml .pylintrc .globalrc .mypy.ini BRANCHES.md
rm include/.gitignore include/CMakeLists.txt library/.gitignore
rm library/CMakeLists.txt library/Makefile
rm -r cmake
rm -rf .git .github doxygen configs programs scripts tests visualc
rm -rf 3rdparty ChangeLog.d docs pkgconfig .gitmodules .readthedocs.yaml
rm library/mps_*
cd ..
git add mbedtls
This is a complete overwrite of previous code so earlier changes in the
previous branch import/mbedtls-3.6.0 will be added on top of this
commit.
Signed-off-by: Sungbae Yoo <sungbaey@nvidia.com>
diff --git a/lib/libmbedtls/mbedtls/library/cmac.c b/lib/libmbedtls/mbedtls/library/cmac.c
index a1ef947..eda10d0 100644
--- a/lib/libmbedtls/mbedtls/library/cmac.c
+++ b/lib/libmbedtls/mbedtls/library/cmac.c
@@ -153,26 +153,11 @@
}
}
-int mbedtls_cipher_cmac_setup(mbedtls_cipher_context_t *ctx)
-{
- mbedtls_cmac_context_t *cmac_ctx;
-
- /* Allocated and initialise in the cipher context memory for the CMAC
- * context */
- cmac_ctx = mbedtls_calloc(1, sizeof(mbedtls_cmac_context_t));
- if (cmac_ctx == NULL)
- return MBEDTLS_ERR_CIPHER_ALLOC_FAILED;
-
- ctx->cmac_ctx = cmac_ctx;
-
- mbedtls_platform_zeroize(cmac_ctx->state, sizeof(cmac_ctx->state));
- return 0;
-}
-
int mbedtls_cipher_cmac_starts(mbedtls_cipher_context_t *ctx,
const unsigned char *key, size_t keybits)
{
mbedtls_cipher_type_t type;
+ mbedtls_cmac_context_t *cmac_ctx;
int retval;
if (ctx == NULL || ctx->cipher_info == NULL || key == NULL) {
@@ -196,11 +181,18 @@
return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA;
}
- /* Check if cmac ctx had been allocated by mbedtls_cipher_cmac_setup() */
- if( ctx->cmac_ctx != NULL )
- return 0;
+ /* Allocated and initialise in the cipher context memory for the CMAC
+ * context */
+ cmac_ctx = mbedtls_calloc(1, sizeof(mbedtls_cmac_context_t));
+ if (cmac_ctx == NULL) {
+ return MBEDTLS_ERR_CIPHER_ALLOC_FAILED;
+ }
- return mbedtls_cipher_cmac_setup( ctx );
+ ctx->cmac_ctx = cmac_ctx;
+
+ mbedtls_platform_zeroize(cmac_ctx->state, sizeof(cmac_ctx->state));
+
+ return 0;
}
int mbedtls_cipher_cmac_update(mbedtls_cipher_context_t *ctx,