Proxy miner signature support (WIP)

This commit is contained in:
SChernykh 2021-06-17 16:58:18 +02:00
parent bc63b63a2a
commit ebe299902c
9 changed files with 71 additions and 22 deletions

View file

@ -167,6 +167,30 @@ void derive_secret_key(const uint8_t* derivation, size_t output_index, const uin
}
bool derive_public_key(const uint8_t* derivation, size_t output_index, const uint8_t* base, uint8_t* derived_key)
{
ec_scalar scalar;
ge_p3 point1;
ge_p3 point2;
ge_cached point3;
ge_p1p1 point4;
ge_p2 point5;
if (ge_frombytes_vartime(&point1, base) != 0) {
return false;
}
derivation_to_scalar(derivation, output_index, scalar);
ge_scalarmult_base(&point2, (uint8_t*) &scalar);
ge_p3_to_cached(&point3, &point2);
ge_add(&point4, &point1, &point3);
ge_p1p1_to_p2(&point5, &point4);
ge_tobytes(derived_key, &point5);
return true;
}
void derive_view_secret_key(const uint8_t* spend_secret_key, uint8_t* view_secret_key)
{
keccak(spend_secret_key, 32, view_secret_key, 32);