Skip to content

Commit 42ebc76

Browse files
authored
Merge pull request #5237 from neduard/jit-support-non-gnu-unix-systems
Support native compilation on non-GNU Unix systems
2 parents 525e923 + d66c5c7 commit 42ebc76

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

scheme-libs/racket/unison/crypto.rkt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,14 @@
9696
(error 'blake2 "~a failed with return value ~a" fn r))))))
9797

9898
(define blake2b-raw (libb2-raw "blake2b"))
99+
(define blake2s-raw (libb2-raw "blake2s"))
99100

100101
(define HashAlgorithm.Md5 (lc-algo "EVP_md5" 128))
101102
(define HashAlgorithm.Sha1 (lc-algo "EVP_sha1" 160))
102103
(define HashAlgorithm.Sha2_256 (lc-algo "EVP_sha256" 256))
103104
(define HashAlgorithm.Sha2_512 (lc-algo "EVP_sha512" 512))
104105
(define HashAlgorithm.Sha3_256 (lc-algo "EVP_sha3_256" 256))
105106
(define HashAlgorithm.Sha3_512 (lc-algo "EVP_sha3_512" 512))
106-
(define HashAlgorithm.Blake2s_256 (lc-algo "EVP_blake2s256" 256))
107-
(define HashAlgorithm.Blake2b_512 (lc-algo "EVP_blake2b512" 512))
108107

109108
(define _EVP_PKEY-pointer (_cpointer 'EVP_PKEY))
110109
(define _EVP_MD_CTX-pointer (_cpointer 'EVP_MD_CTX))
@@ -234,6 +233,8 @@
234233
(chunked-bytes->bytes input)
235234
(chunked-bytes->bytes signature)))
236235

236+
(define (HashAlgorithm.Blake2s_256) (cons 'blake2s 256))
237+
(define (HashAlgorithm.Blake2b_512) (cons 'blake2b 512))
237238
; This one isn't provided by libcrypto, for some reason
238239
(define (HashAlgorithm.Blake2b_256) (cons 'blake2b 256))
239240

@@ -252,6 +253,7 @@
252253
[algo (car kind)])
253254
(case algo
254255
['blake2b (blake2b-raw output input #f bytes (bytes-length input) 0)]
256+
['blake2s (blake2s-raw output input #f bytes (bytes-length input) 0)]
255257
[else (EVP_Digest input (bytes-length input) output #f algo #f)])
256258

257259
output))
@@ -294,6 +296,7 @@
294296
(define (hmacBytes-raw kind key input)
295297
(case (car kind)
296298
['blake2b (hmacBlake kind key input)]
299+
['blake2s (hmacBlake kind key input)]
297300
[else
298301
(let* ([bytes (/ (cdr kind) 8)]
299302
[output (make-bytes bytes)]

unison-src/builtin-tests/jit-tests.output.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ foo = do
3434
I found and typechecked these definitions in scratch.u. If you
3535
do an `add` or `update`, here's how your codebase would
3636
change:
37-
37+
3838
⍟ These new definitions are ok to `add`:
39-
39+
4040
foo : '{Exception} ()
4141
4242
```
@@ -58,10 +58,10 @@ an exception.
5858
runtime-tests/selected> run.native testBug
5959
6060
💔💥
61-
61+
6262
I've encountered a call to builtin.bug with the following
6363
value:
64-
64+
6565
"testing"
6666
6767
```

unison-src/builtin-tests/jit-tests.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env sh
22
set -ex
33

44
# the first arg is the path to the unison executable
@@ -8,9 +8,6 @@ if [ -z "$1" ]; then
88
exit 1
99
fi
1010

11-
# call unison with all its args quoted
12-
ucm=("$@")
13-
1411
runtime_tests_version="@unison/runtime-tests/main"
1512
echo $runtime_tests_version
1613

@@ -27,4 +24,5 @@ runtime_tests_version="$runtime_tests_version" \
2724
< unison-src/builtin-tests/jit-tests.tpl.md \
2825
> unison-src/builtin-tests/jit-tests.md
2926

30-
time "${ucm[@]}" transcript.fork -C $codebase -S $codebase unison-src/builtin-tests/jit-tests.md
27+
# call unison with all its args quoted
28+
time "$@" transcript.fork -C $codebase -S $codebase unison-src/builtin-tests/jit-tests.md

0 commit comments

Comments
 (0)