mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
BYTES_MAX -> MESSAGEBYTES_MAX
This commit is contained in:
@@ -524,7 +524,7 @@ crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c,
|
||||
|
||||
(void) nsec;
|
||||
memcpy(H, ctx->H, sizeof H);
|
||||
if (mlen > crypto_aead_aes256gcm_BYTES_MAX) {
|
||||
if (mlen > crypto_aead_aes256gcm_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
memcpy(&n2[0], npub, 3 * 4);
|
||||
@@ -662,7 +662,7 @@ crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m, unsigned char *
|
||||
CRYPTO_ALIGN(16) unsigned char fb[16];
|
||||
|
||||
(void) nsec;
|
||||
if (clen > crypto_aead_aes256gcm_BYTES_MAX) {
|
||||
if (clen > crypto_aead_aes256gcm_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
mlen = clen;
|
||||
|
||||
@@ -70,7 +70,7 @@ crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
|
||||
unsigned long long clen = 0ULL;
|
||||
int ret;
|
||||
|
||||
if (mlen > crypto_aead_chacha20poly1305_BYTES_MAX) {
|
||||
if (mlen > crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
}
|
||||
ret = crypto_aead_chacha20poly1305_encrypt_detached(c,
|
||||
@@ -145,7 +145,7 @@ crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
|
||||
unsigned long long clen = 0ULL;
|
||||
int ret;
|
||||
|
||||
if (mlen > crypto_aead_chacha20poly1305_ietf_BYTES_MAX) {
|
||||
if (mlen > crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
}
|
||||
ret = crypto_aead_chacha20poly1305_ietf_encrypt_detached(c,
|
||||
|
||||
@@ -40,7 +40,7 @@ crypto_box_easy_afternm(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_box_BYTES_MAX) {
|
||||
if (mlen > crypto_box_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_box_detached_afternm(c + crypto_box_MACBYTES, c, m, mlen, n,
|
||||
@@ -52,7 +52,7 @@ crypto_box_easy(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *n,
|
||||
const unsigned char *pk, const unsigned char *sk)
|
||||
{
|
||||
if (mlen > crypto_box_BYTES_MAX) {
|
||||
if (mlen > crypto_box_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_box_detached(c + crypto_box_MACBYTES, c, m, mlen, n,
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@ crypto_box_curve25519xchacha20poly1305_easy_afternm(unsigned char *c,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_box_curve25519xchacha20poly1305_BYTES_MAX) {
|
||||
if (mlen > crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_box_curve25519xchacha20poly1305_detached_afternm(
|
||||
@@ -98,7 +98,7 @@ crypto_box_curve25519xchacha20poly1305_easy(
|
||||
unsigned char *c, const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *n, const unsigned char *pk, const unsigned char *sk)
|
||||
{
|
||||
if (mlen > crypto_box_curve25519xchacha20poly1305_BYTES_MAX) {
|
||||
if (mlen > crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_box_curve25519xchacha20poly1305_detached(
|
||||
|
||||
@@ -71,7 +71,7 @@ crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_secretbox_BYTES_MAX) {
|
||||
if (mlen > crypto_secretbox_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_secretbox_detached(c + crypto_secretbox_MACBYTES,
|
||||
|
||||
@@ -77,7 +77,7 @@ crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
|
||||
const unsigned char *n,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_secretbox_xchacha20poly1305_BYTES_MAX) {
|
||||
if (mlen > crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
}
|
||||
return crypto_secretbox_xchacha20poly1305_detached
|
||||
|
||||
@@ -83,7 +83,7 @@ crypto_sign_edwards25519sha512batch_open(unsigned char *m,
|
||||
ge_p3 cs3;
|
||||
|
||||
*mlen_p = 0;
|
||||
if (smlen < 64 || smlen - 64 > crypto_sign_edwards25519sha512batch_BYTES_MAX) {
|
||||
if (smlen < 64 || smlen - 64 > crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
}
|
||||
mlen = smlen - 64;
|
||||
|
||||
@@ -171,7 +171,7 @@ crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
|
||||
{
|
||||
unsigned long long mlen;
|
||||
|
||||
if (smlen < 64 || smlen - 64 > crypto_sign_ed25519_BYTES_MAX) {
|
||||
if (smlen < 64 || smlen - 64 > crypto_sign_ed25519_MESSAGEBYTES_MAX) {
|
||||
goto badsig;
|
||||
}
|
||||
mlen = smlen - 64;
|
||||
|
||||
@@ -77,7 +77,7 @@ chacha20_encrypt_bytes(chacha_ctx *ctx, const uint8_t *m, uint8_t *c,
|
||||
if (!bytes) {
|
||||
return; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (bytes > crypto_stream_chacha20_BYTES_MAX) {
|
||||
if (bytes > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
}
|
||||
# include "u8.h"
|
||||
|
||||
@@ -72,7 +72,7 @@ chacha20_encrypt_bytes(chacha_ctx *ctx, const uint8_t *m, uint8_t *c,
|
||||
if (!bytes) {
|
||||
return; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (bytes > crypto_stream_chacha20_BYTES_MAX) {
|
||||
if (bytes > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
}
|
||||
# include "u4.h"
|
||||
|
||||
@@ -92,7 +92,7 @@ chacha20_encrypt_bytes(chacha_ctx *ctx, const uint8_t *m, uint8_t *c,
|
||||
if (!bytes) {
|
||||
return; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (bytes > crypto_stream_chacha20_BYTES_MAX) {
|
||||
if (bytes > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
}
|
||||
j0 = ctx->input[0];
|
||||
|
||||
@@ -30,7 +30,7 @@ size_t crypto_aead_aes256gcm_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_aes256gcm_abytes(void);
|
||||
|
||||
#define crypto_aead_aes256gcm_BYTES_MAX \
|
||||
#define crypto_aead_aes256gcm_MESSAGEBYTES_MAX \
|
||||
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \
|
||||
(16ULL * ((1ULL << 32) - 2ULL)) - crypto_aead_aes256gcm_ABYTES)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ size_t crypto_aead_chacha20poly1305_ietf_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_chacha20poly1305_ietf_abytes(void);
|
||||
|
||||
#define crypto_aead_chacha20poly1305_ietf_BYTES_MAX \
|
||||
#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)
|
||||
|
||||
@@ -102,7 +102,7 @@ size_t crypto_aead_chacha20poly1305_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_chacha20poly1305_abytes(void);
|
||||
|
||||
#define crypto_aead_chacha20poly1305_BYTES_MAX \
|
||||
#define crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX \
|
||||
(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ABYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
|
||||
@@ -27,7 +27,7 @@ size_t crypto_aead_xchacha20poly1305_ietf_npubbytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_aead_xchacha20poly1305_ietf_abytes(void);
|
||||
|
||||
#define crypto_aead_xchacha20poly1305_ietf_BYTES_MAX \
|
||||
#define crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX \
|
||||
(SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
|
||||
@@ -40,7 +40,7 @@ size_t crypto_box_noncebytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_macbytes(void);
|
||||
|
||||
#define crypto_box_BYTES_MAX crypto_box_curve25519xsalsa20poly1305_BYTES_MAX
|
||||
#define crypto_box_MESSAGEBYTES_MAX crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
|
||||
|
||||
#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
|
||||
SODIUM_EXPORT
|
||||
|
||||
@@ -37,8 +37,8 @@ size_t crypto_box_curve25519xchacha20poly1305_noncebytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xchacha20poly1305_macbytes(void);
|
||||
|
||||
#define crypto_box_curve25519xchacha20poly1305_BYTES_MAX \
|
||||
(crypto_stream_xchacha20_BYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)
|
||||
#define crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX \
|
||||
(crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char *pk,
|
||||
|
||||
@@ -48,8 +48,8 @@ size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void);
|
||||
|
||||
#define crypto_box_curve25519xsalsa20poly1305_BYTES_MAX \
|
||||
(crypto_stream_xsalsa20_BYTES_MAX - crypto_box_curve25519xsalsa20poly1305_ZEROBYTES)
|
||||
#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \
|
||||
(crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_ZEROBYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_box_curve25519xsalsa20poly1305(unsigned char *c,
|
||||
|
||||
@@ -29,7 +29,7 @@ size_t crypto_secretbox_macbytes(void);
|
||||
SODIUM_EXPORT
|
||||
const char *crypto_secretbox_primitive(void);
|
||||
|
||||
#define crypto_secretbox_BYTES_MAX crypto_secretbox_xsalsa20poly1305_BYTES_MAX
|
||||
#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
|
||||
|
||||
@@ -24,8 +24,8 @@ size_t crypto_secretbox_xchacha20poly1305_noncebytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_secretbox_xchacha20poly1305_macbytes(void);
|
||||
|
||||
#define crypto_secretbox_xchacha20poly1305_BYTES_MAX \
|
||||
(crypto_stream_xchacha20_BYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
|
||||
#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \
|
||||
(crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
|
||||
|
||||
@@ -24,8 +24,8 @@ size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
|
||||
|
||||
#define crypto_secretbox_xsalsa20poly1305_BYTES_MAX \
|
||||
(crypto_stream_xsalsa20_BYTES_MAX - crypto_secretbox_xsalsa20poly1305_ZEROBYTES)
|
||||
#define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \
|
||||
(crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_ZEROBYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
|
||||
|
||||
@@ -41,7 +41,7 @@ size_t crypto_sign_publickeybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_sign_secretkeybytes(void);
|
||||
|
||||
#define crypto_sign_BYTES_MAX crypto_sign_ed25519_BYTES_MAX
|
||||
#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX
|
||||
|
||||
#define crypto_sign_PRIMITIVE "ed25519"
|
||||
SODIUM_EXPORT
|
||||
|
||||
@@ -35,7 +35,7 @@ size_t crypto_sign_ed25519_publickeybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_sign_ed25519_secretkeybytes(void);
|
||||
|
||||
#define crypto_sign_ed25519_BYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)
|
||||
#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
|
||||
|
||||
@@ -25,7 +25,7 @@ extern "C" {
|
||||
#define crypto_sign_edwards25519sha512batch_BYTES 64U
|
||||
#define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U
|
||||
#define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U)
|
||||
#define crypto_sign_edwards25519sha512batch_BYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES)
|
||||
#define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES)
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_sign_edwards25519sha512batch(unsigned char *sm,
|
||||
|
||||
@@ -29,7 +29,7 @@ size_t crypto_stream_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_noncebytes(void);
|
||||
|
||||
#define crypto_stream_BYTES_MAX crypto_stream_xsalsa20_BYTES_MAX
|
||||
#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX
|
||||
|
||||
#define crypto_stream_PRIMITIVE "xsalsa20"
|
||||
SODIUM_EXPORT
|
||||
|
||||
@@ -28,7 +28,7 @@ size_t crypto_stream_chacha20_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_chacha20_noncebytes(void);
|
||||
|
||||
#define crypto_stream_chacha20_BYTES_MAX SODIUM_SIZE_MAX
|
||||
#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
|
||||
|
||||
/* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */
|
||||
|
||||
@@ -60,7 +60,7 @@ size_t crypto_stream_chacha20_ietf_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_chacha20_ietf_noncebytes(void);
|
||||
|
||||
#define crypto_stream_chacha20_ietf_BYTES_MAX \
|
||||
#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \
|
||||
SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32))
|
||||
|
||||
SODIUM_EXPORT
|
||||
@@ -85,7 +85,7 @@ void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_i
|
||||
|
||||
#define crypto_stream_chacha20_IETF_KEYBYTES crypto_stream_chacha20_ietf_KEYBYTES
|
||||
#define crypto_stream_chacha20_IETF_NONCEBYTES crypto_stream_chacha20_ietf_NONCEBYTES
|
||||
#define crypto_stream_chacha20_IETF_BYTES_MAX crypto_stream_chacha20_ietf_BYTES_MAX
|
||||
#define crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ size_t crypto_stream_salsa20_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_salsa20_noncebytes(void);
|
||||
|
||||
#define crypto_stream_salsa20_BYTES_MAX SODIUM_SIZE_MAX
|
||||
#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
|
||||
|
||||
@@ -27,7 +27,7 @@ size_t crypto_stream_salsa2012_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_salsa2012_noncebytes(void);
|
||||
|
||||
#define crypto_stream_salsa2012_BYTES_MAX SODIUM_SIZE_MAX
|
||||
#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
|
||||
|
||||
@@ -27,7 +27,7 @@ size_t crypto_stream_salsa208_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_salsa208_noncebytes(void);
|
||||
|
||||
#define crypto_stream_salsa208_BYTES_MAX SODIUM_SIZE_MAX
|
||||
#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
|
||||
|
||||
@@ -28,7 +28,7 @@ size_t crypto_stream_xchacha20_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_xchacha20_noncebytes(void);
|
||||
|
||||
#define crypto_stream_xchacha20_BYTES_MAX SODIUM_SIZE_MAX
|
||||
#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
|
||||
|
||||
@@ -28,7 +28,7 @@ size_t crypto_stream_xsalsa20_keybytes(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_stream_xsalsa20_noncebytes(void);
|
||||
|
||||
#define crypto_stream_xsalsa20_BYTES_MAX SODIUM_SIZE_MAX
|
||||
#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
|
||||
|
||||
Reference in New Issue
Block a user