From 28dcef4344b4c91cef41b12a7d1f654248f29cff Mon Sep 17 00:00:00 2001 From: Ken MacKay Date: Thu, 3 Apr 2014 08:46:54 -0700 Subject: [PATCH] Use the built-in rng for testing. --- test/test_ecdh.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/test/test_ecdh.c b/test/test_ecdh.c index 5fd1e6d..ea8cb26 100644 --- a/test/test_ecdh.c +++ b/test/test_ecdh.c @@ -3,41 +3,6 @@ #include #include -#if __AVR__ - -int RNG(uint8_t *p_dest, unsigned p_size) -{ - /* TODO */ - return 0; -} - -#else - -#include -#include - -int RNG(uint8_t *p_dest, unsigned p_size) -{ - static int l_randfd = -1; - if(l_randfd == -1) - { - l_randfd = open("/dev/urandom", O_RDONLY); - if(l_randfd == -1) - { - printf("No access to urandom\n"); - return 0; - } - } - if(read(l_randfd, p_dest, p_size) != (int)p_size) - { - printf("Failed to get random bytes.\n"); - return 0; - } - return 1; -} - -#endif /* TARGET_ARCH_AVR */ - void vli_print(uint8_t *p_vli, unsigned int p_size) { while(p_size) @@ -59,8 +24,6 @@ int main() uint8_t l_secret1[ECC_BYTES]; uint8_t l_secret2[ECC_BYTES]; - - ecc_set_rng(&RNG); printf("Testing 256 random private key pairs\n");