From 214fe473f10cc1b6e57e4f6f040e0e8ee28e48c1 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 24 Jul 2017 23:40:14 +0200 Subject: [PATCH] Add an invalid key to the signature tests --- test/default/sign.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/default/sign.c b/test/default/sign.c index 814f9672..a6f1516b 100644 --- a/test/default/sign.c +++ b/test/default/sign.c @@ -1191,6 +1191,15 @@ int main(void) printf("detached signature verification should have failed\n"); } + sodium_hex2bin(pk, crypto_sign_PUBLICKEYBYTES, + "3eee494fb9eac773144e34b0c755affaf33ea782c0722e5ea8b150e61209ab36", + crypto_sign_PUBLICKEYBYTES * 2, NULL, NULL, NULL); + if (crypto_sign_verify_detached(sig, + (const unsigned char *)test_data[i].m, + i, pk) != -1) { + printf("signature with an invalid public key should have failed\n"); + } + if (crypto_sign_seed_keypair(pk, sk, keypair_seed) != 0) { printf("crypto_sign_seed_keypair() failure\n"); return -1;