mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-13 22:32:27 +00:00
Disentangle NodeDB from the CryptoEngine (#5013)
This commit is contained in:
@@ -111,7 +111,7 @@ void test_DH25519(void)
|
||||
void test_PKC_Decrypt(void)
|
||||
{
|
||||
uint8_t private_key[32];
|
||||
uint8_t public_key[32];
|
||||
meshtastic_UserLite_public_key_t public_key;
|
||||
uint8_t expected_shared[32];
|
||||
uint8_t expected_decrypted[32];
|
||||
uint8_t radioBytes[128] __attribute__((__aligned__));
|
||||
@@ -119,7 +119,8 @@ void test_PKC_Decrypt(void)
|
||||
uint8_t expected_nonce[16];
|
||||
|
||||
uint32_t fromNode;
|
||||
HexToBytes(public_key, "db18fc50eea47f00251cb784819a3cf5fc361882597f589f0d7ff820e8064457");
|
||||
HexToBytes(public_key.bytes, "db18fc50eea47f00251cb784819a3cf5fc361882597f589f0d7ff820e8064457");
|
||||
public_key.size = 32;
|
||||
HexToBytes(private_key, "a00330633e63522f8a4d81ec6d9d1e6617f6c8ffd3a4c698229537d44e522277");
|
||||
HexToBytes(expected_shared, "777b1545c9d6f9a2");
|
||||
HexToBytes(expected_decrypted, "08011204746573744800");
|
||||
@@ -127,9 +128,9 @@ void test_PKC_Decrypt(void)
|
||||
HexToBytes(expected_nonce, "62d6b213036a792b2909000000");
|
||||
fromNode = 0x0929;
|
||||
crypto->setDHPrivateKey(private_key);
|
||||
TEST_ASSERT(crypto->setDHPublicKey(public_key));
|
||||
crypto->hash(crypto->shared_key, 32);
|
||||
crypto->decryptCurve25519(fromNode, 0x13b2d662, 22, radioBytes + 16, decrypted);
|
||||
// TEST_ASSERT(crypto->setDHPublicKey(public_key));
|
||||
// crypto->hash(crypto->shared_key, 32);
|
||||
crypto->decryptCurve25519(fromNode, public_key, 0x13b2d662, 22, radioBytes + 16, decrypted);
|
||||
TEST_ASSERT_EQUAL_MEMORY(expected_shared, crypto->shared_key, 8);
|
||||
TEST_ASSERT_EQUAL_MEMORY(expected_nonce, crypto->nonce, 13);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user