aboutsummaryrefslogtreecommitdiff
path: root/core/crypto/aes/aes_gcm.odin
diff options
context:
space:
mode:
Diffstat (limited to 'core/crypto/aes/aes_gcm.odin')
-rw-r--r--core/crypto/aes/aes_gcm.odin21
1 files changed, 10 insertions, 11 deletions
diff --git a/core/crypto/aes/aes_gcm.odin b/core/crypto/aes/aes_gcm.odin
index d349aa353..bb87788ac 100644
--- a/core/crypto/aes/aes_gcm.odin
+++ b/core/crypto/aes/aes_gcm.odin
@@ -5,7 +5,6 @@ import "core:crypto"
import "core:crypto/_aes"
import "core:crypto/_aes/ct64"
import "core:encoding/endian"
-import "core:mem"
// GCM_IV_SIZE is the default size of the GCM IV in bytes.
GCM_IV_SIZE :: 12
@@ -59,9 +58,9 @@ seal_gcm :: proc(ctx: ^Context_GCM, dst, tag, iv, aad, plaintext: []byte) {
final_ghash_ct64(&s, &h, &j0_enc, len(aad), len(plaintext))
copy(tag, s[:])
- mem.zero_explicit(&h, len(h))
- mem.zero_explicit(&j0, len(j0))
- mem.zero_explicit(&j0_enc, len(j0_enc))
+ zero_explicit(&h, len(h))
+ zero_explicit(&j0, len(j0))
+ zero_explicit(&j0_enc, len(j0_enc))
}
// open_gcm authenticates the aad and ciphertext, and decrypts the ciphertext,
@@ -94,13 +93,13 @@ open_gcm :: proc(ctx: ^Context_GCM, dst, iv, aad, ciphertext, tag: []byte) -> bo
ok := crypto.compare_constant_time(s[:], tag) == 1
if !ok {
- mem.zero_explicit(raw_data(dst), len(dst))
+ zero_explicit(raw_data(dst), len(dst))
}
- mem.zero_explicit(&h, len(h))
- mem.zero_explicit(&j0, len(j0))
- mem.zero_explicit(&j0_enc, len(j0_enc))
- mem.zero_explicit(&s, len(s))
+ zero_explicit(&h, len(h))
+ zero_explicit(&j0, len(j0))
+ zero_explicit(&j0_enc, len(j0_enc))
+ zero_explicit(&s, len(s))
return ok
}
@@ -249,6 +248,6 @@ gctr_ct64 :: proc(
}
}
- mem.zero_explicit(&tmp, size_of(tmp))
- mem.zero_explicit(&tmp2, size_of(tmp2))
+ zero_explicit(&tmp, size_of(tmp))
+ zero_explicit(&tmp2, size_of(tmp2))
}