diff options
Diffstat (limited to 'third_party/srtp/crypto/test/sha1_driver.c')
-rw-r--r-- | third_party/srtp/crypto/test/sha1_driver.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/third_party/srtp/crypto/test/sha1_driver.c b/third_party/srtp/crypto/test/sha1_driver.c index f7cb6ca2..6adfad17 100644 --- a/third_party/srtp/crypto/test/sha1_driver.c +++ b/third_party/srtp/crypto/test/sha1_driver.c @@ -43,8 +43,14 @@ * */ +#ifdef HAVE_CONFIG_H + #include <config.h> +#endif + #include <stdio.h> +#include <string.h> #include "sha1.h" +#include "datatypes.h" #define SHA_PASS 0 #define SHA_FAIL 1 @@ -113,17 +119,17 @@ sha1_test_case_validate(const hash_test_case_t *test_case) { if (0 == memcmp(test_case->hash, hash_value, 20)) { #if VERBOSE printf("PASSED: reference value: %s\n", - octet_string_hex_string((uint8_t *)test_case->hash, 20)); + octet_string_hex_string((const uint8_t *)test_case->hash, 20)); printf("PASSED: computed value: %s\n", - octet_string_hex_string((uint8_t *)hash_value, 20)); + octet_string_hex_string((const uint8_t *)hash_value, 20)); #endif return err_status_ok; } printf("reference value: %s\n", - octet_string_hex_string((uint8_t *)test_case->hash, 20)); + octet_string_hex_string((const uint8_t *)test_case->hash, 20)); printf("computed value: %s\n", - octet_string_hex_string((uint8_t *)hash_value, 20)); + octet_string_hex_string((const uint8_t *)hash_value, 20)); return err_status_algo_fail; @@ -136,7 +142,7 @@ struct hex_sha1_test_case_t { }; err_status_t -sha1_add_test_cases() { +sha1_add_test_cases(void) { int i; err_status_t err; @@ -485,6 +491,21 @@ sha1_add_test_cases() { return err_status_ok; } +err_status_t +sha1_dealloc_test_cases(void) { + hash_test_case_t *t, *next; + + for (t = sha1_test_case_list; t != NULL; t = next) { + next = t->next_test_case; + free(t); + } + + sha1_test_case_list = NULL; + + return err_status_ok; +} + + err_status_t sha1_validate(void) { @@ -510,6 +531,8 @@ sha1_validate(void) { test_case = test_case->next_test_case; } + sha1_dealloc_test_cases(); + return err_status_ok; } |