X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-rsaes_pkcs1v15-test.c;h=1411b936ec045e65053bebdcde36be6ba467d8ed;hb=f63427e84c047aafe16f6ab3b5452d4d2993241d;hp=268c1201709c21b1be29ec83b151ba72def66728;hpb=fdbda6486df88be6ac2ba948f21e84c396499535;p=avr-crypto-lib.git diff --git a/test_src/main-rsaes_pkcs1v15-test.c b/test_src/main-rsaes_pkcs1v15-test.c index 268c120..1411b93 100644 --- a/test_src/main-rsaes_pkcs1v15-test.c +++ b/test_src/main-rsaes_pkcs1v15-test.c @@ -34,7 +34,7 @@ #define DEBUG 1 -const char* algo_name = "RSAES-PKCS1V15"; +const char *algo_name = "RSAES-PKCS1V15"; #define BIGINT_CEIL(x) ((((x) + sizeof(bigint_word_t) - 1) / sizeof(bigint_word_t)) * sizeof(bigint_word_t)) #define BIGINT_OFF(x) ((sizeof(bigint_word_t) - (x) % sizeof(bigint_word_t)) % sizeof(bigint_word_t)) @@ -174,7 +174,7 @@ uint8_t convert_nibble(uint8_t c){ const char *block_ignore_string=" \t\r\n,;"; #define BUFFER_LIMIT 120 -uint16_t read_os(void* dst, uint16_t length, const char* ignore_string){ +uint16_t read_os(void *dst, uint16_t length, const char *ignore_string){ uint16_t counter = 0; uint16_t c; uint8_t v, tmp = 0, idx = 0; @@ -207,7 +207,7 @@ uint16_t read_os(void* dst, uint16_t length, const char* ignore_string){ return counter; } -uint16_t own_atou(const char* str){ +uint16_t own_atou(const char *str){ uint16_t r=0; while(*str && *str >= '0' && *str <= '9'){ r *= 10; @@ -216,7 +216,7 @@ uint16_t own_atou(const char* str){ return r; } -uint8_t read_bigint(bigint_t* a, char* prompt){ +uint8_t read_bigint(bigint_t *a, char *prompt){ uint16_t read_length, actual_length; uint8_t off; uint8_t *buffer; @@ -308,7 +308,7 @@ uint8_t read_key_conv(void){ return r; } -uint8_t load_bigint_from_os(bigint_t* a, PGM_VOID_P os, uint16_t length_B){ +uint8_t load_bigint_from_os(bigint_t *a, PGM_VOID_P os, uint16_t length_B){ a->length_W = BIGINT_CEIL(length_B) / sizeof(bigint_word_t); a->wordv = malloc(BIGINT_CEIL(length_B)); if(!a->wordv){ @@ -521,7 +521,7 @@ void load_priv_crt_mono(void){ } } -uint8_t load_bigint_from_os(bigint_t* a, PGM_VOID_P os, uint16_t length_B){ +uint8_t load_bigint_from_os(bigint_t *a, PGM_VOID_P os, uint16_t length_B){ a->length_W = BIGINT_CEIL(length_B) / sizeof(bigint_word_t); a->wordv = malloc(BIGINT_CEIL(length_B)); if(!a->wordv){ @@ -588,11 +588,13 @@ void quick_test(void){ cli_putstr_P(PSTR("\r\n\r\nciphertext:")); cli_hexdump_block(ciphertext, clen, 4, 16); - if(clen!=sizeof(ENCRYPTED)){ + if(clen != sizeof(ENCRYPTED)){ cli_putstr_P(PSTR("\r\n>>FAIL (no size match)<<")); + return; }else{ if(memcmp_P(ciphertext, ENCRYPTED, clen)){ cli_putstr_P(PSTR("\r\n>>FAIL (no content match)<<")); + return; }else{ cli_putstr_P(PSTR("\r\n>>OK<<")); }