Hiyas,

I am currently refactoring the NN module from TinyECC that provides
big integer arithmetics, but I am not yet quite sure how to make it a
generic module. Here are my problems:

1) Currently it uses #defines to calculate the maximum length of needed
numbers based on the ECC key size used, e.g.:

in NN.h:

#define KEYDIGITS (KEY_BIT_LEN/NN_DIGIT_BITS)
#define MAX_NN_DIGITS (KEYDIGITS+1)

I guess these logic needs to be moved from a header file in the NN
module implementation and if some other component needs to use these
values, it must get them via a command like command uint8_t 
get_max_nn_digits(). Is this
the right way to do this?

2) It also defines a struct in NN.h, which uses the MAX_NN_DIGITS value:

struct Barrett{
    NN_DIGIT mu[2*MAX_NN_DIGITS+1];
    NN_UINT mu_len;
    NN_UINT km;  //length of moduli m, m_{k-1} != 0
};
typedef struct Barrett Barrett;

How can I handle this?

Thanks,
Till

Attachment: pgp6E8jGk2rmu.pgp
Description: PGP signature

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to