aboutsummaryrefslogtreecommitdiff
path: root/tests/test.c
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-05-06 21:50:29 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-05-06 21:50:29 -0400
commitf533694023133552d0d42933d779c95a5854343f (patch)
tree4e6382478aca366e0cfc9ca7a76be0382ae16fac /tests/test.c
parent940ff20348b13d0bc30d9e9f4289dd6de20b16ba (diff)
feat: CMake install & fetch-content test & updates
Diffstat (limited to 'tests/test.c')
-rw-r--r--tests/test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test.c b/tests/test.c
index 3aaf067..bcda32f 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -205,23 +205,24 @@ static int TestEcdsa(NCContext* context, NCSecretKey* secKey, NCPublicKey* pubKe
FillRandomData(invalidSig, sizeof(invalidSig));
FillRandomData(sigEntropy, sizeof(sigEntropy));
+ /* This is the sha256 digest of the message charater buffer above */
digestHex = FromHexString("58884db8f9b2d5583a54b44daeccf029af4dd2874aa5e3dc0e55febebab55d18", 32);
- /* Sign and verify sig64 */
+ /* Test signing just the message digest */
{
uint8_t sig[64];
TEST(NCSignDigest(context, secKey, sigEntropy, digestHex->data, sig), NC_SUCCESS);
TEST(NCVerifyDigest(context, pubKey, digestHex->data, sig), NC_SUCCESS);
}
- /* Sign and verify raw data */
+ /* Sign and verify the raw message */
{
uint8_t sig[64];
TEST(NCSignData(context, secKey, sigEntropy, (uint8_t*)message, strlen32(message), sig), NC_SUCCESS);
TEST(NCVerifyData(context, pubKey, (uint8_t*)message, strlen32(message), sig), NC_SUCCESS);
}
- /* ensure the signature is the same for signing data and sig64 */
+ /* Tests that signing the message and it's digest result in the same signature */
{
uint8_t sig1[64];
uint8_t sig2[64];
@@ -234,7 +235,7 @@ static int TestEcdsa(NCContext* context, NCSecretKey* secKey, NCPublicKey* pubKe
TEST(memcmp(sig1, sig2, 64), 0);
}
- /* Try signing data then veriyfing the sig64 */
+ /* Checks that the signature raw message can be verified against the digest of the message */
{
uint8_t sig[64];
@@ -292,7 +293,8 @@ static int TestPublicApiArgumentValidation(void)
/*
* Test null context
* NOTE: This is never freed, this shouldnt be an issue
- * for testing, but this will leak memory.
+ * for testing, but this will leak memory. (libsecp256k2
+ * allocates internally)
*/
TEST(NCDestroyContext(NULL), ARG_ERROR_POS_0)