From e3b2e4bff64fbda7a527c69d12e19042f98a1899 Mon Sep 17 00:00:00 2001 From: Eduard Nicodei Date: Sat, 13 Jul 2024 21:48:25 +0100 Subject: [PATCH 1/3] use libb2 for all blake functions required if compiling on systems that use eg libressl --- scheme-libs/racket/unison/crypto.rkt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index 4d25dc3d9b..971056e36c 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -96,6 +96,7 @@ (error 'blake2 "~a failed with return value ~a" fn r)))))) (define blake2b-raw (libb2-raw "blake2b")) +(define blake2s-raw (libb2-raw "blake2s")) (define HashAlgorithm.Md5 (lc-algo "EVP_md5" 128)) (define HashAlgorithm.Sha1 (lc-algo "EVP_sha1" 160)) @@ -103,8 +104,6 @@ (define HashAlgorithm.Sha2_512 (lc-algo "EVP_sha512" 512)) (define HashAlgorithm.Sha3_256 (lc-algo "EVP_sha3_256" 256)) (define HashAlgorithm.Sha3_512 (lc-algo "EVP_sha3_512" 512)) -(define HashAlgorithm.Blake2s_256 (lc-algo "EVP_blake2s256" 256)) -(define HashAlgorithm.Blake2b_512 (lc-algo "EVP_blake2b512" 512)) (define _EVP_PKEY-pointer (_cpointer 'EVP_PKEY)) (define _EVP_MD_CTX-pointer (_cpointer 'EVP_MD_CTX)) @@ -234,6 +233,8 @@ (chunked-bytes->bytes input) (chunked-bytes->bytes signature))) +(define (HashAlgorithm.Blake2s_256) (cons 'blake2s 256)) +(define (HashAlgorithm.Blake2b_512) (cons 'blake2b 512)) ; This one isn't provided by libcrypto, for some reason (define (HashAlgorithm.Blake2b_256) (cons 'blake2b 256)) @@ -252,6 +253,7 @@ [algo (car kind)]) (case algo ['blake2b (blake2b-raw output input #f bytes (bytes-length input) 0)] + ['blake2s (blake2s-raw output input #f bytes (bytes-length input) 0)] [else (EVP_Digest input (bytes-length input) output #f algo #f)]) output)) @@ -294,6 +296,7 @@ (define (hmacBytes-raw kind key input) (case (car kind) ['blake2b (hmacBlake kind key input)] + ['blake2s (hmacBlake kind key input)] [else (let* ([bytes (/ (cdr kind) 8)] [output (make-bytes bytes)] From f18cb2fc9d150a4f7220f2cc836e711f75b3520d Mon Sep 17 00:00:00 2001 From: Eduard Nicodei Date: Sun, 14 Jul 2024 01:42:23 +0100 Subject: [PATCH 2/3] use /usr/bin/env sh for jit-tests.sh this is more portable and ensures we can compile on systems without bash (eg *BSD) --- unison-src/builtin-tests/jit-tests.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/unison-src/builtin-tests/jit-tests.sh b/unison-src/builtin-tests/jit-tests.sh index d4d9356ab1..8e29209dc1 100755 --- a/unison-src/builtin-tests/jit-tests.sh +++ b/unison-src/builtin-tests/jit-tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env sh set -ex # the first arg is the path to the unison executable @@ -8,9 +8,6 @@ if [ -z "$1" ]; then exit 1 fi -# call unison with all its args quoted -ucm=("$@") - runtime_tests_version="@unison/runtime-tests/main" echo $runtime_tests_version @@ -27,4 +24,5 @@ runtime_tests_version="$runtime_tests_version" \ < unison-src/builtin-tests/jit-tests.tpl.md \ > unison-src/builtin-tests/jit-tests.md -time "${ucm[@]}" transcript.fork -C $codebase -S $codebase unison-src/builtin-tests/jit-tests.md +# call unison with all its args quoted +time "$@" transcript.fork -C $codebase -S $codebase unison-src/builtin-tests/jit-tests.md From d66c5c79f8e95b1c0ec968a7aaf804122edcd250 Mon Sep 17 00:00:00 2001 From: Eduard Nicodei Date: Wed, 17 Jul 2024 22:24:54 +0100 Subject: [PATCH 3/3] just whitespace changes --- unison-src/builtin-tests/jit-tests.output.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 4bdb6cc29f..616d2d5d9c 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -34,9 +34,9 @@ foo = do I found and typechecked these definitions in scratch.u. If you do an `add` or `update`, here's how your codebase would change: - + ⍟ These new definitions are ok to `add`: - + foo : '{Exception} () ``` @@ -58,10 +58,10 @@ an exception. runtime-tests/selected> run.native testBug 💔💥 - + I've encountered a call to builtin.bug with the following value: - + "testing" ```