diff options
Diffstat (limited to 'libs/libaxolotl/src/curve.c')
-rwxr-xr-x | libs/libaxolotl/src/curve.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libs/libaxolotl/src/curve.c b/libs/libaxolotl/src/curve.c index afa16799e5..e39e08bcba 100755 --- a/libs/libaxolotl/src/curve.c +++ b/libs/libaxolotl/src/curve.c @@ -7,7 +7,8 @@ #include "curve25519/curve25519-donna.h" #include "curve25519/ed25519/additions/curve_sigs.h" -#include "curve25519/ed25519/additions/vxeddsa.h" +#include "curve25519/ed25519/additions/generalized/gen_x.h" +#include "curve25519/ed25519/tests/internal_fast_tests.h" #include "signal_protocol_internal.h" #include "signal_utarray.h" @@ -39,6 +40,13 @@ struct ec_public_key_list UT_array *values; }; +/*int curve_internal_fast_tests(int silent) +{ + if (all_fast_tests(silent) != 0) + return SG_ERR_UNKNOWN; + return 0; +}*/ + int curve_decode_point(ec_public_key **public_key, const uint8_t *key_data, size_t key_len, signal_context *global_context) { ec_public_key *key = 0; @@ -535,7 +543,7 @@ int curve_verify_signature(const ec_public_key *signing_key, const uint8_t *message_data, size_t message_len, const uint8_t *signature_data, size_t signature_len) { - if(signature_len != 64) { + if(signature_len != CURVE_SIGNATURE_LEN) { return SG_ERR_INVAL; } @@ -589,7 +597,7 @@ int curve_verify_vrf_signature(signal_context *context, return SG_ERR_INVAL; } - if(!message_data || !signature_data || signature_len != 96) { + if(!message_data || !signature_data || signature_len != VRF_SIGNATURE_LEN) { signal_log(context, SG_LOG_ERROR, "Invalid message or signature format"); return SG_ERR_VRF_SIG_VERIF_FAILED; } @@ -600,9 +608,9 @@ int curve_verify_vrf_signature(signal_context *context, goto complete; } - result = vxed25519_verify(signal_buffer_data(buffer), + result = generalized_xveddsa_25519_verify(signal_buffer_data(buffer), signature_data, signing_key->data, - message_data, message_len); + message_data, message_len, NULL, 0); if(result != 0) { signal_log(context, SG_LOG_ERROR, "Invalid signature"); result = SG_ERR_VRF_SIG_VERIF_FAILED; @@ -638,9 +646,9 @@ int curve_calculate_vrf_signature(signal_context *context, goto complete; } - result = vxed25519_sign(signal_buffer_data(buffer), + result = generalized_xveddsa_25519_sign(signal_buffer_data(buffer), signing_key->data, - message_data, message_len, random_data); + message_data, message_len, random_data, NULL, 0); if(result != 0) { signal_log(context, SG_LOG_ERROR, "Signature failed!"); result = SG_ERR_UNKNOWN; |