hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 98dfb457aac33ab53580811496a085568523ea65
parent 4d3eb64597edb757fa594d1a4cf9983da7bbf9e6
Author: Armin Preiml <apreiml@strohwolke.at>
Date:   Fri, 16 Dec 2022 14:53:52 +0100

crypto::aes: unexport specific aes implementations

Use [[aes]] and [[init]] to let the module choose the right
implementation.

Signed-off-by: Armin Preiml <apreiml@strohwolke.at>

Diffstat:
Mcrypto/aes/+x86_64/ni.ha | 6+++---
Mcrypto/aes/aes_ct64.ha | 4++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/crypto/aes/+x86_64/ni.ha b/crypto/aes/+x86_64/ni.ha @@ -17,7 +17,7 @@ const x86ni_vtable: cipher::blockvtable = cipher::blockvtable { }; // Checks if the native AES interface is available. -export fn x86ni_available() bool = { +fn x86ni_available() bool = { return rt::cpuid_hasflags(0, rt::cpuid_ecxflags::AES); }; @@ -28,14 +28,14 @@ export fn x86ni_available() bool = { // the cipher, and must call [[crypto::cipher::finish]] when they are finished // using the cipher to securely erase any secret data stored in the cipher // state. -export fn x86ni() block = { +fn x86ni() block = { return block { vtable = &x86ni_vtable, ... }; }; -export fn x86ni_init(b: *block, key: []u8) void = { +fn x86ni_init(b: *block, key: []u8) void = { assert(len(key) == 16 || len(key) == 24 || len(key) == 32, "Invalid aes key length"); diff --git a/crypto/aes/aes_ct64.ha b/crypto/aes/aes_ct64.ha @@ -42,7 +42,7 @@ def CT64_NPARALLEL: size = 4; // the cipher, and must call [[crypto::cipher::finish]] when they are finished // using the cipher to securely erase any secret data stored in the cipher // state. -export fn ct64() block = block { +fn ct64() block = block { vtable = &ct64_vtable, ... }; @@ -56,7 +56,7 @@ const ct64_vtable: cipher::blockvtable = cipher::blockvtable { }; // Initializes the ct64 AES implementation with an encryption key. -export fn ct64_init(cipher: *block, key: []u8) void = { +fn ct64_init(cipher: *block, key: []u8) void = { let comp_skey: [30]u64 = [0...]; cipher.rounds = br_aes_ct64_keysched(comp_skey[..], key, len(key)); br_aes_ct64_skey_expand(ct64_expkey(cipher), cipher.rounds, comp_skey[..]);