authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2022-12-07 04:49:20+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-12-07 03:49:20+00:00
log14416b522e697997f21dd634bfdc70fbff59471b
tree39cab05129da45ad56c314a71b0fc5a48326df63
parente7d28344fa3ee81d6ad7ca5ce1f83d50d8502118
signature Signed by PGP key 4AEE18F83AFDEB23

Revert "std.crypto.aes: use software implementation in comptime context (#13792)" (#13798)

This reverts commit d4adf4420071397d993bac629a9da27b33c67ca3. Unfortunately, this is not the right place to check if AES functions are being used at comptime or not.

1 files changed, 1 insertions(+), 10 deletions(-)

lib/std/crypto/aes.zig+1-10
......@@ -2,19 +2,10 @@ const std = @import("../std.zig");
22const builtin = @import("builtin");
33const testing = std.testing;
44
5fn isComptime() bool {
6 var a: u8 = 0;
7 return @typeInfo(@TypeOf(.{a})).Struct.fields[0].is_comptime;
8}
9
105const has_aesni = std.Target.x86.featureSetHas(builtin.cpu.features, .aes);
116const has_avx = std.Target.x86.featureSetHas(builtin.cpu.features, .avx);
127const has_armaes = std.Target.aarch64.featureSetHas(builtin.cpu.features, .aes);
13const impl = if (isComptime())
14impl: {
15 break :impl @import("aes/soft.zig");
16} else if (builtin.cpu.arch == .x86_64 and has_aesni and has_avx)
17impl: {
8const impl = if (builtin.cpu.arch == .x86_64 and has_aesni and has_avx) impl: {
189 break :impl @import("aes/aesni.zig");
1910} else if (builtin.cpu.arch == .aarch64 and has_armaes)
2011impl: {