X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-rsa-test.c;fp=test_src%2Fmain-rsa-test.c;h=0000000000000000000000000000000000000000;hb=9aebf1891ebd2ab61830988a176e8a9da974d93a;hp=3e0bba267dee34495cfb57b508943b964a417aa5;hpb=e1212ded3556546a568954bedc887fddcb128183;p=avr-crypto-lib.git diff --git a/test_src/main-rsa-test.c b/test_src/main-rsa-test.c deleted file mode 100644 index 3e0bba2..0000000 --- a/test_src/main-rsa-test.c +++ /dev/null @@ -1,181 +0,0 @@ -/* main-rsa-test.c */ -/* - This file is part of the AVR-Crypto-Lib. - Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -/* - * RSA test-suit - * -*/ - -#include "config.h" - -#include "uart_i.h" -#include "debug.h" - -#include "noekeon.h" -#include "noekeon_prng.h" -#include "bigint.h" -#include "bigint_io.h" -#include "rsa.h" -#include "rsa_key_blob.h" - -#include "cli.h" -#include "performance_test.h" -#include -#include -#include - -char* algo_name = "RSA"; - -/***************************************************************************** - * additional validation-functions * - *****************************************************************************/ - -rsa_ctx_t rsa_ctx; - -void load_fix_rsa(void){ - load_rsa_key_blob(&rsa_ctx); -} - -void rsa_print_item(bigint_t* a, PGM_P pstr){ - uint8_t *p; - cli_putstr_P(PSTR("\r\n")); - cli_putstr_P(pstr); - cli_putstr_P(PSTR(": ")); - uint16_t i; - p = a->wordv + a->length_B -1; - for(i=0; ilength_B-1; ++i){ - if(i%16==0){ - cli_putstr_P(PSTR("\r\n ")); - } - cli_hexdump(p, 1); - cli_putc(':'); - --p; - } - if(i%16==0){ - cli_putstr_P(PSTR("\r\n ")); - } - cli_hexdump(p, 1); -} - -void print_rsa_ctx(rsa_ctx_t* ctx){ - cli_putstr_P(PSTR("\r\n === RSA context ===")); - rsa_print_item(&(ctx->modulus), PSTR("modulus")); - rsa_print_item(&(ctx->pubexp), PSTR("public exponent")); - rsa_print_item(&(ctx->privexp), PSTR("private exponent")); -} - -const uint8_t testmsg[128] PROGMEM = { - 0x25, 0x11, 0x1e, 0x08, 0x1c, 0x72, 0x57, 0xbf, - 0x46, 0xbb, 0x56, 0xe8, 0x0b, 0x24, 0x0d, 0x72, - 0x77, 0x11, 0x12, 0x10, 0xec, 0xb9, 0xe4, 0x6f, - 0xe0, 0x6c, 0x83, 0x65, 0xe2, 0xe5, 0x1a, 0x3c, - 0xdb, 0x6c, 0x51, 0x8d, 0xbc, 0xd0, 0x30, 0xb6, - 0xca, 0x01, 0xb4, 0x03, 0x03, 0xe9, 0x86, 0x86, - 0xfe, 0x76, 0x4e, 0xb7, 0x47, 0xb5, 0x06, 0x15, - 0x92, 0x38, 0xc2, 0x0d, 0x3c, 0xfa, 0x53, 0xe3, - 0xe3, 0x57, 0xeb, 0x34, 0xb8, 0xda, 0x7b, 0x0e, - 0x06, 0x28, 0x1d, 0x4a, 0x14, 0xcc, 0x56, 0x8d, - 0xf3, 0x0f, 0x40, 0x2e, 0x23, 0x45, 0xe7, 0xcd, - 0xc5, 0x83, 0x8f, 0xaa, 0x55, 0x55, 0x7d, 0xbd, - 0x19, 0x63, 0xbd, 0x17, 0xda, 0xfd, 0x18, 0xd1, - 0x62, 0x43, 0xc7, 0x33, 0x39, 0x2c, 0xda, 0x64, - 0x27, 0x96, 0xa0, 0x83, 0xa0, 0xf9, 0x3b, 0x1e, - 0x17, 0x71, 0x59, 0xaa, 0x43, 0x3b, 0xeb, 0x80 -}; - -void quick_test(void){ - load_fix_rsa(); - - bigint_t m,c,m_; - uint8_t mw[rsa_ctx.modulus.length_B], cw[rsa_ctx.modulus.length_B], m_w[rsa_ctx.modulus.length_B]; - - print_rsa_ctx(&rsa_ctx); - m.wordv = mw; - c.wordv = cw; - m_.wordv = m_w; - m.length_B = rsa_ctx.modulus.length_B; - m.info = 0; - cli_putstr_P(PSTR("\r\ngenerating random message ...")); -/* do{ - for(i=0; i