]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - bigint/bigint_io.c
adding Montgomery-multiplication stuff and better squaring algo
[avr-crypto-lib.git] / bigint / bigint_io.c
index a3992f25dcd6a3bd2f04a2b9a264c20353e3fd0f..4ba078ef1f8220b815ed52793f1a1f606078bab1 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-void bigint_print_hex(const bigint_ta){
+void bigint_print_hex(const bigint_t *a){
        if(a->length_W==0){
                cli_putc('0');
                return;
@@ -94,7 +94,7 @@ static uint16_t read_byte(void){
        return (t1<<4)|t2;
 }
 
-uint8_t bigint_read_hex_echo(bigint_ta){
+uint8_t bigint_read_hex_echo(bigint_t *a){
        uint16_t allocated=0;
        uint8_t  shift4=0;
        uint16_t  t, idx = 0;
@@ -153,5 +153,9 @@ uint8_t bigint_read_hex_echo(bigint_t* a){
        if(shift4){
                bigint_shiftright(a, 4);
        }
+       if(a->length_W == 1 && a->wordv[0] == 0){
+           a->length_W = 0;
+           a->info = 0;
+       }
        return 0;
 }