Move n from struct curve to its own constant

This commit is contained in:
Manuel Pégourié-Gonnard 2019-11-21 10:23:05 +01:00
parent 4d8777cbb6
commit 356d8594d7
4 changed files with 31 additions and 29 deletions

View file

@ -124,7 +124,6 @@ typedef uint64_t uECC_dword_t;
struct uECC_Curve_t;
typedef const struct uECC_Curve_t * uECC_Curve;
struct uECC_Curve_t {
uECC_word_t n[NUM_ECC_WORDS];
uECC_word_t G[NUM_ECC_WORDS * 2];
uECC_word_t b[NUM_ECC_WORDS];
};
@ -155,15 +154,11 @@ void vli_mmod_fast_secp256r1(unsigned int *result, unsigned int *product);
#define BITS_TO_BYTES(num_bits) ((num_bits + 7) / 8)
extern const uECC_word_t curve_p[NUM_ECC_WORDS];
extern const uECC_word_t curve_n[NUM_ECC_WORDS];
/* definition of curve NIST p-256: */
static const struct uECC_Curve_t curve_secp256r1 = {
{
BYTES_TO_WORDS_8(51, 25, 63, FC, C2, CA, B9, F3),
BYTES_TO_WORDS_8(84, 9E, 17, A7, AD, FA, E6, BC),
BYTES_TO_WORDS_8(FF, FF, FF, FF, FF, FF, FF, FF),
BYTES_TO_WORDS_8(00, 00, 00, 00, FF, FF, FF, FF)
}, {
BYTES_TO_WORDS_8(96, C2, 98, D8, 45, 39, A1, F4),
BYTES_TO_WORDS_8(A0, 33, EB, 2D, 81, 7D, 03, 77),
BYTES_TO_WORDS_8(F2, 40, A4, 63, E5, E6, BC, F8),