initbytes -> headerbytes for clarity

This commit is contained in:
Frank Denis 2017-09-16 23:21:28 +02:00
parent e8f1c0be66
commit bfab44aa40
6 changed files with 20 additions and 19 deletions

View File

@ -385,7 +385,7 @@ _crypto_secretbox_zerobytes 0 1
_crypto_secretstream_xchacha20poly1305_abytes 1 1
_crypto_secretstream_xchacha20poly1305_init_pull 1 1
_crypto_secretstream_xchacha20poly1305_init_push 1 1
_crypto_secretstream_xchacha20poly1305_initbytes 1 1
_crypto_secretstream_xchacha20poly1305_headerbytes 1 1
_crypto_secretstream_xchacha20poly1305_keybytes 1 1
_crypto_secretstream_xchacha20poly1305_keygen 1 1
_crypto_secretstream_xchacha20poly1305_messagebytes_max 1 1
@ -553,6 +553,7 @@ _sodium_pad 1 1
_sodium_runtime_has_aesni 0 0
_sodium_runtime_has_avx 0 0
_sodium_runtime_has_avx2 0 0
_sodium_runtime_has_avx512f 0 0
_sodium_runtime_has_neon 0 0
_sodium_runtime_has_pclmul 0 0
_sodium_runtime_has_sse2 0 0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29,19 +29,19 @@ crypto_secretstream_xchacha20poly1305_keygen
int
crypto_secretstream_xchacha20poly1305_init_push
(crypto_secretstream_xchacha20poly1305_state *state,
unsigned char out[crypto_secretstream_xchacha20poly1305_INITBYTES],
unsigned char out[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
{
COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_INITBYTES ==
COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_HEADERBYTES ==
crypto_core_hchacha20_INPUTBYTES +
crypto_secretstream_xchacha20poly1305_INONCEBYTES);
COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_INITBYTES ==
COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_HEADERBYTES ==
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
COMPILER_ASSERT(sizeof state->nonce ==
crypto_secretstream_xchacha20poly1305_INONCEBYTES +
crypto_secretstream_xchacha20poly1305_COUNTERBYTES);
randombytes_buf(out, crypto_secretstream_xchacha20poly1305_INITBYTES);
randombytes_buf(out, crypto_secretstream_xchacha20poly1305_HEADERBYTES);
crypto_core_hchacha20(state->k, out, k, NULL);
memset(state->nonce, 0, crypto_secretstream_xchacha20poly1305_COUNTERBYTES);
memcpy(state->nonce + crypto_secretstream_xchacha20poly1305_COUNTERBYTES,
@ -55,7 +55,7 @@ crypto_secretstream_xchacha20poly1305_init_push
int
crypto_secretstream_xchacha20poly1305_init_pull
(crypto_secretstream_xchacha20poly1305_state *state,
const unsigned char in[crypto_secretstream_xchacha20poly1305_INITBYTES],
const unsigned char in[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
{
crypto_core_hchacha20(state->k, in, k, NULL);
@ -248,9 +248,9 @@ crypto_secretstream_xchacha20poly1305_abytes(void)
}
size_t
crypto_secretstream_xchacha20poly1305_initbytes(void)
crypto_secretstream_xchacha20poly1305_headerbytes(void)
{
return crypto_secretstream_xchacha20poly1305_INITBYTES;
return crypto_secretstream_xchacha20poly1305_HEADERBYTES;
}
size_t

View File

@ -19,10 +19,10 @@ extern "C" {
SODIUM_EXPORT
size_t crypto_secretstream_xchacha20poly1305_abytes(void);
#define crypto_secretstream_xchacha20poly1305_INITBYTES \
#define crypto_secretstream_xchacha20poly1305_HEADERBYTES \
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
SODIUM_EXPORT
size_t crypto_secretstream_xchacha20poly1305_initbytes(void);
size_t crypto_secretstream_xchacha20poly1305_headerbytes(void);
#define crypto_secretstream_xchacha20poly1305_KEYBYTES \
crypto_aead_xchacha20poly1305_ietf_KEYBYTES
@ -68,7 +68,7 @@ void crypto_secretstream_xchacha20poly1305_keygen
SODIUM_EXPORT
int crypto_secretstream_xchacha20poly1305_init_push
(crypto_secretstream_xchacha20poly1305_state *state,
unsigned char header[crypto_secretstream_xchacha20poly1305_INITBYTES],
unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
SODIUM_EXPORT
@ -81,7 +81,7 @@ int crypto_secretstream_xchacha20poly1305_push
SODIUM_EXPORT
int crypto_secretstream_xchacha20poly1305_init_pull
(crypto_secretstream_xchacha20poly1305_state *state,
const unsigned char header[crypto_secretstream_xchacha20poly1305_INITBYTES],
const unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES]);
SODIUM_EXPORT

View File

@ -18,7 +18,7 @@ main(void)
state = (crypto_secretstream_xchacha20poly1305_state *)
sodium_malloc(crypto_secretstream_xchacha20poly1305_statebytes());
header = (unsigned char *)
sodium_malloc(crypto_secretstream_xchacha20poly1305_INITBYTES);
sodium_malloc(crypto_secretstream_xchacha20poly1305_HEADERBYTES);
m1_len = randombytes_uniform(1000);
m2_len = randombytes_uniform(1000);
@ -177,8 +177,8 @@ main(void)
assert(crypto_secretstream_xchacha20poly1305_abytes() ==
crypto_secretstream_xchacha20poly1305_ABYTES);
assert(crypto_secretstream_xchacha20poly1305_initbytes() ==
crypto_secretstream_xchacha20poly1305_INITBYTES);
assert(crypto_secretstream_xchacha20poly1305_headerbytes() ==
crypto_secretstream_xchacha20poly1305_HEADERBYTES);
assert(crypto_secretstream_xchacha20poly1305_keybytes() ==
crypto_secretstream_xchacha20poly1305_KEYBYTES);
assert(crypto_secretstream_xchacha20poly1305_messagebytes_max() ==