Add *_messagebytes_max() wrappers

This commit is contained in:
Frank Denis
2017-08-03 13:34:31 +02:00
parent 53280aa28f
commit e1fa9cc90c
46 changed files with 189 additions and 8 deletions
@@ -1058,6 +1058,12 @@ crypto_aead_aes256gcm_statebytes(void)
return (sizeof(crypto_aead_aes256gcm_state) + (size_t) 15U) & ~(size_t) 15U;
}
size_t
crypto_aead_aes256gcm_messagebytes_max(void)
{
return crypto_aead_aes256gcm_MESSAGEBYTES_MAX;
}
void
crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
{
@@ -350,6 +350,12 @@ crypto_aead_chacha20poly1305_ietf_abytes(void)
return crypto_aead_chacha20poly1305_ietf_ABYTES;
}
size_t
crypto_aead_chacha20poly1305_ietf_messagebytes_max(void)
{
return crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX;
}
void
crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES])
{
@@ -380,6 +386,12 @@ crypto_aead_chacha20poly1305_abytes(void)
return crypto_aead_chacha20poly1305_ABYTES;
}
size_t
crypto_aead_chacha20poly1305_messagebytes_max(void)
{
return crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX;
}
void
crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES])
{
@@ -147,6 +147,12 @@ crypto_aead_xchacha20poly1305_ietf_abytes(void)
return crypto_aead_xchacha20poly1305_ietf_ABYTES;
}
size_t
crypto_aead_xchacha20poly1305_ietf_messagebytes_max(void)
{
return crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX;
}
void
crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
{
+6
View File
@@ -49,6 +49,12 @@ crypto_box_macbytes(void)
return crypto_box_MACBYTES;
}
size_t
crypto_box_messagebytes_max(void)
{
return crypto_box_MESSAGEBYTES_MAX;
}
const char *
crypto_box_primitive(void)
{
@@ -196,3 +196,9 @@ crypto_box_curve25519xchacha20poly1305_macbytes(void)
{
return crypto_box_curve25519xchacha20poly1305_MACBYTES;
}
size_t
crypto_box_curve25519xchacha20poly1305_messagebytes_max(void)
{
return crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX;
}
@@ -148,3 +148,9 @@ crypto_box_curve25519xsalsa20poly1305_macbytes(void)
{
return crypto_box_curve25519xsalsa20poly1305_MACBYTES;
}
size_t
crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void)
{
return crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX;
}
@@ -32,6 +32,12 @@ crypto_secretbox_macbytes(void)
return crypto_secretbox_MACBYTES;
}
size_t
crypto_secretbox_messagebytes_max(void)
{
return crypto_secretbox_MESSAGEBYTES_MAX;
}
const char *
crypto_secretbox_primitive(void)
{
@@ -169,3 +169,9 @@ crypto_secretbox_xchacha20poly1305_macbytes(void)
{
return crypto_secretbox_xchacha20poly1305_MACBYTES;
}
size_t
crypto_secretbox_xchacha20poly1305_messagebytes_max(void)
{
return crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX;
}
@@ -76,6 +76,12 @@ crypto_secretbox_xsalsa20poly1305_macbytes(void)
return crypto_secretbox_xsalsa20poly1305_MACBYTES;
}
size_t
crypto_secretbox_xsalsa20poly1305_messagebytes_max(void)
{
return crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX;
}
void
crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES])
{
+6
View File
@@ -31,6 +31,12 @@ crypto_sign_secretkeybytes(void)
return crypto_sign_SECRETKEYBYTES;
}
size_t
crypto_sign_messagebytes_max(void)
{
return crypto_sign_MESSAGEBYTES_MAX;
}
const char *
crypto_sign_primitive(void)
{
@@ -35,6 +35,12 @@ crypto_sign_ed25519_secretkeybytes(void)
return crypto_sign_ed25519_SECRETKEYBYTES;
}
size_t
crypto_sign_ed25519_messagebytes_max(void)
{
return crypto_sign_ed25519_MESSAGEBYTES_MAX;
}
int
crypto_sign_ed25519_sk_to_seed(unsigned char *seed, const unsigned char *sk)
{
@@ -26,6 +26,12 @@ crypto_stream_chacha20_noncebytes(void) {
return crypto_stream_chacha20_NONCEBYTES;
}
size_t
crypto_stream_chacha20_messagebytes_max(void)
{
return crypto_stream_chacha20_MESSAGEBYTES_MAX;
}
size_t
crypto_stream_chacha20_ietf_keybytes(void) {
return crypto_stream_chacha20_ietf_KEYBYTES;
@@ -36,6 +42,12 @@ crypto_stream_chacha20_ietf_noncebytes(void) {
return crypto_stream_chacha20_ietf_NONCEBYTES;
}
size_t
crypto_stream_chacha20_ietf_messagebytes_max(void)
{
return crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX;
}
int
crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
@@ -14,6 +14,12 @@ crypto_stream_noncebytes(void)
return crypto_stream_NONCEBYTES;
}
size_t
crypto_stream_messagebytes_max(void)
{
return crypto_stream_MESSAGEBYTES_MAX;
}
const char *
crypto_stream_primitive(void)
{
@@ -37,6 +37,12 @@ crypto_stream_salsa20_noncebytes(void)
return crypto_stream_salsa20_NONCEBYTES;
}
size_t
crypto_stream_salsa20_messagebytes_max(void)
{
return crypto_stream_salsa20_MESSAGEBYTES_MAX;
}
int
crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
@@ -13,6 +13,12 @@ crypto_stream_salsa2012_noncebytes(void)
return crypto_stream_salsa2012_NONCEBYTES;
}
size_t
crypto_stream_salsa2012_messagebytes_max(void)
{
return crypto_stream_salsa2012_MESSAGEBYTES_MAX;
}
void
crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
{
@@ -13,6 +13,12 @@ crypto_stream_salsa208_noncebytes(void)
return crypto_stream_salsa208_NONCEBYTES;
}
size_t
crypto_stream_salsa208_messagebyte_max(void)
{
return crypto_stream_salsa208_MESSAGEBYTES_MAX;
}
void
crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES])
{
@@ -19,6 +19,12 @@ crypto_stream_xchacha20_noncebytes(void)
return crypto_stream_xchacha20_NONCEBYTES;
}
size_t
crypto_stream_xchacha20_messagebytes_max(void)
{
return crypto_stream_xchacha20_MESSAGEBYTES_MAX;
}
int
crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
const unsigned char *n, const unsigned char *k)
@@ -53,6 +53,12 @@ crypto_stream_xsalsa20_noncebytes(void)
return crypto_stream_xsalsa20_NONCEBYTES;
}
size_t
crypto_stream_xsalsa20_messagebytes_max(void)
{
return crypto_stream_xsalsa20_MESSAGEBYTES_MAX;
}
void
crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES])
{
@@ -33,6 +33,8 @@ size_t crypto_aead_aes256gcm_abytes(void);
#define crypto_aead_aes256gcm_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \
(16ULL * ((1ULL << 32) - 2ULL)) - crypto_aead_aes256gcm_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_aes256gcm_messagebytes_max(void);
typedef CRYPTO_ALIGN(16) unsigned char crypto_aead_aes256gcm_state[512];
@@ -33,6 +33,8 @@ size_t crypto_aead_chacha20poly1305_ietf_abytes(void);
#define crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ietf_ABYTES, \
(64ULL * (1ULL << 32) - 64ULL) - crypto_aead_chacha20poly1305_ietf_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max(void);
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
@@ -104,6 +106,8 @@ size_t crypto_aead_chacha20poly1305_abytes(void);
#define crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX \
(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_chacha20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
@@ -157,10 +161,11 @@ void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20pol
/* Aliases */
#define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
#define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
#define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES
#define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES
#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES
#define crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
#ifdef __cplusplus
}
@@ -29,6 +29,8 @@ size_t crypto_aead_xchacha20poly1305_ietf_abytes(void);
#define crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX \
(SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES)
SODIUM_EXPORT
size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max(void);
SODIUM_EXPORT
int crypto_aead_xchacha20poly1305_ietf_encrypt(unsigned char *c,
@@ -82,10 +84,11 @@ void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchac
/* Aliases */
#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES
#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES
#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
#define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES
#define crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
#ifdef __cplusplus
}
@@ -41,6 +41,8 @@ SODIUM_EXPORT
size_t crypto_box_macbytes(void);
#define crypto_box_MESSAGEBYTES_MAX crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_box_messagebytes_max(void);
#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
SODIUM_EXPORT
@@ -39,6 +39,8 @@ size_t crypto_box_curve25519xchacha20poly1305_macbytes(void);
#define crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX \
(crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)
SODIUM_EXPORT
size_t crypto_box_curve25519xchacha20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char *pk,
@@ -39,6 +39,8 @@ size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \
(crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES)
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
@@ -30,6 +30,8 @@ SODIUM_EXPORT
const char *crypto_secretbox_primitive(void);
#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_secretbox_messagebytes_max(void);
SODIUM_EXPORT
int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
@@ -26,6 +26,8 @@ size_t crypto_secretbox_xchacha20poly1305_macbytes(void);
#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \
(crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
SODIUM_EXPORT
size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
@@ -27,6 +27,8 @@ size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
#define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \
(crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES)
SODIUM_EXPORT
size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void);
SODIUM_EXPORT
int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
@@ -42,6 +42,8 @@ SODIUM_EXPORT
size_t crypto_sign_secretkeybytes(void);
#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_sign_messagebytes_max(void);
#define crypto_sign_PRIMITIVE "ed25519"
SODIUM_EXPORT
@@ -36,6 +36,8 @@ SODIUM_EXPORT
size_t crypto_sign_ed25519_secretkeybytes(void);
#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)
SODIUM_EXPORT
size_t crypto_sign_ed25519_messagebytes_max(void);
SODIUM_EXPORT
int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
@@ -30,6 +30,8 @@ SODIUM_EXPORT
size_t crypto_stream_noncebytes(void);
#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX
SODIUM_EXPORT
size_t crypto_stream_messagebytes_max(void);
#define crypto_stream_PRIMITIVE "xsalsa20"
SODIUM_EXPORT
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_chacha20_noncebytes(void);
#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_chacha20_messagebytes_max(void);
/* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */
@@ -62,6 +64,8 @@ size_t crypto_stream_chacha20_ietf_noncebytes(void);
#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32))
SODIUM_EXPORT
size_t crypto_stream_chacha20_ietf_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_salsa20_noncebytes(void);
#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_salsa20_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
@@ -28,6 +28,8 @@ SODIUM_EXPORT
size_t crypto_stream_salsa2012_noncebytes(void);
#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_salsa2012_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
@@ -28,6 +28,8 @@ SODIUM_EXPORT
size_t crypto_stream_salsa208_noncebytes(void);
#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_salsa208_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_xchacha20_noncebytes(void);
#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_xchacha20_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
@@ -29,6 +29,8 @@ SODIUM_EXPORT
size_t crypto_stream_xsalsa20_noncebytes(void);
#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
SODIUM_EXPORT
size_t crypto_stream_xsalsa20_messagebytes_max(void);
SODIUM_EXPORT
int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
+1
View File
@@ -3236,6 +3236,7 @@ main(void)
assert(crypto_aead_aes256gcm_npubbytes() == crypto_aead_aes256gcm_NPUBBYTES);
assert(crypto_aead_aes256gcm_abytes() == crypto_aead_aes256gcm_ABYTES);
assert(crypto_aead_aes256gcm_statebytes() >= sizeof(crypto_aead_aes256gcm_state));
assert(crypto_aead_aes256gcm_messagebytes_max() == crypto_aead_aes256gcm_MESSAGEBYTES_MAX);
printf("OK\n");
return 0;
+2
View File
@@ -346,10 +346,12 @@ tv_ietf(void)
assert(crypto_aead_chacha20poly1305_ietf_npubbytes() > crypto_aead_chacha20poly1305_npubbytes());
assert(crypto_aead_chacha20poly1305_ietf_nsecbytes() == 0U);
assert(crypto_aead_chacha20poly1305_ietf_nsecbytes() == crypto_aead_chacha20poly1305_nsecbytes());
assert(crypto_aead_chacha20poly1305_ietf_messagebytes_max() == crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
assert(crypto_aead_chacha20poly1305_IETF_KEYBYTES == crypto_aead_chacha20poly1305_ietf_KEYBYTES);
assert(crypto_aead_chacha20poly1305_IETF_NSECBYTES == crypto_aead_chacha20poly1305_ietf_NSECBYTES);
assert(crypto_aead_chacha20poly1305_IETF_NPUBBYTES == crypto_aead_chacha20poly1305_ietf_NPUBBYTES);
assert(crypto_aead_chacha20poly1305_IETF_ABYTES == crypto_aead_chacha20poly1305_ietf_ABYTES);
assert(crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX == crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
return 0;
}
+2
View File
@@ -179,10 +179,12 @@ tv(void)
assert(crypto_aead_xchacha20poly1305_ietf_npubbytes() == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
assert(crypto_aead_xchacha20poly1305_ietf_nsecbytes() == 0U);
assert(crypto_aead_xchacha20poly1305_ietf_nsecbytes() == crypto_aead_xchacha20poly1305_ietf_NSECBYTES);
assert(crypto_aead_xchacha20poly1305_ietf_messagebytes_max() == crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX);
assert(crypto_aead_xchacha20poly1305_IETF_KEYBYTES == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
assert(crypto_aead_xchacha20poly1305_IETF_NSECBYTES == crypto_aead_xchacha20poly1305_ietf_NSECBYTES);
assert(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
assert(crypto_aead_xchacha20poly1305_IETF_ABYTES == crypto_aead_xchacha20poly1305_ietf_ABYTES);
assert(crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX == crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX);
return 0;
}
+3
View File
@@ -87,6 +87,7 @@ main(void)
assert(crypto_box_zerobytes() > 0U);
assert(crypto_box_boxzerobytes() > 0U);
assert(crypto_box_macbytes() > 0U);
assert(crypto_box_messagebytes_max() > 0U);
assert(strcmp(crypto_box_primitive(), "curve25519xsalsa20poly1305") == 0);
assert(crypto_box_curve25519xsalsa20poly1305_seedbytes() ==
crypto_box_seedbytes());
@@ -104,6 +105,8 @@ main(void)
crypto_box_boxzerobytes());
assert(crypto_box_curve25519xsalsa20poly1305_macbytes() ==
crypto_box_macbytes());
assert(crypto_box_curve25519xsalsa20poly1305_messagebytes_max() ==
crypto_box_messagebytes_max());
return 0;
}
+2
View File
@@ -175,10 +175,12 @@ main(void)
assert(crypto_stream_chacha20_keybytes() == crypto_stream_chacha20_KEYBYTES);
assert(crypto_stream_chacha20_noncebytes() > 0U);
assert(crypto_stream_chacha20_noncebytes() == crypto_stream_chacha20_NONCEBYTES);
assert(crypto_stream_chacha20_messagebytes_max() == crypto_stream_chacha20_MESSAGEBYTES_MAX);
assert(crypto_stream_chacha20_ietf_keybytes() > 0U);
assert(crypto_stream_chacha20_ietf_keybytes() == crypto_stream_chacha20_ietf_KEYBYTES);
assert(crypto_stream_chacha20_ietf_noncebytes() > 0U);
assert(crypto_stream_chacha20_ietf_noncebytes() == crypto_stream_chacha20_ietf_NONCEBYTES);
assert(crypto_stream_chacha20_ietf_messagebytes_max() == crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX);
return 0;
}
+3
View File
@@ -65,6 +65,7 @@ main(void)
assert(crypto_secretbox_zerobytes() > 0U);
assert(crypto_secretbox_boxzerobytes() > 0U);
assert(crypto_secretbox_macbytes() > 0U);
assert(crypto_secretbox_messagebytes_max() > 0U);
assert(strcmp(crypto_secretbox_primitive(), "xsalsa20poly1305") == 0);
assert(crypto_secretbox_keybytes() ==
crypto_secretbox_xsalsa20poly1305_keybytes());
@@ -76,6 +77,8 @@ main(void)
crypto_secretbox_xsalsa20poly1305_boxzerobytes());
assert(crypto_secretbox_macbytes() ==
crypto_secretbox_xsalsa20poly1305_macbytes());
assert(crypto_secretbox_messagebytes_max() ==
crypto_secretbox_xsalsa20poly1305_messagebytes_max());
return 0;
}
+2
View File
@@ -1300,9 +1300,11 @@ int main(void)
assert(crypto_sign_seedbytes() > 0U);
assert(crypto_sign_publickeybytes() > 0U);
assert(crypto_sign_secretkeybytes() > 0U);
assert(crypto_sign_messagebytes_max() > 0U);
assert(strcmp(crypto_sign_primitive(), "ed25519") == 0);
assert(crypto_sign_bytes() == crypto_sign_ed25519_bytes());
assert(crypto_sign_seedbytes() == crypto_sign_ed25519_seedbytes());
assert(crypto_sign_messagebytes_max() == crypto_sign_ed25519_messagebytes_max());
assert(crypto_sign_publickeybytes()
== crypto_sign_ed25519_publickeybytes());
assert(crypto_sign_secretkeybytes()
+2
View File
@@ -55,9 +55,11 @@ main(void)
assert(crypto_stream_keybytes() > 0U);
assert(crypto_stream_noncebytes() > 0U);
assert(crypto_stream_messagebytes_max() > 0U);
assert(strcmp(crypto_stream_primitive(), "xsalsa20") == 0);
assert(crypto_stream_keybytes() == crypto_stream_xsalsa20_keybytes());
assert(crypto_stream_noncebytes() == crypto_stream_xsalsa20_noncebytes());
assert(crypto_stream_messagebytes_max() == crypto_stream_xsalsa20_messagebytes_max());
return 0;
}
+1
View File
@@ -41,6 +41,7 @@ main(void)
assert(crypto_stream_salsa20_keybytes() > 0U);
assert(crypto_stream_salsa20_noncebytes() > 0U);
assert(crypto_stream_salsa20_messagebytes_max() > 0U);
return 0;
}
+1
View File
@@ -405,6 +405,7 @@ tv_box_xchacha20poly1305(void)
assert(crypto_box_curve25519xchacha20poly1305_beforenmbytes() == crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES);
assert(crypto_box_curve25519xchacha20poly1305_noncebytes() == crypto_box_curve25519xchacha20poly1305_NONCEBYTES);
assert(crypto_box_curve25519xchacha20poly1305_macbytes() == crypto_box_curve25519xchacha20poly1305_MACBYTES);
assert(crypto_box_curve25519xchacha20poly1305_messagebytes_max() == crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX);
printf("tv_box_xchacha20poly1305: ok\n");
}