From c7313f56a69bacf0aed56693c497d5bdfab051e3 Mon Sep 17 00:00:00 2001 From: David Sheets Date: Fri, 12 Jul 2013 17:30:51 +0100 Subject: [PATCH] Add a crypto_sign_SEEDBYTES macro/getter and associated ed25519 macro/getter --- src/libsodium/crypto_sign/crypto_sign.c | 6 ++++++ src/libsodium/crypto_sign/ed25519/ref10/api.h | 1 + src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c | 5 +++++ src/libsodium/include/sodium/crypto_sign.h | 4 ++++ src/libsodium/include/sodium/crypto_sign_ed25519.h | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/src/libsodium/crypto_sign/crypto_sign.c b/src/libsodium/crypto_sign/crypto_sign.c index 1f3b8560..81fb1b96 100644 --- a/src/libsodium/crypto_sign/crypto_sign.c +++ b/src/libsodium/crypto_sign/crypto_sign.c @@ -7,6 +7,12 @@ crypto_sign_bytes(void) return crypto_sign_BYTES; } +size_t +crypto_sign_seedbytes(void) +{ + return crypto_sign_SEEDBYTES; +} + size_t crypto_sign_publickeybytes(void) { diff --git a/src/libsodium/crypto_sign/ed25519/ref10/api.h b/src/libsodium/crypto_sign/ed25519/ref10/api.h index 87cd56e9..74309f7e 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/api.h +++ b/src/libsodium/crypto_sign/ed25519/ref10/api.h @@ -6,6 +6,7 @@ #define crypto_sign_keypair crypto_sign_ed25519_keypair #define crypto_sign_seed_keypair crypto_sign_ed25519_seed_keypair #define crypto_sign_BYTES crypto_sign_ed25519_BYTES +#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES #define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES #define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES #define crypto_sign_PRIMITIVE "ed25519" diff --git a/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c b/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c index a02031c9..8d2382c0 100644 --- a/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c +++ b/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c @@ -5,6 +5,11 @@ crypto_sign_ed25519_bytes(void) { return crypto_sign_ed25519_BYTES; } +size_t +crypto_sign_ed25519_seedbytes(void) { + return crypto_sign_ed25519_SEEDBYTES; +} + size_t crypto_sign_ed25519_publickeybytes(void) { return crypto_sign_ed25519_PUBLICKEYBYTES; diff --git a/src/libsodium/include/sodium/crypto_sign.h b/src/libsodium/include/sodium/crypto_sign.h index 60d37ae0..9efb2ebc 100644 --- a/src/libsodium/include/sodium/crypto_sign.h +++ b/src/libsodium/include/sodium/crypto_sign.h @@ -21,6 +21,10 @@ extern "C" { SODIUM_EXPORT size_t crypto_sign_bytes(void); +#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES +SODIUM_EXPORT +size_t crypto_sign_seedbytes(void); + #define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES SODIUM_EXPORT size_t crypto_sign_publickeybytes(void); diff --git a/src/libsodium/include/sodium/crypto_sign_ed25519.h b/src/libsodium/include/sodium/crypto_sign_ed25519.h index c572c6a7..aaf7082c 100644 --- a/src/libsodium/include/sodium/crypto_sign_ed25519.h +++ b/src/libsodium/include/sodium/crypto_sign_ed25519.h @@ -6,6 +6,7 @@ #define crypto_sign_ed25519_SECRETKEYBYTES 64U #define crypto_sign_ed25519_PUBLICKEYBYTES 32U +#define crypto_sign_ed25519_SEEDBYTES 32U #define crypto_sign_ed25519_BYTES 64U #ifdef __cplusplus @@ -15,6 +16,9 @@ extern "C" { SODIUM_EXPORT size_t crypto_sign_ed25519_bytes(void); +SODIUM_EXPORT +size_t crypto_sign_ed25519_seedbytes(void); + SODIUM_EXPORT size_t crypto_sign_ed25519_publickeybytes(void);