Files
utun2/tests/ecc_debug.c
T
Evgeny 1d4741e69e Clean: Remove all obsolete ETCP tests, keep only working handshake test
Deleted 13 obsolete ETCP and connection test files:
- test_etcp.c, test_etcp_2instance.c, test_etcp_connection_init.c
- test_etcp_connections_send.c, test_etcp_link_crypto_working.c
- test_etcp_link_simple.c, test_etcp_simple.c, test_etcp_stress.c
- test_etcp_connection_full.c, test_etcp_connection_real.c
- test_etcp_full_lifecycle.c, test_etcp_new.c, test_etcp_simple_real.c

Updated Makefile.am to include only:
- test_etcp_two_instances_fixed (working handshake test)
- Essential module tests (routing, secure_channel, lib, etc.)

Result: Clean test suite with only functional ETCP handshake demonstration
2026-01-21 08:00:54 +03:00

57 lines
1.8 KiB
C

#include <tinycrypt/ecc.h>
#include <tinycrypt/ecc_dh.h>
#include <tinycrypt/aes.h>
#include <tinycrypt/ccm_mode.h>
#include <tinycrypt/constants.h>
#include <string.h>
#include <stdio.h>
#define SC_NONCE_SIZE 8
#define SC_TAG_SIZE 8
#define SC_SESSION_KEY_SIZE 16
int main() {
printf("=== ECC-initialized Debug Test ===\n");
// Try to initialize ECC
printf("Initializing ECC...\n");
uECC_Curve curve = uECC_secp256r1();
if (curve) {
printf("✓ ECC curve initialized: %p\n", (void*)curve);
} else {
printf("❌ ECC curve initialization failed\n");
}
// Test AES key setup
struct tc_aes_key_sched_struct sched;
uint8_t test_key[SC_SESSION_KEY_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10};
printf("\nTesting AES key setup...\n");
int aes_result = tc_aes128_set_encrypt_key(&sched, test_key);
printf("tc_aes128_set_encrypt_key returned: %d\n", aes_result);
if (aes_result == TC_CRYPTO_SUCCESS) {
printf("✓ AES key setup successful\n");
// Test CCM config
struct tc_ccm_mode_struct ccm_state = {0};
TCCcmMode_t c = &ccm_state;
uint8_t nonce[SC_NONCE_SIZE] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
printf("\nTesting CCM config...\n");
int ccm_result = tc_ccm_config(c, &sched, nonce, SC_NONCE_SIZE, SC_TAG_SIZE);
printf("tc_ccm_config returned: %d\n", ccm_result);
if (ccm_result == TC_CRYPTO_SUCCESS) {
printf("✓ CCM config successful\n");
} else {
printf("❌ CCM config failed even with ECC initialization\n");
}
} else {
printf("❌ AES key setup failed\n");
}
return 0;
}