Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Enumerations | Functions
Botan::Sodium Namespace Reference

## Enumerations
enum | Sodium_Constants : size_t { SODIUM_SIZE_MAX = 0xFFFFFFFF, crypto_aead_chacha20poly1305_ABYTES = 16, crypto_aead_chacha20poly1305_KEYBYTES = 32, crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_aead_chacha20poly1305_NPUBBYTES = 8, crypto_aead_chacha20poly1305_NSECBYTES = 0, crypto_aead_chacha20poly1305_ietf_ABYTES = 16, crypto_aead_chacha20poly1305_ietf_KEYBYTES = 32, crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_aead_chacha20poly1305_ietf_NPUBBYTES = 12, crypto_aead_chacha20poly1305_ietf_NSECBYTES = 0, crypto_aead_xchacha20poly1305_ietf_ABYTES = 16, crypto_aead_xchacha20poly1305_ietf_KEYBYTES = 32, crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_aead_xchacha20poly1305_ietf_NPUBBYTES = 24, crypto_aead_xchacha20poly1305_ietf_NSECBYTES = 0, crypto_auth_hmacsha256_BYTES = 32, crypto_auth_hmacsha256_KEYBYTES = 32, crypto_auth_hmacsha512256_BYTES = 32, crypto_auth_hmacsha512256_KEYBYTES = 32, crypto_auth_hmacsha512_BYTES = 64, crypto_auth_hmacsha512_KEYBYTES = 32, crypto_auth_BYTES = crypto_auth_hmacsha512256_BYTES, crypto_auth_KEYBYTES = crypto_auth_hmacsha512256_KEYBYTES, crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES = 32, crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES = 16, crypto_box_curve25519xsalsa20poly1305_MACBYTES = 16, crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_box_curve25519xsalsa20poly1305_NONCEBYTES = 24, crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES = 32, crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES = 32, crypto_box_curve25519xsalsa20poly1305_SEEDBYTES = 32, crypto_box_curve25519xsalsa20poly1305_ZEROBYTES = crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES + crypto_box_curve25519xsalsa20poly1305_MACBYTES, crypto_box_BEFORENMBYTES = crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES, crypto_box_BOXZEROBYTES = crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES, crypto_box_MACBYTES = crypto_box_curve25519xsalsa20poly1305_MACBYTES, crypto_box_MESSAGEBYTES_MAX = crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX, crypto_box_NONCEBYTES = crypto_box_curve25519xsalsa20poly1305_NONCEBYTES, crypto_box_PUBLICKEYBYTES = crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES, crypto_box_SECRETKEYBYTES = crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES, crypto_box_SEEDBYTES = crypto_box_curve25519xsalsa20poly1305_SEEDBYTES, crypto_box_ZEROBYTES = crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, crypto_core_hchacha20_CONSTBYTES = 16, crypto_core_hchacha20_INPUTBYTES = 16, crypto_core_hchacha20_KEYBYTES = 32, crypto_core_hchacha20_OUTPUTBYTES = 32, crypto_core_hsalsa20_CONSTBYTES = 16, crypto_core_hsalsa20_INPUTBYTES = 16, crypto_core_hsalsa20_KEYBYTES = 32, crypto_core_hsalsa20_OUTPUTBYTES = 32, crypto_hash_sha256_BYTES = 32, crypto_hash_sha512_BYTES = 64, crypto_hash_BYTES = crypto_hash_sha512_BYTES, crypto_onetimeauth_poly1305_BYTES = 16, crypto_onetimeauth_poly1305_KEYBYTES = 32, crypto_onetimeauth_BYTES = crypto_onetimeauth_poly1305_BYTES, crypto_onetimeauth_KEYBYTES = crypto_onetimeauth_poly1305_KEYBYTES, crypto_scalarmult_curve25519_BYTES = 32, crypto_scalarmult_curve25519_SCALARBYTES = 32, crypto_scalarmult_BYTES = crypto_scalarmult_curve25519_BYTES, crypto_scalarmult_SCALARBYTES = crypto_scalarmult_curve25519_SCALARBYTES, crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES = 16, crypto_secretbox_xsalsa20poly1305_KEYBYTES = 32, crypto_secretbox_xsalsa20poly1305_MACBYTES = 16, crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_secretbox_xsalsa20poly1305_NONCEBYTES = 24, crypto_secretbox_xsalsa20poly1305_ZEROBYTES = crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + crypto_secretbox_xsalsa20poly1305_MACBYTES, crypto_secretbox_BOXZEROBYTES = crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES, crypto_secretbox_KEYBYTES = crypto_secretbox_xsalsa20poly1305_KEYBYTES, crypto_secretbox_MACBYTES = crypto_secretbox_xsalsa20poly1305_MACBYTES, crypto_secretbox_MESSAGEBYTES_MAX = crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX, crypto_secretbox_NONCEBYTES = crypto_secretbox_xsalsa20poly1305_NONCEBYTES, crypto_secretbox_ZEROBYTES = crypto_secretbox_xsalsa20poly1305_ZEROBYTES, crypto_shorthash_siphash24_BYTES = 8, crypto_shorthash_siphash24_KEYBYTES = 16, crypto_shorthash_BYTES = crypto_shorthash_siphash24_BYTES, crypto_shorthash_KEYBYTES = crypto_shorthash_siphash24_KEYBYTES, crypto_sign_ed25519_BYTES = 64, crypto_sign_ed25519_MESSAGEBYTES_MAX = (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES), crypto_sign_ed25519_PUBLICKEYBYTES = 32, crypto_sign_ed25519_SECRETKEYBYTES = (32 + 32), crypto_sign_ed25519_SEEDBYTES = 32, crypto_sign_BYTES = crypto_sign_ed25519_BYTES, crypto_sign_MESSAGEBYTES_MAX = crypto_sign_ed25519_MESSAGEBYTES_MAX, crypto_sign_PUBLICKEYBYTES = crypto_sign_ed25519_PUBLICKEYBYTES, crypto_sign_SECRETKEYBYTES = crypto_sign_ed25519_SECRETKEYBYTES, crypto_sign_SEEDBYTES = crypto_sign_ed25519_SEEDBYTES, crypto_stream_chacha20_KEYBYTES = 32, crypto_stream_chacha20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_stream_chacha20_NONCEBYTES = 8, crypto_stream_chacha20_ietf_KEYBYTES = 32, crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_stream_chacha20_ietf_NONCEBYTES = 12, crypto_stream_salsa20_KEYBYTES = 32, crypto_stream_salsa20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_stream_salsa20_NONCEBYTES = 8, crypto_stream_xchacha20_KEYBYTES = 32, crypto_stream_xchacha20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_stream_xchacha20_NONCEBYTES = 24, crypto_stream_xsalsa20_KEYBYTES = 32, crypto_stream_xsalsa20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX, crypto_stream_xsalsa20_NONCEBYTES = 24, crypto_stream_KEYBYTES = crypto_stream_xsalsa20_KEYBYTES, crypto_stream_MESSAGEBYTES_MAX = crypto_stream_xsalsa20_MESSAGEBYTES_MAX, crypto_stream_NONCEBYTES = crypto_stream_xsalsa20_NONCEBYTES, crypto_verify_16_BYTES = 16, crypto_verify_32_BYTES = 32, crypto_verify_64_BYTES = 64, randombytes_SEEDBYTES = 32 }

