Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/scalar_impl.h
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | static const unsigned char order[32] = { | ||||
0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, | 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, | ||||
0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x41 | 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x41 | ||||
}; | }; | ||||
#endif | #endif | ||||
secp256k1_num_set_bin(r, order, 32); | secp256k1_num_set_bin(r, order, 32); | ||||
} | } | ||||
#endif | #endif | ||||
static int secp256k1_scalar_set_b32_seckey(secp256k1_scalar *r, const unsigned char *bin) { | |||||
int overflow; | |||||
secp256k1_scalar_set_b32(r, bin, &overflow); | |||||
return (!overflow) & (!secp256k1_scalar_is_zero(r)); | |||||
} | |||||
static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *x) { | static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *x) { | ||||
#if defined(EXHAUSTIVE_TEST_ORDER) | #if defined(EXHAUSTIVE_TEST_ORDER) | ||||
int i; | int i; | ||||
*r = 0; | *r = 0; | ||||
for (i = 0; i < EXHAUSTIVE_TEST_ORDER; i++) | for (i = 0; i < EXHAUSTIVE_TEST_ORDER; i++) | ||||
if ((i * *x) % EXHAUSTIVE_TEST_ORDER == 1) | if ((i * *x) % EXHAUSTIVE_TEST_ORDER == 1) | ||||
*r = i; | *r = i; | ||||
/* If this VERIFY_CHECK triggers we were given a noninvertible scalar (and thus | /* If this VERIFY_CHECK triggers we were given a noninvertible scalar (and thus | ||||
▲ Show 20 Lines • Show All 271 Lines • Show Last 20 Lines |