Skip to content

Commit

Permalink
Fix picky openssl.
Browse files Browse the repository at this point in the history
openssl on Darwin/aarch64 is pickier than Darwin/amd64i is pickier than FreeBSD.
  • Loading branch information
Keve authored and bapt committed Nov 26, 2024
1 parent 889d250 commit 0b60265
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 4 additions & 3 deletions tests/frontend/fingerprint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ setup() {
atf_skip_on Linux Test fails on Linux
atf_check -o save:repo.pub -e ignore \
pkg key --create repo.key
keyform=""
_typecmd=""
;;
ecc)
atf_skip_on Darwin Test fails on Darwin
atf_skip_on Linux Test fails on Linux
atf_check -o ignore -e ignore \
openssl ecparam -genkey -name secp256k1 -out repo.key -outform DER
chmod 0400 repo.key
atf_check -o ignore -e ignore \
openssl ec -in repo.key -pubout -out repo.pub -outform DER
openssl ec -inform DER -in repo.key -pubout -out repo.pub -outform DER
keyform="-keyform DER"
_typecmd='printf "%s\n%s\n" "TYPE" "ecdsa"'
;;
esac
Expand All @@ -47,7 +48,7 @@ read -t 2 sum
$_typecmd
echo SIGNATURE
echo -n \$sum | /usr/bin/openssl dgst -sign repo.key -sha256 -binary
echo -n \$sum | openssl dgst $keyform -sign repo.key -sha256 -binary
echo
echo CERT
cat repo.pub
Expand Down
10 changes: 8 additions & 2 deletions tests/frontend/key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,17 @@ key_sign_body() {
# Generate a key with pkg
atf_check -o save:repo.pub -e ignore \
pkg key --create -t "$signer" repo.key

atf_check -o save:msg.sig \
pkg key --sign -t "$signer" repo.key < msg

atf_check -o ignore openssl dgst -sha256 -verify repo.pub \
if [ $signer = ecdsa ]; then
keyform="-keyform DER"
else
keyform=""
fi

atf_check -o ignore openssl dgst -sha256 $keyform -verify repo.pub \
-signature msg.sig msg
done
}
2 changes: 1 addition & 1 deletion tests/frontend/pubkey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ecc_test() {
openssl ecparam -genkey -name secp256k1 -out repo.key -outform DER
chmod 0400 repo.key
atf_check -o ignore -e ignore \
openssl ec -in repo.key -pubout -out repo.pub -outform DER
openssl ec -inform DER -in repo.key -pubout -out repo.pub -outform DER
;;
esac

Expand Down

0 comments on commit 0b60265

Please sign in to comment.