From 2134acdc09f6359c7c51d19e8d3f90f20c387f80 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Sun, 24 Aug 2025 15:24:05 +0200 Subject: [PATCH] Renaming ambiguous names --- main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index 50b8422..1426f96 100644 --- a/main.c +++ b/main.c @@ -27,15 +27,15 @@ int main(void) { // uint8_t seed[32]; // arc4random_buf(seed, 32); - uint8_t sk[64]; /* secret key */ - uint8_t pk[32]; /* Matching public key */ + uint8_t seckey[64]; /* secret key */ + uint8_t pubkey[32]; /* Matching public key */ PRINT_HEX(seed, seed_len); /* The seed is wiped automatically here */ - crypto_eddsa_key_pair(sk, pk, seed); + crypto_eddsa_key_pair(seckey, pubkey, seed); - print_hex("PubKey", pk, 32); - print_hex("SecKey", sk, 64); + PRINT_HEX(pubkey, 32); + PRINT_HEX(seckey, 64); uint8_t message[4]; @@ -43,24 +43,24 @@ int main(void) { arc4random_buf(message, 4); PRINT_HEX(message, sizeof(message)); - uint8_t sig[64]; + uint8_t signature[64]; /* Sign it and store the signature in sig[] */ - crypto_eddsa_sign(sig, sk, (const uint8_t *)message, sizeof(message)); - print_hex("Signature:", sig, 64); + crypto_eddsa_sign(signature, seckey, (const uint8_t *)message, sizeof(message)); + PRINT_HEX(signature, 64); /* Assert valid */ - assert(!crypto_eddsa_check(sig, pk, (const uint8_t *)message, sizeof(message))); + assert(!crypto_eddsa_check(signature, pubkey, (const uint8_t *)message, sizeof(message))); /* Tamper with payload to invalidate the signature */ arc4random_buf(message, 4); PRINT_HEX(message, sizeof(message)); /* Assert invalid */ - assert(crypto_eddsa_check(sig, pk, (const uint8_t *)message, sizeof(message))); + assert(crypto_eddsa_check(signature, pubkey, (const uint8_t *)message, sizeof(message))); /* Wipe the secret key if it is no longer needed */ - crypto_wipe(sk, 32); + crypto_wipe(seckey, 32); printf("Program finished: Ok!\n"); }