Avoid some implicit type conversions to make C++ compilers happy.
This commit is contained in:
parent
bfe96ba1ee
commit
c01df1adc9
|
@ -50,8 +50,8 @@ static void secp256k1_ecmult_table_precomp_ge_storage_var(secp256k1_ge_storage_t
|
||||||
secp256k1_gej_t d;
|
secp256k1_gej_t d;
|
||||||
int i;
|
int i;
|
||||||
const int table_size = 1 << (w-2);
|
const int table_size = 1 << (w-2);
|
||||||
secp256k1_gej_t *prej = checked_malloc(sizeof(secp256k1_gej_t) * table_size);
|
secp256k1_gej_t *prej = (secp256k1_gej_t *)checked_malloc(sizeof(secp256k1_gej_t) * table_size);
|
||||||
secp256k1_ge_t *prea = checked_malloc(sizeof(secp256k1_ge_t) * table_size);
|
secp256k1_ge_t *prea = (secp256k1_ge_t *)checked_malloc(sizeof(secp256k1_ge_t) * table_size);
|
||||||
prej[0] = *a;
|
prej[0] = *a;
|
||||||
secp256k1_gej_double_var(&d, a);
|
secp256k1_gej_double_var(&d, a);
|
||||||
for (i = 1; i < table_size; i++) {
|
for (i = 1; i < table_size; i++) {
|
||||||
|
|
|
@ -77,14 +77,14 @@ static void secp256k1_ge_set_all_gej_var(size_t len, secp256k1_ge_t *r, const se
|
||||||
secp256k1_fe_t *azi;
|
secp256k1_fe_t *azi;
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
az = checked_malloc(sizeof(secp256k1_fe_t) * len);
|
az = (secp256k1_fe_t *)checked_malloc(sizeof(secp256k1_fe_t) * len);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (!a[i].infinity) {
|
if (!a[i].infinity) {
|
||||||
az[count++] = a[i].z;
|
az[count++] = a[i].z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
azi = checked_malloc(sizeof(secp256k1_fe_t) * count);
|
azi = (secp256k1_fe_t *)checked_malloc(sizeof(secp256k1_fe_t) * count);
|
||||||
secp256k1_fe_inv_all_var(count, azi, az);
|
secp256k1_fe_inv_all_var(count, azi, az);
|
||||||
free(az);
|
free(az);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ int secp256k1_ecdsa_verify(const unsigned char *msg32, const unsigned char *sig,
|
||||||
static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, unsigned int counter, const void *data) {
|
static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, unsigned int counter, const void *data) {
|
||||||
secp256k1_rfc6979_hmac_sha256_t rng;
|
secp256k1_rfc6979_hmac_sha256_t rng;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
secp256k1_rfc6979_hmac_sha256_initialize(&rng, key32, 32, msg32, 32, data, data != NULL ? 32 : 0);
|
secp256k1_rfc6979_hmac_sha256_initialize(&rng, key32, 32, msg32, 32, (const unsigned char*)data, data != NULL ? 32 : 0);
|
||||||
for (i = 0; i <= counter; i++) {
|
for (i = 0; i <= counter; i++) {
|
||||||
secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32);
|
secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32);
|
||||||
}
|
}
|
||||||
|
|
|
@ -884,8 +884,8 @@ void test_ge(void) {
|
||||||
* All magnitudes are randomized.
|
* All magnitudes are randomized.
|
||||||
* All 17*17 combinations of points are added to eachother, using all applicable methods.
|
* All 17*17 combinations of points are added to eachother, using all applicable methods.
|
||||||
*/
|
*/
|
||||||
secp256k1_ge_t *ge = malloc(sizeof(secp256k1_ge_t) * (1 + 4 * runs));
|
secp256k1_ge_t *ge = (secp256k1_ge_t *)malloc(sizeof(secp256k1_ge_t) * (1 + 4 * runs));
|
||||||
secp256k1_gej_t *gej = malloc(sizeof(secp256k1_gej_t) * (1 + 4 * runs));
|
secp256k1_gej_t *gej = (secp256k1_gej_t *)malloc(sizeof(secp256k1_gej_t) * (1 + 4 * runs));
|
||||||
secp256k1_gej_set_infinity(&gej[0]);
|
secp256k1_gej_set_infinity(&gej[0]);
|
||||||
secp256k1_ge_clear(&ge[0]);
|
secp256k1_ge_clear(&ge[0]);
|
||||||
secp256k1_ge_set_gej_var(&ge[0], &gej[0]);
|
secp256k1_ge_set_gej_var(&ge[0], &gej[0]);
|
||||||
|
@ -961,7 +961,7 @@ void test_ge(void) {
|
||||||
/* Test adding all points together in random order equals infinity. */
|
/* Test adding all points together in random order equals infinity. */
|
||||||
{
|
{
|
||||||
secp256k1_gej_t sum = SECP256K1_GEJ_CONST_INFINITY;
|
secp256k1_gej_t sum = SECP256K1_GEJ_CONST_INFINITY;
|
||||||
secp256k1_gej_t *gej_shuffled = malloc((4 * runs + 1) * sizeof(secp256k1_gej_t));
|
secp256k1_gej_t *gej_shuffled = (secp256k1_gej_t *)malloc((4 * runs + 1) * sizeof(secp256k1_gej_t));
|
||||||
for (i = 0; i < 4 * runs + 1; i++) {
|
for (i = 0; i < 4 * runs + 1; i++) {
|
||||||
gej_shuffled[i] = gej[i];
|
gej_shuffled[i] = gej[i];
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ void test_ge(void) {
|
||||||
|
|
||||||
/* Test batch gej -> ge conversion. */
|
/* Test batch gej -> ge conversion. */
|
||||||
{
|
{
|
||||||
secp256k1_ge_t *ge_set_all = malloc((4 * runs + 1) * sizeof(secp256k1_ge_t));
|
secp256k1_ge_t *ge_set_all = (secp256k1_ge_t *)malloc((4 * runs + 1) * sizeof(secp256k1_ge_t));
|
||||||
secp256k1_ge_set_all_gej_var(4 * runs + 1, ge_set_all, gej);
|
secp256k1_ge_set_all_gej_var(4 * runs + 1, ge_set_all, gej);
|
||||||
for (i = 0; i < 4 * runs + 1; i++) {
|
for (i = 0; i < 4 * runs + 1; i++) {
|
||||||
ge_equals_gej(&ge_set_all[i], &gej[i]);
|
ge_equals_gej(&ge_set_all[i], &gej[i]);
|
||||||
|
|
Loading…
Reference in New Issue