mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 11:56:31 +02:00
crypto: more places needing fixing for GCC 8.1
This commit is contained in:
parent
4a72d595a6
commit
9317bce9ca
@ -124,9 +124,9 @@ namespace crypto {
|
|||||||
random_scalar(rng);
|
random_scalar(rng);
|
||||||
}
|
}
|
||||||
sec = rng;
|
sec = rng;
|
||||||
sc_reduce32(&sec); // reduce in case second round of keys (sendkeys)
|
sc_reduce32(&unwrap(sec)); // reduce in case second round of keys (sendkeys)
|
||||||
|
|
||||||
ge_scalarmult_base(&point, &sec);
|
ge_scalarmult_base(&point, &unwrap(sec));
|
||||||
ge_p3_tobytes(&pub, &point);
|
ge_p3_tobytes(&pub, &point);
|
||||||
|
|
||||||
return rng;
|
return rng;
|
||||||
@ -139,10 +139,10 @@ namespace crypto {
|
|||||||
|
|
||||||
bool crypto_ops::secret_key_to_public_key(const secret_key &sec, public_key &pub) {
|
bool crypto_ops::secret_key_to_public_key(const secret_key &sec, public_key &pub) {
|
||||||
ge_p3 point;
|
ge_p3 point;
|
||||||
if (sc_check(&sec) != 0) {
|
if (sc_check(&unwrap(sec)) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ge_scalarmult_base(&point, &sec);
|
ge_scalarmult_base(&point, &unwrap(sec));
|
||||||
ge_p3_tobytes(&pub, &point);
|
ge_p3_tobytes(&pub, &point);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ namespace crypto {
|
|||||||
if (ge_frombytes_vartime(&point, &key1) != 0) {
|
if (ge_frombytes_vartime(&point, &key1) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ge_scalarmult(&point2, &key2, &point);
|
ge_scalarmult(&point2, &unwrap(key2), &point);
|
||||||
ge_mul8(&point3, &point2);
|
ge_mul8(&point3, &point2);
|
||||||
ge_p1p1_to_p2(&point2, &point3);
|
ge_p1p1_to_p2(&point2, &point3);
|
||||||
ge_tobytes(&derivation, &point2);
|
ge_tobytes(&derivation, &point2);
|
||||||
@ -199,7 +199,7 @@ namespace crypto {
|
|||||||
ec_scalar scalar;
|
ec_scalar scalar;
|
||||||
assert(sc_check(&base) == 0);
|
assert(sc_check(&base) == 0);
|
||||||
derivation_to_scalar(derivation, output_index, scalar);
|
derivation_to_scalar(derivation, output_index, scalar);
|
||||||
sc_add(&derived_key, &base, &scalar);
|
sc_add(&unwrap(derived_key), &unwrap(base), &scalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool crypto_ops::derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &derived_key) {
|
bool crypto_ops::derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &derived_key) {
|
||||||
@ -254,7 +254,7 @@ namespace crypto {
|
|||||||
ge_scalarmult_base(&tmp3, &k);
|
ge_scalarmult_base(&tmp3, &k);
|
||||||
ge_p3_tobytes(&buf.comm, &tmp3);
|
ge_p3_tobytes(&buf.comm, &tmp3);
|
||||||
hash_to_scalar(&buf, sizeof(s_comm), sig.c);
|
hash_to_scalar(&buf, sizeof(s_comm), sig.c);
|
||||||
sc_mulsub(&sig.r, &sig.c, &sec, &k);
|
sc_mulsub(&sig.r, &sig.c, &unwrap(sec), &k);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool crypto_ops::check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig) {
|
bool crypto_ops::check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig) {
|
||||||
@ -347,7 +347,7 @@ namespace crypto {
|
|||||||
hash_to_scalar(&buf, sizeof(buf), sig.c);
|
hash_to_scalar(&buf, sizeof(buf), sig.c);
|
||||||
|
|
||||||
// sig.r = k - sig.c*r
|
// sig.r = k - sig.c*r
|
||||||
sc_mulsub(&sig.r, &sig.c, &r, &k);
|
sc_mulsub(&sig.r, &sig.c, &unwrap(r), &k);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool crypto_ops::check_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional<public_key> &B, const public_key &D, const signature &sig) {
|
bool crypto_ops::check_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional<public_key> &B, const public_key &D, const signature &sig) {
|
||||||
@ -451,7 +451,7 @@ namespace crypto {
|
|||||||
ge_p2 point2;
|
ge_p2 point2;
|
||||||
assert(sc_check(&sec) == 0);
|
assert(sc_check(&sec) == 0);
|
||||||
hash_to_ec(pub, point);
|
hash_to_ec(pub, point);
|
||||||
ge_scalarmult(&point2, &sec, &point);
|
ge_scalarmult(&point2, &unwrap(sec), &point);
|
||||||
ge_tobytes(&image, &point2);
|
ge_tobytes(&image, &point2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ POP_WARNINGS
|
|||||||
}
|
}
|
||||||
hash_to_scalar(buf.get(), rs_comm_size(pubs_count), h);
|
hash_to_scalar(buf.get(), rs_comm_size(pubs_count), h);
|
||||||
sc_sub(&sig[sec_index].c, &h, &sum);
|
sc_sub(&sig[sec_index].c, &h, &sum);
|
||||||
sc_mulsub(&sig[sec_index].r, &sig[sec_index].c, &sec, &k);
|
sc_mulsub(&sig[sec_index].r, &sig[sec_index].c, &unwrap(sec), &k);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool crypto_ops::check_ring_signature(const hash &prefix_hash, const key_image &image,
|
bool crypto_ops::check_ring_signature(const hash &prefix_hash, const key_image &image,
|
||||||
|
Loading…
Reference in New Issue
Block a user