commit 18bb46c8153da24acc1d1d7c2a9fbb572f95757c
parent d4449388c590db10abd2572f13b23496a26a3093
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 11 Feb 2021 18:44:09 -0500
stdlib: add crypto::random
Diffstat:
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/gen-stdlib b/gen-stdlib
@@ -106,6 +106,14 @@ bytes() {
gen_ssa bytes
}
+crypto_random() {
+ printf '# crypto::random\n'
+ gen_srcs crypto::random \
+ '$(PLATFORM).ha' \
+ random.ha
+ gen_ssa crypto::random rt io
+}
+
encoding_utf8() {
# XXX: Also has ordering issues
printf '# encoding::utf8\n'
@@ -231,6 +239,7 @@ printf '# This file is generated by the gen-stdlib script, do not edit it by han
modules="ascii
bytes
+crypto_random
encoding_utf8
fmt
io
diff --git a/mk/stdlib.mk b/mk/stdlib.mk
@@ -66,6 +66,9 @@ hare_stdlib_deps+=$(stdlib_ascii)
stdlib_bytes=$(HARECACHE)/bytes/bytes.o
hare_stdlib_deps+=$(stdlib_bytes)
+stdlib_crypto_random=$(HARECACHE)/crypto/random/crypto.random.o
+hare_stdlib_deps+=$(stdlib_crypto_random)
+
stdlib_encoding_utf8=$(HARECACHE)/encoding/utf8/encoding.utf8.o
hare_stdlib_deps+=$(stdlib_encoding_utf8)
@@ -115,6 +118,17 @@ $(HARECACHE)/bytes/bytes.ssa: $(stdlib_bytes_srcs) $(stdlib_rt)
@HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nbytes \
-t$(HARECACHE)/bytes/bytes.td $(stdlib_bytes_srcs)
+# crypto::random
+stdlib_crypto_random_srcs= \
+ $(STDLIB)/crypto/random/$(PLATFORM).ha \
+ $(STDLIB)/crypto/random/random.ha
+
+$(HARECACHE)/crypto/random/crypto.random.ssa: $(stdlib_crypto_random_srcs) $(stdlib_rt) $(stdlib_rt) $(stdlib_io)
+ @printf 'HAREC \t$@\n'
+ @mkdir -p $(HARECACHE)/crypto/random
+ @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Ncrypto::random \
+ -t$(HARECACHE)/crypto/random/crypto.random.td $(stdlib_crypto_random_srcs)
+
# encoding::utf8
stdlib_encoding_utf8_srcs= \
$(STDLIB)/encoding/utf8/rune.ha \
@@ -291,6 +305,9 @@ hare_testlib_deps+=$(testlib_ascii)
testlib_bytes=$(TESTCACHE)/bytes/bytes.o
hare_testlib_deps+=$(testlib_bytes)
+testlib_crypto_random=$(TESTCACHE)/crypto/random/crypto.random.o
+hare_testlib_deps+=$(testlib_crypto_random)
+
testlib_encoding_utf8=$(TESTCACHE)/encoding/utf8/encoding.utf8.o
hare_testlib_deps+=$(testlib_encoding_utf8)
@@ -340,6 +357,17 @@ $(TESTCACHE)/bytes/bytes.ssa: $(testlib_bytes_srcs) $(testlib_rt)
@HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nbytes \
-t$(TESTCACHE)/bytes/bytes.td $(testlib_bytes_srcs)
+# crypto::random
+testlib_crypto_random_srcs= \
+ $(STDLIB)/crypto/random/$(PLATFORM).ha \
+ $(STDLIB)/crypto/random/random.ha
+
+$(TESTCACHE)/crypto/random/crypto.random.ssa: $(testlib_crypto_random_srcs) $(testlib_rt) $(testlib_rt) $(testlib_io)
+ @printf 'HAREC \t$@\n'
+ @mkdir -p $(TESTCACHE)/crypto/random
+ @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Ncrypto::random \
+ -t$(TESTCACHE)/crypto/random/crypto.random.td $(testlib_crypto_random_srcs)
+
# encoding::utf8
testlib_encoding_utf8_srcs= \
$(STDLIB)/encoding/utf8/rune.ha \