mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Remove crypto_core_ed25519_from_uniform
This commit is contained in:
@@ -167,7 +167,6 @@ _crypto_core_ed25519_add 0 1
|
||||
_crypto_core_ed25519_bytes 0 1
|
||||
_crypto_core_ed25519_from_string 0 1
|
||||
_crypto_core_ed25519_from_string_ro 0 1
|
||||
_crypto_core_ed25519_from_uniform 0 1
|
||||
_crypto_core_ed25519_hashbytes 0 1
|
||||
_crypto_core_ed25519_is_valid_point 0 1
|
||||
_crypto_core_ed25519_nonreducedscalarbytes 0 1
|
||||
|
||||
@@ -57,14 +57,6 @@ crypto_core_ed25519_sub(unsigned char *r,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
|
||||
{
|
||||
ge25519_from_uniform(p, r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define HASH_GE_L 48U
|
||||
|
||||
static int
|
||||
@@ -121,7 +113,7 @@ crypto_core_ed25519_random(unsigned char *p)
|
||||
unsigned char h[crypto_core_ed25519_UNIFORMBYTES];
|
||||
|
||||
randombytes_buf(h, sizeof h);
|
||||
(void) crypto_core_ed25519_from_uniform(p, h);
|
||||
ge25519_from_uniform(p, h);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -45,14 +45,6 @@ int crypto_core_ed25519_sub(unsigned char *r,
|
||||
const unsigned char *p, const unsigned char *q)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
/*
|
||||
* Removal notice: this function is undocumented and has been marked as
|
||||
* deprecated since 2019. It will be removed. Bindings should not refer to it.
|
||||
*/
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
|
||||
__attribute__ ((nonnull));
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_core_ed25519_from_string(unsigned char p[crypto_core_ed25519_BYTES],
|
||||
const char *ctx, const unsigned char *msg,
|
||||
|
||||
@@ -64,25 +64,16 @@ add_l64(unsigned char * const S)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *h, *r;
|
||||
unsigned char *h;
|
||||
unsigned char *p, *p2, *p3;
|
||||
unsigned char *sc, *sc2, *sc3;
|
||||
unsigned char *sc64;
|
||||
unsigned char *seed;
|
||||
char *hex;
|
||||
unsigned int i, j;
|
||||
|
||||
h = (unsigned char *) sodium_malloc(crypto_core_ed25519_HASHBYTES);
|
||||
r = (unsigned char *) sodium_malloc(crypto_core_ed25519_UNIFORMBYTES);
|
||||
p = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES);
|
||||
for (i = 0; i < 500; i++) {
|
||||
randombytes_buf(r, crypto_core_ed25519_UNIFORMBYTES);
|
||||
if (crypto_core_ed25519_from_uniform(p, r) != 0) {
|
||||
printf("crypto_core_ed25519_from_uniform() failed\n");
|
||||
}
|
||||
if (crypto_core_ed25519_is_valid_point(p) == 0) {
|
||||
printf("crypto_core_ed25519_from_uniform() returned an invalid point\n");
|
||||
}
|
||||
crypto_core_ed25519_random(p);
|
||||
if (crypto_core_ed25519_is_valid_point(p) == 0) {
|
||||
printf("crypto_core_ed25519_random() returned an invalid point\n");
|
||||
@@ -202,25 +193,6 @@ main(void)
|
||||
printf("crypto_core_ed25519_scalar_reduce() failed\n");
|
||||
}
|
||||
|
||||
randombytes_buf(r, crypto_core_ed25519_UNIFORMBYTES);
|
||||
crypto_core_ed25519_from_uniform(p, r);
|
||||
memcpy(p2, p, crypto_core_ed25519_BYTES);
|
||||
crypto_core_ed25519_scalar_random(sc);
|
||||
if (crypto_scalarmult_ed25519_noclamp(p, sc, p) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed (1)\n");
|
||||
}
|
||||
crypto_core_ed25519_scalar_complement(sc, sc);
|
||||
if (crypto_scalarmult_ed25519_noclamp(p2, sc, p2) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed (2)\n");
|
||||
}
|
||||
crypto_core_ed25519_add(p3, p, p2);
|
||||
crypto_core_ed25519_from_uniform(p, r);
|
||||
crypto_core_ed25519_sub(p, p, p3);
|
||||
assert(p[0] == 0x01);
|
||||
for (i = 1; i < crypto_core_ed25519_BYTES; i++) {
|
||||
assert(p[i] == 0);
|
||||
}
|
||||
|
||||
crypto_core_ed25519_random(p);
|
||||
memcpy(p2, p, crypto_core_ed25519_BYTES);
|
||||
crypto_core_ed25519_scalar_random(sc);
|
||||
@@ -400,17 +372,6 @@ main(void)
|
||||
assert(memcmp(sc3, sc, crypto_core_ed25519_SCALARBYTES) != 0);
|
||||
}
|
||||
|
||||
seed = (unsigned char *) sodium_malloc(randombytes_SEEDBYTES);
|
||||
for (i = 0; i < 15; i++) {
|
||||
randombytes_buf_deterministic(r, crypto_core_ed25519_UNIFORMBYTES, seed);
|
||||
if (crypto_core_ed25519_from_uniform(p, r) != 0) {
|
||||
printf("crypto_core_ed25519_from_uniform() failed\n");
|
||||
}
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
p, crypto_core_ed25519_BYTES);
|
||||
printf("from_uniform_deterministic (%u): %s\n", i, hex);
|
||||
sodium_increment(seed, randombytes_SEEDBYTES);
|
||||
}
|
||||
crypto_core_ed25519_scalar_mul(sc, L_1, sc_8);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
@@ -518,7 +479,6 @@ main(void)
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("h*2: %s\n", hex);
|
||||
|
||||
sodium_free(seed);
|
||||
sodium_free(hex);
|
||||
sodium_free(sc64);
|
||||
sodium_free(sc3);
|
||||
@@ -527,7 +487,6 @@ main(void)
|
||||
sodium_free(p3);
|
||||
sodium_free(p2);
|
||||
sodium_free(p);
|
||||
sodium_free(r);
|
||||
sodium_free(h);
|
||||
|
||||
assert(crypto_core_ed25519_BYTES == crypto_core_ed25519_bytes());
|
||||
|
||||
@@ -15,21 +15,6 @@ sub1: f67c79849de0253ba142949e1db6224b13121212121212121212121212121202
|
||||
add2: b02e8581ce62f69922427c23f970f7e951525252525252525252525252525202
|
||||
sub2: 3da570db4b001cbeb35a7b7fe588e72aaeadadadadadadadadadadadadadad0d
|
||||
mul: 4453ef38408c06677c1b810e4bf8b1991f01c88716fbfa2f075a518b77da400b
|
||||
from_uniform_deterministic (0): b18e62cf804b022fec392b0e2d6539d0f059732616c11913f510f73ae2544ebc
|
||||
from_uniform_deterministic (1): b9d23004e78c58e22da72e109550133e3d3bb9e46afcc066b82326319653d62c
|
||||
from_uniform_deterministic (2): 14063782c8b8a677dce09c4e51719b1cf942bf71bc765c1ec9832a8b4446983c
|
||||
from_uniform_deterministic (3): 02d6dbac70f6a14de72f4e17386016b08d6506336a086f10e719fbad8831d550
|
||||
from_uniform_deterministic (4): 11c851408e7892c2eae37584423a8f9c797e3649d45946b53e64319318a750b0
|
||||
from_uniform_deterministic (5): d4b9eaf70ffdc238c88725e294bdd02a6ce85577c5e7add7ca07041873019842
|
||||
from_uniform_deterministic (6): 740a6141079285c1b9e84ed463dcce5d3d40a167fa13129463eaf97d2a7bf654
|
||||
from_uniform_deterministic (7): e504a3e00bbf506cbe388784d85e85b10c428c37eba04ebd19a60948b71ad2cf
|
||||
from_uniform_deterministic (8): 67cd50902c40c943f22c479c587fb3e5da2f8f1ad402049ac49ddc45ec20884c
|
||||
from_uniform_deterministic (9): 658bffa23b425a91268ee17559073c4b1548209054ed7cf00ffe582696dda8dc
|
||||
from_uniform_deterministic (10): b55b93e7a0fe554f86f1f4c991871a27756fee359a8c6bb7554ec91d5d552c49
|
||||
from_uniform_deterministic (11): fbc2bb45df1d806489a5a6415898c719c45c932d3467b6ce948ee80c0e8122c9
|
||||
from_uniform_deterministic (12): 93164e57b5e3ae6826ac9e0c31ddecf94e21a39a29ba9d1d24e9e588fe065d95
|
||||
from_uniform_deterministic (13): 16824d74c9482890dc57b0ec843a0a5231b581d2ce3909934d7658389f169093
|
||||
from_uniform_deterministic (14): 2f5b0336c7f0af520badeae99450f92835c27224ab4cd117f55b176afb6f0001
|
||||
(L-1)*8: e5d3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010
|
||||
8(L-1): e5d3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010
|
||||
(L-1)^2: 0100000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
@@ -204,7 +204,6 @@ crypto_core_ed25519_add
|
||||
crypto_core_ed25519_bytes
|
||||
crypto_core_ed25519_from_string
|
||||
crypto_core_ed25519_from_string_ro
|
||||
crypto_core_ed25519_from_uniform
|
||||
crypto_core_ed25519_hashbytes
|
||||
crypto_core_ed25519_is_valid_point
|
||||
crypto_core_ed25519_nonreducedscalarbytes
|
||||
|
||||
Reference in New Issue
Block a user