-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mbedtls] Upgrade mbedTLS to version 3.4.0
This commit introduces the following changes along with the upgrade of mbedTLS to version 3.4.0: * updating the sonames of mbedTLS-produced libs; * aligning all Gramine patches to conform with the new coding style of mbedTLS; * explicitly specifying the Gramine-provided secure zeroization function `erase_memory()` and updating it to a more performant version to cope with the updated `mbedtls_platform_zeroize()` detection logic; * dropping `MBEDTLS_SHA224_C` in the mbedTLS config which is now made independent from `MBEDTLS_SHA256_C` (it is actually not used in Gramine but was required to be present together with `MBEDTLS_SHA256_C` in the previous mbedTLS versions). Signed-off-by: Kailun Qin <kailun.qin@intel.com>
- Loading branch information
1 parent
b748897
commit ea047eb
Showing
11 changed files
with
121 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[wrap-file] | ||
directory = mbedtls-mbedtls-3.4.0 | ||
source_url = https://github.com/ARMmbed/mbedtls/archive/mbedtls-3.4.0.tar.gz | ||
source_fallback_url = https://packages.gramineproject.io/distfiles/mbedtls-3.4.0.tar.gz | ||
source_filename = mbedtls-3.4.0.tar.gz | ||
source_hash = a5dac98592b1ac2232de0aed8f4ee62dffaa99e843e6f41dca2958095c737afd | ||
|
||
patch_directory = mbedtls | ||
|
||
# this unpacks the sources to `mbedtls-mbedtls-3.4.0/mbedtls-mbedtls-3.4.0` | ||
lead_directory_missing = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
diff --git a/library/aes.c b/library/aes.c | ||
index 319d9bb67e89fa7a62ce3f2e14aa1552b7c91a12..2725b7bb8cfc5cd2f593050454a6d2b23866834d 100644 | ||
index 69da5828ac619ed837559df5c54b6bb1e11076b0..ca54bfa0b086c495d47a7cba9b256ec9cae4ae16 100644 | ||
--- a/library/aes.c | ||
+++ b/library/aes.c | ||
@@ -543,6 +543,8 @@ int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key, | ||
#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64) | ||
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) ) | ||
return( mbedtls_aesni_setkey_enc( (unsigned char *) RK, key, keybits ) ); | ||
+ else | ||
+ return( MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED ); | ||
@@ -582,6 +582,9 @@ int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, | ||
if (mbedtls_aesni_has_support(MBEDTLS_AESNI_AES)) { | ||
return mbedtls_aesni_setkey_enc((unsigned char *) RK, key, keybits); | ||
} | ||
+ else { | ||
+ return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED; | ||
+ } | ||
#endif | ||
|
||
for( i = 0; i < ( keybits >> 5 ); i++ ) | ||
@@ -654,6 +656,11 @@ int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key, | ||
(const unsigned char *) ( cty.buf + cty.rk_offset ), ctx->nr ); | ||
#if defined(MBEDTLS_AESCE_C) && defined(MBEDTLS_HAVE_ARM64) | ||
@@ -687,6 +690,10 @@ int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, | ||
(const unsigned char *) (cty.buf + cty.rk_offset), ctx->nr); | ||
goto exit; | ||
} | ||
+ else | ||
+ { | ||
+ else { | ||
+ ret = MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED; | ||
+ goto exit; | ||
+ } | ||
#endif | ||
|
||
SK = cty.buf + cty.rk_offset + cty.nr * 4; | ||
@@ -947,6 +954,8 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx, | ||
#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64) | ||
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) ) | ||
return( mbedtls_aesni_crypt_ecb( ctx, mode, input, output ) ); | ||
+ else | ||
+ return( MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED ); | ||
#if defined(MBEDTLS_AESCE_C) && defined(MBEDTLS_HAVE_ARM64) | ||
@@ -1013,6 +1020,9 @@ int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, | ||
if (mbedtls_aesni_has_support(MBEDTLS_AESNI_AES)) { | ||
return mbedtls_aesni_crypt_ecb(ctx, mode, input, output); | ||
} | ||
+ else { | ||
+ return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED; | ||
+ } | ||
#endif | ||
|
||
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) | ||
#if defined(MBEDTLS_AESCE_C) && defined(MBEDTLS_HAVE_ARM64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.