Skip to content

Commit

Permalink
scalar_add_b32
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancdotorg committed Jan 23, 2017
1 parent a18b9c7 commit 660c20d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ec_pubkey_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,17 @@ int secp256k1_ec_pubkey_batch_create(unsigned int num, unsigned char (*pub)[65],
return 0;
}

int secp256k1_scalar_add_b32(void * out, void * a, void *b) {
secp256k1_scalar_t tmp_a, tmp_b;

secp256k1_scalar_set_b32(&tmp_a, a, NULL);
secp256k1_scalar_set_b32(&tmp_b, b, NULL);
secp256k1_scalar_add(&tmp_a, &tmp_a, &tmp_b);
secp256k1_scalar_get_b32(out, &tmp_a);

return 0;
}

inline static void _priv_add(unsigned char *priv, unsigned char add, int p) {
priv[p] += add;
if (priv[p] < add) {
Expand Down
2 changes: 2 additions & 0 deletions ec_pubkey_fast.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ int secp256k1_ec_pubkey_create_precomp(unsigned char *, int *, const unsigned ch
int secp256k1_ec_pubkey_incr_init(unsigned char *, unsigned int);
int secp256k1_ec_pubkey_incr(unsigned char *, int *, unsigned char *);

int secp256k1_scalar_add_b32(void *, void *, void *);

void priv_add_uint8(unsigned char *, unsigned char);
void priv_add_uint32(unsigned char *, unsigned int);

Expand Down

0 comments on commit 660c20d

Please sign in to comment.