From 08c94c66a0f28beb94e03acfbb45e3e47900c24b Mon Sep 17 00:00:00 2001 From: Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com> Date: Mon, 14 Jun 2021 12:21:29 -0700 Subject: [PATCH] Move LibC to lib.cr --- src/crypto-secret/lib.cr | 11 +++++++++++ src/crypto-secret/secret.cr | 12 +----------- 2 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 src/crypto-secret/lib.cr diff --git a/src/crypto-secret/lib.cr b/src/crypto-secret/lib.cr new file mode 100644 index 0000000..ce8fda4 --- /dev/null +++ b/src/crypto-secret/lib.cr @@ -0,0 +1,11 @@ +require "crypto/subtle" + +lib LibC + fun explicit_bzero(Void*, LibC::SizeT) : Void +end + +struct Slice(T) + def wipe + LibC.explicit_bzero to_unsafe, bytesize + end +end diff --git a/src/crypto-secret/secret.cr b/src/crypto-secret/secret.cr index dfc7371..bea8bb6 100644 --- a/src/crypto-secret/secret.cr +++ b/src/crypto-secret/secret.cr @@ -1,14 +1,4 @@ -require "crypto/subtle" - -lib LibC - fun explicit_bzero(Void*, LibC::SizeT) : Void -end - -struct Slice(T) - def wipe - LibC.explicit_bzero to_unsafe, bytesize - end -end +require "./lib" # Interface to hold sensitive information (often cryptographic keys) #