Kristian Lein-Mathisen
2018-11-19 10:19:10 UTC
Hi guys,
I was trying tweetnacl on Termux on Android 9 and ran into this problem:
***@localhost ~/p/chicken-5.0.0>
csi -R tweetnacl -p '(make-symmetric-sign-key)'
Error: (read-u8vector) bad argument type - not a port: #f
....
This happens because tweetnacl creates its current-entropy-port using
cond-expand with unix, windows or else, the latter which is yielding the #f
error above.
I found this surprising as I'd expect Android to be unix. As I'm sure you
know, it isn't:
csi -p '(cond-expand (unix 1))'
Error: during expansion of (cond-expand ...) - no matching clause in
`cond-expand' form: unix
***@localhost ~/p/chicken-5.0.0>
csi -p '(cond-expand ((or android unix) 1))'
1
But tweetnacl isn't much use without current-entropy-port, and I hove its
/dev/random requirement:
***@localhost ~/p/chicken-5.0.0>
dd if=/dev/random bs=1 count=12 ^/dev/null |xxd -p
44ca8634752db3243ac222f0
So, my questions:
1. Is Android non-unix intentionally?
2. Could tweetnacl cond-expand with (or unix android) so it works
out-of-the-box on Android?
Thanks in advance,
K.
I was trying tweetnacl on Termux on Android 9 and ran into this problem:
***@localhost ~/p/chicken-5.0.0>
csi -R tweetnacl -p '(make-symmetric-sign-key)'
Error: (read-u8vector) bad argument type - not a port: #f
....
This happens because tweetnacl creates its current-entropy-port using
cond-expand with unix, windows or else, the latter which is yielding the #f
error above.
I found this surprising as I'd expect Android to be unix. As I'm sure you
know, it isn't:
csi -p '(cond-expand (unix 1))'
Error: during expansion of (cond-expand ...) - no matching clause in
`cond-expand' form: unix
***@localhost ~/p/chicken-5.0.0>
csi -p '(cond-expand ((or android unix) 1))'
1
But tweetnacl isn't much use without current-entropy-port, and I hove its
/dev/random requirement:
***@localhost ~/p/chicken-5.0.0>
dd if=/dev/random bs=1 count=12 ^/dev/null |xxd -p
44ca8634752db3243ac222f0
So, my questions:
1. Is Android non-unix intentionally?
2. Could tweetnacl cond-expand with (or unix android) so it works
out-of-the-box on Android?
Thanks in advance,
K.