X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=rsa%2Frsa_basic.c;h=a7c321964aa86602605a392cf6535332a5eae099;hb=01b5d29136b37105c7e533bd3ec2299d31551627;hp=fbdc80ba457ada443b03d8b84552c0ad8e9d9950;hpb=fdbda6486df88be6ac2ba948f21e84c396499535;p=avr-crypto-lib.git diff --git a/rsa/rsa_basic.c b/rsa/rsa_basic.c index fbdc80b..a7c3219 100644 --- a/rsa/rsa_basic.c +++ b/rsa/rsa_basic.c @@ -28,9 +28,10 @@ #if DEBUG #include "cli.h" +#include #endif -void rsa_enc(bigint_t* data, const rsa_publickey_t* key){ +void rsa_enc(bigint_t *data, const rsa_publickey_t *key){ /* cli_putstr_P(PSTR("\r\n -->rsa_enc()\r\n m = ")); bigint_print_hex(data); @@ -50,7 +51,7 @@ h = (m1 - m2) * qinv % p m = m2 + q * h */ -uint8_t rsa_dec_crt_mono(bigint_t* data, const rsa_privatekey_t* key){ +uint8_t rsa_dec_crt_mono(bigint_t *data, const rsa_privatekey_t *key){ bigint_t m1, m2; m1.wordv = malloc((key->components[0].length_W /* + 1 */) * sizeof(bigint_word_t)); m2.wordv = malloc((key->components[1].length_W /* + 1 */) * sizeof(bigint_word_t)); @@ -101,7 +102,7 @@ uint8_t rsa_dec_crt_mono(bigint_t* data, const rsa_privatekey_t* key){ while(BIGINT_NEG_MASK & m1.info){ #if DEBUG cli_putstr_P(PSTR("\r\nDBG: adding ")); - bigint_print_hex(key->components[0]); + bigint_print_hex(&key->components[0]); cli_putstr_P(PSTR("\r\nDBG: to ")); bigint_print_hex(&m1); #endif @@ -160,7 +161,7 @@ uint8_t rsa_dec_crt_mono(bigint_t* data, const rsa_privatekey_t* key){ return 0; } -uint8_t rsa_dec(bigint_t* data, const rsa_privatekey_t* key){ +uint8_t rsa_dec(bigint_t *data, const rsa_privatekey_t *key){ if(key->n == 1){ bigint_expmod_u(data, data, &(key->components[0]), &key->modulus); return 0; @@ -178,7 +179,7 @@ uint8_t rsa_dec(bigint_t* data, const rsa_privatekey_t* key){ return 2; } -void rsa_os2ip(bigint_t* dest, const void* data, uint32_t length_B){ +void rsa_os2ip(bigint_t *dest, const void *data, uint32_t length_B){ #if BIGINT_WORD_SIZE == 8 if(data){ memcpy(dest->wordv, data, length_B); @@ -214,7 +215,7 @@ void rsa_os2ip(bigint_t* dest, const void* data, uint32_t length_B){ bigint_adjust(dest); } -void rsa_i2osp(void* dest, bigint_t* src, uint16_t* out_length_B){ +void rsa_i2osp(void *dest, bigint_t *src, uint16_t *out_length_B){ #if BIGINT_WORD_SIZE == 8 if(dest){ uint8_t *e = src->wordv + src->length_W;