Deprecate crypto_core_ed25519_from_hash()
This commit is contained in:
parent
dbab49d48d
commit
bfa866e2f0
@ -48,7 +48,7 @@ int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
|
|||||||
|
|
||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
int crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h)
|
int crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h)
|
||||||
__attribute__ ((nonnull));
|
__attribute__ ((nonnull)) __attribute__ ((deprecated));
|
||||||
|
|
||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
void crypto_core_ed25519_random(unsigned char *p)
|
void crypto_core_ed25519_random(unsigned char *p)
|
||||||
|
@ -44,14 +44,13 @@ add_l64(unsigned char * const S)
|
|||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
unsigned char *h, *r;
|
unsigned char *r;
|
||||||
unsigned char *p, *p2, *p3;
|
unsigned char *p, *p2, *p3;
|
||||||
unsigned char *sc, *sc2, *sc3;
|
unsigned char *sc, *sc2, *sc3;
|
||||||
unsigned char *sc64;
|
unsigned char *sc64;
|
||||||
char *hex;
|
char *hex;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
h = (unsigned char *) sodium_malloc(crypto_core_ed25519_HASHBYTES);
|
|
||||||
r = (unsigned char *) sodium_malloc(crypto_core_ed25519_UNIFORMBYTES);
|
r = (unsigned char *) sodium_malloc(crypto_core_ed25519_UNIFORMBYTES);
|
||||||
p = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES);
|
p = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES);
|
||||||
for (i = 0; i < 500; i++) {
|
for (i = 0; i < 500; i++) {
|
||||||
@ -63,14 +62,6 @@ main(void)
|
|||||||
printf("crypto_core_ed25519_from_uniform() returned an invalid point\n");
|
printf("crypto_core_ed25519_from_uniform() returned an invalid point\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
randombytes_buf(h, crypto_core_ed25519_HASHBYTES);
|
|
||||||
if (crypto_core_ed25519_from_hash(p, h) != 0) {
|
|
||||||
printf("crypto_core_ed25519_from_hash() failed\n");
|
|
||||||
}
|
|
||||||
if (crypto_core_ed25519_is_valid_point(p) == 0) {
|
|
||||||
printf("crypto_core_ed25519_from_hash() returned an invalid point\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
crypto_core_ed25519_random(p);
|
crypto_core_ed25519_random(p);
|
||||||
if (crypto_core_ed25519_is_valid_point(p) == 0) {
|
if (crypto_core_ed25519_is_valid_point(p) == 0) {
|
||||||
printf("crypto_core_ed25519_random() returned an invalid point\n");
|
printf("crypto_core_ed25519_random() returned an invalid point\n");
|
||||||
@ -396,7 +387,6 @@ main(void)
|
|||||||
sodium_free(p2);
|
sodium_free(p2);
|
||||||
sodium_free(p);
|
sodium_free(p);
|
||||||
sodium_free(r);
|
sodium_free(r);
|
||||||
sodium_free(h);
|
|
||||||
|
|
||||||
assert(crypto_core_ed25519_BYTES == crypto_core_ed25519_bytes());
|
assert(crypto_core_ed25519_BYTES == crypto_core_ed25519_bytes());
|
||||||
assert(crypto_core_ed25519_SCALARBYTES == crypto_core_ed25519_scalarbytes());
|
assert(crypto_core_ed25519_SCALARBYTES == crypto_core_ed25519_scalarbytes());
|
||||||
@ -404,8 +394,6 @@ main(void)
|
|||||||
assert(crypto_core_ed25519_NONREDUCEDSCALARBYTES >= crypto_core_ed25519_SCALARBYTES);
|
assert(crypto_core_ed25519_NONREDUCEDSCALARBYTES >= crypto_core_ed25519_SCALARBYTES);
|
||||||
assert(crypto_core_ed25519_UNIFORMBYTES == crypto_core_ed25519_uniformbytes());
|
assert(crypto_core_ed25519_UNIFORMBYTES == crypto_core_ed25519_uniformbytes());
|
||||||
assert(crypto_core_ed25519_UNIFORMBYTES >= crypto_core_ed25519_BYTES);
|
assert(crypto_core_ed25519_UNIFORMBYTES >= crypto_core_ed25519_BYTES);
|
||||||
assert(crypto_core_ed25519_HASHBYTES == crypto_core_ed25519_hashbytes());
|
|
||||||
assert(crypto_core_ed25519_HASHBYTES >= 2 * crypto_core_ed25519_BYTES);
|
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user