grondilu / libdigest-raku

Raku implementation of various digests
Artistic License 2.0
27 stars 42 forks source link

fails to install on macos with openssl@1 and openssl@3 brew packages installed #25

Closed sdondley closed 2 years ago

sdondley commented 2 years ago
> $ prove6 --lib -v t/*                                             [±master ✓]
1..7
ok 1 - d41d8cd98f00b204e9800998ecf8427e is MD5 digest of ''
ok 2 - 0cc175b9c0f1b6a831c399e269772661 is MD5 digest of 'a'
ok 3 - 900150983cd24fb0d6963f7d28e17f72 is MD5 digest of 'abc'
ok 4 - f96b697d7cb7938d525a2f31aaf161d0 is MD5 digest of 'message digest'
ok 5 - c3fcd3d76192e4007dfb496cca67e13b is MD5 digest of 'abcdefghijklmnopqrstuvwxyz'
ok 6 - d174ab98d277d9f5a5611c2c9f419d9f is MD5 digest of 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
ok 7 - 57edf4a22be3c955ac49da2e2107b67a is MD5 digest of '12345678901234567890123456789012345678901234567890123456789012345678901234567890'
t/digest.t .. ok
1..8
ok 1 - RIPEMD()
ok 2 - RIPEMD(a)
ok 3 - RIPEMD(abc)
ok 4 - RIPEMD(message digest)
ok 5 - RIPEMD(abcdefghijklmnopqrstuvwxyz)
ok 6 - RIPEMD(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)
ok 7 - RIPEMD(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789)
ok 8 - RIPEMD(12345678901234567890123456789012345678901234567890123456789012345678901234567890)
t/ripemd.t .. ok
1..9
ok 1 - SHA-1(abc)
ok 2 - SHA-1(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)
ok 3 - SHA-256(abc)
ok 4 - SHA-256(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)
ok 5 - SHA-512(abc)
ok 6 - SHA-512(abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu)
unknown option '-mac'
options are
-c              to output the digest with separating colons
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-keyform arg    key file format (PEM or ENGINE)
-signature file signature to verify
-binary         output in binary form
-hmac key       create hashed MAC with key
-engine e       use engine e, possibly a hardware device.
-md5            to use the md5 message digest algorithm (default)
-md4            to use the md4 message digest algorithm
-md2            to use the md2 message digest algorithm
-sha1           to use the sha1 message digest algorithm
-sha            to use the sha message digest algorithm
-sha224         to use the sha224 message digest algorithm
-sha256         to use the sha256 message digest algorithm
-sha384         to use the sha384 message digest algorithm
-sha512         to use the sha512 message digest algorithm
-mdc2           to use the mdc2 message digest algorithm
-ripemd160      to use the ripemd160 message digest algorithm
# Failed test at t/sha.t line 23
# The spawned command 'openssl' exited unsuccessfully (exit code: 1, signal: 0)
not ok 7 -
unknown option '-mac'
options are
-c              to output the digest with separating colons
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-keyform arg    key file format (PEM or ENGINE)
-signature file signature to verify
-binary         output in binary form
-hmac key       create hashed MAC with key
-engine e       use engine e, possibly a hardware device.
-md5            to use the md5 message digest algorithm (default)
-md4            to use the md4 message digest algorithm
-md2            to use the md2 message digest algorithm
-sha1           to use the sha1 message digest algorithm
-sha            to use the sha message digest algorithm
-sha224         to use the sha224 message digest algorithm
-sha256         to use the sha256 message digest algorithm
-sha384         to use the sha384 message digest algorithm
-sha512         to use the sha512 message digest algorithm
-mdc2           to use the mdc2 message digest algorithm
-ripemd160      to use the ripemd160 message digest algorithm
# Failed test at t/sha.t line 24
# The spawned command 'openssl' exited unsuccessfully (exit code: 1, signal: 0)
not ok 8 -
unknown option '-mac'
options are
-c              to output the digest with separating colons
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-keyform arg    key file format (PEM or ENGINE)
-signature file signature to verify
-binary         output in binary form
-hmac key       create hashed MAC with key
-engine e       use engine e, possibly a hardware device.
-md5            to use the md5 message digest algorithm (default)
-md4            to use the md4 message digest algorithm
-md2            to use the md2 message digest algorithm
-sha1           to use the sha1 message digest algorithm
-sha            to use the sha message digest algorithm
-sha224         to use the sha224 message digest algorithm
-sha256         to use the sha256 message digest algorithm
-sha384         to use the sha384 message digest algorithm
-sha512         to use the sha512 message digest algorithm
-mdc2           to use the mdc2 message digest algorithm
-ripemd160      to use the ripemd160 message digest algorithm
# Failed test at t/sha.t line 25
# The spawned command 'openssl' exited unsuccessfully (exit code: 1, signal: 0)
# You failed 3 tests of 9
grondilu commented 2 years ago

I can't reproduce this on my system. Please check your openssl version.

$ openssl version 
OpenSSL 3.0.3 3 May 2022 (Library: OpenSSL 3.0.3 3 May 2022)

Most notably, check that the dgst openssl sub-command accepts a -mac ALG option.

$ openssl dgst --help
[...]
Signing options:
 -sign val           Sign digest using private key
 -verify val         Verify a signature using public key
 -prverify val       Verify a signature using private key
 -sigopt val         Signature parameter in n:v form
 -signature infile   File with signature to verify
 -hmac val           Create hashed MAC with key
 -mac val            Create MAC (not necessarily HMAC)
 -macopt val         MAC algorithm parameters in n:v form or key
 -*                  Any supported digest
 -fips-fingerprint   Compute HMAC with the key used in OpenSSL-FIPS fingerprint
[...]

That being said, I notice now that the doc recommends to use openssl-mac instead. I guess I should do that.

grondilu commented 2 years ago

Maybe commit https://github.com/grondilu/libdigest-raku/commit/fbc469a4447ba762ebc91a7bc84498de6d593467

solves this?

sdondley commented 2 years ago

OK, will give it a shot. Thanks.

Heads up, P6C modules seem to be having problems getting updated with zef. See https://github.com/Raku/ecosystem/issues/606#issuecomment-1171507573

sdondley commented 2 years ago

Yes, that worked. Thanks!