X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=shamirs;a=blobdiff_plain;f=shamirssecret.c;h=be6eed3f9d0c4247dc09a6a7d27fa0f775a32396;hp=cc3e71334a1277367c2beae82bd05f9496945287;hb=421e5acbd6f375ca9f2f16d260fe9c5505fb42f4;hpb=7564918dc5ea2af16b99cac19bd158cf075ceded diff --git a/shamirssecret.c b/shamirssecret.c index cc3e713..be6eed3 100644 --- a/shamirssecret.c +++ b/shamirssecret.c @@ -102,6 +102,11 @@ static uint8_t field_pow_ret(uint8_t calc, uint8_t a, uint8_t e) { return ret; } static uint8_t field_pow(uint8_t a, uint8_t e) { +#ifndef TEST + // Although this function works for a==0, its not trivially obvious why, + // and since we never call with a==0, we just assert a != 0 (except when testing) + assert(a != 0); +#endif return field_pow_ret(exp[(log[a] * e) % 255], a, e); }