From b52cc450534b01efbee74572d5235dcff212e9bc Mon Sep 17 00:00:00 2001 From: Stefan Stefanov Date: Wed, 1 Apr 2026 23:03:25 +0300 Subject: [PATCH] core/crypto/aes: Fix src size check Fixed a faulty check that would check the `dst` twice instead of checking the `src` and `dst` input parameters in `encrypt_ecb()` & `decrypt_ecb()`. --- core/crypto/aes/aes_ecb.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/crypto/aes/aes_ecb.odin b/core/crypto/aes/aes_ecb.odin index cac62de5d..9ec1a9a37 100644 --- a/core/crypto/aes/aes_ecb.odin +++ b/core/crypto/aes/aes_ecb.odin @@ -21,7 +21,7 @@ init_ecb :: proc(ctx: ^Context_ECB, key: []byte, impl := DEFAULT_IMPLEMENTATION) encrypt_ecb :: proc(ctx: ^Context_ECB, dst, src: []byte) { ensure(ctx._is_initialized) ensure(len(dst) == BLOCK_SIZE, "crypto/aes: invalid dst size") - ensure(len(dst) == BLOCK_SIZE, "crypto/aes: invalid src size") + ensure(len(src) == BLOCK_SIZE, "crypto/aes: invalid src size") switch &impl in ctx._impl { case ct64.Context: @@ -35,7 +35,7 @@ encrypt_ecb :: proc(ctx: ^Context_ECB, dst, src: []byte) { decrypt_ecb :: proc(ctx: ^Context_ECB, dst, src: []byte) { ensure(ctx._is_initialized) ensure(len(dst) == BLOCK_SIZE, "crypto/aes: invalid dst size") - ensure(len(dst) == BLOCK_SIZE, "crypto/aes: invalid src size") + ensure(len(src) == BLOCK_SIZE, "crypto/aes: invalid src size") switch &impl in ctx._impl { case ct64.Context: