X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=ecdsa%2Fnist_p192.c;h=7e8d9292f62cde26032bd77e2d3a2f21ce947106;hp=4e68e25a636ee1c8d8bf1ef83e64ffdbdacbd2d5;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=45d15fcc098c9eece5c39b5e421a1706f187a0d3 diff --git a/ecdsa/nist_p192.c b/ecdsa/nist_p192.c index 4e68e25..7e8d929 100644 --- a/ecdsa/nist_p192.c +++ b/ecdsa/nist_p192.c @@ -1,7 +1,7 @@ /* p192.c */ /* This file is part of the AVR-Crypto-Lib. - Copyright (C) 2006-2012 Daniel Otte (daniel.otte@rub.de) + Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) 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 @@ -46,6 +46,12 @@ uint8_t nist_curve_p192_p_w[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +uint8_t nist_curve_p192_n_w[] = { + 0x31, 0x28, 0xd2, 0xb4, 0xb1, 0xc9, 0x6b, 0x14, + 0x36, 0xf8, 0xde, 0x99, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + uint8_t nist_curve_p192_b_w[] = { 0xb1, 0xb9, 0x46, 0xc1, 0xec, 0xde, 0xb8, 0xfe, 0x49, 0x30, 0x24, 0x72, 0xab, 0xe9, 0xa7, 0x0f, @@ -85,6 +91,13 @@ bigint_t nist_curve_p192_p = { .info = 7 }; + +bigint_t nist_curve_p192_n = { + .length_W = 192 / BIGINT_WORD_SIZE, + .wordv = nist_curve_p192_n_w, + .info = 7 +}; + bigint_t nist_curve_p192_b = { .length_W = 192 / BIGINT_WORD_SIZE, .wordv = nist_curve_p192_b_w, @@ -124,17 +137,18 @@ ecc_combi_point_t nist_curve_p192_basepoint = { ecc_curve_sp_t nist_curve_p192 = { .b = &nist_curve_p192_b, .p = &nist_curve_p192_p, + .n = &nist_curve_p192_n, .reduce_p = bigint_reduce_p192 }; /* - * A = ( A5 || A4 || A3 || A2 || A1 || A0 ) ; An if 64-bit + * A = ( A5 || A4 || A3 || A2 || A1 || A0 ) ; An is 64-bit * A mod p = B = T + S1 + S2 + S3 mod p * * T = ( A2 || A1 || A0 ) - * S1 = ( A3 || A3 ) - * S2 = ( A4 || A4 || 0 ) + * S1 = ( 0 || A3 || A3 ) + * S2 = ( A4 || A4 || 0 ) * S3 = ( A5 || A5 || A5 ) * */