From 2d2a8a2d7dd79cdef9fd2447b68c24175cebbf11 Mon Sep 17 00:00:00 2001 From: Miguel Terron Date: Wed, 4 Jun 2025 07:44:04 +1200 Subject: [PATCH] Unconditionally compile AES Cleanup language on the test file --- test/tool/net/lcrypto_test.lua | 24 ++++++++++++------------ third_party/mbedtls/config.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/tool/net/lcrypto_test.lua b/test/tool/net/lcrypto_test.lua index 52a7a5521..5b6c6a640 100644 --- a/test/tool/net/lcrypto_test.lua +++ b/test/tool/net/lcrypto_test.lua @@ -1,17 +1,17 @@ -- Helper function to print test results -local function assert_equal(actual, expected, plaintext) +local function assert_equal(actual, expected, message) if actual ~= expected then - error(plaintext .. ": expected " .. tostring(expected) .. ", got " .. tostring(actual)) + error(message .. ": expected " .. tostring(expected) .. ", got " .. tostring(actual)) else - print("PASS: " .. plaintext) + print("PASS: " .. message) end end -local function assert_not_equal(actual, not_expected, plaintext) +local function assert_not_equal(actual, not_expected, message) if actual == not_expected then - error(plaintext .. ": did not expect " .. tostring(not_expected)) + error(message .. ": did not expect " .. tostring(not_expected)) else - print("PASS: " .. plaintext) + print("PASS: " .. message) end end @@ -46,10 +46,10 @@ end local function test_rsa_signing_verification() print('\n\27[1;7mTest RSA signing and verification \27[0m') local priv_key, pub_key = crypto.generatekeypair("rsa", 2048) - local plaintext = "Sign this plaintext" - local signature = crypto.sign("rsa", priv_key, plaintext, "sha256") + local message = "Sign this message" + local signature = crypto.sign("rsa", priv_key, message, "sha256") assert_equal(type(signature), "string", "RSA signing") - local is_valid = crypto.verify("rsa", pub_key, plaintext, signature, "sha256") + local is_valid = crypto.verify("rsa", pub_key, message, signature, "sha256") assert_equal(is_valid, true, "RSA signature verification") end @@ -57,10 +57,10 @@ end local function test_ecdsa_signing_verification() print('\n\27[1;7mTest ECDSA signing and verification \27[0m') local priv_key, pub_key = crypto.generatekeypair("ecdsa", "secp256r1") - local plaintext = "Sign this plaintext with ECDSA" - local signature = crypto.sign("ecdsa", priv_key, plaintext, "sha256") + local message = "Sign this message with ECDSA" + local signature = crypto.sign("ecdsa", priv_key, message, "sha256") assert_equal(type(signature), "string", "ECDSA signing") - local is_valid = crypto.verify("ecdsa", pub_key, plaintext, signature, "sha256") + local is_valid = crypto.verify("ecdsa", pub_key, message, signature, "sha256") assert_equal(is_valid, true, "ECDSA signature verification") end diff --git a/third_party/mbedtls/config.h b/third_party/mbedtls/config.h index d181060b1..c4e457749 100644 --- a/third_party/mbedtls/config.h +++ b/third_party/mbedtls/config.h @@ -38,9 +38,9 @@ /* block modes */ #define MBEDTLS_GCM_C -#ifndef TINY #define MBEDTLS_CIPHER_MODE_CBC #define MBEDTLS_CIPHER_MODE_CTR +#ifndef TINY /*#define MBEDTLS_CCM_C*/ /*#define MBEDTLS_CIPHER_MODE_CFB*/ /*#define MBEDTLS_CIPHER_MODE_OFB*/