1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

+ crypto_core_ed25519_is_valid_point()

This commit is contained in:
Frank Denis 2017-11-13 14:36:40 +01:00
parent c01884ea80
commit 75d507a434
3 changed files with 19 additions and 0 deletions

View File

@ -145,6 +145,7 @@ _crypto_box_seedbytes 1 1
_crypto_box_zerobytes 0 1
_crypto_core_ed25519_add 0 1
_crypto_core_ed25519_sub 0 1
_crypto_core_ed25519_is_valid_point 0 1
_crypto_core_hchacha20 1 1
_crypto_core_hchacha20_constbytes 1 1
_crypto_core_hchacha20_inputbytes 1 1

View File

@ -3,6 +3,21 @@
#include "private/common.h"
#include "private/ed25519_ref10.h"
int
crypto_core_ed25519_is_valid_point(const unsigned char *p)
{
ge25519_p3 p_p3;
if (ge25519_is_canonical(p) == 0 ||
ge25519_has_small_order(p) != 0 ||
ge25519_frombytes(&p_p3, p) != 0 ||
ge25519_is_on_curve(&p_p3) == 0 ||
ge25519_is_on_main_subgroup(&p_p3) == 0) {
return -1;
}
return 0;
}
int
crypto_core_ed25519_add(unsigned char *r,
const unsigned char *p, const unsigned char *q)

View File

@ -8,6 +8,9 @@
extern "C" {
#endif
SODIUM_EXPORT
int crypto_core_ed25519_is_valid_point(const unsigned char *p);
SODIUM_EXPORT
int crypto_core_ed25519_add(unsigned char *r,
const unsigned char *p, const unsigned char *q);