Rename crypto_core_*_from_string to crypto_core_*_from_string_nu

RO should be the default
This commit is contained in:
Frank Denis
2026-02-20 23:19:12 +01:00
parent 44cf631d04
commit 8bb79ae24d
6 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ _crypto_box_seedbytes 1 1
_crypto_box_zerobytes 0 1
_crypto_core_ed25519_add 0 1
_crypto_core_ed25519_bytes 0 1
_crypto_core_ed25519_from_string 0 1
_crypto_core_ed25519_from_string_nu 0 1
_crypto_core_ed25519_from_string_ro 0 1
_crypto_core_ed25519_hashbytes 0 1
_crypto_core_ed25519_is_valid_point 0 1
File diff suppressed because one or more lines are too long
@@ -88,10 +88,10 @@ _string_to_points(unsigned char * const px, const size_t n,
}
int
crypto_core_ed25519_from_string(unsigned char p[crypto_core_ed25519_BYTES],
const unsigned char *ctx, size_t ctx_len,
const unsigned char *msg, size_t msg_len,
int hash_alg)
crypto_core_ed25519_from_string_nu(unsigned char p[crypto_core_ed25519_BYTES],
const unsigned char *ctx, size_t ctx_len,
const unsigned char *msg, size_t msg_len,
int hash_alg)
{
return _string_to_points(p, 1, ctx, ctx_len, msg, msg_len, hash_alg);
}
@@ -46,10 +46,10 @@ int crypto_core_ed25519_sub(unsigned char *r,
__attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_core_ed25519_from_string(unsigned char p[crypto_core_ed25519_BYTES],
const unsigned char *ctx, size_t ctx_len,
const unsigned char *msg, size_t msg_len,
int hash_alg)
int crypto_core_ed25519_from_string_nu(unsigned char p[crypto_core_ed25519_BYTES],
const unsigned char *ctx, size_t ctx_len,
const unsigned char *msg, size_t msg_len,
int hash_alg)
__attribute__ ((nonnull(1)));
SODIUM_EXPORT
+10 -10
View File
@@ -192,13 +192,13 @@ test_from_string(void)
expected_y[j] = expected_yr[crypto_core_ed25519_BYTES - 1U - j];
}
if (test_data[i].ro == 0) {
if (crypto_core_ed25519_from_string(
if (crypto_core_ed25519_from_string_nu(
y,
(const unsigned char *) "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_NU_",
sizeof("QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_NU_") - 1U,
(const unsigned char *) test_data[i].msg,
strlen(test_data[i].msg), H2CHASH) != 0) {
printf("crypto_core_ed25519_from_string() failed\n");
printf("crypto_core_ed25519_from_string_nu() failed\n");
}
} else {
if (crypto_core_ed25519_from_string_ro(
@@ -224,10 +224,10 @@ test_from_string(void)
}
}
if (crypto_core_ed25519_from_string(y, NULL, 0U, (const unsigned char *) "msg",
3U, H2CHASH) != 0 ||
crypto_core_ed25519_from_string(y, (const unsigned char *) "", 0U,
guard_page, 0U, H2CHASH) != 0 ||
if (crypto_core_ed25519_from_string_nu(y, NULL, 0U, (const unsigned char *) "msg",
3U, H2CHASH) != 0 ||
crypto_core_ed25519_from_string_nu(y, (const unsigned char *) "", 0U,
guard_page, 0U, H2CHASH) != 0 ||
crypto_core_ed25519_from_string_ro(
y, NULL, 0U, (const unsigned char *) "msg", 3U, H2CHASH) != 0 ||
crypto_core_ed25519_from_string_ro(y, (const unsigned char *) "", 0U,
@@ -237,10 +237,10 @@ test_from_string(void)
oversized_ctx = (char *) sodium_malloc(oversized_ctx_len);
memset(oversized_ctx, 'X', oversized_ctx_len);
crypto_core_ed25519_from_string(y, (const unsigned char *) oversized_ctx,
oversized_ctx_len - 1U,
(const unsigned char *) "msg", 3U,
H2CHASH);
crypto_core_ed25519_from_string_nu(y, (const unsigned char *) oversized_ctx,
oversized_ctx_len - 1U,
(const unsigned char *) "msg", 3U,
H2CHASH);
sodium_bin2hex(y_hex, crypto_core_ed25519_BYTES * 2U + 1U, y,
crypto_core_ed25519_BYTES);
printf("NU with oversized context: %s\n", y_hex);
+1 -1
View File
@@ -194,7 +194,7 @@ crypto_box_seedbytes
crypto_box_zerobytes
crypto_core_ed25519_add
crypto_core_ed25519_bytes
crypto_core_ed25519_from_string
crypto_core_ed25519_from_string_nu
crypto_core_ed25519_from_string_ro
crypto_core_ed25519_hashbytes
crypto_core_ed25519_is_valid_point