You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.1 KiB

#include "../src/secure_channel.h"
#include <string.h>
#include <stdio.h>
int main() {
printf("=== Simple Crypto Test ===\n");
// Test basic secure channel functionality
struct SC_MYKEYS keys;
for (int i = 0; i < SC_PRIVKEY_SIZE; i++) {
keys.private_key[i] = i;
keys.public_key[i] = i + 64;
}
sc_context_t ctx;
int result = sc_init_ctx(&ctx, &keys);
printf("✓ Context initialized: %d\n", result);
// Test hex to binary conversion
const char* hex_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
uint8_t binary_key[32];
int hex_result = hex_to_binary(hex_key, binary_key, 32);
printf("✓ Hex to binary conversion: %d\n", hex_result);
// Test key validation
int valid_result = sc_validate_key(keys.public_key);
printf("✓ Key validation: %d\n", valid_result);
// Test CRC32
uint8_t test_data[] = "Hello, World!";
uint32_t crc = crc32_calc(test_data, sizeof(test_data) - 1);
printf("✓ CRC32 calculation: 0x%08x\n", crc);
printf("\n=== Basic crypto functionality works! ===\n");
return 0;
}