## Functions
size_t | crypto_aead_chacha20poly1305_abytes ()
int | crypto_aead_chacha20poly1305_decrypt (uint8_t m[], unsigned long long *ptext_len, uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_chacha20poly1305_decrypt_detached (uint8_t m[], uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t mac[], const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_chacha20poly1305_encrypt (uint8_t ctext[], unsigned long long *ctext_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_chacha20poly1305_encrypt_detached (uint8_t ctext[], uint8_t mac[], unsigned long long *mac_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
size_t | crypto_aead_chacha20poly1305_ietf_abytes ()
int | crypto_aead_chacha20poly1305_ietf_decrypt (uint8_t ptext[], unsigned long long *ptext_len, uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_chacha20poly1305_ietf_decrypt_detached (uint8_t m[], uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t mac[], const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_chacha20poly1305_ietf_encrypt (uint8_t ctext[], unsigned long long *ctext_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_chacha20poly1305_ietf_encrypt_detached (uint8_t ctext[], uint8_t mac[], unsigned long long *mac_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
size_t | crypto_aead_chacha20poly1305_ietf_keybytes ()
void | crypto_aead_chacha20poly1305_ietf_keygen (uint8_t k[32])
size_t | crypto_aead_chacha20poly1305_ietf_messagebytes_max ()
size_t | crypto_aead_chacha20poly1305_ietf_npubbytes ()
size_t | crypto_aead_chacha20poly1305_ietf_nsecbytes ()
size_t | crypto_aead_chacha20poly1305_keybytes ()
void | crypto_aead_chacha20poly1305_keygen (uint8_t k[32])
size_t | crypto_aead_chacha20poly1305_messagebytes_max ()
size_t | crypto_aead_chacha20poly1305_npubbytes ()
size_t | crypto_aead_chacha20poly1305_nsecbytes ()
size_t | crypto_aead_xchacha20poly1305_ietf_abytes ()
int | crypto_aead_xchacha20poly1305_ietf_decrypt (uint8_t ptext[], unsigned long long *ptext_len, uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_xchacha20poly1305_ietf_decrypt_detached (uint8_t ptext[], uint8_t unused_secret_nonce[], const uint8_t ctext[], size_t ctext_len, const uint8_t mac[], const uint8_t ad[], size_t ad_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_xchacha20poly1305_ietf_encrypt (uint8_t ctext[], unsigned long long *ctext_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
int | crypto_aead_xchacha20poly1305_ietf_encrypt_detached (uint8_t ctext[], uint8_t mac[], unsigned long long *mac_len, const uint8_t ptext[], size_t ptext_len, const uint8_t ad[], size_t ad_len, const uint8_t unused_secret_nonce[], const uint8_t nonce[], const uint8_t key[])
size_t | crypto_aead_xchacha20poly1305_ietf_keybytes ()
void | crypto_aead_xchacha20poly1305_ietf_keygen (uint8_t k[32])
size_t | crypto_aead_xchacha20poly1305_ietf_messagebytes_max ()
size_t | crypto_aead_xchacha20poly1305_ietf_npubbytes ()
size_t | crypto_aead_xchacha20poly1305_ietf_nsecbytes ()
int | crypto_auth (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t | crypto_auth_bytes ()
int | crypto_auth_hmacsha256 (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t | crypto_auth_hmacsha256_bytes ()
size_t | crypto_auth_hmacsha256_keybytes ()
void | crypto_auth_hmacsha256_keygen (uint8_t k[32])
int | crypto_auth_hmacsha256_verify (const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
int | crypto_auth_hmacsha512 (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
int | crypto_auth_hmacsha512256 (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t | crypto_auth_hmacsha512256_bytes ()
size_t | crypto_auth_hmacsha512256_keybytes ()
void | crypto_auth_hmacsha512256_keygen (uint8_t k[32])
int | crypto_auth_hmacsha512256_verify (const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t | crypto_auth_hmacsha512_bytes ()
size_t | crypto_auth_hmacsha512_keybytes ()
void | crypto_auth_hmacsha512_keygen (uint8_t k[32])
int | crypto_auth_hmacsha512_verify (const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t | crypto_auth_keybytes ()
void | crypto_auth_keygen (uint8_t k[])
const char * | crypto_auth_primitive ()
int | crypto_auth_verify (const uint8_t mac[], const uint8_t in[], size_t in_len, const uint8_t key[])
int | crypto_box (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_afternm (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_box_beforenm (uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
size_t | crypto_box_beforenmbytes ()
size_t | crypto_box_boxzerobytes ()
int | crypto_box_curve25519xsalsa20poly1305 (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_curve25519xsalsa20poly1305_afternm (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_box_curve25519xsalsa20poly1305_beforenm (uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
size_t | crypto_box_curve25519xsalsa20poly1305_beforenmbytes ()
size_t | crypto_box_curve25519xsalsa20poly1305_boxzerobytes ()
int | crypto_box_curve25519xsalsa20poly1305_keypair (uint8_t pk[32], uint8_t sk[32])
size_t | crypto_box_curve25519xsalsa20poly1305_macbytes ()
size_t | crypto_box_curve25519xsalsa20poly1305_messagebytes_max ()
size_t | crypto_box_curve25519xsalsa20poly1305_noncebytes ()
int | crypto_box_curve25519xsalsa20poly1305_open (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_curve25519xsalsa20poly1305_open_afternm (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_box_curve25519xsalsa20poly1305_publickeybytes ()
size_t | crypto_box_curve25519xsalsa20poly1305_secretkeybytes ()
int | crypto_box_curve25519xsalsa20poly1305_seed_keypair (uint8_t pk[32], uint8_t sk[32], const uint8_t seed[32])
size_t | crypto_box_curve25519xsalsa20poly1305_seedbytes ()
size_t | crypto_box_curve25519xsalsa20poly1305_zerobytes ()
int | crypto_box_detached (uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_detached_afternm (uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_box_easy (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_easy_afternm (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_box_keypair (uint8_t pk[32], uint8_t sk[32])
size_t | crypto_box_macbytes ()
size_t | crypto_box_messagebytes_max ()
size_t | crypto_box_noncebytes ()
int | crypto_box_open (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_open_afternm (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_box_open_detached (uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_open_detached_afternm (uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_box_open_easy (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
int | crypto_box_open_easy_afternm (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
const char * | crypto_box_primitive ()
size_t | crypto_box_publickeybytes ()
size_t | crypto_box_secretkeybytes ()
int | crypto_box_seed_keypair (uint8_t pk[32], uint8_t sk[32], const uint8_t seed[])
size_t | crypto_box_seedbytes ()
size_t | crypto_box_zerobytes ()
int | crypto_core_hsalsa20 (uint8_t out[], const uint8_t in[], const uint8_t key[], const uint8_t c[])
size_t | crypto_core_hsalsa20_constbytes ()
size_t | crypto_core_hsalsa20_inputbytes ()
size_t | crypto_core_hsalsa20_keybytes ()
size_t | crypto_core_hsalsa20_outputbytes ()
int | crypto_hash (uint8_t out[], const uint8_t in[], size_t in_len)
size_t | crypto_hash_bytes ()
const char * | crypto_hash_primitive ()
int | crypto_hash_sha256 (uint8_t out[], const uint8_t in[], size_t in_len)
size_t | crypto_hash_sha256_bytes ()
int | crypto_hash_sha512 (uint8_t out[64], const uint8_t in[], size_t in_len)
size_t | crypto_hash_sha512_bytes ()
int | crypto_onetimeauth (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t | crypto_onetimeauth_bytes ()
size_t | crypto_onetimeauth_keybytes ()
void | crypto_onetimeauth_keygen (uint8_t k[32])
int | crypto_onetimeauth_poly1305 (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
size_t | crypto_onetimeauth_poly1305_bytes ()
size_t | crypto_onetimeauth_poly1305_keybytes ()
void | crypto_onetimeauth_poly1305_keygen (uint8_t k[32])
int | crypto_onetimeauth_poly1305_verify (const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
const char * | crypto_onetimeauth_primitive ()
int | crypto_onetimeauth_verify (const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
int | crypto_scalarmult (uint8_t out[], const uint8_t scalar[], const uint8_t base[])
int | crypto_scalarmult_base (uint8_t out[], const uint8_t scalar[])
size_t | crypto_scalarmult_bytes ()
int | crypto_scalarmult_curve25519 (uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32])
int | crypto_scalarmult_curve25519_base (uint8_t out[32], const uint8_t scalar[32])
size_t | crypto_scalarmult_curve25519_bytes ()
size_t | crypto_scalarmult_curve25519_scalarbytes ()
const char * | crypto_scalarmult_primitive ()
size_t | crypto_scalarmult_scalarbytes ()
int | crypto_secretbox (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_secretbox_boxzerobytes ()
int | crypto_secretbox_detached (uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_secretbox_easy (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_secretbox_keybytes ()
void | crypto_secretbox_keygen (uint8_t k[32])
size_t | crypto_secretbox_macbytes ()
size_t | crypto_secretbox_messagebytes_max ()
size_t | crypto_secretbox_noncebytes ()
int | crypto_secretbox_open (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_secretbox_open_detached (uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_secretbox_open_easy (uint8_t out[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
const char * | crypto_secretbox_primitive ()
int | crypto_secretbox_xsalsa20poly1305 (uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_secretbox_xsalsa20poly1305_boxzerobytes ()
size_t | crypto_secretbox_xsalsa20poly1305_keybytes ()
void | crypto_secretbox_xsalsa20poly1305_keygen (uint8_t k[32])
size_t | crypto_secretbox_xsalsa20poly1305_macbytes ()
size_t | crypto_secretbox_xsalsa20poly1305_messagebytes_max ()
size_t | crypto_secretbox_xsalsa20poly1305_noncebytes ()
int | crypto_secretbox_xsalsa20poly1305_open (uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_secretbox_xsalsa20poly1305_zerobytes ()
size_t | crypto_secretbox_zerobytes ()
int | crypto_shorthash (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t k[16])
size_t | crypto_shorthash_bytes ()
size_t | crypto_shorthash_keybytes ()
void | crypto_shorthash_keygen (uint8_t k[16])
const char * | crypto_shorthash_primitive ()
int | crypto_shorthash_siphash24 (uint8_t out[8], const uint8_t in[], size_t in_len, const uint8_t key[16])
size_t | crypto_shorthash_siphash24_bytes ()
size_t | crypto_shorthash_siphash24_keybytes ()
size_t | crypto_sign_bytes ()
int | crypto_sign_detached (uint8_t sig[], unsigned long long *sig_len, const uint8_t msg[], size_t msg_len, const uint8_t sk[32])
size_t | crypto_sign_ed25519_bytes ()
int | crypto_sign_ed25519_detached (uint8_t sig[], unsigned long long *sig_len, const uint8_t msg[], size_t msg_len, const uint8_t sk[32])
int | crypto_sign_ed25519_keypair (uint8_t pk[32], uint8_t sk[64])
size_t | crypto_sign_ed25519_messagebytes_max ()
size_t | crypto_sign_ed25519_publickeybytes ()
size_t | crypto_sign_ed25519_secretkeybytes ()
int | crypto_sign_ed25519_seed_keypair (uint8_t pk[], uint8_t sk[], const uint8_t seed[])
size_t | crypto_sign_ed25519_seedbytes ()
int | crypto_sign_ed25519_verify_detached (const uint8_t sig[], const uint8_t msg[], size_t msg_len, const uint8_t pk[32])
int | crypto_sign_keypair (uint8_t pk[32], uint8_t sk[32])
size_t | crypto_sign_messagebytes_max ()
const char * | crypto_sign_primitive ()
size_t | crypto_sign_publickeybytes ()
size_t | crypto_sign_secretkeybytes ()
int | crypto_sign_seed_keypair (uint8_t pk[32], uint8_t sk[32], const uint8_t seed[])
size_t | crypto_sign_seedbytes ()
int | crypto_sign_verify_detached (const uint8_t sig[], const uint8_t in[], size_t in_len, const uint8_t pk[32])
int | crypto_stream (uint8_t out[], size_t out_len, const uint8_t nonce[24], const uint8_t key[32])
int | crypto_stream_chacha20 (uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_stream_chacha20_ietf (uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_stream_chacha20_ietf_keybytes ()
void | crypto_stream_chacha20_ietf_keygen (uint8_t k[32])
size_t | crypto_stream_chacha20_ietf_messagebytes_max ()
size_t | crypto_stream_chacha20_ietf_noncebytes ()
int | crypto_stream_chacha20_ietf_xor (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_stream_chacha20_ietf_xor_ic (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint32_t ic, const uint8_t key[])
size_t | crypto_stream_chacha20_keybytes ()
void | crypto_stream_chacha20_keygen (uint8_t k[32])
size_t | crypto_stream_chacha20_messagebytes_max ()
size_t | crypto_stream_chacha20_noncebytes ()
int | crypto_stream_chacha20_xor (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_stream_chacha20_xor_ic (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
size_t | crypto_stream_keybytes ()
void | crypto_stream_keygen (uint8_t key[32])
size_t | crypto_stream_messagebytes_max ()
size_t | crypto_stream_noncebytes ()
const char * | crypto_stream_primitive ()
int | crypto_stream_salsa20 (uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_stream_salsa20_keybytes ()
void | crypto_stream_salsa20_keygen (uint8_t k[32])
size_t | crypto_stream_salsa20_messagebytes_max ()
size_t | crypto_stream_salsa20_noncebytes ()
int | crypto_stream_salsa20_xor (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_stream_salsa20_xor_ic (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
int | crypto_stream_xchacha20 (uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_stream_xchacha20_keybytes ()
void | crypto_stream_xchacha20_keygen (uint8_t k[32])
size_t | crypto_stream_xchacha20_messagebytes_max ()
size_t | crypto_stream_xchacha20_noncebytes ()
int | crypto_stream_xchacha20_xor (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_stream_xchacha20_xor_ic (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
int | crypto_stream_xor (uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t nonce[24], const uint8_t key[32])
int | crypto_stream_xsalsa20 (uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
size_t | crypto_stream_xsalsa20_keybytes ()
void | crypto_stream_xsalsa20_keygen (uint8_t k[32])
size_t | crypto_stream_xsalsa20_messagebytes_max ()
size_t | crypto_stream_xsalsa20_noncebytes ()
int | crypto_stream_xsalsa20_xor (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
int | crypto_stream_xsalsa20_xor_ic (uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
int | crypto_verify_16 (const uint8_t x[16], const uint8_t y[16])
int | crypto_verify_32 (const uint8_t x[32], const uint8_t y[32])
int | crypto_verify_64 (const uint8_t x[64], const uint8_t y[64])
void | randombytes (uint8_t buf[], size_t buf_len)
void | randombytes_buf (void *buf, size_t size)
void | randombytes_buf_deterministic (void *buf, size_t size, const uint8_t seed[randombytes_SEEDBYTES])
int | randombytes_close ()
const char * | randombytes_implementation_name ()
uint32_t | randombytes_random ()
size_t | randombytes_seedbytes ()
void | randombytes_stir ()
uint32_t | randombytes_uniform (uint32_t upper_bound)
void | sodium_add (uint8_t a[], const uint8_t b[], size_t len)
void * | sodium_allocarray (size_t count, size_t size)
int | sodium_compare (const uint8_t x[], const uint8_t y[], size_t len)
void | sodium_free (void *ptr)
void | sodium_increment (uint8_t n[], size_t nlen)
int | sodium_init ()
int | sodium_is_zero (const uint8_t nonce[], size_t nlen)
int | sodium_library_minimal ()
int | sodium_library_version_major ()
int | sodium_library_version_minor ()
void * | sodium_malloc (size_t size)
int | sodium_memcmp (const void *x, const void *y, size_t len)
void | sodium_memzero (void *ptr, size_t len)
int | sodium_mprotect_noaccess (void *ptr)
int | sodium_mprotect_readwrite (void *ptr)
const char * | sodium_version_string ()

## Detailed Description

The Sodium namespace contains a partial implementation of the libsodium API.

## Enumeration Type Documentation

enum Botan::Sodium::Sodium_Constants : size_t

Enumerator
SODIUM_SIZE_MAX |
crypto_aead_chacha20poly1305_ABYTES |
crypto_aead_chacha20poly1305_KEYBYTES |
crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX |
crypto_aead_chacha20poly1305_NPUBBYTES |
crypto_aead_chacha20poly1305_NSECBYTES |
crypto_aead_chacha20poly1305_ietf_ABYTES |
crypto_aead_chacha20poly1305_ietf_KEYBYTES |
crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX |
crypto_aead_chacha20poly1305_ietf_NPUBBYTES |
crypto_aead_chacha20poly1305_ietf_NSECBYTES |
crypto_aead_xchacha20poly1305_ietf_ABYTES |
crypto_aead_xchacha20poly1305_ietf_KEYBYTES |
crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX |
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES |
crypto_aead_xchacha20poly1305_ietf_NSECBYTES |
crypto_auth_hmacsha256_BYTES |
crypto_auth_hmacsha256_KEYBYTES |
crypto_auth_hmacsha512256_BYTES |
crypto_auth_hmacsha512256_KEYBYTES |
crypto_auth_hmacsha512_BYTES |
crypto_auth_hmacsha512_KEYBYTES |
crypto_auth_BYTES |
crypto_auth_KEYBYTES |
crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES |
crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES |
crypto_box_curve25519xsalsa20poly1305_MACBYTES |
crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX |
crypto_box_curve25519xsalsa20poly1305_NONCEBYTES |
crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES |
crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES |
crypto_box_curve25519xsalsa20poly1305_SEEDBYTES |
crypto_box_curve25519xsalsa20poly1305_ZEROBYTES |
crypto_box_BEFORENMBYTES |
crypto_box_BOXZEROBYTES |
crypto_box_MACBYTES |
crypto_box_MESSAGEBYTES_MAX |
crypto_box_NONCEBYTES |
crypto_box_PUBLICKEYBYTES |
crypto_box_SECRETKEYBYTES |
crypto_box_SEEDBYTES |
crypto_box_ZEROBYTES |
crypto_core_hchacha20_CONSTBYTES |
crypto_core_hchacha20_INPUTBYTES |
crypto_core_hchacha20_KEYBYTES |
crypto_core_hchacha20_OUTPUTBYTES |
crypto_core_hsalsa20_CONSTBYTES |
crypto_core_hsalsa20_INPUTBYTES |
crypto_core_hsalsa20_KEYBYTES |
crypto_core_hsalsa20_OUTPUTBYTES |
crypto_hash_sha256_BYTES |
crypto_hash_sha512_BYTES |
crypto_hash_BYTES |
crypto_onetimeauth_poly1305_BYTES |
crypto_onetimeauth_poly1305_KEYBYTES |
crypto_onetimeauth_BYTES |
crypto_onetimeauth_KEYBYTES |
crypto_scalarmult_curve25519_BYTES |
crypto_scalarmult_curve25519_SCALARBYTES |
crypto_scalarmult_BYTES |
crypto_scalarmult_SCALARBYTES |
crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES |
crypto_secretbox_xsalsa20poly1305_KEYBYTES |
crypto_secretbox_xsalsa20poly1305_MACBYTES |
crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX |
crypto_secretbox_xsalsa20poly1305_NONCEBYTES |
crypto_secretbox_xsalsa20poly1305_ZEROBYTES |
crypto_secretbox_BOXZEROBYTES |
crypto_secretbox_KEYBYTES |
crypto_secretbox_MACBYTES |
crypto_secretbox_MESSAGEBYTES_MAX |
crypto_secretbox_NONCEBYTES |
crypto_secretbox_ZEROBYTES |
crypto_shorthash_siphash24_BYTES |
crypto_shorthash_siphash24_KEYBYTES |
crypto_shorthash_BYTES |
crypto_shorthash_KEYBYTES |
crypto_sign_ed25519_BYTES |
crypto_sign_ed25519_MESSAGEBYTES_MAX |
crypto_sign_ed25519_PUBLICKEYBYTES |
crypto_sign_ed25519_SECRETKEYBYTES |
crypto_sign_ed25519_SEEDBYTES |
crypto_sign_BYTES |
crypto_sign_MESSAGEBYTES_MAX |
crypto_sign_PUBLICKEYBYTES |
crypto_sign_SECRETKEYBYTES |
crypto_sign_SEEDBYTES |
crypto_stream_chacha20_KEYBYTES |
crypto_stream_chacha20_MESSAGEBYTES_MAX |
crypto_stream_chacha20_NONCEBYTES |
crypto_stream_chacha20_ietf_KEYBYTES |
crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX |
crypto_stream_chacha20_ietf_NONCEBYTES |
crypto_stream_salsa20_KEYBYTES |
crypto_stream_salsa20_MESSAGEBYTES_MAX |
crypto_stream_salsa20_NONCEBYTES |
crypto_stream_xchacha20_KEYBYTES |
crypto_stream_xchacha20_MESSAGEBYTES_MAX |
crypto_stream_xchacha20_NONCEBYTES |
crypto_stream_xsalsa20_KEYBYTES |
crypto_stream_xsalsa20_MESSAGEBYTES_MAX |
crypto_stream_xsalsa20_NONCEBYTES |
crypto_stream_KEYBYTES |
crypto_stream_MESSAGEBYTES_MAX |
crypto_stream_NONCEBYTES |
crypto_verify_16_BYTES |
crypto_verify_32_BYTES |
crypto_verify_64_BYTES |
randombytes_SEEDBYTES |

Definition at line 21 of file sodium.h.

21 : size_t {
22 SODIUM_SIZE_MAX = 0xFFFFFFFF,
23
24 crypto_aead_chacha20poly1305_ABYTES = 16,
25 crypto_aead_chacha20poly1305_KEYBYTES = 32,
26 crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
27 crypto_aead_chacha20poly1305_NPUBBYTES = 8,
28 crypto_aead_chacha20poly1305_NSECBYTES = 0,
29
30 crypto_aead_chacha20poly1305_ietf_ABYTES = 16,
31 crypto_aead_chacha20poly1305_ietf_KEYBYTES = 32,
32 crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
33 crypto_aead_chacha20poly1305_ietf_NPUBBYTES = 12,
34 crypto_aead_chacha20poly1305_ietf_NSECBYTES = 0,
35
36 crypto_aead_xchacha20poly1305_ietf_ABYTES = 16,
37 crypto_aead_xchacha20poly1305_ietf_KEYBYTES = 32,
38 crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
39 crypto_aead_xchacha20poly1305_ietf_NPUBBYTES = 24,
40 crypto_aead_xchacha20poly1305_ietf_NSECBYTES = 0,
41
42 crypto_auth_hmacsha256_BYTES = 32,
43 crypto_auth_hmacsha256_KEYBYTES = 32,
44 crypto_auth_hmacsha512256_BYTES = 32,
45 crypto_auth_hmacsha512256_KEYBYTES = 32,
46 crypto_auth_hmacsha512_BYTES = 64,
47 crypto_auth_hmacsha512_KEYBYTES = 32,
48
49 crypto_auth_BYTES = crypto_auth_hmacsha512256_BYTES,
50 crypto_auth_KEYBYTES = crypto_auth_hmacsha512256_KEYBYTES,
51
52 crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES = 32,
53 crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES = 16,
54 crypto_box_curve25519xsalsa20poly1305_MACBYTES = 16,
55 crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
56 crypto_box_curve25519xsalsa20poly1305_NONCEBYTES = 24,
57 crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES = 32,
58 crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES = 32,
59 crypto_box_curve25519xsalsa20poly1305_SEEDBYTES = 32,
60 crypto_box_curve25519xsalsa20poly1305_ZEROBYTES = crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES + crypto_box_curve25519xsalsa20poly1305_MACBYTES,
61
62 crypto_box_BEFORENMBYTES = crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES,
63 crypto_box_BOXZEROBYTES = crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES,
64 crypto_box_MACBYTES = crypto_box_curve25519xsalsa20poly1305_MACBYTES,
65 crypto_box_MESSAGEBYTES_MAX = crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX,
66 crypto_box_NONCEBYTES = crypto_box_curve25519xsalsa20poly1305_NONCEBYTES,
67 crypto_box_PUBLICKEYBYTES = crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES,
68 crypto_box_SECRETKEYBYTES = crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES,
69 crypto_box_SEEDBYTES = crypto_box_curve25519xsalsa20poly1305_SEEDBYTES,
70 crypto_box_ZEROBYTES = crypto_box_curve25519xsalsa20poly1305_ZEROBYTES,
71
72 crypto_core_hchacha20_CONSTBYTES = 16,
73 crypto_core_hchacha20_INPUTBYTES = 16,
74 crypto_core_hchacha20_KEYBYTES = 32,
75 crypto_core_hchacha20_OUTPUTBYTES = 32,
76
77 crypto_core_hsalsa20_CONSTBYTES = 16,
78 crypto_core_hsalsa20_INPUTBYTES = 16,
79 crypto_core_hsalsa20_KEYBYTES = 32,
80 crypto_core_hsalsa20_OUTPUTBYTES = 32,
81
82 crypto_hash_sha256_BYTES = 32,
83 crypto_hash_sha512_BYTES = 64,
84 crypto_hash_BYTES = crypto_hash_sha512_BYTES,
85
86 crypto_onetimeauth_poly1305_BYTES = 16,
87 crypto_onetimeauth_poly1305_KEYBYTES = 32,
88 crypto_onetimeauth_BYTES = crypto_onetimeauth_poly1305_BYTES,
89 crypto_onetimeauth_KEYBYTES = crypto_onetimeauth_poly1305_KEYBYTES,
90
91 crypto_scalarmult_curve25519_BYTES = 32,
92 crypto_scalarmult_curve25519_SCALARBYTES = 32,
93 crypto_scalarmult_BYTES = crypto_scalarmult_curve25519_BYTES,
94 crypto_scalarmult_SCALARBYTES = crypto_scalarmult_curve25519_SCALARBYTES,
95
96 crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES = 16,
97 crypto_secretbox_xsalsa20poly1305_KEYBYTES = 32,
98 crypto_secretbox_xsalsa20poly1305_MACBYTES = 16,
99 crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
100 crypto_secretbox_xsalsa20poly1305_NONCEBYTES = 24,
101 crypto_secretbox_xsalsa20poly1305_ZEROBYTES = crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + crypto_secretbox_xsalsa20poly1305_MACBYTES,
102
103 crypto_secretbox_BOXZEROBYTES = crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES,
104 crypto_secretbox_KEYBYTES = crypto_secretbox_xsalsa20poly1305_KEYBYTES,
105 crypto_secretbox_MACBYTES = crypto_secretbox_xsalsa20poly1305_MACBYTES,
106 crypto_secretbox_MESSAGEBYTES_MAX = crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX,
107 crypto_secretbox_NONCEBYTES = crypto_secretbox_xsalsa20poly1305_NONCEBYTES,
108 crypto_secretbox_ZEROBYTES = crypto_secretbox_xsalsa20poly1305_ZEROBYTES,
109
110 crypto_shorthash_siphash24_BYTES = 8,
111 crypto_shorthash_siphash24_KEYBYTES = 16,
112 crypto_shorthash_BYTES = crypto_shorthash_siphash24_BYTES,
113 crypto_shorthash_KEYBYTES = crypto_shorthash_siphash24_KEYBYTES,
114
115 crypto_sign_ed25519_BYTES = 64,
116 crypto_sign_ed25519_MESSAGEBYTES_MAX = (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES),
117 crypto_sign_ed25519_PUBLICKEYBYTES = 32,
118 crypto_sign_ed25519_SECRETKEYBYTES = (32 + 32),
119 crypto_sign_ed25519_SEEDBYTES = 32,
120 crypto_sign_BYTES = crypto_sign_ed25519_BYTES,
121 crypto_sign_MESSAGEBYTES_MAX = crypto_sign_ed25519_MESSAGEBYTES_MAX,
122 crypto_sign_PUBLICKEYBYTES = crypto_sign_ed25519_PUBLICKEYBYTES,
123 crypto_sign_SECRETKEYBYTES = crypto_sign_ed25519_SECRETKEYBYTES,
124 crypto_sign_SEEDBYTES = crypto_sign_ed25519_SEEDBYTES,
125
126 crypto_stream_chacha20_KEYBYTES = 32,
127 crypto_stream_chacha20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
128 crypto_stream_chacha20_NONCEBYTES = 8,
129 crypto_stream_chacha20_ietf_KEYBYTES = 32,
130 crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
131 crypto_stream_chacha20_ietf_NONCEBYTES = 12,
132 crypto_stream_salsa20_KEYBYTES = 32,
133 crypto_stream_salsa20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
134 crypto_stream_salsa20_NONCEBYTES = 8,
135 crypto_stream_xchacha20_KEYBYTES = 32,
136 crypto_stream_xchacha20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
137 crypto_stream_xchacha20_NONCEBYTES = 24,
138 crypto_stream_xsalsa20_KEYBYTES = 32,
139 crypto_stream_xsalsa20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX,
140 crypto_stream_xsalsa20_NONCEBYTES = 24,
141 crypto_stream_KEYBYTES = crypto_stream_xsalsa20_KEYBYTES,
142 crypto_stream_MESSAGEBYTES_MAX = crypto_stream_xsalsa20_MESSAGEBYTES_MAX,
143 crypto_stream_NONCEBYTES = crypto_stream_xsalsa20_NONCEBYTES,
144
145 crypto_verify_16_BYTES = 16,
146 crypto_verify_32_BYTES = 32,
147 crypto_verify_64_BYTES = 64,
148
149 randombytes_SEEDBYTES = 32,
150 };
Botan::Sodium::crypto_core_hsalsa20_KEYBYTES
Definition: sodium.h:79
Botan::Sodium::crypto_core_hchacha20_INPUTBYTES
Definition: sodium.h:73
Botan::Sodium::crypto_sign_ed25519_SEEDBYTES
Definition: sodium.h:119
Botan::Sodium::crypto_box_ZEROBYTES
Definition: sodium.h:70
Botan::Sodium::crypto_box_BOXZEROBYTES
Definition: sodium.h:63
Botan::Sodium::crypto_secretbox_ZEROBYTES
Definition: sodium.h:108
Botan::Sodium::crypto_hash_sha256_BYTES
Definition: sodium.h:82
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_NSECBYTES
Definition: sodium.h:40
Botan::Sodium::crypto_sign_ed25519_SECRETKEYBYTES
Definition: sodium.h:118
Botan::Sodium::crypto_scalarmult_curve25519_SCALARBYTES
Definition: sodium.h:92
Botan::Sodium::crypto_sign_ed25519_BYTES
Definition: sodium.h:115
Botan::Sodium::crypto_auth_hmacsha256_KEYBYTES
Definition: sodium.h:43
Botan::Sodium::crypto_shorthash_BYTES
Definition: sodium.h:112
Botan::Sodium::crypto_sign_PUBLICKEYBYTES
Definition: sodium.h:122
Botan::Sodium::crypto_aead_chacha20poly1305_ABYTES
Definition: sodium.h:24
Botan::Sodium::crypto_sign_MESSAGEBYTES_MAX
Definition: sodium.h:121
Botan::Sodium::crypto_core_hsalsa20_INPUTBYTES
Definition: sodium.h:78
Botan::Sodium::crypto_stream_chacha20_KEYBYTES
Definition: sodium.h:126
Botan::Sodium::crypto_stream_salsa20_NONCEBYTES
Definition: sodium.h:134
Botan::Sodium::crypto_shorthash_siphash24_BYTES
Definition: sodium.h:110
Botan::Sodium::crypto_aead_chacha20poly1305_NSECBYTES
Definition: sodium.h:28
Botan::Sodium::crypto_sign_SECRETKEYBYTES
Definition: sodium.h:123
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
Definition: sodium.h:56
Botan::Sodium::SODIUM_SIZE_MAX
Definition: sodium.h:22
Botan::Sodium::crypto_stream_chacha20_NONCEBYTES
Definition: sodium.h:128
Botan::Sodium::crypto_box_BEFORENMBYTES
Definition: sodium.h:62
Botan::Sodium::crypto_auth_BYTES
Definition: sodium.h:49
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_KEYBYTES
Definition: sodium.h:37
Botan::Sodium::crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX
Definition: sodium.h:26
Botan::Sodium::crypto_auth_hmacsha256_BYTES
Definition: sodium.h:42
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_NPUBBYTES
Definition: sodium.h:33
Botan::Sodium::crypto_onetimeauth_poly1305_KEYBYTES
Definition: sodium.h:87
Botan::Sodium::crypto_stream_xsalsa20_KEYBYTES
Definition: sodium.h:138
Botan::Sodium::crypto_core_hsalsa20_CONSTBYTES
Definition: sodium.h:77
Botan::Sodium::crypto_stream_xchacha20_NONCEBYTES
Definition: sodium.h:137
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
Definition: sodium.h:32
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
Definition: sodium.h:53
Botan::Sodium::crypto_sign_ed25519_MESSAGEBYTES_MAX
Definition: sodium.h:116
Botan::Sodium::crypto_secretbox_MACBYTES
Definition: sodium.h:105
Botan::Sodium::crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX
Definition: sodium.h:130
Botan::Sodium::crypto_scalarmult_SCALARBYTES
Definition: sodium.h:94
Botan::Sodium::crypto_auth_KEYBYTES
Definition: sodium.h:50
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
Definition: sodium.h:55
Botan::Sodium::crypto_hash_sha512_BYTES
Definition: sodium.h:83
Botan::Sodium::crypto_core_hchacha20_CONSTBYTES
Definition: sodium.h:72
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
Definition: sodium.h:39
Botan::Sodium::crypto_secretbox_MESSAGEBYTES_MAX
Definition: sodium.h:106
Botan::Sodium::crypto_auth_hmacsha512256_BYTES
Definition: sodium.h:44
Botan::Sodium::crypto_shorthash_siphash24_KEYBYTES
Definition: sodium.h:111
Botan::Sodium::crypto_secretbox_KEYBYTES
Definition: sodium.h:104
Botan::Sodium::crypto_scalarmult_BYTES
Definition: sodium.h:93
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
Definition: sodium.h:38
Botan::Sodium::crypto_stream_xchacha20_MESSAGEBYTES_MAX
Definition: sodium.h:136
Botan::Sodium::crypto_verify_64_BYTES
Definition: sodium.h:147
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_MACBYTES
Definition: sodium.h:54
Botan::Sodium::crypto_secretbox_BOXZEROBYTES
Definition: sodium.h:103
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
Definition: sodium.h:52
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
Definition: sodium.h:58
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_NONCEBYTES
Definition: sodium.h:100
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_ZEROBYTES
Definition: sodium.h:101
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_MACBYTES
Definition: sodium.h:98
Botan::Sodium::crypto_sign_ed25519_PUBLICKEYBYTES
Definition: sodium.h:117
Botan::Sodium::crypto_stream_xsalsa20_NONCEBYTES
Definition: sodium.h:140
Botan::Sodium::crypto_stream_salsa20_KEYBYTES
Definition: sodium.h:132
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
Definition: sodium.h:96
Botan::Sodium::crypto_box_MACBYTES
Definition: sodium.h:64
Botan::Sodium::crypto_stream_MESSAGEBYTES_MAX
Definition: sodium.h:142
Botan::Sodium::crypto_verify_32_BYTES
Definition: sodium.h:146
Botan::Sodium::crypto_secretbox_NONCEBYTES
Definition: sodium.h:107
Botan::Sodium::crypto_box_SECRETKEYBYTES
Definition: sodium.h:68
Botan::Sodium::crypto_stream_salsa20_MESSAGEBYTES_MAX
Definition: sodium.h:133
Botan::Sodium::crypto_onetimeauth_poly1305_BYTES
Definition: sodium.h:86
Botan::Sodium::crypto_core_hsalsa20_OUTPUTBYTES
Definition: sodium.h:80
Botan::Sodium::crypto_verify_16_BYTES
Definition: sodium.h:145
Botan::Sodium::crypto_auth_hmacsha512256_KEYBYTES
Definition: sodium.h:45
Botan::Sodium::crypto_scalarmult_curve25519_BYTES
Definition: sodium.h:91
Botan::Sodium::crypto_aead_chacha20poly1305_NPUBBYTES
Definition: sodium.h:27
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
Definition: sodium.h:57
Botan::Sodium::crypto_onetimeauth_BYTES
Definition: sodium.h:88
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_KEYBYTES
Definition: sodium.h:31
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
Definition: sodium.h:99
Botan::Sodium::crypto_box_SEEDBYTES
Definition: sodium.h:69
Botan::Sodium::crypto_stream_KEYBYTES
Definition: sodium.h:141
Botan::Sodium::crypto_sign_SEEDBYTES
Definition: sodium.h:124
Botan::Sodium::crypto_stream_chacha20_ietf_KEYBYTES
Definition: sodium.h:129
Botan::Sodium::crypto_hash_BYTES
Definition: sodium.h:84
Botan::Sodium::crypto_core_hchacha20_OUTPUTBYTES
Definition: sodium.h:75
Botan::Sodium::crypto_shorthash_KEYBYTES
Definition: sodium.h:113
Botan::Sodium::crypto_stream_chacha20_MESSAGEBYTES_MAX
Definition: sodium.h:127
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_ABYTES
Definition: sodium.h:30
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
Definition: sodium.h:60
Botan::Sodium::crypto_box_MESSAGEBYTES_MAX
Definition: sodium.h:65
Botan::Sodium::crypto_box_NONCEBYTES
Definition: sodium.h:66
Botan::Sodium::crypto_stream_xchacha20_KEYBYTES
Definition: sodium.h:135
Botan::Sodium::crypto_sign_BYTES
Definition: sodium.h:120
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_KEYBYTES
Definition: sodium.h:97
Botan::Sodium::randombytes_SEEDBYTES
Definition: sodium.h:149
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_NSECBYTES
Definition: sodium.h:34
Botan::Sodium::crypto_stream_NONCEBYTES
Definition: sodium.h:143
Botan::Sodium::crypto_auth_hmacsha512_KEYBYTES
Definition: sodium.h:47
Botan::Sodium::crypto_stream_xsalsa20_MESSAGEBYTES_MAX
Definition: sodium.h:139
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
Definition: sodium.h:59
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_ABYTES
Definition: sodium.h:36
Botan::Sodium::crypto_box_PUBLICKEYBYTES
Definition: sodium.h:67
Botan::Sodium::crypto_stream_chacha20_ietf_NONCEBYTES
Definition: sodium.h:131
Botan::Sodium::crypto_onetimeauth_KEYBYTES
Definition: sodium.h:89
Botan::Sodium::crypto_auth_hmacsha512_BYTES
Definition: sodium.h:46
Botan::Sodium::crypto_core_hchacha20_KEYBYTES
Definition: sodium.h:74
Botan::Sodium::crypto_aead_chacha20poly1305_KEYBYTES
Definition: sodium.h:25

## Function Documentation

size_t Botan::Sodium::crypto_aead_chacha20poly1305_abytes | ( |  | ) |
| inline

Definition at line 462 of file sodium.h.

References crypto_aead_chacha20poly1305_ABYTES.

463 {
464 return crypto_aead_chacha20poly1305_ABYTES;
465 }
Botan::Sodium::crypto_aead_chacha20poly1305_ABYTES
Definition: sodium.h:24

int Botan::Sodium::crypto_aead_chacha20poly1305_decrypt | ( | uint8_t | m[],
|  | unsigned long long * | ptext_len,
|  | uint8_t | unused_secret_nonce[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 236 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

245 {
246 BOTAN_UNUSED(unused_secret_nonce);
247 return sodium_aead_chacha20poly1305_decrypt(
248 ptext, ptext_len, ctext, ctext_len,
249 ad, ad_len, nonce, crypto_aead_chacha20poly1305_npubbytes(), key);
250 }
Botan::Sodium::crypto_aead_chacha20poly1305_npubbytes
size_t crypto_aead_chacha20poly1305_npubbytes()
Definition: sodium.h:457
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

int Botan::Sodium::crypto_aead_chacha20poly1305_decrypt_detached | ( | uint8_t | m[],
|  | uint8_t | unused_secret_nonce[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | mac[],
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 272 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

281 {
282 BOTAN_UNUSED(unused_secret_nonce);
283
284 return sodium_aead_chacha20poly1305_decrypt_detached(
285 ptext, ctext, ctext_len, mac,
286 ad, ad_len, nonce, crypto_aead_chacha20poly1305_npubbytes(), key);
287 }
Botan::Sodium::crypto_aead_chacha20poly1305_npubbytes
size_t crypto_aead_chacha20poly1305_npubbytes()
Definition: sodium.h:457
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

int Botan::Sodium::crypto_aead_chacha20poly1305_encrypt | ( | uint8_t | ctext[],
|  | unsigned long long * | ctext_len,
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | unused_secret_nonce[],
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 220 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

229 {
230 BOTAN_UNUSED(unused_secret_nonce);
231 return sodium_aead_chacha20poly1305_encrypt(
232 ctext, ctext_len, ptext, ptext_len,
233 ad, ad_len, nonce, crypto_aead_chacha20poly1305_npubbytes(), key);
234 }
Botan::Sodium::crypto_aead_chacha20poly1305_npubbytes
size_t crypto_aead_chacha20poly1305_npubbytes()
Definition: sodium.h:457
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

int Botan::Sodium::crypto_aead_chacha20poly1305_encrypt_detached | ( | uint8_t | ctext[],
|  | uint8_t | mac[],
|  | unsigned long long * | mac_len,
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | unused_secret_nonce[],
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 252 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

262 {
263 BOTAN_UNUSED(unused_secret_nonce);
264 if(mac_len)
265 *mac_len = 16;
266
267 return sodium_aead_chacha20poly1305_encrypt_detached(
268 ctext, mac, ptext, ptext_len,
269 ad, ad_len, nonce, crypto_aead_chacha20poly1305_npubbytes(), key);
270 }
Botan::Sodium::crypto_aead_chacha20poly1305_npubbytes
size_t crypto_aead_chacha20poly1305_npubbytes()
Definition: sodium.h:457
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_abytes | ( |  | ) |
| inline

Definition at line 387 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_ABYTES.

388 {
389 return crypto_aead_chacha20poly1305_ietf_ABYTES;
390 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_ABYTES
Definition: sodium.h:30

int Botan::Sodium::crypto_aead_chacha20poly1305_ietf_decrypt | ( | uint8_t | ptext[],
|  | unsigned long long * | ptext_len,
|  | uint8_t | unused_secret_nonce[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 165 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

174 {
175 BOTAN_UNUSED(unused_secret_nonce);
176
177 return sodium_aead_chacha20poly1305_decrypt(
178 ptext, ptext_len, ctext, ctext_len,
179 ad, ad_len, nonce, crypto_aead_chacha20poly1305_ietf_npubbytes(), key);
180 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_npubbytes
size_t crypto_aead_chacha20poly1305_ietf_npubbytes()
Definition: sodium.h:382
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

int Botan::Sodium::crypto_aead_chacha20poly1305_ietf_decrypt_detached | ( | uint8_t | m[],
|  | uint8_t | unused_secret_nonce[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | mac[],
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 203 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

212 {
213 BOTAN_UNUSED(unused_secret_nonce);
214
215 return sodium_aead_chacha20poly1305_decrypt_detached(
216 ptext, ctext, ctext_len, mac,
217 ad, ad_len, nonce, crypto_aead_chacha20poly1305_ietf_npubbytes(), key);
218 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_npubbytes
size_t crypto_aead_chacha20poly1305_ietf_npubbytes()
Definition: sodium.h:382
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

int Botan::Sodium::crypto_aead_chacha20poly1305_ietf_encrypt | ( | uint8_t | ctext[],
|  | unsigned long long * | ctext_len,
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | unused_secret_nonce[],
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 148 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

157 {
158 BOTAN_UNUSED(unused_secret_nonce);
159
160 return sodium_aead_chacha20poly1305_encrypt(
161 ctext, ctext_len, ptext, ptext_len,
162 ad, ad_len, nonce, crypto_aead_chacha20poly1305_ietf_npubbytes(), key);
163 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_npubbytes
size_t crypto_aead_chacha20poly1305_ietf_npubbytes()
Definition: sodium.h:382
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

int Botan::Sodium::crypto_aead_chacha20poly1305_ietf_encrypt_detached | ( | uint8_t | ctext[],
|  | uint8_t | mac[],
|  | unsigned long long * | mac_len,
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | unused_secret_nonce[],
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 182 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

192 {
193 BOTAN_UNUSED(unused_secret_nonce);
194
195 if(mac_len)
196 *mac_len = 16;
197
198 return sodium_aead_chacha20poly1305_encrypt_detached(
199 ctext, mac, ptext, ptext_len,
200 ad, ad_len, nonce, crypto_aead_chacha20poly1305_ietf_npubbytes(), key);
201 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_npubbytes
size_t crypto_aead_chacha20poly1305_ietf_npubbytes()
Definition: sodium.h:382
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_keybytes | ( |  | ) |
| inline

Definition at line 372 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_KEYBYTES.

373 {
374 return crypto_aead_chacha20poly1305_ietf_KEYBYTES;
375 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_KEYBYTES
Definition: sodium.h:31

void Botan::Sodium::crypto_aead_chacha20poly1305_ietf_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 442 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_KEYBYTES, and randombytes_buf().

443 {
444 return randombytes_buf(k, crypto_aead_chacha20poly1305_ietf_KEYBYTES);
445 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_KEYBYTES
Definition: sodium.h:31

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_messagebytes_max | ( |  | ) |
| inline

Definition at line 392 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX.

393 {
394 return crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX;
395 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
Definition: sodium.h:32

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_npubbytes | ( |  | ) |
| inline

Definition at line 382 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_NPUBBYTES.

Referenced by crypto_aead_chacha20poly1305_ietf_decrypt(), crypto_aead_chacha20poly1305_ietf_decrypt_detached(), crypto_aead_chacha20poly1305_ietf_encrypt(), and crypto_aead_chacha20poly1305_ietf_encrypt_detached().

383 {
384 return crypto_aead_chacha20poly1305_ietf_NPUBBYTES;
385 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_NPUBBYTES
Definition: sodium.h:33

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_nsecbytes | ( |  | ) |
| inline

Definition at line 377 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_NSECBYTES.

378 {
379 return crypto_aead_chacha20poly1305_ietf_NSECBYTES;
380 }
Botan::Sodium::crypto_aead_chacha20poly1305_ietf_NSECBYTES
Definition: sodium.h:34

size_t Botan::Sodium::crypto_aead_chacha20poly1305_keybytes | ( |  | ) |
| inline

Definition at line 447 of file sodium.h.

References crypto_aead_chacha20poly1305_KEYBYTES.

448 {
449 return crypto_aead_chacha20poly1305_KEYBYTES;
450 }
Botan::Sodium::crypto_aead_chacha20poly1305_KEYBYTES
Definition: sodium.h:25

void Botan::Sodium::crypto_aead_chacha20poly1305_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 517 of file sodium.h.

References randombytes_buf().

518 {
519 randombytes_buf(k, 32);
520 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_aead_chacha20poly1305_messagebytes_max | ( |  | ) |
| inline

Definition at line 467 of file sodium.h.

References crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX.

468 {
469 return crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX;
470 }
Botan::Sodium::crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX
Definition: sodium.h:26

size_t Botan::Sodium::crypto_aead_chacha20poly1305_npubbytes | ( |  | ) |
| inline

Definition at line 457 of file sodium.h.

References crypto_aead_chacha20poly1305_NPUBBYTES.

Referenced by crypto_aead_chacha20poly1305_decrypt(), crypto_aead_chacha20poly1305_decrypt_detached(), crypto_aead_chacha20poly1305_encrypt(), and crypto_aead_chacha20poly1305_encrypt_detached().

458 {
459 return crypto_aead_chacha20poly1305_NPUBBYTES;
460 }
Botan::Sodium::crypto_aead_chacha20poly1305_NPUBBYTES
Definition: sodium.h:27

size_t Botan::Sodium::crypto_aead_chacha20poly1305_nsecbytes | ( |  | ) |
| inline

Definition at line 452 of file sodium.h.

References crypto_aead_chacha20poly1305_NSECBYTES.

453 {
454 return crypto_aead_chacha20poly1305_NSECBYTES;
455 }
Botan::Sodium::crypto_aead_chacha20poly1305_NSECBYTES
Definition: sodium.h:28

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_abytes | ( |  | ) |
| inline

Definition at line 539 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_ABYTES.

540 {
541 return crypto_aead_xchacha20poly1305_ietf_ABYTES;
542 }
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_ABYTES
Definition: sodium.h:36

int Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_decrypt | ( | uint8_t | ptext[],
|  | unsigned long long * | ptext_len,
|  | uint8_t | unused_secret_nonce[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 306 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

315 {
316 BOTAN_UNUSED(unused_secret_nonce);
317
318 return sodium_aead_chacha20poly1305_decrypt(
319 ptext, ptext_len, ctext, ctext_len,
320 ad, ad_len, nonce, crypto_aead_xchacha20poly1305_ietf_npubbytes(), key);
321 }
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_npubbytes
size_t crypto_aead_xchacha20poly1305_ietf_npubbytes()
Definition: sodium.h:534

int Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_decrypt_detached | ( | uint8_t | ptext[],
|  | uint8_t | unused_secret_nonce[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | mac[],
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 343 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

352 {
353 BOTAN_UNUSED(unused_secret_nonce);
354 return sodium_aead_chacha20poly1305_decrypt_detached(
355 ptext, ctext, ctext_len, mac,
356 ad, ad_len, nonce, crypto_aead_xchacha20poly1305_ietf_npubbytes(), key);
357 }
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_npubbytes
size_t crypto_aead_xchacha20poly1305_ietf_npubbytes()
Definition: sodium.h:534

int Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_encrypt | ( | uint8_t | ctext[],
|  | unsigned long long * | ctext_len,
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | unused_secret_nonce[],
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 289 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

298 {
299 BOTAN_UNUSED(unused_secret_nonce);
300
301 return sodium_aead_chacha20poly1305_encrypt(
302 ctext, ctext_len, ptext, ptext_len,
303 ad, ad_len, nonce, crypto_aead_xchacha20poly1305_ietf_npubbytes(), key);
304 }
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_npubbytes
size_t crypto_aead_xchacha20poly1305_ietf_npubbytes()
Definition: sodium.h:534

int Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_encrypt_detached | ( | uint8_t | ctext[],
|  | uint8_t | mac[],
|  | unsigned long long * | mac_len,
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | ad[],
|  | size_t | ad_len,
|  | const uint8_t | unused_secret_nonce[],
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 323 of file sodium_aead.cpp.

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

333 {
334 BOTAN_UNUSED(unused_secret_nonce);
335 if(mac_len)
336 *mac_len = 16;
337
338 return sodium_aead_chacha20poly1305_encrypt_detached(
339 ctext, mac, ptext, ptext_len,
340 ad, ad_len, nonce, crypto_aead_xchacha20poly1305_ietf_npubbytes(), key);
341 }
BOTAN_UNUSED
#define BOTAN_UNUSED(...)
Definition: assert.h:142
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_npubbytes
size_t crypto_aead_xchacha20poly1305_ietf_npubbytes()
Definition: sodium.h:534

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_keybytes | ( |  | ) |
| inline

Definition at line 524 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_KEYBYTES.

525 {
526 return crypto_aead_xchacha20poly1305_ietf_KEYBYTES;
527 }
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_KEYBYTES
Definition: sodium.h:37

void Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 594 of file sodium.h.

References randombytes_buf().

595 {
596 return randombytes_buf(k, 32);
597 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_messagebytes_max | ( |  | ) |
| inline

Definition at line 544 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX.

545 {
546 return crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX;
547 }
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
Definition: sodium.h:38

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_npubbytes | ( |  | ) |
| inline

Definition at line 534 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_NPUBBYTES.

Referenced by crypto_aead_xchacha20poly1305_ietf_decrypt(), crypto_aead_xchacha20poly1305_ietf_decrypt_detached(), crypto_aead_xchacha20poly1305_ietf_encrypt(), and crypto_aead_xchacha20poly1305_ietf_encrypt_detached().

535 {
536 return crypto_aead_xchacha20poly1305_ietf_NPUBBYTES;
537 }
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
Definition: sodium.h:39

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_nsecbytes | ( |  | ) |
| inline

Definition at line 529 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_NSECBYTES.

530 {
531 return crypto_aead_xchacha20poly1305_ietf_NSECBYTES;
532 }
Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_NSECBYTES
Definition: sodium.h:40

int Botan::Sodium::crypto_auth | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 920 of file sodium.h.

References crypto_auth_hmacsha512256().

922 {
923 return crypto_auth_hmacsha512256(out, in, in_len, key);
924 }
Botan::Sodium::crypto_auth_hmacsha512256
int crypto_auth_hmacsha512256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:83

size_t Botan::Sodium::crypto_auth_bytes | ( |  | ) |
| inline

Definition at line 914 of file sodium.h.

References crypto_auth_BYTES.

914 { return crypto_auth_BYTES; }
Botan::Sodium::crypto_auth_BYTES
Definition: sodium.h:49

int Botan::Sodium::crypto_auth_hmacsha256 | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 109 of file sodium_auth.cpp.

References Botan::MessageAuthenticationCode::create_or_throw(), and crypto_auth_hmacsha256_KEYBYTES.

Referenced by crypto_auth_hmacsha256_verify().

113 {
114 auto mac = MessageAuthenticationCode::create_or_throw("HMAC(SHA-256)");
115 mac->set_key(key, crypto_auth_hmacsha256_KEYBYTES);
116 mac->update(in, in_len);
117 mac->final(out);
118 return 0;
119 }
Botan::Sodium::crypto_auth_hmacsha256_KEYBYTES
Definition: sodium.h:43

size_t Botan::Sodium::crypto_auth_hmacsha256_bytes | ( |  | ) |
| inline

Definition at line 949 of file sodium.h.

References crypto_auth_hmacsha256_BYTES.

950 {
951 return crypto_auth_hmacsha256_BYTES;
952 }
Botan::Sodium::crypto_auth_hmacsha256_BYTES
Definition: sodium.h:42

size_t Botan::Sodium::crypto_auth_hmacsha256_keybytes | ( |  | ) |
| inline

Definition at line 954 of file sodium.h.

References crypto_auth_hmacsha256_KEYBYTES.

955 {
956 return crypto_auth_hmacsha256_KEYBYTES;
957 }
Botan::Sodium::crypto_auth_hmacsha256_KEYBYTES
Definition: sodium.h:43

void Botan::Sodium::crypto_auth_hmacsha256_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 971 of file sodium.h.

References randombytes_buf().

972 {
973 return randombytes_buf(k, 32);
974 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

int Botan::Sodium::crypto_auth_hmacsha256_verify | ( | const uint8_t | h[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 121 of file sodium_auth.cpp.

References crypto_auth_hmacsha256(), crypto_auth_hmacsha256_BYTES, and crypto_verify_32().

125 {
126 secure_vector<uint8_t> computed(crypto_auth_hmacsha256_BYTES);
127 crypto_auth_hmacsha256(computed.data(), in, in_len, key);
128 return crypto_verify_32(computed.data(), mac) ? 0 : -1;
129 }
Botan::Sodium::crypto_auth_hmacsha256_BYTES
Definition: sodium.h:42
Botan::Sodium::crypto_verify_32
int crypto_verify_32(const uint8_t x[32], const uint8_t y[32])
Definition: sodium_utils.cpp:50
Botan::Sodium::crypto_auth_hmacsha256
int crypto_auth_hmacsha256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:109

int Botan::Sodium::crypto_auth_hmacsha512 | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 61 of file sodium_auth.cpp.

References Botan::MessageAuthenticationCode::create_or_throw(), and crypto_auth_hmacsha512_KEYBYTES.

Referenced by crypto_auth_hmacsha512_verify().

65 {
66 auto mac = MessageAuthenticationCode::create_or_throw("HMAC(SHA-512)");
67 mac->set_key(key, crypto_auth_hmacsha512_KEYBYTES);
68 mac->update(in, in_len);
69 mac->final(out);
70 return 0;
71 }
Botan::Sodium::crypto_auth_hmacsha512_KEYBYTES
Definition: sodium.h:47

int Botan::Sodium::crypto_auth_hmacsha512256 | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 83 of file sodium_auth.cpp.

References Botan::copy_mem(), Botan::MessageAuthenticationCode::create_or_throw(), crypto_auth_hmacsha512256_BYTES, and crypto_auth_hmacsha512256_KEYBYTES.

Referenced by crypto_auth(), and crypto_auth_hmacsha512256_verify().

87 {
88 auto mac = MessageAuthenticationCode::create_or_throw("HMAC(SHA-512)");
89 mac->set_key(key, crypto_auth_hmacsha512256_KEYBYTES);
90 mac->update(in, in_len);
91
92 secure_vector<uint8_t> buf(64);
93 mac->final(buf);
94
95 copy_mem(out, buf.data(), crypto_auth_hmacsha512256_BYTES);
96 return 0;
97 }
Botan::Sodium::crypto_auth_hmacsha512256_BYTES
Definition: sodium.h:44
Botan::copy_mem
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:132
Botan::Sodium::crypto_auth_hmacsha512256_KEYBYTES
Definition: sodium.h:45

size_t Botan::Sodium::crypto_auth_hmacsha512256_bytes | ( |  | ) |
| inline

Definition at line 885 of file sodium.h.

References crypto_auth_hmacsha512256_BYTES.

886 {
887 return crypto_auth_hmacsha512256_BYTES;
888 }
Botan::Sodium::crypto_auth_hmacsha512256_BYTES
Definition: sodium.h:44

size_t Botan::Sodium::crypto_auth_hmacsha512256_keybytes | ( |  | ) |
| inline

Definition at line 890 of file sodium.h.

References crypto_auth_hmacsha512256_KEYBYTES.

891 {
892 return crypto_auth_hmacsha512256_KEYBYTES;
893 }
Botan::Sodium::crypto_auth_hmacsha512256_KEYBYTES
Definition: sodium.h:45

void Botan::Sodium::crypto_auth_hmacsha512256_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 907 of file sodium.h.

References randombytes_buf().

908 {
909 return randombytes_buf(k, 32);
910 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

int Botan::Sodium::crypto_auth_hmacsha512256_verify | ( | const uint8_t | h[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 99 of file sodium_auth.cpp.

References crypto_auth_hmacsha512256(), crypto_auth_hmacsha512256_BYTES, and crypto_verify_32().

Referenced by crypto_auth_verify().

103 {
104 secure_vector<uint8_t> computed(crypto_auth_hmacsha512256_BYTES);
105 crypto_auth_hmacsha512256(computed.data(), in, in_len, key);
106 return crypto_verify_32(computed.data(), mac) ? 0 : -1;
107 }
Botan::Sodium::crypto_auth_hmacsha512256
int crypto_auth_hmacsha512256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:83
Botan::Sodium::crypto_auth_hmacsha512256_BYTES
Definition: sodium.h:44
Botan::Sodium::crypto_verify_32
int crypto_verify_32(const uint8_t x[32], const uint8_t y[32])
Definition: sodium_utils.cpp:50

size_t Botan::Sodium::crypto_auth_hmacsha512_bytes | ( |  | ) |
| inline

Definition at line 862 of file sodium.h.

References crypto_auth_hmacsha512_BYTES.

862 { return crypto_auth_hmacsha512_BYTES; }
Botan::Sodium::crypto_auth_hmacsha512_BYTES
Definition: sodium.h:46

size_t Botan::Sodium::crypto_auth_hmacsha512_keybytes | ( |  | ) |
| inline

Definition at line 864 of file sodium.h.

References crypto_auth_hmacsha512_KEYBYTES.

864 { return crypto_auth_hmacsha512_KEYBYTES; }
Botan::Sodium::crypto_auth_hmacsha512_KEYBYTES
Definition: sodium.h:47

void Botan::Sodium::crypto_auth_hmacsha512_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 878 of file sodium.h.

References randombytes_buf().

879 {
880 return randombytes_buf(k, 32);
881 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

int Botan::Sodium::crypto_auth_hmacsha512_verify | ( | const uint8_t | h[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 73 of file sodium_auth.cpp.

References crypto_auth_hmacsha512(), crypto_auth_hmacsha512_BYTES, and crypto_verify_64().

77 {
78 secure_vector<uint8_t> computed(crypto_auth_hmacsha512_BYTES);
79 crypto_auth_hmacsha512(computed.data(), in, in_len, key);
80 return crypto_verify_64(computed.data(), mac) ? 0 : -1;
81 }
Botan::Sodium::crypto_auth_hmacsha512
int crypto_auth_hmacsha512(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:61
Botan::Sodium::crypto_verify_64
int crypto_verify_64(const uint8_t x[64], const uint8_t y[64])
Definition: sodium_utils.cpp:55
Botan::Sodium::crypto_auth_hmacsha512_BYTES
Definition: sodium.h:46

size_t Botan::Sodium::crypto_auth_keybytes | ( |  | ) |
| inline

Definition at line 916 of file sodium.h.

References crypto_auth_KEYBYTES.

916 { return crypto_auth_KEYBYTES; }
Botan::Sodium::crypto_auth_KEYBYTES
Definition: sodium.h:50

void Botan::Sodium::crypto_auth_keygen | ( | uint8_t | k[] | ) |
| inline

Definition at line 932 of file sodium.h.

References crypto_auth_KEYBYTES, and randombytes_buf().

933 {
934 return randombytes_buf(k, crypto_auth_KEYBYTES);
935 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17
Botan::Sodium::crypto_auth_KEYBYTES
Definition: sodium.h:50

const char* Botan::Sodium::crypto_auth_primitive | ( |  | ) |
| inline

Definition at line 918 of file sodium.h.

918 { return "hmacsha512256"; }

int Botan::Sodium::crypto_auth_verify | ( | const uint8_t | mac[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 926 of file sodium.h.

References crypto_auth_hmacsha512256_verify().

928 {
929 return crypto_auth_hmacsha512256_verify(mac, in, in_len, key);
930 }
Botan::Sodium::crypto_auth_hmacsha512256_verify
int crypto_auth_hmacsha512256_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:99

int Botan::Sodium::crypto_box | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |
| inline

Definition at line 839 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305().

842 {
843 return crypto_box_curve25519xsalsa20poly1305(ctext, ptext, ptext_len, nonce, pk, sk);
844 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305
int crypto_box_curve25519xsalsa20poly1305(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:42

int Botan::Sodium::crypto_box_afternm | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 785 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_afternm().

788 {
789 return crypto_box_curve25519xsalsa20poly1305_afternm(ctext, ptext, ptext_len, nonce, key);
790 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_afternm
int crypto_box_curve25519xsalsa20poly1305_afternm(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:676

int Botan::Sodium::crypto_box_beforenm | ( | uint8_t | key[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |
| inline

Definition at line 779 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_beforenm().

Referenced by crypto_box_detached(), and crypto_box_open_detached().

781 {
782 return crypto_box_curve25519xsalsa20poly1305_beforenm(key, pk, sk);
783 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_beforenm
int crypto_box_curve25519xsalsa20poly1305_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:29

size_t Botan::Sodium::crypto_box_beforenmbytes | ( |  | ) |
| inline

Definition at line 726 of file sodium.h.

References crypto_box_BEFORENMBYTES.

727 {
728 return crypto_box_BEFORENMBYTES;
729 }
Botan::Sodium::crypto_box_BEFORENMBYTES
Definition: sodium.h:62

size_t Botan::Sodium::crypto_box_boxzerobytes | ( |  | ) |
| inline

Definition at line 837 of file sodium.h.

References crypto_box_BOXZEROBYTES.

837 { return crypto_box_BOXZEROBYTES; }
Botan::Sodium::crypto_box_BOXZEROBYTES
Definition: sodium.h:63

int Botan::Sodium::crypto_box_curve25519xsalsa20poly1305 | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |

Definition at line 42 of file sodium_box.cpp.

References crypto_box_curve25519xsalsa20poly1305_afternm(), and crypto_box_curve25519xsalsa20poly1305_beforenm().

Referenced by crypto_box().

48 {
49 secure_vector<uint8_t> shared(32);
50
51 if(crypto_box_curve25519xsalsa20poly1305_beforenm(shared.data(), pk, sk) != 0)
52 return -1;
53
54 return crypto_box_curve25519xsalsa20poly1305_afternm(ctext, ptext, ptext_len, nonce, shared.data());
55 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_afternm
int crypto_box_curve25519xsalsa20poly1305_afternm(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:676
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_beforenm
int crypto_box_curve25519xsalsa20poly1305_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:29

int Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_afternm | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 676 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305().

Referenced by crypto_box_afternm(), and crypto_box_curve25519xsalsa20poly1305().

681 {
682 return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
683 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305
int crypto_secretbox_xsalsa20poly1305(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:14

int Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_beforenm | ( | uint8_t | key[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |

Definition at line 29 of file sodium_box.cpp.

References crypto_core_hsalsa20(), and crypto_scalarmult_curve25519().

Referenced by crypto_box_beforenm(), crypto_box_curve25519xsalsa20poly1305(), and crypto_box_curve25519xsalsa20poly1305_open().

32 {
33 const uint8_t zero[16] = { 0 };
34 secure_vector<uint8_t> shared(32);
35
36 if(crypto_scalarmult_curve25519(shared.data(), sk, pk) != 0)
37 return -1;
38
39 return crypto_core_hsalsa20(key, zero, shared.data(), nullptr);
40 }
Botan::Sodium::crypto_core_hsalsa20
int crypto_core_hsalsa20(uint8_t out[], const uint8_t in[], const uint8_t key[], const uint8_t c[])
Definition: sodium_salsa.cpp:13
Botan::Sodium::crypto_scalarmult_curve25519
int crypto_scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32])
Definition: sodium_25519.cpp:13

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_beforenmbytes | ( |  | ) |
| inline

Definition at line 616 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES.

617 {
618 return crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES;
619 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
Definition: sodium.h:52

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_boxzerobytes | ( |  | ) |
| inline

Definition at line 636 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES.

637 {
638 return crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES;
639 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
Definition: sodium.h:53

int Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_keypair | ( | uint8_t | pk[32],
|  | uint8_t | sk[32]
| ) |  |

Definition at line 22 of file sodium_box.cpp.

References crypto_scalarmult_curve25519_base(), and randombytes_buf().

Referenced by crypto_box_keypair().

24 {
25 randombytes_buf(sk, 32);
26 return crypto_scalarmult_curve25519_base(pk, sk);
27 }
Botan::Sodium::crypto_scalarmult_curve25519_base
int crypto_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32])
Definition: sodium_25519.cpp:19
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_macbytes | ( |  | ) |
| inline

Definition at line 626 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_MACBYTES.

627 {
628 return crypto_box_curve25519xsalsa20poly1305_MACBYTES;
629 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_MACBYTES
Definition: sodium.h:54

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_messagebytes_max | ( |  | ) |
| inline

Definition at line 631 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX.

632 {
633 return crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX;
634 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
Definition: sodium.h:55

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_noncebytes | ( |  | ) |
| inline

Definition at line 621 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_NONCEBYTES.

622 {
623 return crypto_box_curve25519xsalsa20poly1305_NONCEBYTES;
624 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
Definition: sodium.h:56

int Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_open | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |

Definition at line 57 of file sodium_box.cpp.

References crypto_box_curve25519xsalsa20poly1305_beforenm(), and crypto_box_curve25519xsalsa20poly1305_open_afternm().

Referenced by crypto_box_open().

63 {
64 secure_vector<uint8_t> shared(32);
65
66 if(crypto_box_curve25519xsalsa20poly1305_beforenm(shared.data(), pk, sk) != 0)
67 return -1;
68
69 return crypto_box_curve25519xsalsa20poly1305_open_afternm(ptext, ctext, ctext_len, nonce, shared.data());
70 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_open_afternm
int crypto_box_curve25519xsalsa20poly1305_open_afternm(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:685
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_beforenm
int crypto_box_curve25519xsalsa20poly1305_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:29

int Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_open_afternm | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 685 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_open().

Referenced by crypto_box_curve25519xsalsa20poly1305_open(), and crypto_box_open_afternm().

690 {
691 return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
692 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_open
int crypto_secretbox_xsalsa20poly1305_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:41

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_publickeybytes | ( |  | ) |
| inline

Definition at line 606 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES.

607 {
608 return crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES;
609 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
Definition: sodium.h:57

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_secretkeybytes | ( |  | ) |
| inline

Definition at line 611 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES.

612 {
613 return crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES;
614 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
Definition: sodium.h:58

int Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_seed_keypair | ( | uint8_t | pk[32],
|  | uint8_t | sk[32],
|  | const uint8_t | seed[32]
| ) |  |

Definition at line 12 of file sodium_box.cpp.

References Botan::copy_mem(), crypto_hash_sha512(), and crypto_scalarmult_curve25519_base().

Referenced by crypto_box_seed_keypair().

15 {
16 secure_vector<uint8_t> digest(64);
17 crypto_hash_sha512(digest.data(), seed, 32);
18 copy_mem(sk, digest.data(), 32);
19 return crypto_scalarmult_curve25519_base(pk, sk);
20 }
Botan::Sodium::crypto_hash_sha512
int crypto_hash_sha512(uint8_t out[64], const uint8_t in[], size_t in_len)
Definition: sodium_auth.cpp:13
Botan::Sodium::crypto_scalarmult_curve25519_base
int crypto_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32])
Definition: sodium_25519.cpp:19
Botan::copy_mem
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:132

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_seedbytes | ( |  | ) |
| inline

Definition at line 601 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_SEEDBYTES.

602 {
603 return crypto_box_curve25519xsalsa20poly1305_SEEDBYTES;
604 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
Definition: sodium.h:59

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_zerobytes | ( |  | ) |
| inline

Definition at line 641 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_ZEROBYTES.

642 {
643 return crypto_box_curve25519xsalsa20poly1305_ZEROBYTES;
644 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
Definition: sodium.h:60

int Botan::Sodium::crypto_box_detached | ( | uint8_t | ctext[],
|  | uint8_t | mac[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |

Definition at line 72 of file sodium_box.cpp.

References crypto_box_beforenm(), and crypto_box_detached_afternm().

Referenced by crypto_box_easy().

76 {
77 secure_vector<uint8_t> shared(32);
78
79 if(crypto_box_beforenm(shared.data(), pk, sk) != 0)
80 return -1;
81
82 return crypto_box_detached_afternm(ctext, mac, ptext, ptext_len, nonce, shared.data());
83 }
Botan::Sodium::crypto_box_beforenm
int crypto_box_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium.h:779
Botan::Sodium::crypto_box_detached_afternm
int crypto_box_detached_afternm(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:821

int Botan::Sodium::crypto_box_detached_afternm | ( | uint8_t | ctext[],
|  | uint8_t | mac[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 821 of file sodium.h.

References crypto_secretbox_detached().

Referenced by crypto_box_detached(), and crypto_box_easy_afternm().

824 {
825 return crypto_secretbox_detached(ctext, mac, ptext, ptext_len, nonce, key);
826 }
Botan::Sodium::crypto_secretbox_detached
int crypto_secretbox_detached(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:73

int Botan::Sodium::crypto_box_easy | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |
| inline

Definition at line 758 of file sodium.h.

References crypto_box_detached(), and crypto_box_MACBYTES.

761 {
762 return crypto_box_detached(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, pk, sk);
763 }
Botan::Sodium::crypto_box_detached
int crypto_box_detached(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:72
Botan::Sodium::crypto_box_MACBYTES
Definition: sodium.h:64

int Botan::Sodium::crypto_box_easy_afternm | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 828 of file sodium.h.

References crypto_box_detached_afternm(), and crypto_box_MACBYTES.

831 {
832 return crypto_box_detached_afternm(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, key);
833 }
Botan::Sodium::crypto_box_detached_afternm
int crypto_box_detached_afternm(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:821
Botan::Sodium::crypto_box_MACBYTES
Definition: sodium.h:64

int Botan::Sodium::crypto_box_keypair | ( | uint8_t | pk[32],
|  | uint8_t | sk[32]
| ) |  |
| inline

Definition at line 739 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_keypair().

740 {
741 return crypto_box_curve25519xsalsa20poly1305_keypair(pk, sk);
742 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_keypair
int crypto_box_curve25519xsalsa20poly1305_keypair(uint8_t pk[32], uint8_t sk[32])
Definition: sodium_box.cpp:22

size_t Botan::Sodium::crypto_box_macbytes | ( |  | ) |
| inline

Definition at line 716 of file sodium.h.

References crypto_box_MACBYTES.

717 {
718 return crypto_box_MACBYTES;
719 }
Botan::Sodium::crypto_box_MACBYTES
Definition: sodium.h:64

size_t Botan::Sodium::crypto_box_messagebytes_max | ( |  | ) |
| inline

Definition at line 721 of file sodium.h.

References crypto_box_MESSAGEBYTES_MAX.

722 {
723 return crypto_box_MESSAGEBYTES_MAX;
724 }
Botan::Sodium::crypto_box_MESSAGEBYTES_MAX
Definition: sodium.h:65

size_t Botan::Sodium::crypto_box_noncebytes | ( |  | ) |
| inline

Definition at line 711 of file sodium.h.

References crypto_box_NONCEBYTES.

712 {
713 return crypto_box_NONCEBYTES;
714 }
Botan::Sodium::crypto_box_NONCEBYTES
Definition: sodium.h:66

int Botan::Sodium::crypto_box_open | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |
| inline

Definition at line 846 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_open().

849 {
850 return crypto_box_curve25519xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, pk, sk);
851 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_open
int crypto_box_curve25519xsalsa20poly1305_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:57

int Botan::Sodium::crypto_box_open_afternm | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 792 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_open_afternm().

795 {
796 return crypto_box_curve25519xsalsa20poly1305_open_afternm(ptext, ctext, ctext_len, nonce, key);
797 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_open_afternm
int crypto_box_curve25519xsalsa20poly1305_open_afternm(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:685

int Botan::Sodium::crypto_box_open_detached | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | const uint8_t | mac[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |

Definition at line 85 of file sodium_box.cpp.

References crypto_box_beforenm(), and crypto_box_open_detached_afternm().

Referenced by crypto_box_open_easy().

91 {
92 secure_vector<uint8_t> shared(32);
93
94 if(crypto_box_beforenm(shared.data(), pk, sk) != 0)
95 return -1;
96
97 return crypto_box_open_detached_afternm(ptext, ctext, mac, ctext_len, nonce, shared.data());
98 }
Botan::Sodium::crypto_box_open_detached_afternm
int crypto_box_open_detached_afternm(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:799
Botan::Sodium::crypto_box_beforenm
int crypto_box_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium.h:779

int Botan::Sodium::crypto_box_open_detached_afternm | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | const uint8_t | mac[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 799 of file sodium.h.

References crypto_secretbox_open_detached().

Referenced by crypto_box_open_detached(), and crypto_box_open_easy_afternm().

803 {
804 return crypto_secretbox_open_detached(ptext, ctext, mac, ctext_len, nonce, key);
805 }
Botan::Sodium::crypto_secretbox_open_detached
int crypto_secretbox_open_detached(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:96

int Botan::Sodium::crypto_box_open_easy | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | pk[32],
|  | const uint8_t | sk[32]
| ) |  |
| inline

Definition at line 765 of file sodium.h.

References crypto_box_MACBYTES, and crypto_box_open_detached().

768 {
769 if(ctext_len < crypto_box_MACBYTES)
770 {
771 return -1;
772 }
773
774 return crypto_box_open_detached(ptext, ctext + crypto_box_MACBYTES,
775 ctext, ctext_len - crypto_box_MACBYTES,
776 nonce, pk, sk);
777 }
Botan::Sodium::crypto_box_open_detached
int crypto_box_open_detached(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium_box.cpp:85
Botan::Sodium::crypto_box_MACBYTES
Definition: sodium.h:64

int Botan::Sodium::crypto_box_open_easy_afternm | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 807 of file sodium.h.

References crypto_box_MACBYTES, and crypto_box_open_detached_afternm().

810 {
811 if(ctext_len < crypto_box_MACBYTES)
812 {
813 return -1;
814 }
815
816 return crypto_box_open_detached_afternm(ptext, ctext + crypto_box_MACBYTES,
817 ctext, ctext_len - crypto_box_MACBYTES,
818 nonce, key);
819 }
Botan::Sodium::crypto_box_open_detached_afternm
int crypto_box_open_detached_afternm(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium.h:799
Botan::Sodium::crypto_box_MACBYTES
Definition: sodium.h:64

const char* Botan::Sodium::crypto_box_primitive | ( |  | ) |
| inline

Definition at line 731 of file sodium.h.

731 { return "curve25519xsalsa20poly1305"; }

size_t Botan::Sodium::crypto_box_publickeybytes | ( |  | ) |
| inline

Definition at line 701 of file sodium.h.

References crypto_box_PUBLICKEYBYTES.

702 {
703 return crypto_box_PUBLICKEYBYTES;
704 }
Botan::Sodium::crypto_box_PUBLICKEYBYTES
Definition: sodium.h:67

size_t Botan::Sodium::crypto_box_secretkeybytes | ( |  | ) |
| inline

Definition at line 706 of file sodium.h.

References crypto_box_SECRETKEYBYTES.

707 {
708 return crypto_box_SECRETKEYBYTES;
709 }
Botan::Sodium::crypto_box_SECRETKEYBYTES
Definition: sodium.h:68

int Botan::Sodium::crypto_box_seed_keypair | ( | uint8_t | pk[32],
|  | uint8_t | sk[32],
|  | const uint8_t | seed[]
| ) |  |
| inline

Definition at line 733 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_seed_keypair().

735 {
736 return crypto_box_curve25519xsalsa20poly1305_seed_keypair(pk, sk, seed);
737 }
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_seed_keypair
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(uint8_t pk[32], uint8_t sk[32], const uint8_t seed[32])
Definition: sodium_box.cpp:12

size_t Botan::Sodium::crypto_box_seedbytes | ( |  | ) |
| inline

Definition at line 696 of file sodium.h.

References crypto_box_SEEDBYTES.

697 {
698 return crypto_box_SEEDBYTES;
699 }
Botan::Sodium::crypto_box_SEEDBYTES
Definition: sodium.h:69

size_t Botan::Sodium::crypto_box_zerobytes | ( |  | ) |
| inline

Definition at line 835 of file sodium.h.

References crypto_box_ZEROBYTES.

835 { return crypto_box_ZEROBYTES; }
Botan::Sodium::crypto_box_ZEROBYTES
Definition: sodium.h:70

int Botan::Sodium::crypto_core_hsalsa20 | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | const uint8_t | key[],
|  | const uint8_t | c[]
| ) |  |

Definition at line 13 of file sodium_salsa.cpp.

References Botan::copy_out_le(), Botan::Salsa20::hsalsa20(), and Botan::load_le< uint32_t >().

Referenced by crypto_box_curve25519xsalsa20poly1305_beforenm().

15 {
16 uint32_t in32[16] = { 0 };
17
18 static const uint32_t SIGMA[] =
19 { 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574 };
20
21 if(c == nullptr)
22 {
23 in32[0] = SIGMA[0];
24 in32[5] = SIGMA[1];
25 in32[10] = SIGMA[2];
26 in32[15] = SIGMA[3];
27 }
28 else
29 {
30 in32[0] = load_le<uint32_t>(c, 0);
31 in32[5] = load_le<uint32_t>(c, 1);
32 in32[10] = load_le<uint32_t>(c, 2);
33 in32[15] = load_le<uint32_t>(c, 3);
34 }
35
36 in32[1] = load_le<uint32_t>(key, 0);
37 in32[2] = load_le<uint32_t>(key, 1);
38 in32[3] = load_le<uint32_t>(key, 2);
39 in32[4] = load_le<uint32_t>(key, 3);
40
41 in32[6] = load_le<uint32_t>(in, 0);
42 in32[7] = load_le<uint32_t>(in, 1);
43 in32[8] = load_le<uint32_t>(in, 2);
44 in32[9] = load_le<uint32_t>(in, 3);
45
46 in32[11] = load_le<uint32_t>(key, 4);
47 in32[12] = load_le<uint32_t>(key, 5);
48 in32[13] = load_le<uint32_t>(key, 6);
49 in32[14] = load_le<uint32_t>(key, 7);
50
51 uint32_t out32[8] = { 0 };
52 Salsa20::hsalsa20(out32, in32);
53
54 copy_out_le(out, 32, out32);
55 return 0;
56 }
Botan::copy_out_le
void copy_out_le(uint8_t out[], size_t out_bytes, const T in[])
Definition: loadstor.h:679
Botan::load_le< uint32_t >
uint32_t load_le< uint32_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:198

size_t Botan::Sodium::crypto_core_hsalsa20_constbytes | ( |  | ) |
| inline

Definition at line 1030 of file sodium.h.

References crypto_core_hsalsa20_CONSTBYTES.

1031 {
1032 return crypto_core_hsalsa20_CONSTBYTES;
1033 }
Botan::Sodium::crypto_core_hsalsa20_CONSTBYTES
Definition: sodium.h:77

size_t Botan::Sodium::crypto_core_hsalsa20_inputbytes | ( |  | ) |
| inline

Definition at line 1020 of file sodium.h.

References crypto_core_hsalsa20_INPUTBYTES.

1021 {
1022 return crypto_core_hsalsa20_INPUTBYTES;
1023 }
Botan::Sodium::crypto_core_hsalsa20_INPUTBYTES
Definition: sodium.h:78

size_t Botan::Sodium::crypto_core_hsalsa20_keybytes | ( |  | ) |
| inline

Definition at line 1025 of file sodium.h.

References crypto_core_hsalsa20_KEYBYTES.

1026 {
1027 return crypto_core_hsalsa20_KEYBYTES;
1028 }
Botan::Sodium::crypto_core_hsalsa20_KEYBYTES
Definition: sodium.h:79

size_t Botan::Sodium::crypto_core_hsalsa20_outputbytes | ( |  | ) |
| inline

Definition at line 1015 of file sodium.h.

References crypto_core_hsalsa20_OUTPUTBYTES.

1016 {
1017 return crypto_core_hsalsa20_OUTPUTBYTES;
1018 }
Botan::Sodium::crypto_core_hsalsa20_OUTPUTBYTES
Definition: sodium.h:80

int Botan::Sodium::crypto_hash | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len
| ) |  |
| inline

Definition at line 1046 of file sodium.h.

References crypto_hash_sha512().

1047 {
1048 return crypto_hash_sha512(out, in, in_len);
1049 }
Botan::Sodium::crypto_hash_sha512
int crypto_hash_sha512(uint8_t out[64], const uint8_t in[], size_t in_len)
Definition: sodium_auth.cpp:13

size_t Botan::Sodium::crypto_hash_bytes | ( |  | ) |
| inline

Definition at line 1041 of file sodium.h.

References crypto_hash_BYTES.

1042 {
1043 return crypto_hash_BYTES;
1044 }
Botan::Sodium::crypto_hash_BYTES
Definition: sodium.h:84

const char* Botan::Sodium::crypto_hash_primitive | ( |  | ) |
| inline

Definition at line 1051 of file sodium.h.

1051 { return "sha512"; }

int Botan::Sodium::crypto_hash_sha256 | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len
| ) |  |

Definition at line 21 of file sodium_auth.cpp.

References Botan::HashFunction::create_or_throw().

22 {
23 auto sha256 = HashFunction::create_or_throw("SHA-256");
24 sha256->update(in, in_len);
25 sha256->final(out);
26 return 0;
27 }

size_t Botan::Sodium::crypto_hash_sha256_bytes | ( |  | ) |
| inline

Definition at line 939 of file sodium.h.

References crypto_hash_sha256_BYTES.

940 {
941 return crypto_hash_sha256_BYTES;
942 }
Botan::Sodium::crypto_hash_sha256_BYTES
Definition: sodium.h:82

int Botan::Sodium::crypto_hash_sha512 | ( | uint8_t | out[64],
|  | const uint8_t | in[],
|  | size_t | in_len
| ) |  |

Definition at line 13 of file sodium_auth.cpp.

References Botan::HashFunction::create_or_throw().

Referenced by crypto_box_curve25519xsalsa20poly1305_seed_keypair(), and crypto_hash().

14 {
15 auto sha512 = HashFunction::create_or_throw("SHA-512");
16 sha512->update(in, in_len);
17 sha512->final(out);
18 return 0;
19 }

size_t Botan::Sodium::crypto_hash_sha512_bytes | ( |  | ) |
| inline

Definition at line 855 of file sodium.h.

References crypto_hash_sha512_BYTES.

855 { return crypto_hash_sha512_BYTES; }
Botan::Sodium::crypto_hash_sha512_BYTES
Definition: sodium.h:83

int Botan::Sodium::crypto_onetimeauth | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 1090 of file sodium.h.

References crypto_onetimeauth_poly1305().

1092 {
1093 return crypto_onetimeauth_poly1305(out, in, in_len, key);
1094 }
Botan::Sodium::crypto_onetimeauth_poly1305
int crypto_onetimeauth_poly1305(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:39

size_t Botan::Sodium::crypto_onetimeauth_bytes | ( |  | ) |
| inline

Definition at line 1084 of file sodium.h.

References crypto_onetimeauth_BYTES.

1084 { return crypto_onetimeauth_BYTES; }
Botan::Sodium::crypto_onetimeauth_BYTES
Definition: sodium.h:88

size_t Botan::Sodium::crypto_onetimeauth_keybytes | ( |  | ) |
| inline

Definition at line 1086 of file sodium.h.

References crypto_onetimeauth_KEYBYTES.

1086 { return crypto_onetimeauth_KEYBYTES; }
Botan::Sodium::crypto_onetimeauth_KEYBYTES
Definition: sodium.h:89

void Botan::Sodium::crypto_onetimeauth_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 1102 of file sodium.h.

References crypto_onetimeauth_poly1305_keygen().

1103 {
1104 return crypto_onetimeauth_poly1305_keygen(k);
1105 }
Botan::Sodium::crypto_onetimeauth_poly1305_keygen
void crypto_onetimeauth_poly1305_keygen(uint8_t k[32])
Definition: sodium.h:1077

int Botan::Sodium::crypto_onetimeauth_poly1305 | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 39 of file sodium_auth.cpp.

References Botan::MessageAuthenticationCode::create_or_throw(), and crypto_onetimeauth_poly1305_KEYBYTES.

Referenced by crypto_onetimeauth(), and crypto_onetimeauth_poly1305_verify().

43 {
44 auto mac = MessageAuthenticationCode::create_or_throw("Poly1305");
45 mac->set_key(key, crypto_onetimeauth_poly1305_KEYBYTES);
46 mac->update(in, in_len);
47 mac->final(out);
48 return 0;
49 }
Botan::Sodium::crypto_onetimeauth_poly1305_KEYBYTES
Definition: sodium.h:87

size_t Botan::Sodium::crypto_onetimeauth_poly1305_bytes | ( |  | ) |
| inline

Definition at line 1055 of file sodium.h.

References crypto_onetimeauth_poly1305_BYTES.

1056 {
1057 return crypto_onetimeauth_poly1305_BYTES;
1058 }
Botan::Sodium::crypto_onetimeauth_poly1305_BYTES
Definition: sodium.h:86

size_t Botan::Sodium::crypto_onetimeauth_poly1305_keybytes | ( |  | ) |
| inline

Definition at line 1060 of file sodium.h.

References crypto_onetimeauth_poly1305_KEYBYTES.

1061 {
1062 return crypto_onetimeauth_poly1305_KEYBYTES;
1063 }
Botan::Sodium::crypto_onetimeauth_poly1305_KEYBYTES
Definition: sodium.h:87

void Botan::Sodium::crypto_onetimeauth_poly1305_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 1077 of file sodium.h.

References randombytes_buf().

Referenced by crypto_onetimeauth_keygen().

1078 {
1079 return randombytes_buf(k, 32);
1080 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

int Botan::Sodium::crypto_onetimeauth_poly1305_verify | ( | const uint8_t | h[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |

Definition at line 51 of file sodium_auth.cpp.

References crypto_onetimeauth_poly1305(), crypto_onetimeauth_poly1305_BYTES, and crypto_verify_16().

Referenced by crypto_onetimeauth_verify().

55 {
56 secure_vector<uint8_t> computed(crypto_onetimeauth_poly1305_BYTES);
57 crypto_onetimeauth_poly1305(computed.data(), in, in_len, key);
58 return crypto_verify_16(computed.data(), mac) ? 0 : -1;
59 }
Botan::Sodium::crypto_onetimeauth_poly1305
int crypto_onetimeauth_poly1305(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:39
Botan::Sodium::crypto_verify_16
int crypto_verify_16(const uint8_t x[16], const uint8_t y[16])
Definition: sodium_utils.cpp:45
Botan::Sodium::crypto_onetimeauth_poly1305_BYTES
Definition: sodium.h:86

const char* Botan::Sodium::crypto_onetimeauth_primitive | ( |  | ) |
| inline

Definition at line 1088 of file sodium.h.

1088 { return "poly1305"; }

int Botan::Sodium::crypto_onetimeauth_verify | ( | const uint8_t | h[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 1096 of file sodium.h.

References crypto_onetimeauth_poly1305_verify().

1098 {
1099 return crypto_onetimeauth_poly1305_verify(h, in, in_len, key);
1100 }
Botan::Sodium::crypto_onetimeauth_poly1305_verify
int crypto_onetimeauth_poly1305_verify(const uint8_t h[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:51

int Botan::Sodium::crypto_scalarmult | ( | uint8_t | out[],
|  | const uint8_t | scalar[],
|  | const uint8_t | base[]
| ) |  |
| inline

Definition at line 1138 of file sodium.h.

References crypto_scalarmult_curve25519().

1139 {
1140 return crypto_scalarmult_curve25519(out, scalar, base);
1141 }
Botan::Sodium::crypto_scalarmult_curve25519
int crypto_scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32])
Definition: sodium_25519.cpp:13

int Botan::Sodium::crypto_scalarmult_base | ( | uint8_t | out[],
|  | const uint8_t | scalar[]
| ) |  |
| inline

Definition at line 1133 of file sodium.h.

References crypto_scalarmult_curve25519_base().

1134 {
1135 return crypto_scalarmult_curve25519_base(out, scalar);
1136 }
Botan::Sodium::crypto_scalarmult_curve25519_base
int crypto_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32])
Definition: sodium_25519.cpp:19

size_t Botan::Sodium::crypto_scalarmult_bytes | ( |  | ) |
| inline

Definition at line 1127 of file sodium.h.

References crypto_scalarmult_curve25519_bytes().

1127 { return crypto_scalarmult_curve25519_bytes(); }
Botan::Sodium::crypto_scalarmult_curve25519_bytes
size_t crypto_scalarmult_curve25519_bytes()
Definition: sodium.h:1109

int Botan::Sodium::crypto_scalarmult_curve25519 | ( | uint8_t | out[32],
|  | const uint8_t | scalar[32],
|  | const uint8_t | basepoint[32]
| ) |  |

Definition at line 13 of file sodium_25519.cpp.

References Botan::curve25519_donna().

Referenced by crypto_box_curve25519xsalsa20poly1305_beforenm(), and crypto_scalarmult().

14 {
15 curve25519_donna(out, scalar, point);
16 return 0;
17 }
Botan::curve25519_donna
void curve25519_donna(uint8_t mypublic[32], const uint8_t secret[32], const uint8_t basepoint[32])
Definition: donna.cpp:440

int Botan::Sodium::crypto_scalarmult_curve25519_base | ( | uint8_t | out[32],
|  | const uint8_t | scalar[32]
| ) |  |

Definition at line 19 of file sodium_25519.cpp.

References Botan::curve25519_basepoint().

Referenced by crypto_box_curve25519xsalsa20poly1305_keypair(), crypto_box_curve25519xsalsa20poly1305_seed_keypair(), and crypto_scalarmult_base().

20 {
21 curve25519_basepoint(out, scalar);
22 return 0;
23 }
Botan::curve25519_basepoint
void curve25519_basepoint(uint8_t mypublic[32], const uint8_t secret[32])
Definition: curve25519.cpp:16

size_t Botan::Sodium::crypto_scalarmult_curve25519_bytes | ( |  | ) |
| inline

Definition at line 1109 of file sodium.h.

References crypto_scalarmult_curve25519_BYTES.

Referenced by crypto_scalarmult_bytes().

1110 {
1111 return crypto_scalarmult_curve25519_BYTES;
1112 }
Botan::Sodium::crypto_scalarmult_curve25519_BYTES
Definition: sodium.h:91

size_t Botan::Sodium::crypto_scalarmult_curve25519_scalarbytes | ( |  | ) |
| inline

Definition at line 1114 of file sodium.h.

References crypto_scalarmult_curve25519_SCALARBYTES.

Referenced by crypto_scalarmult_scalarbytes().

1115 {
1116 return crypto_scalarmult_curve25519_SCALARBYTES;
1117 }
Botan::Sodium::crypto_scalarmult_curve25519_SCALARBYTES
Definition: sodium.h:92

const char* Botan::Sodium::crypto_scalarmult_primitive | ( |  | ) |
| inline

Definition at line 1131 of file sodium.h.

1131 { return "curve25519"; }

size_t Botan::Sodium::crypto_scalarmult_scalarbytes | ( |  | ) |
| inline

Definition at line 1129 of file sodium.h.

References crypto_scalarmult_curve25519_scalarbytes().

1129 { return crypto_scalarmult_curve25519_scalarbytes(); }
Botan::Sodium::crypto_scalarmult_curve25519_scalarbytes
size_t crypto_scalarmult_curve25519_scalarbytes()
Definition: sodium.h:1114

int Botan::Sodium::crypto_secretbox | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 356 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305().

359 {
360 return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
361 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305
int crypto_secretbox_xsalsa20poly1305(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:14

size_t Botan::Sodium::crypto_secretbox_boxzerobytes | ( |  | ) |
| inline

Definition at line 351 of file sodium.h.

References crypto_secretbox_BOXZEROBYTES.

352 {
353 return crypto_secretbox_BOXZEROBYTES;
354 }
Botan::Sodium::crypto_secretbox_BOXZEROBYTES
Definition: sodium.h:103

int Botan::Sodium::crypto_secretbox_detached | ( | uint8_t | ctext[],
|  | uint8_t | mac[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 73 of file sodium_secretbox.cpp.

References Botan::MessageAuthenticationCode::create_or_throw(), Botan::StreamCipher::create_or_throw(), crypto_secretbox_KEYBYTES, and crypto_secretbox_NONCEBYTES.

Referenced by crypto_box_detached_afternm(), and crypto_secretbox_easy().

78 {
79 auto salsa = StreamCipher::create_or_throw("Salsa20");
80 salsa->set_key(key, crypto_secretbox_KEYBYTES);
81 salsa->set_iv(nonce, crypto_secretbox_NONCEBYTES);
82
83 secure_vector<uint8_t> auth_key(32);
84 salsa->write_keystream(auth_key.data(), auth_key.size());
85
86 salsa->cipher(ptext, ctext, ptext_len);
87
88 auto poly1305 = MessageAuthenticationCode::create_or_throw("Poly1305");
89 poly1305->set_key(auth_key);
90 poly1305->update(ctext, ptext_len);
91 poly1305->final(mac);
92
93 return 0;
94 }
Botan::Sodium::crypto_secretbox_KEYBYTES
Definition: sodium.h:104
Botan::Sodium::crypto_secretbox_NONCEBYTES
Definition: sodium.h:107

int Botan::Sodium::crypto_secretbox_easy | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 320 of file sodium.h.

References crypto_secretbox_detached(), and crypto_secretbox_MACBYTES.

323 {
324 return crypto_secretbox_detached(ctext + crypto_secretbox_MACBYTES, ctext,
325 ptext, ptext_len, nonce, key);
326 }
Botan::Sodium::crypto_secretbox_detached
int crypto_secretbox_detached(uint8_t ctext[], uint8_t mac[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:73
Botan::Sodium::crypto_secretbox_MACBYTES
Definition: sodium.h:105

size_t Botan::Sodium::crypto_secretbox_keybytes | ( |  | ) |
| inline

Definition at line 295 of file sodium.h.

References crypto_secretbox_KEYBYTES.

295 { return crypto_secretbox_KEYBYTES; }
Botan::Sodium::crypto_secretbox_KEYBYTES
Definition: sodium.h:104

void Botan::Sodium::crypto_secretbox_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 341 of file sodium.h.

References randombytes_buf().

342 {
343 return randombytes_buf(k, 32);
344 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_secretbox_macbytes | ( |  | ) |
| inline

Definition at line 299 of file sodium.h.

References crypto_secretbox_MACBYTES.

299 { return crypto_secretbox_MACBYTES; }
Botan::Sodium::crypto_secretbox_MACBYTES
Definition: sodium.h:105

size_t Botan::Sodium::crypto_secretbox_messagebytes_max | ( |  | ) |
| inline

Definition at line 301 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX.

301 { return crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX; }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
Definition: sodium.h:99

size_t Botan::Sodium::crypto_secretbox_noncebytes | ( |  | ) |
| inline

Definition at line 297 of file sodium.h.

References crypto_secretbox_NONCEBYTES.

297 { return crypto_secretbox_NONCEBYTES; }
Botan::Sodium::crypto_secretbox_NONCEBYTES
Definition: sodium.h:107

int Botan::Sodium::crypto_secretbox_open | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 363 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_open().

366 {
367 return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
368 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_open
int crypto_secretbox_xsalsa20poly1305_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:41

int Botan::Sodium::crypto_secretbox_open_detached | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | const uint8_t | mac[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 96 of file sodium_secretbox.cpp.

References Botan::constant_time_compare(), Botan::MessageAuthenticationCode::create_or_throw(), Botan::StreamCipher::create_or_throw(), crypto_secretbox_KEYBYTES, and crypto_secretbox_NONCEBYTES.

Referenced by crypto_box_open_detached_afternm(), and crypto_secretbox_open_easy().

102 {
103 auto salsa = StreamCipher::create_or_throw("Salsa20");
104 salsa->set_key(key, crypto_secretbox_KEYBYTES);
105 salsa->set_iv(nonce, crypto_secretbox_NONCEBYTES);
106
107 secure_vector<uint8_t> auth_key(32);
108 salsa->write_keystream(auth_key.data(), auth_key.size());
109
110 auto poly1305 = MessageAuthenticationCode::create_or_throw("Poly1305");
111 poly1305->set_key(auth_key);
112 poly1305->update(ctext, ctext_len);
113 secure_vector<uint8_t> computed_mac = poly1305->final();
114
115 if(!constant_time_compare(mac, computed_mac.data(), computed_mac.size()))
116 return -1;
117
118 salsa->cipher(ctext, ptext, ctext_len);
119
120 return 0;
121 }
Botan::constant_time_compare
bool constant_time_compare(const uint8_t x[], const uint8_t y[], size_t len)
Definition: mem_ops.h:82
Botan::Sodium::crypto_secretbox_KEYBYTES
Definition: sodium.h:104
Botan::Sodium::crypto_secretbox_NONCEBYTES
Definition: sodium.h:107

int Botan::Sodium::crypto_secretbox_open_easy | ( | uint8_t | out[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |
| inline

Definition at line 328 of file sodium.h.

References crypto_secretbox_MACBYTES, and crypto_secretbox_open_detached().

330 {
331 if(ctext_len < crypto_secretbox_MACBYTES)
332 {
333 return -1;
334 }
335
336 return crypto_secretbox_open_detached(out, ctext + crypto_secretbox_MACBYTES,
337 ctext, ctext_len - crypto_secretbox_MACBYTES,
338 nonce, key);
339 }
Botan::Sodium::crypto_secretbox_MACBYTES
Definition: sodium.h:105
Botan::Sodium::crypto_secretbox_open_detached
int crypto_secretbox_open_detached(uint8_t ptext[], const uint8_t ctext[], const uint8_t mac[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_secretbox.cpp:96

const char* Botan::Sodium::crypto_secretbox_primitive | ( |  | ) |
| inline

Definition at line 303 of file sodium.h.

303 { return "xsalsa20poly1305"; }

int Botan::Sodium::crypto_secretbox_xsalsa20poly1305 | ( | uint8_t | ctext[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 14 of file sodium_secretbox.cpp.

References Botan::clear_mem(), Botan::MessageAuthenticationCode::create_or_throw(), Botan::StreamCipher::create_or_throw(), crypto_secretbox_KEYBYTES, and crypto_secretbox_NONCEBYTES.

Referenced by crypto_box_curve25519xsalsa20poly1305_afternm(), and crypto_secretbox().

19 {
20 if(ptext_len < 32)
21 return -1;
22
23 auto salsa = StreamCipher::create_or_throw("Salsa20");
24 salsa->set_key(key, crypto_secretbox_KEYBYTES);
25 salsa->set_iv(nonce, crypto_secretbox_NONCEBYTES);
26
27 secure_vector<uint8_t> auth_key(32);
28 salsa->write_keystream(auth_key.data(), auth_key.size());
29
30 salsa->cipher(ptext + 32, ctext + 32, ptext_len - 32);
31
32 auto poly1305 = MessageAuthenticationCode::create_or_throw("Poly1305");
33 poly1305->set_key(auth_key);
34 poly1305->update(ctext + 32, ptext_len - 32);
35 poly1305->final(ctext + 16);
36
37 clear_mem(ctext, 16);
38 return 0;
39 }
Botan::clear_mem
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:112
Botan::Sodium::crypto_secretbox_KEYBYTES
Definition: sodium.h:104
Botan::Sodium::crypto_secretbox_NONCEBYTES
Definition: sodium.h:107

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_boxzerobytes | ( |  | ) |
| inline

Definition at line 283 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES.

284 {
285 return crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES;
286 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
Definition: sodium.h:96

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_keybytes | ( |  | ) |
| inline

Definition at line 244 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_KEYBYTES.

245 {
246 return crypto_secretbox_xsalsa20poly1305_KEYBYTES;
247 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_KEYBYTES
Definition: sodium.h:97

void Botan::Sodium::crypto_secretbox_xsalsa20poly1305_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 278 of file sodium.h.

References randombytes_buf().

279 {
280 return randombytes_buf(k, 32);
281 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_macbytes | ( |  | ) |
| inline

Definition at line 254 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_MACBYTES.

255 {
256 return crypto_secretbox_xsalsa20poly1305_MACBYTES;
257 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_MACBYTES
Definition: sodium.h:98

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_messagebytes_max | ( |  | ) |
| inline

Definition at line 259 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX.

260 {
261 return crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX;
262 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
Definition: sodium.h:99

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_noncebytes | ( |  | ) |
| inline

Definition at line 249 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_NONCEBYTES.

250 {
251 return crypto_secretbox_xsalsa20poly1305_NONCEBYTES;
252 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_NONCEBYTES
Definition: sodium.h:100

int Botan::Sodium::crypto_secretbox_xsalsa20poly1305_open | ( | uint8_t | ptext[],
|  | const uint8_t | ctext[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 41 of file sodium_secretbox.cpp.

References Botan::clear_mem(), Botan::constant_time_compare(), Botan::MessageAuthenticationCode::create_or_throw(), Botan::StreamCipher::create_or_throw(), crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, crypto_secretbox_KEYBYTES, and crypto_secretbox_NONCEBYTES.

Referenced by crypto_box_curve25519xsalsa20poly1305_open_afternm(), and crypto_secretbox_open().

46 {
47 if(ctext_len < crypto_box_curve25519xsalsa20poly1305_ZEROBYTES)
48 {
49 return -1;
50 }
51
52 auto salsa = StreamCipher::create_or_throw("Salsa20");
53 salsa->set_key(key, crypto_secretbox_KEYBYTES);
54 salsa->set_iv(nonce, crypto_secretbox_NONCEBYTES);
55
56 secure_vector<uint8_t> auth_key(32);
57 salsa->write_keystream(auth_key.data(), auth_key.size());
58
59 auto poly1305 = MessageAuthenticationCode::create_or_throw("Poly1305");
60 poly1305->set_key(auth_key);
61 poly1305->update(ctext + 32, ctext_len - 32);
62 secure_vector<uint8_t> computed = poly1305->final();
63
64 if(!constant_time_compare(computed.data(), ctext + 16, 16))
65 return -1;
66
67 salsa->cipher(ctext + 32, ptext + 32, ctext_len - 32);
68
69 clear_mem(ptext, 32);
70 return 0;
71 }
Botan::clear_mem
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:112
Botan::constant_time_compare
bool constant_time_compare(const uint8_t x[], const uint8_t y[], size_t len)
Definition: mem_ops.h:82
Botan::Sodium::crypto_secretbox_KEYBYTES
Definition: sodium.h:104
Botan::Sodium::crypto_secretbox_NONCEBYTES
Definition: sodium.h:107
Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
Definition: sodium.h:60

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_zerobytes | ( |  | ) |
| inline

Definition at line 288 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_ZEROBYTES.

289 {
290 return crypto_secretbox_xsalsa20poly1305_ZEROBYTES;
291 }
Botan::Sodium::crypto_secretbox_xsalsa20poly1305_ZEROBYTES
Definition: sodium.h:101

size_t Botan::Sodium::crypto_secretbox_zerobytes | ( |  | ) |
| inline

Definition at line 346 of file sodium.h.

References crypto_secretbox_ZEROBYTES.

347 {
348 return crypto_secretbox_ZEROBYTES;
349 }
Botan::Sodium::crypto_secretbox_ZEROBYTES
Definition: sodium.h:108

int Botan::Sodium::crypto_shorthash | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | k[16]
| ) |  |
| inline

Definition at line 1333 of file sodium.h.

References crypto_shorthash_siphash24().

1335 {
1336 return crypto_shorthash_siphash24(out, in, in_len, k);
1337 }
Botan::Sodium::crypto_shorthash_siphash24
int crypto_shorthash_siphash24(uint8_t out[8], const uint8_t in[], size_t in_len, const uint8_t key[16])
Definition: sodium_auth.cpp:29

size_t Botan::Sodium::crypto_shorthash_bytes | ( |  | ) |
| inline

Definition at line 1327 of file sodium.h.

References crypto_shorthash_siphash24_bytes().

1327 { return crypto_shorthash_siphash24_bytes(); }
Botan::Sodium::crypto_shorthash_siphash24_bytes
size_t crypto_shorthash_siphash24_bytes()
Definition: sodium.h:1318

size_t Botan::Sodium::crypto_shorthash_keybytes | ( |  | ) |
| inline

Definition at line 1329 of file sodium.h.

References crypto_shorthash_siphash24_keybytes().

1329 { return crypto_shorthash_siphash24_keybytes(); }
Botan::Sodium::crypto_shorthash_siphash24_keybytes
size_t crypto_shorthash_siphash24_keybytes()
Definition: sodium.h:1320

void Botan::Sodium::crypto_shorthash_keygen | ( | uint8_t | k[16] | ) |
| inline

Definition at line 1339 of file sodium.h.

References crypto_shorthash_siphash24_KEYBYTES, and randombytes_buf().

1340 {
1341 randombytes_buf(k, crypto_shorthash_siphash24_KEYBYTES);
1342 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17
Botan::Sodium::crypto_shorthash_siphash24_KEYBYTES
Definition: sodium.h:111

const char* Botan::Sodium::crypto_shorthash_primitive | ( |  | ) |
| inline

Definition at line 1331 of file sodium.h.

1331 { return "siphash24"; }

int Botan::Sodium::crypto_shorthash_siphash24 | ( | uint8_t | out[8],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | key[16]
| ) |  |

Definition at line 29 of file sodium_auth.cpp.

References Botan::MessageAuthenticationCode::create_or_throw(), and crypto_shorthash_siphash24_KEYBYTES.

Referenced by crypto_shorthash().

31 {
32 auto mac = MessageAuthenticationCode::create_or_throw("SipHash(2,4)");
33 mac->set_key(key, crypto_shorthash_siphash24_KEYBYTES);
34 mac->update(in, in_len);
35 mac->final(out);
36 return 0;
37 }
Botan::Sodium::crypto_shorthash_siphash24_KEYBYTES
Definition: sodium.h:111

size_t Botan::Sodium::crypto_shorthash_siphash24_bytes | ( |  | ) |
| inline

Definition at line 1318 of file sodium.h.

References crypto_shorthash_siphash24_BYTES.

Referenced by crypto_shorthash_bytes().

1318 { return crypto_shorthash_siphash24_BYTES; }
Botan::Sodium::crypto_shorthash_siphash24_BYTES
Definition: sodium.h:110

size_t Botan::Sodium::crypto_shorthash_siphash24_keybytes | ( |  | ) |
| inline

Definition at line 1320 of file sodium.h.

References crypto_shorthash_siphash24_KEYBYTES.

Referenced by crypto_shorthash_keybytes().

1320 { return crypto_shorthash_siphash24_KEYBYTES; }
Botan::Sodium::crypto_shorthash_siphash24_KEYBYTES
Definition: sodium.h:111

size_t Botan::Sodium::crypto_sign_bytes | ( |  | ) |
| inline

Definition at line 1393 of file sodium.h.

References crypto_sign_BYTES.

1394 {
1395 return crypto_sign_BYTES;
1396 }
Botan::Sodium::crypto_sign_BYTES
Definition: sodium.h:120

int Botan::Sodium::crypto_sign_detached | ( | uint8_t | sig[],
|  | unsigned long long * | sig_len,
|  | const uint8_t | msg[],
|  | size_t | msg_len,
|  | const uint8_t | sk[32]
| ) |  |
| inline

Definition at line 1434 of file sodium.h.

References crypto_sign_ed25519_detached().

1437 {
1438 return crypto_sign_ed25519_detached(sig, sig_len, msg, msg_len, sk);
1439 }
Botan::Sodium::crypto_sign_ed25519_detached
int crypto_sign_ed25519_detached(uint8_t sig[], unsigned long long *sig_len, const uint8_t msg[], size_t msg_len, const uint8_t sk[32])
Definition: sodium_25519.cpp:24

size_t Botan::Sodium::crypto_sign_ed25519_bytes | ( |  | ) |
| inline

Definition at line 1346 of file sodium.h.

References crypto_sign_ed25519_BYTES.

1347 {
1348 return crypto_sign_ed25519_BYTES;
1349 }
Botan::Sodium::crypto_sign_ed25519_BYTES
Definition: sodium.h:115

int Botan::Sodium::crypto_sign_ed25519_detached | ( | uint8_t | sig[],
|  | unsigned long long * | sig_len,
|  | const uint8_t | msg[],
|  | size_t | msg_len,
|  | const uint8_t | sk[32]
| ) |  |

Definition at line 24 of file sodium_25519.cpp.

References Botan::ed25519_sign().

Referenced by crypto_sign_detached().

29 {
30 ed25519_sign(sig, msg, msg_len, sk, nullptr, 0);
31
32 if(sig_len)
33 *sig_len = 64;
34 return 0;
35 }
Botan::ed25519_sign
void ed25519_sign(uint8_t sig[64], const uint8_t m[], size_t mlen, const uint8_t sk[64], const uint8_t domain_sep[], size_t domain_sep_len)
Definition: ed25519.cpp:36

int Botan::Sodium::crypto_sign_ed25519_keypair | ( | uint8_t | pk[32],
|  | uint8_t | sk[64]
| ) |  |

Definition at line 46 of file sodium_25519.cpp.

References crypto_sign_ed25519_seed_keypair(), and randombytes_buf().

Referenced by crypto_sign_keypair().

47 {
48 secure_vector<uint8_t> seed(32);
49 randombytes_buf(seed.data(), seed.size());
50 return crypto_sign_ed25519_seed_keypair(pk, sk, seed.data());
51 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17
Botan::Sodium::crypto_sign_ed25519_seed_keypair
int crypto_sign_ed25519_seed_keypair(uint8_t pk[], uint8_t sk[], const uint8_t seed[])
Definition: sodium_25519.cpp:53

size_t Botan::Sodium::crypto_sign_ed25519_messagebytes_max | ( |  | ) |
| inline

Definition at line 1366 of file sodium.h.

References crypto_sign_ed25519_MESSAGEBYTES_MAX.

1367 {
1368 return crypto_sign_ed25519_MESSAGEBYTES_MAX;
1369 }
Botan::Sodium::crypto_sign_ed25519_MESSAGEBYTES_MAX
Definition: sodium.h:116

size_t Botan::Sodium::crypto_sign_ed25519_publickeybytes | ( |  | ) |
| inline

Definition at line 1356 of file sodium.h.

References crypto_sign_ed25519_PUBLICKEYBYTES.

1357 {
1358 return crypto_sign_ed25519_PUBLICKEYBYTES;
1359 }
Botan::Sodium::crypto_sign_ed25519_PUBLICKEYBYTES
Definition: sodium.h:117

size_t Botan::Sodium::crypto_sign_ed25519_secretkeybytes | ( |  | ) |
| inline

Definition at line 1361 of file sodium.h.

References crypto_sign_ed25519_SECRETKEYBYTES.

1362 {
1363 return crypto_sign_ed25519_SECRETKEYBYTES;
1364 }
Botan::Sodium::crypto_sign_ed25519_SECRETKEYBYTES
Definition: sodium.h:118

int Botan::Sodium::crypto_sign_ed25519_seed_keypair | ( | uint8_t | pk[],
|  | uint8_t | sk[],
|  | const uint8_t | seed[]
| ) |  |

Definition at line 53 of file sodium_25519.cpp.

References Botan::ed25519_gen_keypair().

Referenced by crypto_sign_ed25519_keypair(), and crypto_sign_seed_keypair().

55 {
56 ed25519_gen_keypair(pk, sk, seed);
57 return 0;
58 }
Botan::ed25519_gen_keypair
void ed25519_gen_keypair(uint8_t *pk, uint8_t *sk, const uint8_t seed[32])
Definition: ed25519.cpp:18

size_t Botan::Sodium::crypto_sign_ed25519_seedbytes | ( |  | ) |
| inline

Definition at line 1351 of file sodium.h.

References crypto_sign_ed25519_SEEDBYTES.

1352 {
1353 return crypto_sign_ed25519_SEEDBYTES;
1354 }
Botan::Sodium::crypto_sign_ed25519_SEEDBYTES
Definition: sodium.h:119

int Botan::Sodium::crypto_sign_ed25519_verify_detached | ( | const uint8_t | sig[],
|  | const uint8_t | msg[],
|  | size_t | msg_len,
|  | const uint8_t | pk[32]
| ) |  |

Definition at line 37 of file sodium_25519.cpp.

References Botan::ed25519_verify().

Referenced by crypto_sign_verify_detached().

41 {
42 const bool ok = ed25519_verify(msg, msg_len, sig, pk, nullptr, 0);
43 return ok ? 0 : -1;
44 }
Botan::ed25519_verify
bool ed25519_verify(const uint8_t *m, size_t mlen, const uint8_t sig[64], const uint8_t *pk, const uint8_t domain_sep[], size_t domain_sep_len)
Definition: ed25519.cpp:71

int Botan::Sodium::crypto_sign_keypair | ( | uint8_t | pk[32],
|  | uint8_t | sk[32]
| ) |  |
| inline

Definition at line 1429 of file sodium.h.

References crypto_sign_ed25519_keypair().

1430 {
1431 return crypto_sign_ed25519_keypair(pk, sk);
1432 }
Botan::Sodium::crypto_sign_ed25519_keypair
int crypto_sign_ed25519_keypair(uint8_t pk[32], uint8_t sk[64])
Definition: sodium_25519.cpp:46

size_t Botan::Sodium::crypto_sign_messagebytes_max | ( |  | ) |
| inline

Definition at line 1413 of file sodium.h.

References crypto_sign_MESSAGEBYTES_MAX.

1414 {
1415 return crypto_sign_MESSAGEBYTES_MAX;
1416 }
Botan::Sodium::crypto_sign_MESSAGEBYTES_MAX
Definition: sodium.h:121

const char* Botan::Sodium::crypto_sign_primitive | ( |  | ) |
| inline

Definition at line 1418 of file sodium.h.

1419 {
1420 return "ed25519";
1421 }

size_t Botan::Sodium::crypto_sign_publickeybytes | ( |  | ) |
| inline

Definition at line 1403 of file sodium.h.

References crypto_sign_PUBLICKEYBYTES.

1404 {
1405 return crypto_sign_PUBLICKEYBYTES;
1406 }
Botan::Sodium::crypto_sign_PUBLICKEYBYTES
Definition: sodium.h:122

size_t Botan::Sodium::crypto_sign_secretkeybytes | ( |  | ) |
| inline

Definition at line 1408 of file sodium.h.

References crypto_sign_SECRETKEYBYTES.

1409 {
1410 return crypto_sign_SECRETKEYBYTES;
1411 }
Botan::Sodium::crypto_sign_SECRETKEYBYTES
Definition: sodium.h:123

int Botan::Sodium::crypto_sign_seed_keypair | ( | uint8_t | pk[32],
|  | uint8_t | sk[32],
|  | const uint8_t | seed[]
| ) |  |
| inline

Definition at line 1423 of file sodium.h.

References crypto_sign_ed25519_seed_keypair().

1425 {
1426 return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
1427 }
Botan::Sodium::crypto_sign_ed25519_seed_keypair
int crypto_sign_ed25519_seed_keypair(uint8_t pk[], uint8_t sk[], const uint8_t seed[])
Definition: sodium_25519.cpp:53

size_t Botan::Sodium::crypto_sign_seedbytes | ( |  | ) |
| inline

Definition at line 1398 of file sodium.h.

References crypto_sign_SEEDBYTES.

1399 {
1400 return crypto_sign_SEEDBYTES;
1401 }
Botan::Sodium::crypto_sign_SEEDBYTES
Definition: sodium.h:124

int Botan::Sodium::crypto_sign_verify_detached | ( | const uint8_t | sig[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | pk[32]
| ) |  |
| inline

Definition at line 1441 of file sodium.h.

References crypto_sign_ed25519_verify_detached().

1445 {
1446 return crypto_sign_ed25519_verify_detached(sig, in, in_len, pk);
1447 }
Botan::Sodium::crypto_sign_ed25519_verify_detached
int crypto_sign_ed25519_verify_detached(const uint8_t sig[], const uint8_t msg[], size_t msg_len, const uint8_t pk[32])
Definition: sodium_25519.cpp:37

int Botan::Sodium::crypto_stream | ( | uint8_t | out[],
|  | size_t | out_len,
|  | const uint8_t | nonce[24],
|  | const uint8_t | key[32]
| ) |  |
| inline

Definition at line 1299 of file sodium.h.

References crypto_stream_xsalsa20().

1301 {
1302 return crypto_stream_xsalsa20(out, out_len, nonce, key);
1303 }
Botan::Sodium::crypto_stream_xsalsa20
int crypto_stream_xsalsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_salsa.cpp:91

int Botan::Sodium::crypto_stream_chacha20 | ( | uint8_t | out[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 12 of file sodium_chacha.cpp.

References Botan::StreamCipher::create_or_throw(), crypto_stream_chacha20_KEYBYTES, and crypto_stream_chacha20_NONCEBYTES.

14 {
15 auto chacha = StreamCipher::create_or_throw("ChaCha(20)");
16 chacha->set_key(key, crypto_stream_chacha20_KEYBYTES);
17 chacha->set_iv(nonce, crypto_stream_chacha20_NONCEBYTES);
18 chacha->write_keystream(out, out_len);
19 return 0;
20 }
Botan::Sodium::crypto_stream_chacha20_KEYBYTES
Definition: sodium.h:126
Botan::Sodium::crypto_stream_chacha20_NONCEBYTES
Definition: sodium.h:128

int Botan::Sodium::crypto_stream_chacha20_ietf | ( | uint8_t | out[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 45 of file sodium_chacha.cpp.

References Botan::StreamCipher::create_or_throw(), crypto_stream_chacha20_ietf_KEYBYTES, and crypto_stream_chacha20_ietf_NONCEBYTES.

47 {
48 auto chacha = StreamCipher::create_or_throw("ChaCha(20)");
49 chacha->set_key(key, crypto_stream_chacha20_ietf_KEYBYTES);
50 chacha->set_iv(nonce, crypto_stream_chacha20_ietf_NONCEBYTES);
51 chacha->write_keystream(out, out_len);
52 return 0;
53 }
Botan::Sodium::crypto_stream_chacha20_ietf_KEYBYTES
Definition: sodium.h:129
Botan::Sodium::crypto_stream_chacha20_ietf_NONCEBYTES
Definition: sodium.h:131

size_t Botan::Sodium::crypto_stream_chacha20_ietf_keybytes | ( |  | ) |
| inline

Definition at line 1180 of file sodium.h.

References crypto_stream_chacha20_ietf_KEYBYTES.

1181 {
1182 return crypto_stream_chacha20_ietf_KEYBYTES;
1183 }
Botan::Sodium::crypto_stream_chacha20_ietf_KEYBYTES
Definition: sodium.h:129

void Botan::Sodium::crypto_stream_chacha20_ietf_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 1210 of file sodium.h.

References randombytes_buf().

1211 {
1212 return randombytes_buf(k, 32);
1213 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_stream_chacha20_ietf_messagebytes_max | ( |  | ) |
| inline

Definition at line 1190 of file sodium.h.

References crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX.

1191 {
1192 return crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX;
1193 }
Botan::Sodium::crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX
Definition: sodium.h:130

size_t Botan::Sodium::crypto_stream_chacha20_ietf_noncebytes | ( |  | ) |
| inline

Definition at line 1185 of file sodium.h.

References crypto_stream_chacha20_ietf_NONCEBYTES.

1186 {
1187 return crypto_stream_chacha20_ietf_NONCEBYTES;
1188 }
Botan::Sodium::crypto_stream_chacha20_ietf_NONCEBYTES
Definition: sodium.h:131

int Botan::Sodium::crypto_stream_chacha20_ietf_xor | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 55 of file sodium_chacha.cpp.

References crypto_stream_chacha20_ietf_xor_ic().

59 {
60 return crypto_stream_chacha20_ietf_xor_ic(out, in, in_len, nonce, 0, key);
61 }
Botan::Sodium::crypto_stream_chacha20_ietf_xor_ic
int crypto_stream_chacha20_ietf_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint32_t ic, const uint8_t key[])
Definition: sodium_chacha.cpp:63

int Botan::Sodium::crypto_stream_chacha20_ietf_xor_ic | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | uint32_t | ic,
|  | const uint8_t | key[]
| ) |  |

Definition at line 63 of file sodium_chacha.cpp.

References Botan::StreamCipher::create_or_throw(), crypto_stream_chacha20_ietf_KEYBYTES, and crypto_stream_chacha20_ietf_NONCEBYTES.

Referenced by crypto_stream_chacha20_ietf_xor().

67 {
68 auto chacha = StreamCipher::create_or_throw("ChaCha(20)");
69 chacha->set_key(key, crypto_stream_chacha20_ietf_KEYBYTES);
70 chacha->set_iv(nonce, crypto_stream_chacha20_ietf_NONCEBYTES);
71 chacha->seek(static_cast<uint64_t>(ic) * 64);
72 chacha->cipher(in, out, in_len);
73 return 0;
74 }
Botan::Sodium::crypto_stream_chacha20_ietf_KEYBYTES
Definition: sodium.h:129
Botan::Sodium::crypto_stream_chacha20_ietf_NONCEBYTES
Definition: sodium.h:131

size_t Botan::Sodium::crypto_stream_chacha20_keybytes | ( |  | ) |
| inline

Definition at line 1145 of file sodium.h.

References crypto_stream_chacha20_KEYBYTES.

1146 {
1147 return crypto_stream_chacha20_KEYBYTES;
1148 }
Botan::Sodium::crypto_stream_chacha20_KEYBYTES
Definition: sodium.h:126

void Botan::Sodium::crypto_stream_chacha20_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 1175 of file sodium.h.

References randombytes_buf().

1176 {
1177 return randombytes_buf(k, 32);
1178 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_stream_chacha20_messagebytes_max | ( |  | ) |
| inline

Definition at line 1155 of file sodium.h.

References crypto_stream_chacha20_MESSAGEBYTES_MAX.

1156 {
1157 return crypto_stream_chacha20_MESSAGEBYTES_MAX;
1158 }
Botan::Sodium::crypto_stream_chacha20_MESSAGEBYTES_MAX
Definition: sodium.h:127

size_t Botan::Sodium::crypto_stream_chacha20_noncebytes | ( |  | ) |
| inline

Definition at line 1150 of file sodium.h.

References crypto_stream_chacha20_NONCEBYTES.

1151 {
1152 return crypto_stream_chacha20_NONCEBYTES;
1153 }
Botan::Sodium::crypto_stream_chacha20_NONCEBYTES
Definition: sodium.h:128

int Botan::Sodium::crypto_stream_chacha20_xor | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 22 of file sodium_chacha.cpp.

References crypto_stream_chacha20_xor_ic().

25 {
26 return crypto_stream_chacha20_xor_ic(out, in, in_len, nonce, 0, key);
27 }
Botan::Sodium::crypto_stream_chacha20_xor_ic
int crypto_stream_chacha20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
Definition: sodium_chacha.cpp:29

int Botan::Sodium::crypto_stream_chacha20_xor_ic | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | uint64_t | ic,
|  | const uint8_t | key[]
| ) |  |

Definition at line 29 of file sodium_chacha.cpp.

References Botan::StreamCipher::create_or_throw(), crypto_stream_chacha20_KEYBYTES, and crypto_stream_chacha20_NONCEBYTES.

Referenced by crypto_stream_chacha20_xor().

33 {
34 if((ic >> 6) != 0) // otherwise multiply overflows
35 return -1;
36
37 auto chacha = StreamCipher::create_or_throw("ChaCha(20)");
38 chacha->set_key(key, crypto_stream_chacha20_KEYBYTES);
39 chacha->set_iv(nonce, crypto_stream_chacha20_NONCEBYTES);
40 chacha->seek(ic * 64);
41 chacha->cipher(in, out, in_len);
42 return 0;
43 }
Botan::Sodium::crypto_stream_chacha20_KEYBYTES
Definition: sodium.h:126
Botan::Sodium::crypto_stream_chacha20_NONCEBYTES
Definition: sodium.h:128

size_t Botan::Sodium::crypto_stream_keybytes | ( |  | ) |
| inline

Definition at line 1291 of file sodium.h.

References crypto_stream_xsalsa20_keybytes().

1291 { return crypto_stream_xsalsa20_keybytes(); }
Botan::Sodium::crypto_stream_xsalsa20_keybytes
size_t crypto_stream_xsalsa20_keybytes()
Definition: sodium.h:978

void Botan::Sodium::crypto_stream_keygen | ( | uint8_t | key[32] | ) |
| inline

Definition at line 1311 of file sodium.h.

References randombytes_buf().

1312 {
1313 return randombytes_buf(key, 32);
1314 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_stream_messagebytes_max | ( |  | ) |
| inline

Definition at line 1295 of file sodium.h.

References crypto_stream_MESSAGEBYTES_MAX.

1295 { return crypto_stream_MESSAGEBYTES_MAX; }
Botan::Sodium::crypto_stream_MESSAGEBYTES_MAX
Definition: sodium.h:142

size_t Botan::Sodium::crypto_stream_noncebytes | ( |  | ) |
| inline

Definition at line 1293 of file sodium.h.

References crypto_stream_xsalsa20_noncebytes().

1293 { return crypto_stream_xsalsa20_noncebytes(); }
Botan::Sodium::crypto_stream_xsalsa20_noncebytes
size_t crypto_stream_xsalsa20_noncebytes()
Definition: sodium.h:983

const char* Botan::Sodium::crypto_stream_primitive | ( |  | ) |
| inline

Definition at line 1297 of file sodium.h.

1297 { return "xsalsa20"; }

int Botan::Sodium::crypto_stream_salsa20 | ( | uint8_t | out[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 58 of file sodium_salsa.cpp.

References crypto_stream_salsa20_KEYBYTES, crypto_stream_salsa20_NONCEBYTES, Botan::Salsa20::set_iv(), Botan::SymmetricAlgorithm::set_key(), and Botan::StreamCipher::write_keystream().

60 {
61 Salsa20 salsa;
62 salsa.set_key(key, crypto_stream_salsa20_KEYBYTES);
63 salsa.set_iv(nonce, crypto_stream_salsa20_NONCEBYTES);
64 salsa.write_keystream(out, out_len);
65 return 0;
66 }
Botan::Sodium::crypto_stream_salsa20_NONCEBYTES
Definition: sodium.h:134
Botan::Sodium::crypto_stream_salsa20_KEYBYTES
Definition: sodium.h:132

size_t Botan::Sodium::crypto_stream_salsa20_keybytes | ( |  | ) |
| inline

Definition at line 1254 of file sodium.h.

References crypto_stream_xsalsa20_KEYBYTES.

1255 {
1256 return crypto_stream_xsalsa20_KEYBYTES;
1257 }
Botan::Sodium::crypto_stream_xsalsa20_KEYBYTES
Definition: sodium.h:138

void Botan::Sodium::crypto_stream_salsa20_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 1284 of file sodium.h.

References randombytes_buf().

1285 {
1286 return randombytes_buf(k, 32);
1287 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_stream_salsa20_messagebytes_max | ( |  | ) |
| inline

Definition at line 1264 of file sodium.h.

References crypto_stream_salsa20_MESSAGEBYTES_MAX.

1265 {
1266 return crypto_stream_salsa20_MESSAGEBYTES_MAX;
1267 }
Botan::Sodium::crypto_stream_salsa20_MESSAGEBYTES_MAX
Definition: sodium.h:133

size_t Botan::Sodium::crypto_stream_salsa20_noncebytes | ( |  | ) |
| inline

Definition at line 1259 of file sodium.h.

References crypto_stream_salsa20_NONCEBYTES.

1260 {
1261 return crypto_stream_salsa20_NONCEBYTES;
1262 }
Botan::Sodium::crypto_stream_salsa20_NONCEBYTES
Definition: sodium.h:134

int Botan::Sodium::crypto_stream_salsa20_xor | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 68 of file sodium_salsa.cpp.

References crypto_stream_salsa20_xor_ic().

71 {
72 return crypto_stream_salsa20_xor_ic(out, in, in_len, nonce, 0, key);
73 }
Botan::Sodium::crypto_stream_salsa20_xor_ic
int crypto_stream_salsa20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
Definition: sodium_salsa.cpp:75

int Botan::Sodium::crypto_stream_salsa20_xor_ic | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | uint64_t | ic,
|  | const uint8_t | key[]
| ) |  |

Definition at line 75 of file sodium_salsa.cpp.

References Botan::Salsa20::cipher(), crypto_stream_salsa20_KEYBYTES, crypto_stream_salsa20_NONCEBYTES, Botan::Salsa20::seek(), Botan::Salsa20::set_iv(), and Botan::SymmetricAlgorithm::set_key().

Referenced by crypto_stream_salsa20_xor().

79 {
80 if((ic >> 6) != 0) // otherwise multiply overflows
81 return -1;
82
83 Salsa20 salsa;
84 salsa.set_key(key, crypto_stream_salsa20_KEYBYTES);
85 salsa.set_iv(nonce, crypto_stream_salsa20_NONCEBYTES);
86 salsa.seek(ic * 64);
87 salsa.cipher(in, out, in_len);
88 return 0;
89 }
Botan::Sodium::crypto_stream_salsa20_NONCEBYTES
Definition: sodium.h:134
Botan::Sodium::crypto_stream_salsa20_KEYBYTES
Definition: sodium.h:132

int Botan::Sodium::crypto_stream_xchacha20 | ( | uint8_t | out[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 76 of file sodium_chacha.cpp.

References Botan::StreamCipher::create_or_throw(), crypto_stream_xchacha20_KEYBYTES, and crypto_stream_xchacha20_NONCEBYTES.

78 {
79 auto chacha = StreamCipher::create_or_throw("ChaCha(20)");
80 chacha->set_key(key, crypto_stream_xchacha20_KEYBYTES);
81 chacha->set_iv(nonce, crypto_stream_xchacha20_NONCEBYTES);
82 chacha->write_keystream(out, out_len);
83 return 0;
84 }
Botan::Sodium::crypto_stream_xchacha20_NONCEBYTES
Definition: sodium.h:137
Botan::Sodium::crypto_stream_xchacha20_KEYBYTES
Definition: sodium.h:135

size_t Botan::Sodium::crypto_stream_xchacha20_keybytes | ( |  | ) |
| inline

Definition at line 1217 of file sodium.h.

References crypto_stream_xchacha20_KEYBYTES.

1218 {
1219 return crypto_stream_xchacha20_KEYBYTES;
1220 }
Botan::Sodium::crypto_stream_xchacha20_KEYBYTES
Definition: sodium.h:135

void Botan::Sodium::crypto_stream_xchacha20_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 1247 of file sodium.h.

References crypto_stream_xchacha20_KEYBYTES, and randombytes_buf().

1248 {
1249 return randombytes_buf(k, crypto_stream_xchacha20_KEYBYTES);
1250 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17
Botan::Sodium::crypto_stream_xchacha20_KEYBYTES
Definition: sodium.h:135

size_t Botan::Sodium::crypto_stream_xchacha20_messagebytes_max | ( |  | ) |
| inline

Definition at line 1227 of file sodium.h.

References crypto_stream_xchacha20_MESSAGEBYTES_MAX.

1228 {
1229 return crypto_stream_xchacha20_MESSAGEBYTES_MAX;
1230 }
Botan::Sodium::crypto_stream_xchacha20_MESSAGEBYTES_MAX
Definition: sodium.h:136

size_t Botan::Sodium::crypto_stream_xchacha20_noncebytes | ( |  | ) |
| inline

Definition at line 1222 of file sodium.h.

References crypto_stream_xchacha20_NONCEBYTES.

1223 {
1224 return crypto_stream_xchacha20_NONCEBYTES;
1225 }
Botan::Sodium::crypto_stream_xchacha20_NONCEBYTES
Definition: sodium.h:137

int Botan::Sodium::crypto_stream_xchacha20_xor | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 86 of file sodium_chacha.cpp.

References crypto_stream_xchacha20_xor_ic().

89 {
90 return crypto_stream_xchacha20_xor_ic(out, in, in_len, nonce, 0, key);
91 }
Botan::Sodium::crypto_stream_xchacha20_xor_ic
int crypto_stream_xchacha20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
Definition: sodium_chacha.cpp:93

int Botan::Sodium::crypto_stream_xchacha20_xor_ic | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | uint64_t | ic,
|  | const uint8_t | key[]
| ) |  |

Definition at line 93 of file sodium_chacha.cpp.

References Botan::StreamCipher::create_or_throw(), crypto_stream_xchacha20_KEYBYTES, and crypto_stream_xchacha20_NONCEBYTES.

Referenced by crypto_stream_xchacha20_xor().

97 {
98 if((ic >> 6) != 0) // otherwise multiply overflows
99 return -1;
100
101 auto chacha = StreamCipher::create_or_throw("ChaCha(20)");
102 chacha->set_key(key, crypto_stream_xchacha20_KEYBYTES);
103 chacha->set_iv(nonce, crypto_stream_xchacha20_NONCEBYTES);
104 chacha->seek(ic * 64);
105 chacha->cipher(in, out, in_len);
106 return 0;
107 }
Botan::Sodium::crypto_stream_xchacha20_NONCEBYTES
Definition: sodium.h:137
Botan::Sodium::crypto_stream_xchacha20_KEYBYTES
Definition: sodium.h:135

int Botan::Sodium::crypto_stream_xor | ( | uint8_t | out[],
|  | const uint8_t | in[],
|  | size_t | in_len,
|  | const uint8_t | nonce[24],
|  | const uint8_t | key[32]
| ) |  |
| inline

Definition at line 1305 of file sodium.h.

References crypto_stream_xsalsa20_xor().

1307 {
1308 return crypto_stream_xsalsa20_xor(out, in, in_len, nonce, key);
1309 }
Botan::Sodium::crypto_stream_xsalsa20_xor
int crypto_stream_xsalsa20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])
Definition: sodium_salsa.cpp:101

int Botan::Sodium::crypto_stream_xsalsa20 | ( | uint8_t | out[],
|  | size_t | ctext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 91 of file sodium_salsa.cpp.

References crypto_stream_xsalsa20_KEYBYTES, crypto_stream_xsalsa20_NONCEBYTES, Botan::Salsa20::set_iv(), Botan::SymmetricAlgorithm::set_key(), and Botan::StreamCipher::write_keystream().

Referenced by crypto_stream().

93 {
94 Salsa20 salsa;
95 salsa.set_key(key, crypto_stream_xsalsa20_KEYBYTES);
96 salsa.set_iv(nonce, crypto_stream_xsalsa20_NONCEBYTES);
97 salsa.write_keystream(out, out_len);
98 return 0;
99 }
Botan::Sodium::crypto_stream_xsalsa20_KEYBYTES
Definition: sodium.h:138
Botan::Sodium::crypto_stream_xsalsa20_NONCEBYTES
Definition: sodium.h:140

size_t Botan::Sodium::crypto_stream_xsalsa20_keybytes | ( |  | ) |
| inline

Definition at line 978 of file sodium.h.

References crypto_stream_xsalsa20_KEYBYTES.

Referenced by crypto_stream_keybytes().

979 {
980 return crypto_stream_xsalsa20_KEYBYTES;
981 }
Botan::Sodium::crypto_stream_xsalsa20_KEYBYTES
Definition: sodium.h:138

void Botan::Sodium::crypto_stream_xsalsa20_keygen | ( | uint8_t | k[32] | ) |
| inline

Definition at line 1008 of file sodium.h.

References randombytes_buf().

1009 {
1010 return randombytes_buf(k, 32);
1011 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::crypto_stream_xsalsa20_messagebytes_max | ( |  | ) |
| inline

Definition at line 988 of file sodium.h.

References crypto_stream_xsalsa20_MESSAGEBYTES_MAX.

989 {
990 return crypto_stream_xsalsa20_MESSAGEBYTES_MAX;
991 }
Botan::Sodium::crypto_stream_xsalsa20_MESSAGEBYTES_MAX
Definition: sodium.h:139

size_t Botan::Sodium::crypto_stream_xsalsa20_noncebytes | ( |  | ) |
| inline

Definition at line 983 of file sodium.h.

References crypto_stream_xsalsa20_NONCEBYTES.

Referenced by crypto_stream_noncebytes().

984 {
985 return crypto_stream_xsalsa20_NONCEBYTES;
986 }
Botan::Sodium::crypto_stream_xsalsa20_NONCEBYTES
Definition: sodium.h:140

int Botan::Sodium::crypto_stream_xsalsa20_xor | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | const uint8_t | key[]
| ) |  |

Definition at line 101 of file sodium_salsa.cpp.

References crypto_stream_xsalsa20_xor_ic().

Referenced by crypto_stream_xor().

104 {
105 return crypto_stream_xsalsa20_xor_ic(out, in, in_len, nonce, 0, key);
106 }
Botan::Sodium::crypto_stream_xsalsa20_xor_ic
int crypto_stream_xsalsa20_xor_ic(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], uint64_t ic, const uint8_t key[])
Definition: sodium_salsa.cpp:108

int Botan::Sodium::crypto_stream_xsalsa20_xor_ic | ( | uint8_t | out[],
|  | const uint8_t | ptext[],
|  | size_t | ptext_len,
|  | const uint8_t | nonce[],
|  | uint64_t | ic,
|  | const uint8_t | key[]
| ) |  |

Definition at line 108 of file sodium_salsa.cpp.

References Botan::Salsa20::cipher(), crypto_stream_xsalsa20_KEYBYTES, crypto_stream_xsalsa20_NONCEBYTES, Botan::Salsa20::seek(), Botan::Salsa20::set_iv(), and Botan::SymmetricAlgorithm::set_key().

Referenced by crypto_stream_xsalsa20_xor().

112 {
113 if((ic >> 6) != 0) // otherwise multiply overflows
114 return -1;
115
116 Salsa20 salsa;
117 salsa.set_key(key, crypto_stream_xsalsa20_KEYBYTES);
118 salsa.set_iv(nonce, crypto_stream_xsalsa20_NONCEBYTES);
119 salsa.seek(ic * 64);
120 salsa.cipher(in, out, in_len);
121 return 0;
122 }
Botan::Sodium::crypto_stream_xsalsa20_KEYBYTES
Definition: sodium.h:138
Botan::Sodium::crypto_stream_xsalsa20_NONCEBYTES
Definition: sodium.h:140

int Botan::Sodium::crypto_verify_16 | ( | const uint8_t | x[16],
|  | const uint8_t | y[16]
| ) |  |

Definition at line 45 of file sodium_utils.cpp.

References Botan::same_mem().

Referenced by crypto_onetimeauth_poly1305_verify().

46 {
47 return same_mem(x, y, 16);
48 }
Botan::same_mem
bool same_mem(const T *p1, const T *p2, size_t n)
Definition: mem_ops.h:216

int Botan::Sodium::crypto_verify_32 | ( | const uint8_t | x[32],
|  | const uint8_t | y[32]
| ) |  |

Definition at line 50 of file sodium_utils.cpp.

References Botan::same_mem().

Referenced by crypto_auth_hmacsha256_verify(), and crypto_auth_hmacsha512256_verify().

51 {
52 return same_mem(x, y, 32);
53 }
Botan::same_mem
bool same_mem(const T *p1, const T *p2, size_t n)
Definition: mem_ops.h:216

int Botan::Sodium::crypto_verify_64 | ( | const uint8_t | x[64],
|  | const uint8_t | y[64]
| ) |  |

Definition at line 55 of file sodium_utils.cpp.

References Botan::same_mem().

Referenced by crypto_auth_hmacsha512_verify().

56 {
57 return same_mem(x, y, 64);
58 }
Botan::same_mem
bool same_mem(const T *p1, const T *p2, size_t n)
Definition: mem_ops.h:216

void Botan::Sodium::randombytes | ( | uint8_t | buf[],
|  | size_t | buf_len
| ) |  |
| inline

Definition at line 237 of file sodium.h.

References randombytes_buf().

238 {
239 return randombytes_buf(buf, buf_len);
240 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

void Botan::Sodium::randombytes_buf | ( | void * | buf,
|  | size_t | size
| ) |  |

Definition at line 17 of file sodium_utils.cpp.

References Botan::RandomNumberGenerator::randomize(), and Botan::system_rng().

Referenced by crypto_aead_chacha20poly1305_ietf_keygen(), crypto_aead_chacha20poly1305_keygen(), crypto_aead_xchacha20poly1305_ietf_keygen(), crypto_auth_hmacsha256_keygen(), crypto_auth_hmacsha512256_keygen(), crypto_auth_hmacsha512_keygen(), crypto_auth_keygen(), crypto_box_curve25519xsalsa20poly1305_keypair(), crypto_onetimeauth_poly1305_keygen(), crypto_secretbox_keygen(), crypto_secretbox_xsalsa20poly1305_keygen(), crypto_shorthash_keygen(), crypto_sign_ed25519_keypair(), crypto_stream_chacha20_ietf_keygen(), crypto_stream_chacha20_keygen(), crypto_stream_keygen(), crypto_stream_salsa20_keygen(), crypto_stream_xchacha20_keygen(), crypto_stream_xsalsa20_keygen(), randombytes(), randombytes_random(), and randombytes_uniform().

18 {
19 system_rng().randomize(static_cast<uint8_t*>(buf), len);
20 }
Botan::system_rng
RandomNumberGenerator & system_rng()
Definition: system_rng.cpp:279
Botan::RandomNumberGenerator::randomize
virtual void randomize(uint8_t output[], size_t length)=0

void Botan::Sodium::randombytes_buf_deterministic | ( | void * | buf,
|  | size_t | size,
|  | const uint8_t | seed[randombytes_SEEDBYTES]
| ) |  |

Definition at line 33 of file sodium_utils.cpp.

References Botan::ChaCha::set_iv(), Botan::SymmetricAlgorithm::set_key(), and Botan::ChaCha::write_keystream().

34 {
35 const unsigned char nonce[12] = {
36 'L', 'i', 'b', 's', 'o', 'd', 'i', 'u', 'm', 'D', 'R', 'G'
37 };
38
39 ChaCha chacha(20);
40 chacha.set_key(seed, randombytes_SEEDBYTES);
41 chacha.set_iv(nonce, sizeof(nonce));
42 chacha.write_keystream(static_cast<uint8_t*>(buf), size);
43 }
Botan::Sodium::randombytes_SEEDBYTES
Definition: sodium.h:149

int Botan::Sodium::randombytes_close | ( |  | ) |
| inline

Definition at line 230 of file sodium.h.

230 { return 0; }

const char* Botan::Sodium::randombytes_implementation_name | ( |  | ) |
| inline

Definition at line 232 of file sodium.h.

233 {
234 return "botan";
235 }

uint32_t Botan::Sodium::randombytes_random | ( |  | ) |
| inline

Definition at line 221 of file sodium.h.

References randombytes_buf().

222 {
223 uint32_t x = 0;
224 randombytes_buf(&x, 4);
225 return x;
226 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

size_t Botan::Sodium::randombytes_seedbytes | ( |  | ) |
| inline

Definition at line 209 of file sodium.h.

References randombytes_SEEDBYTES.

209 { return randombytes_SEEDBYTES; }
Botan::Sodium::randombytes_SEEDBYTES
Definition: sodium.h:149

void Botan::Sodium::randombytes_stir | ( |  | ) |
| inline

Definition at line 228 of file sodium.h.

228 {}

uint32_t Botan::Sodium::randombytes_uniform | ( | uint32_t | upper_bound | ) |

Definition at line 22 of file sodium_utils.cpp.

References randombytes_buf().

23 {
24 if(upper_bound <= 1)
25 return 0;
26
27 // Not completely uniform
28 uint64_t x;
29 randombytes_buf(&x, sizeof(x));
30 return x % upper_bound;
31 }
Botan::Sodium::randombytes_buf
void randombytes_buf(void *buf, size_t size)
Definition: sodium_utils.cpp:17

void Botan::Sodium::sodium_add | ( | uint8_t | a[],
|  | const uint8_t | b[],
|  | size_t | len
| ) |  |

Definition at line 107 of file sodium_utils.cpp.

References Botan::carry().

108 {
109 uint8_t carry = 0;
110 for(size_t i = 0; i != len; ++i)
111 {
112 a[i] += b[i] + carry;
113 carry = (a[i] < b[i]);
114 }
115 }
Botan::carry
void carry(int64_t &h0, int64_t &h1)
Definition: ed25519_internal.h:32

void * Botan::Sodium::sodium_allocarray | ( | size_t | count,
|  | size_t | size
| ) |  |

Definition at line 140 of file sodium_utils.cpp.

References sodium_malloc().

141 {
142 const size_t bytes = count * size;
143 if(bytes < count || bytes < size)
144 return nullptr;
145 return sodium_malloc(bytes);
146 }
Botan::Sodium::sodium_malloc
void * sodium_malloc(size_t size)
Definition: sodium_utils.cpp:117

int Botan::Sodium::sodium_compare | ( | const uint8_t | x[],
|  | const uint8_t | y[],
|  | size_t | len
| ) |  |

Definition at line 71 of file sodium_utils.cpp.

References Botan::CT::Mask< T >::is_equal(), and Botan::CT::Mask< T >::is_lt().

72 {
73 const uint8_t LT = static_cast<uint8_t>(-1);
74 const uint8_t EQ = 0;
75 const uint8_t GT = 1;
76
77 uint8_t result = EQ; // until found otherwise
78
79 for(size_t i = 0; i != len; ++i)
80 {
81 const auto is_eq = CT::Mask<uint8_t>::is_equal(x[i], y[i]);
82 const auto is_lt = CT::Mask<uint8_t>::is_lt(x[i], y[i]);
83 result = is_eq.select(result, is_lt.select(LT, GT));
84 }
85
86 return static_cast<int8_t>(result);
87 }

void Botan::Sodium::sodium_free | ( | void * | ptr | ) |

Definition at line 129 of file sodium_utils.cpp.

References Botan::load_le< uint64_t >(), and Botan::secure_scrub_memory().

130 {
131 if(ptr == nullptr)
132 return;
133
134 uint8_t* p = static_cast<uint8_t*>(ptr) - 8;
135 const uint64_t len = load_le<uint64_t>(p, 0);
136 secure_scrub_memory(ptr, static_cast<size_t>(len));
137 std::free(p);
138 }
Botan::load_le< uint64_t >
uint64_t load_le< uint64_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:237
Botan::secure_scrub_memory
void secure_scrub_memory(void *ptr, size_t n)
Definition: os_utils.cpp:66

void Botan::Sodium::sodium_increment | ( | uint8_t | n[],
|  | size_t | nlen
| ) |  |

Definition at line 97 of file sodium_utils.cpp.

References Botan::carry().

98 {
99 uint8_t carry = 1;
100 for(size_t i = 0; i != len; ++i)
101 {
102 b[i] += carry;
103 carry &= (b[i] == 0);
104 }
105 }
Botan::carry
void carry(int64_t &h0, int64_t &h1)
Definition: ed25519_internal.h:32

int Botan::Sodium::sodium_init | ( |  | ) |
| inline

Definition at line 160 of file sodium.h.

160 { return 0; }

int Botan::Sodium::sodium_is_zero | ( | const uint8_t | nonce[],
|  | size_t | nlen
| ) |  |

Definition at line 89 of file sodium_utils.cpp.

References Botan::CT::Mask< T >::expand().

90 {
91 uint8_t sum = 0;
92 for(size_t i = 0; i != len; ++i)
93 sum |= b[i];
94 return static_cast<int>(CT::Mask<uint8_t>::expand(sum).if_not_set_return(1));
95 }

int Botan::Sodium::sodium_library_minimal | ( |  | ) |
| inline

Definition at line 158 of file sodium.h.

158 { return 0; }

int Botan::Sodium::sodium_library_version_major | ( |  | ) |
| inline

Definition at line 154 of file sodium.h.

154 { return 0; }

int Botan::Sodium::sodium_library_version_minor | ( |  | ) |
| inline

Definition at line 156 of file sodium.h.

156 { return 0; }

void * Botan::Sodium::sodium_malloc | ( | size_t | size | ) |

Definition at line 117 of file sodium_utils.cpp.

References Botan::store_le().

Referenced by sodium_allocarray().

118 {
119 const uint64_t len = size;
120
121 if(size + sizeof(len) < size)
122 return nullptr;
123
124 uint8_t* p = static_cast<uint8_t*>(std::calloc(size + sizeof(len), 1));
125 store_le(len, p);
126 return p + 8;
127 }
Botan::store_le
void store_le(uint16_t in, uint8_t out[2])
Definition: loadstor.h:454

int Botan::Sodium::sodium_memcmp | ( | const void * | x,
|  | const void * | y,
|  | size_t | len
| ) |  |

Definition at line 65 of file sodium_utils.cpp.

References Botan::constant_time_compare().

66 {
67 const bool same = constant_time_compare(static_cast<const uint8_t*>(x), static_cast<const uint8_t*>(y), len);
68 return same ? 0 : -1;
69 }
Botan::constant_time_compare
bool constant_time_compare(const uint8_t x[], const uint8_t y[], size_t len)
Definition: mem_ops.h:82

void Botan::Sodium::sodium_memzero | ( | void * | ptr,
|  | size_t | len
| ) |  |

Definition at line 60 of file sodium_utils.cpp.

References Botan::secure_scrub_memory().

61 {
62 secure_scrub_memory(ptr, len);
63 }
Botan::secure_scrub_memory
void secure_scrub_memory(void *ptr, size_t n)
Definition: os_utils.cpp:66

int Botan::Sodium::sodium_mprotect_noaccess | ( | void * | ptr | ) |

Definition at line 148 of file sodium_utils.cpp.

References Botan::OS::page_prohibit_access().

149 {
150 OS::page_prohibit_access(ptr);
151 return 0;
152 }
Botan::OS::page_prohibit_access
void page_prohibit_access(void *page)
Definition: os_utils.cpp:551

int Botan::Sodium::sodium_mprotect_readwrite | ( | void * | ptr | ) |

Definition at line 154 of file sodium_utils.cpp.

References Botan::OS::page_allow_access().

155 {
156 OS::page_allow_access(ptr);
157 return 0;
158 }
Botan::OS::page_allow_access
void page_allow_access(void *page)
Definition: os_utils.cpp:539

const char* Botan::Sodium::sodium_version_string | ( |  | ) |
| inline

Definition at line 152 of file sodium.h.

152 { return "Botan Sodium Compat"; }