Botan 3.0.0-alpha0
Crypto and TLS for C&
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

◆ Sodium_Constants

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

Function Documentation

◆ crypto_aead_chacha20poly1305_abytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_abytes ( )
inline

Definition at line 462 of file sodium.h.

463 {
465 }

References crypto_aead_chacha20poly1305_ABYTES.

◆ crypto_aead_chacha20poly1305_decrypt()

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.

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 }
#define BOTAN_UNUSED(...)
Definition: assert.h:141
size_t crypto_aead_chacha20poly1305_npubbytes()
Definition: sodium.h:457

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

◆ crypto_aead_chacha20poly1305_decrypt_detached()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

◆ crypto_aead_chacha20poly1305_encrypt()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

◆ crypto_aead_chacha20poly1305_encrypt_detached()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_npubbytes().

◆ crypto_aead_chacha20poly1305_ietf_abytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_abytes ( )
inline

Definition at line 387 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_ABYTES.

◆ crypto_aead_chacha20poly1305_ietf_decrypt()

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.

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 }
size_t crypto_aead_chacha20poly1305_ietf_npubbytes()
Definition: sodium.h:382

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

◆ crypto_aead_chacha20poly1305_ietf_decrypt_detached()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

◆ crypto_aead_chacha20poly1305_ietf_encrypt()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

◆ crypto_aead_chacha20poly1305_ietf_encrypt_detached()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_chacha20poly1305_ietf_npubbytes().

◆ crypto_aead_chacha20poly1305_ietf_keybytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_keybytes ( )
inline

Definition at line 372 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_KEYBYTES.

◆ crypto_aead_chacha20poly1305_ietf_keygen()

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

Definition at line 442 of file sodium.h.

443 {
445 }
void randombytes_buf(void *buf, size_t size)

References crypto_aead_chacha20poly1305_ietf_KEYBYTES, and randombytes_buf().

◆ crypto_aead_chacha20poly1305_ietf_messagebytes_max()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_messagebytes_max ( )
inline

◆ crypto_aead_chacha20poly1305_ietf_npubbytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_npubbytes ( )
inline

◆ crypto_aead_chacha20poly1305_ietf_nsecbytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_ietf_nsecbytes ( )
inline

Definition at line 377 of file sodium.h.

References crypto_aead_chacha20poly1305_ietf_NSECBYTES.

◆ crypto_aead_chacha20poly1305_keybytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_keybytes ( )
inline

Definition at line 447 of file sodium.h.

448 {
450 }

References crypto_aead_chacha20poly1305_KEYBYTES.

◆ crypto_aead_chacha20poly1305_keygen()

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

Definition at line 517 of file sodium.h.

518 {
519 randombytes_buf(k, 32);
520 }

References randombytes_buf().

◆ crypto_aead_chacha20poly1305_messagebytes_max()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_messagebytes_max ( )
inline

Definition at line 467 of file sodium.h.

References crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX.

◆ crypto_aead_chacha20poly1305_npubbytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_npubbytes ( )
inline

◆ crypto_aead_chacha20poly1305_nsecbytes()

size_t Botan::Sodium::crypto_aead_chacha20poly1305_nsecbytes ( )
inline

Definition at line 452 of file sodium.h.

453 {
455 }

References crypto_aead_chacha20poly1305_NSECBYTES.

◆ crypto_aead_xchacha20poly1305_ietf_abytes()

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_abytes ( )
inline

Definition at line 539 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_ABYTES.

◆ crypto_aead_xchacha20poly1305_ietf_decrypt()

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.

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 }
size_t crypto_aead_xchacha20poly1305_ietf_npubbytes()
Definition: sodium.h:534

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

◆ crypto_aead_xchacha20poly1305_ietf_decrypt_detached()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

◆ crypto_aead_xchacha20poly1305_ietf_encrypt()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

◆ crypto_aead_xchacha20poly1305_ietf_encrypt_detached()

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.

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 }

References BOTAN_UNUSED, and crypto_aead_xchacha20poly1305_ietf_npubbytes().

◆ crypto_aead_xchacha20poly1305_ietf_keybytes()

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_keybytes ( )
inline

Definition at line 524 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_KEYBYTES.

◆ crypto_aead_xchacha20poly1305_ietf_keygen()

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

Definition at line 594 of file sodium.h.

595 {
596 return randombytes_buf(k, 32);
597 }

References randombytes_buf().

◆ crypto_aead_xchacha20poly1305_ietf_messagebytes_max()

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_messagebytes_max ( )
inline

◆ crypto_aead_xchacha20poly1305_ietf_npubbytes()

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_npubbytes ( )
inline

◆ crypto_aead_xchacha20poly1305_ietf_nsecbytes()

size_t Botan::Sodium::crypto_aead_xchacha20poly1305_ietf_nsecbytes ( )
inline

Definition at line 529 of file sodium.h.

References crypto_aead_xchacha20poly1305_ietf_NSECBYTES.

◆ crypto_auth()

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.

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

References crypto_auth_hmacsha512256().

◆ crypto_auth_bytes()

size_t Botan::Sodium::crypto_auth_bytes ( )
inline

Definition at line 914 of file sodium.h.

914{ return crypto_auth_BYTES; }

References crypto_auth_BYTES.

◆ crypto_auth_hmacsha256()

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.

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 }

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

Referenced by crypto_auth_hmacsha256_verify().

◆ crypto_auth_hmacsha256_bytes()

size_t Botan::Sodium::crypto_auth_hmacsha256_bytes ( )
inline

Definition at line 949 of file sodium.h.

950 {
952 }

References crypto_auth_hmacsha256_BYTES.

◆ crypto_auth_hmacsha256_keybytes()

size_t Botan::Sodium::crypto_auth_hmacsha256_keybytes ( )
inline

Definition at line 954 of file sodium.h.

955 {
957 }

References crypto_auth_hmacsha256_KEYBYTES.

◆ crypto_auth_hmacsha256_keygen()

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

Definition at line 971 of file sodium.h.

972 {
973 return randombytes_buf(k, 32);
974 }

References randombytes_buf().

◆ crypto_auth_hmacsha256_verify()

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.

125 {
127 crypto_auth_hmacsha256(computed.data(), in, in_len, key);
128 return crypto_verify_32(computed.data(), mac) ? 0 : -1;
129 }
int crypto_verify_32(const uint8_t x[32], const uint8_t y[32])
int crypto_auth_hmacsha256(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65

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

◆ crypto_auth_hmacsha512()

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.

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 }

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

Referenced by crypto_auth_hmacsha512_verify().

◆ crypto_auth_hmacsha512256()

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.

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
93 mac->final(buf);
94
96 return 0;
97 }
constexpr void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:126

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().

◆ crypto_auth_hmacsha512256_bytes()

size_t Botan::Sodium::crypto_auth_hmacsha512256_bytes ( )
inline

Definition at line 885 of file sodium.h.

886 {
888 }

References crypto_auth_hmacsha512256_BYTES.

◆ crypto_auth_hmacsha512256_keybytes()

size_t Botan::Sodium::crypto_auth_hmacsha512256_keybytes ( )
inline

Definition at line 890 of file sodium.h.

891 {
893 }

References crypto_auth_hmacsha512256_KEYBYTES.

◆ crypto_auth_hmacsha512256_keygen()

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

Definition at line 907 of file sodium.h.

908 {
909 return randombytes_buf(k, 32);
910 }

References randombytes_buf().

◆ crypto_auth_hmacsha512256_verify()

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.

103 {
105 crypto_auth_hmacsha512256(computed.data(), in, in_len, key);
106 return crypto_verify_32(computed.data(), mac) ? 0 : -1;
107 }

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

Referenced by crypto_auth_verify().

◆ crypto_auth_hmacsha512_bytes()

size_t Botan::Sodium::crypto_auth_hmacsha512_bytes ( )
inline

Definition at line 862 of file sodium.h.

References crypto_auth_hmacsha512_BYTES.

◆ crypto_auth_hmacsha512_keybytes()

size_t Botan::Sodium::crypto_auth_hmacsha512_keybytes ( )
inline

Definition at line 864 of file sodium.h.

References crypto_auth_hmacsha512_KEYBYTES.

◆ crypto_auth_hmacsha512_keygen()

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

Definition at line 878 of file sodium.h.

879 {
880 return randombytes_buf(k, 32);
881 }

References randombytes_buf().

◆ crypto_auth_hmacsha512_verify()

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.

77 {
79 crypto_auth_hmacsha512(computed.data(), in, in_len, key);
80 return crypto_verify_64(computed.data(), mac) ? 0 : -1;
81 }
int crypto_auth_hmacsha512(uint8_t out[], const uint8_t in[], size_t in_len, const uint8_t key[])
Definition: sodium_auth.cpp:61
int crypto_verify_64(const uint8_t x[64], const uint8_t y[64])

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

◆ crypto_auth_keybytes()

size_t Botan::Sodium::crypto_auth_keybytes ( )
inline

Definition at line 916 of file sodium.h.

916{ return crypto_auth_KEYBYTES; }

References crypto_auth_KEYBYTES.

◆ crypto_auth_keygen()

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

Definition at line 932 of file sodium.h.

933 {
935 }

References crypto_auth_KEYBYTES, and randombytes_buf().

◆ crypto_auth_primitive()

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

Definition at line 918 of file sodium.h.

918{ return "hmacsha512256"; }

◆ crypto_auth_verify()

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.

928 {
929 return crypto_auth_hmacsha512256_verify(mac, in, in_len, key);
930 }
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

References crypto_auth_hmacsha512256_verify().

◆ crypto_box()

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.

842 {
843 return crypto_box_curve25519xsalsa20poly1305(ctext, ptext, ptext_len, nonce, pk, sk);
844 }
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

References crypto_box_curve25519xsalsa20poly1305().

◆ crypto_box_afternm()

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.

788 {
789 return crypto_box_curve25519xsalsa20poly1305_afternm(ctext, ptext, ptext_len, nonce, key);
790 }
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

References crypto_box_curve25519xsalsa20poly1305_afternm().

◆ crypto_box_beforenm()

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.

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

References crypto_box_curve25519xsalsa20poly1305_beforenm().

Referenced by crypto_box_detached(), and crypto_box_open_detached().

◆ crypto_box_beforenmbytes()

size_t Botan::Sodium::crypto_box_beforenmbytes ( )
inline

Definition at line 726 of file sodium.h.

727 {
729 }

References crypto_box_BEFORENMBYTES.

◆ crypto_box_boxzerobytes()

size_t Botan::Sodium::crypto_box_boxzerobytes ( )
inline

Definition at line 837 of file sodium.h.

837{ return crypto_box_BOXZEROBYTES; }

References crypto_box_BOXZEROBYTES.

◆ crypto_box_curve25519xsalsa20poly1305()

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.

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 }

References crypto_box_curve25519xsalsa20poly1305_afternm(), and crypto_box_curve25519xsalsa20poly1305_beforenm().

Referenced by crypto_box().

◆ crypto_box_curve25519xsalsa20poly1305_afternm()

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.

681 {
682 return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
683 }
int crypto_secretbox_xsalsa20poly1305(uint8_t ctext[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])

References crypto_secretbox_xsalsa20poly1305().

Referenced by crypto_box_afternm(), and crypto_box_curve25519xsalsa20poly1305().

◆ crypto_box_curve25519xsalsa20poly1305_beforenm()

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.

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 }
int crypto_scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t basepoint[32])
int crypto_core_hsalsa20(uint8_t out[], const uint8_t in[], const uint8_t key[], const uint8_t c[])

References crypto_core_hsalsa20(), and crypto_scalarmult_curve25519().

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

◆ crypto_box_curve25519xsalsa20poly1305_beforenmbytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_beforenmbytes ( )
inline

◆ crypto_box_curve25519xsalsa20poly1305_boxzerobytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_boxzerobytes ( )
inline

◆ crypto_box_curve25519xsalsa20poly1305_keypair()

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

Definition at line 22 of file sodium_box.cpp.

24 {
25 randombytes_buf(sk, 32);
27 }
int crypto_scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32])

References crypto_scalarmult_curve25519_base(), and randombytes_buf().

Referenced by crypto_box_keypair().

◆ crypto_box_curve25519xsalsa20poly1305_macbytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_macbytes ( )
inline

Definition at line 626 of file sodium.h.

References crypto_box_curve25519xsalsa20poly1305_MACBYTES.

◆ crypto_box_curve25519xsalsa20poly1305_messagebytes_max()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_messagebytes_max ( )
inline

◆ crypto_box_curve25519xsalsa20poly1305_noncebytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_noncebytes ( )
inline

◆ crypto_box_curve25519xsalsa20poly1305_open()

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.

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 }
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

References crypto_box_curve25519xsalsa20poly1305_beforenm(), and crypto_box_curve25519xsalsa20poly1305_open_afternm().

Referenced by crypto_box_open().

◆ crypto_box_curve25519xsalsa20poly1305_open_afternm()

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.

690 {
691 return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
692 }
int crypto_secretbox_xsalsa20poly1305_open(uint8_t ptext[], const uint8_t ctext[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])

References crypto_secretbox_xsalsa20poly1305_open().

Referenced by crypto_box_curve25519xsalsa20poly1305_open(), and crypto_box_open_afternm().

◆ crypto_box_curve25519xsalsa20poly1305_publickeybytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_publickeybytes ( )
inline

◆ crypto_box_curve25519xsalsa20poly1305_secretkeybytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_secretkeybytes ( )
inline

◆ crypto_box_curve25519xsalsa20poly1305_seed_keypair()

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.

15 {
16 secure_vector<uint8_t> digest(64);
17 crypto_hash_sha512(digest.data(), seed, 32);
18 copy_mem(sk, digest.data(), 32);
20 }
int crypto_hash_sha512(uint8_t out[64], const uint8_t in[], size_t in_len)
Definition: sodium_auth.cpp:13

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

Referenced by crypto_box_seed_keypair().

◆ crypto_box_curve25519xsalsa20poly1305_seedbytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_seedbytes ( )
inline

◆ crypto_box_curve25519xsalsa20poly1305_zerobytes()

size_t Botan::Sodium::crypto_box_curve25519xsalsa20poly1305_zerobytes ( )
inline

◆ crypto_box_detached()

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.

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 }
int crypto_box_beforenm(uint8_t key[], const uint8_t pk[32], const uint8_t sk[32])
Definition: sodium.h:779
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

References crypto_box_beforenm(), and crypto_box_detached_afternm().

Referenced by crypto_box_easy().

◆ crypto_box_detached_afternm()

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.

824 {
825 return crypto_secretbox_detached(ctext, mac, ptext, ptext_len, nonce, key);
826 }
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[])

References crypto_secretbox_detached().

Referenced by crypto_box_detached(), and crypto_box_easy_afternm().

◆ crypto_box_easy()

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.

761 {
762 return crypto_box_detached(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, pk, sk);
763 }
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

References crypto_box_detached(), and crypto_box_MACBYTES.

◆ crypto_box_easy_afternm()

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.

831 {
832 return crypto_box_detached_afternm(ctext + crypto_box_MACBYTES, ctext, ptext, ptext_len, nonce, key);
833 }

References crypto_box_detached_afternm(), and crypto_box_MACBYTES.

◆ crypto_box_keypair()

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

Definition at line 739 of file sodium.h.

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

References crypto_box_curve25519xsalsa20poly1305_keypair().

◆ crypto_box_macbytes()

size_t Botan::Sodium::crypto_box_macbytes ( )
inline

Definition at line 716 of file sodium.h.

717 {
718 return crypto_box_MACBYTES;
719 }

References crypto_box_MACBYTES.

◆ crypto_box_messagebytes_max()

size_t Botan::Sodium::crypto_box_messagebytes_max ( )
inline

Definition at line 721 of file sodium.h.

722 {
724 }

References crypto_box_MESSAGEBYTES_MAX.

◆ crypto_box_noncebytes()

size_t Botan::Sodium::crypto_box_noncebytes ( )
inline

Definition at line 711 of file sodium.h.

712 {
714 }

References crypto_box_NONCEBYTES.

◆ crypto_box_open()

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.

849 {
850 return crypto_box_curve25519xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, pk, sk);
851 }
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

References crypto_box_curve25519xsalsa20poly1305_open().

◆ crypto_box_open_afternm()

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.

795 {
796 return crypto_box_curve25519xsalsa20poly1305_open_afternm(ptext, ctext, ctext_len, nonce, key);
797 }

References crypto_box_curve25519xsalsa20poly1305_open_afternm().

◆ crypto_box_open_detached()

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.

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 }
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

References crypto_box_beforenm(), and crypto_box_open_detached_afternm().

Referenced by crypto_box_open_easy().

◆ crypto_box_open_detached_afternm()

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.

803 {
804 return crypto_secretbox_open_detached(ptext, ctext, mac, ctext_len, nonce, key);
805 }
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[])

References crypto_secretbox_open_detached().

Referenced by crypto_box_open_detached(), and crypto_box_open_easy_afternm().

◆ crypto_box_open_easy()

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.

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 }
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

References crypto_box_MACBYTES, and crypto_box_open_detached().

◆ crypto_box_open_easy_afternm()

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.

810 {
811 if(ctext_len < crypto_box_MACBYTES)
812 {
813 return -1;
814 }
815
817 ctext, ctext_len - crypto_box_MACBYTES,
818 nonce, key);
819 }

References crypto_box_MACBYTES, and crypto_box_open_detached_afternm().

◆ crypto_box_primitive()

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

Definition at line 731 of file sodium.h.

731{ return "curve25519xsalsa20poly1305"; }

◆ crypto_box_publickeybytes()

size_t Botan::Sodium::crypto_box_publickeybytes ( )
inline

Definition at line 701 of file sodium.h.

702 {
704 }

References crypto_box_PUBLICKEYBYTES.

◆ crypto_box_secretkeybytes()

size_t Botan::Sodium::crypto_box_secretkeybytes ( )
inline

Definition at line 706 of file sodium.h.

707 {
709 }

References crypto_box_SECRETKEYBYTES.

◆ crypto_box_seed_keypair()

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.

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

References crypto_box_curve25519xsalsa20poly1305_seed_keypair().

◆ crypto_box_seedbytes()

size_t Botan::Sodium::crypto_box_seedbytes ( )
inline

Definition at line 696 of file sodium.h.

697 {
699 }

References crypto_box_SEEDBYTES.

◆ crypto_box_zerobytes()

size_t Botan::Sodium::crypto_box_zerobytes ( )
inline

Definition at line 835 of file sodium.h.

835{ return crypto_box_ZEROBYTES; }

References crypto_box_ZEROBYTES.

◆ crypto_core_hsalsa20()

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.

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 }
constexpr uint32_t load_le< uint32_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:209
void copy_out_le(uint8_t out[], size_t out_bytes, const T in[])
Definition: loadstor.h:690

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

Referenced by crypto_box_curve25519xsalsa20poly1305_beforenm().

◆ crypto_core_hsalsa20_constbytes()

size_t Botan::Sodium::crypto_core_hsalsa20_constbytes ( )
inline

Definition at line 1030 of file sodium.h.

1031 {
1033 }

References crypto_core_hsalsa20_CONSTBYTES.

◆ crypto_core_hsalsa20_inputbytes()

size_t Botan::Sodium::crypto_core_hsalsa20_inputbytes ( )
inline

Definition at line 1020 of file sodium.h.

1021 {
1023 }

References crypto_core_hsalsa20_INPUTBYTES.

◆ crypto_core_hsalsa20_keybytes()

size_t Botan::Sodium::crypto_core_hsalsa20_keybytes ( )
inline

Definition at line 1025 of file sodium.h.

1026 {
1028 }

References crypto_core_hsalsa20_KEYBYTES.

◆ crypto_core_hsalsa20_outputbytes()

size_t Botan::Sodium::crypto_core_hsalsa20_outputbytes ( )
inline

Definition at line 1015 of file sodium.h.

1016 {
1018 }

References crypto_core_hsalsa20_OUTPUTBYTES.

◆ crypto_hash()

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.

1047 {
1048 return crypto_hash_sha512(out, in, in_len);
1049 }

References crypto_hash_sha512().

◆ crypto_hash_bytes()

size_t Botan::Sodium::crypto_hash_bytes ( )
inline

Definition at line 1041 of file sodium.h.

1042 {
1043 return crypto_hash_BYTES;
1044 }

References crypto_hash_BYTES.

◆ crypto_hash_primitive()

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

Definition at line 1051 of file sodium.h.

1051{ return "sha512"; }

◆ crypto_hash_sha256()

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.

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

References Botan::HashFunction::create_or_throw().

◆ crypto_hash_sha256_bytes()

size_t Botan::Sodium::crypto_hash_sha256_bytes ( )
inline

Definition at line 939 of file sodium.h.

940 {
942 }

References crypto_hash_sha256_BYTES.

◆ crypto_hash_sha512()

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.

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

References Botan::HashFunction::create_or_throw().

Referenced by crypto_box_curve25519xsalsa20poly1305_seed_keypair(), and crypto_hash().

◆ crypto_hash_sha512_bytes()

size_t Botan::Sodium::crypto_hash_sha512_bytes ( )
inline

Definition at line 855 of file sodium.h.

855{ return crypto_hash_sha512_BYTES; }

References crypto_hash_sha512_BYTES.

◆ crypto_onetimeauth()

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.

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

References crypto_onetimeauth_poly1305().

◆ crypto_onetimeauth_bytes()

size_t Botan::Sodium::crypto_onetimeauth_bytes ( )
inline

Definition at line 1084 of file sodium.h.

1084{ return crypto_onetimeauth_BYTES; }

References crypto_onetimeauth_BYTES.

◆ crypto_onetimeauth_keybytes()

size_t Botan::Sodium::crypto_onetimeauth_keybytes ( )
inline

Definition at line 1086 of file sodium.h.

References crypto_onetimeauth_KEYBYTES.

◆ crypto_onetimeauth_keygen()

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

Definition at line 1102 of file sodium.h.

1103 {
1105 }
void crypto_onetimeauth_poly1305_keygen(uint8_t k[32])
Definition: sodium.h:1077

References crypto_onetimeauth_poly1305_keygen().

◆ crypto_onetimeauth_poly1305()

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.

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 }

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

Referenced by crypto_onetimeauth(), and crypto_onetimeauth_poly1305_verify().

◆ crypto_onetimeauth_poly1305_bytes()

size_t Botan::Sodium::crypto_onetimeauth_poly1305_bytes ( )
inline

Definition at line 1055 of file sodium.h.

1056 {
1058 }

References crypto_onetimeauth_poly1305_BYTES.

◆ crypto_onetimeauth_poly1305_keybytes()

size_t Botan::Sodium::crypto_onetimeauth_poly1305_keybytes ( )
inline

Definition at line 1060 of file sodium.h.

1061 {
1063 }

References crypto_onetimeauth_poly1305_KEYBYTES.

◆ crypto_onetimeauth_poly1305_keygen()

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

Definition at line 1077 of file sodium.h.

1078 {
1079 return randombytes_buf(k, 32);
1080 }

References randombytes_buf().

Referenced by crypto_onetimeauth_keygen().

◆ crypto_onetimeauth_poly1305_verify()

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.

55 {
57 crypto_onetimeauth_poly1305(computed.data(), in, in_len, key);
58 return crypto_verify_16(computed.data(), mac) ? 0 : -1;
59 }
int crypto_verify_16(const uint8_t x[16], const uint8_t y[16])

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

Referenced by crypto_onetimeauth_verify().

◆ crypto_onetimeauth_primitive()

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

Definition at line 1088 of file sodium.h.

1088{ return "poly1305"; }

◆ crypto_onetimeauth_verify()

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.

1098 {
1099 return crypto_onetimeauth_poly1305_verify(h, in, in_len, key);
1100 }
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

References crypto_onetimeauth_poly1305_verify().

◆ crypto_scalarmult()

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.

1139 {
1140 return crypto_scalarmult_curve25519(out, scalar, base);
1141 }

References crypto_scalarmult_curve25519().

◆ crypto_scalarmult_base()

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

Definition at line 1133 of file sodium.h.

1134 {
1135 return crypto_scalarmult_curve25519_base(out, scalar);
1136 }

References crypto_scalarmult_curve25519_base().

◆ crypto_scalarmult_bytes()

size_t Botan::Sodium::crypto_scalarmult_bytes ( )
inline

Definition at line 1127 of file sodium.h.

size_t crypto_scalarmult_curve25519_bytes()
Definition: sodium.h:1109

References crypto_scalarmult_curve25519_bytes().

◆ crypto_scalarmult_curve25519()

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.

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

References Botan::curve25519_donna().

Referenced by crypto_box_curve25519xsalsa20poly1305_beforenm(), and crypto_scalarmult().

◆ crypto_scalarmult_curve25519_base()

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.

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

References Botan::curve25519_basepoint().

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

◆ crypto_scalarmult_curve25519_bytes()

size_t Botan::Sodium::crypto_scalarmult_curve25519_bytes ( )
inline

Definition at line 1109 of file sodium.h.

1110 {
1112 }

References crypto_scalarmult_curve25519_BYTES.

Referenced by crypto_scalarmult_bytes().

◆ crypto_scalarmult_curve25519_scalarbytes()

size_t Botan::Sodium::crypto_scalarmult_curve25519_scalarbytes ( )
inline

Definition at line 1114 of file sodium.h.

1115 {
1117 }

References crypto_scalarmult_curve25519_SCALARBYTES.

Referenced by crypto_scalarmult_scalarbytes().

◆ crypto_scalarmult_primitive()

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

Definition at line 1131 of file sodium.h.

1131{ return "curve25519"; }

◆ crypto_scalarmult_scalarbytes()

size_t Botan::Sodium::crypto_scalarmult_scalarbytes ( )
inline

Definition at line 1129 of file sodium.h.

size_t crypto_scalarmult_curve25519_scalarbytes()
Definition: sodium.h:1114

References crypto_scalarmult_curve25519_scalarbytes().

◆ crypto_secretbox()

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.

359 {
360 return crypto_secretbox_xsalsa20poly1305(ctext, ptext, ptext_len, nonce, key);
361 }

References crypto_secretbox_xsalsa20poly1305().

◆ crypto_secretbox_boxzerobytes()

size_t Botan::Sodium::crypto_secretbox_boxzerobytes ( )
inline

Definition at line 351 of file sodium.h.

352 {
354 }

References crypto_secretbox_BOXZEROBYTES.

◆ crypto_secretbox_detached()

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.

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 }

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().

◆ crypto_secretbox_easy()

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.

323 {
325 ptext, ptext_len, nonce, key);
326 }

References crypto_secretbox_detached(), and crypto_secretbox_MACBYTES.

◆ crypto_secretbox_keybytes()

size_t Botan::Sodium::crypto_secretbox_keybytes ( )
inline

Definition at line 295 of file sodium.h.

References crypto_secretbox_KEYBYTES.

◆ crypto_secretbox_keygen()

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

Definition at line 341 of file sodium.h.

342 {
343 return randombytes_buf(k, 32);
344 }

References randombytes_buf().

◆ crypto_secretbox_macbytes()

size_t Botan::Sodium::crypto_secretbox_macbytes ( )
inline

Definition at line 299 of file sodium.h.

References crypto_secretbox_MACBYTES.

◆ crypto_secretbox_messagebytes_max()

size_t Botan::Sodium::crypto_secretbox_messagebytes_max ( )
inline

◆ crypto_secretbox_noncebytes()

size_t Botan::Sodium::crypto_secretbox_noncebytes ( )
inline

Definition at line 297 of file sodium.h.

References crypto_secretbox_NONCEBYTES.

◆ crypto_secretbox_open()

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.

366 {
367 return crypto_secretbox_xsalsa20poly1305_open(ptext, ctext, ctext_len, nonce, key);
368 }

References crypto_secretbox_xsalsa20poly1305_open().

◆ crypto_secretbox_open_detached()

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.

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 }
bool constant_time_compare(const uint8_t x[], const uint8_t y[], size_t len)
Definition: mem_ops.h:82

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().

◆ crypto_secretbox_open_easy()

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.

330 {
331 if(ctext_len < crypto_secretbox_MACBYTES)
332 {
333 return -1;
334 }
335
337 ctext, ctext_len - crypto_secretbox_MACBYTES,
338 nonce, key);
339 }

References crypto_secretbox_MACBYTES, and crypto_secretbox_open_detached().

◆ crypto_secretbox_primitive()

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

Definition at line 303 of file sodium.h.

303{ return "xsalsa20poly1305"; }

◆ crypto_secretbox_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.

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 }
constexpr void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:115

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().

◆ crypto_secretbox_xsalsa20poly1305_boxzerobytes()

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_boxzerobytes ( )
inline

Definition at line 283 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES.

◆ crypto_secretbox_xsalsa20poly1305_keybytes()

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_keybytes ( )
inline

Definition at line 244 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_KEYBYTES.

◆ crypto_secretbox_xsalsa20poly1305_keygen()

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

Definition at line 278 of file sodium.h.

279 {
280 return randombytes_buf(k, 32);
281 }

References randombytes_buf().

◆ crypto_secretbox_xsalsa20poly1305_macbytes()

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_macbytes ( )
inline

Definition at line 254 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_MACBYTES.

◆ crypto_secretbox_xsalsa20poly1305_messagebytes_max()

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_messagebytes_max ( )
inline

◆ crypto_secretbox_xsalsa20poly1305_noncebytes()

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_noncebytes ( )
inline

Definition at line 249 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_NONCEBYTES.

◆ crypto_secretbox_xsalsa20poly1305_open()

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.

46 {
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 }

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().

◆ crypto_secretbox_xsalsa20poly1305_zerobytes()

size_t Botan::Sodium::crypto_secretbox_xsalsa20poly1305_zerobytes ( )
inline

Definition at line 288 of file sodium.h.

References crypto_secretbox_xsalsa20poly1305_ZEROBYTES.

◆ crypto_secretbox_zerobytes()

size_t Botan::Sodium::crypto_secretbox_zerobytes ( )
inline

Definition at line 346 of file sodium.h.

347 {
349 }

References crypto_secretbox_ZEROBYTES.

◆ crypto_shorthash()

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.

1335 {
1336 return crypto_shorthash_siphash24(out, in, in_len, k);
1337 }
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

References crypto_shorthash_siphash24().

◆ crypto_shorthash_bytes()

size_t Botan::Sodium::crypto_shorthash_bytes ( )
inline

Definition at line 1327 of file sodium.h.

size_t crypto_shorthash_siphash24_bytes()
Definition: sodium.h:1318

References crypto_shorthash_siphash24_bytes().

◆ crypto_shorthash_keybytes()

size_t Botan::Sodium::crypto_shorthash_keybytes ( )
inline

Definition at line 1329 of file sodium.h.

size_t crypto_shorthash_siphash24_keybytes()
Definition: sodium.h:1320

References crypto_shorthash_siphash24_keybytes().

◆ crypto_shorthash_keygen()

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().

◆ crypto_shorthash_primitive()

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

Definition at line 1331 of file sodium.h.

1331{ return "siphash24"; }

◆ crypto_shorthash_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.

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 }

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

Referenced by crypto_shorthash().

◆ crypto_shorthash_siphash24_bytes()

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().

◆ crypto_shorthash_siphash24_keybytes()

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().

◆ crypto_sign_bytes()

size_t Botan::Sodium::crypto_sign_bytes ( )
inline

Definition at line 1393 of file sodium.h.

1394 {
1395 return crypto_sign_BYTES;
1396 }

References crypto_sign_BYTES.

◆ crypto_sign_detached()

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.

1437 {
1438 return crypto_sign_ed25519_detached(sig, sig_len, msg, msg_len, sk);
1439 }
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])

References crypto_sign_ed25519_detached().

◆ crypto_sign_ed25519_bytes()

size_t Botan::Sodium::crypto_sign_ed25519_bytes ( )
inline

Definition at line 1346 of file sodium.h.

1347 {
1349 }

References crypto_sign_ed25519_BYTES.

◆ crypto_sign_ed25519_detached()

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.

29 {
30 ed25519_sign(sig, msg, msg_len, sk, nullptr, 0);
31
32 if(sig_len)
33 *sig_len = 64;
34 return 0;
35 }
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

References Botan::ed25519_sign().

Referenced by crypto_sign_detached().

◆ crypto_sign_ed25519_keypair()

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

Definition at line 46 of file sodium_25519.cpp.

47 {
49 randombytes_buf(seed.data(), seed.size());
50 return crypto_sign_ed25519_seed_keypair(pk, sk, seed.data());
51 }
int crypto_sign_ed25519_seed_keypair(uint8_t pk[], uint8_t sk[], const uint8_t seed[])

References crypto_sign_ed25519_seed_keypair(), and randombytes_buf().

Referenced by crypto_sign_keypair().

◆ crypto_sign_ed25519_messagebytes_max()

size_t Botan::Sodium::crypto_sign_ed25519_messagebytes_max ( )
inline

Definition at line 1366 of file sodium.h.

1367 {
1369 }

References crypto_sign_ed25519_MESSAGEBYTES_MAX.

◆ crypto_sign_ed25519_publickeybytes()

size_t Botan::Sodium::crypto_sign_ed25519_publickeybytes ( )
inline

Definition at line 1356 of file sodium.h.

1357 {
1359 }

References crypto_sign_ed25519_PUBLICKEYBYTES.

◆ crypto_sign_ed25519_secretkeybytes()

size_t Botan::Sodium::crypto_sign_ed25519_secretkeybytes ( )
inline

Definition at line 1361 of file sodium.h.

1362 {
1364 }

References crypto_sign_ed25519_SECRETKEYBYTES.

◆ crypto_sign_ed25519_seed_keypair()

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.

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

References Botan::ed25519_gen_keypair().

Referenced by crypto_sign_ed25519_keypair(), and crypto_sign_seed_keypair().

◆ crypto_sign_ed25519_seedbytes()

size_t Botan::Sodium::crypto_sign_ed25519_seedbytes ( )
inline

Definition at line 1351 of file sodium.h.

1352 {
1354 }

References crypto_sign_ed25519_SEEDBYTES.

◆ crypto_sign_ed25519_verify_detached()

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.

41 {
42 const bool ok = ed25519_verify(msg, msg_len, sig, pk, nullptr, 0);
43 return ok ? 0 : -1;
44 }
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

References Botan::ed25519_verify().

Referenced by crypto_sign_verify_detached().

◆ crypto_sign_keypair()

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

Definition at line 1429 of file sodium.h.

1430 {
1431 return crypto_sign_ed25519_keypair(pk, sk);
1432 }
int crypto_sign_ed25519_keypair(uint8_t pk[32], uint8_t sk[64])

References crypto_sign_ed25519_keypair().

◆ crypto_sign_messagebytes_max()

size_t Botan::Sodium::crypto_sign_messagebytes_max ( )
inline

Definition at line 1413 of file sodium.h.

1414 {
1416 }

References crypto_sign_MESSAGEBYTES_MAX.

◆ crypto_sign_primitive()

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

Definition at line 1418 of file sodium.h.

1419 {
1420 return "ed25519";
1421 }

◆ crypto_sign_publickeybytes()

size_t Botan::Sodium::crypto_sign_publickeybytes ( )
inline

Definition at line 1403 of file sodium.h.

1404 {
1406 }

References crypto_sign_PUBLICKEYBYTES.

◆ crypto_sign_secretkeybytes()

size_t Botan::Sodium::crypto_sign_secretkeybytes ( )
inline

Definition at line 1408 of file sodium.h.

1409 {
1411 }

References crypto_sign_SECRETKEYBYTES.

◆ crypto_sign_seed_keypair()

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.

1425 {
1426 return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
1427 }

References crypto_sign_ed25519_seed_keypair().

◆ crypto_sign_seedbytes()

size_t Botan::Sodium::crypto_sign_seedbytes ( )
inline

Definition at line 1398 of file sodium.h.

1399 {
1400 return crypto_sign_SEEDBYTES;
1401 }

References crypto_sign_SEEDBYTES.

◆ crypto_sign_verify_detached()

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.

1445 {
1446 return crypto_sign_ed25519_verify_detached(sig, in, in_len, pk);
1447 }
int crypto_sign_ed25519_verify_detached(const uint8_t sig[], const uint8_t msg[], size_t msg_len, const uint8_t pk[32])

References crypto_sign_ed25519_verify_detached().

◆ crypto_stream()

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.

1301 {
1302 return crypto_stream_xsalsa20(out, out_len, nonce, key);
1303 }
int crypto_stream_xsalsa20(uint8_t out[], size_t ctext_len, const uint8_t nonce[], const uint8_t key[])

References crypto_stream_xsalsa20().

◆ crypto_stream_chacha20()

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.

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 }

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

◆ crypto_stream_chacha20_ietf()

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.

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 }

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

◆ crypto_stream_chacha20_ietf_keybytes()

size_t Botan::Sodium::crypto_stream_chacha20_ietf_keybytes ( )
inline

Definition at line 1180 of file sodium.h.

1181 {
1183 }

References crypto_stream_chacha20_ietf_KEYBYTES.

◆ crypto_stream_chacha20_ietf_keygen()

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

Definition at line 1210 of file sodium.h.

1211 {
1212 return randombytes_buf(k, 32);
1213 }

References randombytes_buf().

◆ crypto_stream_chacha20_ietf_messagebytes_max()

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.

◆ crypto_stream_chacha20_ietf_noncebytes()

size_t Botan::Sodium::crypto_stream_chacha20_ietf_noncebytes ( )
inline

Definition at line 1185 of file sodium.h.

1186 {
1188 }

References crypto_stream_chacha20_ietf_NONCEBYTES.

◆ crypto_stream_chacha20_ietf_xor()

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.

59 {
60 return crypto_stream_chacha20_ietf_xor_ic(out, in, in_len, nonce, 0, key);
61 }
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[])

References crypto_stream_chacha20_ietf_xor_ic().

◆ crypto_stream_chacha20_ietf_xor_ic()

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.

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 }

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

Referenced by crypto_stream_chacha20_ietf_xor().

◆ crypto_stream_chacha20_keybytes()

size_t Botan::Sodium::crypto_stream_chacha20_keybytes ( )
inline

Definition at line 1145 of file sodium.h.

1146 {
1148 }

References crypto_stream_chacha20_KEYBYTES.

◆ crypto_stream_chacha20_keygen()

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

Definition at line 1175 of file sodium.h.

1176 {
1177 return randombytes_buf(k, 32);
1178 }

References randombytes_buf().

◆ crypto_stream_chacha20_messagebytes_max()

size_t Botan::Sodium::crypto_stream_chacha20_messagebytes_max ( )
inline

Definition at line 1155 of file sodium.h.

1156 {
1158 }

References crypto_stream_chacha20_MESSAGEBYTES_MAX.

◆ crypto_stream_chacha20_noncebytes()

size_t Botan::Sodium::crypto_stream_chacha20_noncebytes ( )
inline

Definition at line 1150 of file sodium.h.

1151 {
1153 }

References crypto_stream_chacha20_NONCEBYTES.

◆ crypto_stream_chacha20_xor()

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.

25 {
26 return crypto_stream_chacha20_xor_ic(out, in, in_len, nonce, 0, key);
27 }
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[])

References crypto_stream_chacha20_xor_ic().

◆ crypto_stream_chacha20_xor_ic()

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.

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 }

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

Referenced by crypto_stream_chacha20_xor().

◆ crypto_stream_keybytes()

size_t Botan::Sodium::crypto_stream_keybytes ( )
inline

Definition at line 1291 of file sodium.h.

size_t crypto_stream_xsalsa20_keybytes()
Definition: sodium.h:978

References crypto_stream_xsalsa20_keybytes().

◆ crypto_stream_keygen()

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

Definition at line 1311 of file sodium.h.

1312 {
1313 return randombytes_buf(key, 32);
1314 }

References randombytes_buf().

◆ crypto_stream_messagebytes_max()

size_t Botan::Sodium::crypto_stream_messagebytes_max ( )
inline

Definition at line 1295 of file sodium.h.

References crypto_stream_MESSAGEBYTES_MAX.

◆ crypto_stream_noncebytes()

size_t Botan::Sodium::crypto_stream_noncebytes ( )
inline

Definition at line 1293 of file sodium.h.

size_t crypto_stream_xsalsa20_noncebytes()
Definition: sodium.h:983

References crypto_stream_xsalsa20_noncebytes().

◆ crypto_stream_primitive()

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

Definition at line 1297 of file sodium.h.

1297{ return "xsalsa20"; }

◆ crypto_stream_salsa20()

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.

60 {
61 Salsa20 salsa;
64 salsa.write_keystream(out, out_len);
65 return 0;
66 }
void set_iv(const uint8_t iv[], size_t iv_len) override
Definition: salsa20.cpp:198
virtual void write_keystream(uint8_t out[], size_t len)
Definition: stream_cipher.h:66
void set_key(const SymmetricKey &key)
Definition: sym_algo.h:147

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

◆ crypto_stream_salsa20_keybytes()

size_t Botan::Sodium::crypto_stream_salsa20_keybytes ( )
inline

Definition at line 1254 of file sodium.h.

1255 {
1257 }

References crypto_stream_xsalsa20_KEYBYTES.

◆ crypto_stream_salsa20_keygen()

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

Definition at line 1284 of file sodium.h.

1285 {
1286 return randombytes_buf(k, 32);
1287 }

References randombytes_buf().

◆ crypto_stream_salsa20_messagebytes_max()

size_t Botan::Sodium::crypto_stream_salsa20_messagebytes_max ( )
inline

Definition at line 1264 of file sodium.h.

1265 {
1267 }

References crypto_stream_salsa20_MESSAGEBYTES_MAX.

◆ crypto_stream_salsa20_noncebytes()

size_t Botan::Sodium::crypto_stream_salsa20_noncebytes ( )
inline

Definition at line 1259 of file sodium.h.

1260 {
1262 }

References crypto_stream_salsa20_NONCEBYTES.

◆ crypto_stream_salsa20_xor()

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.

71 {
72 return crypto_stream_salsa20_xor_ic(out, in, in_len, nonce, 0, key);
73 }
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[])

References crypto_stream_salsa20_xor_ic().

◆ crypto_stream_salsa20_xor_ic()

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.

79 {
80 if((ic >> 6) != 0) // otherwise multiply overflows
81 return -1;
82
83 Salsa20 salsa;
86 salsa.seek(ic * 64);
87 salsa.cipher(in, out, in_len);
88 return 0;
89 }
void seek(uint64_t offset) override
Definition: salsa20.cpp:288
void cipher(const uint8_t in[], uint8_t out[], size_t length) override
Definition: salsa20.cpp:111

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().

◆ crypto_stream_xchacha20()

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.

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 }

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

◆ crypto_stream_xchacha20_keybytes()

size_t Botan::Sodium::crypto_stream_xchacha20_keybytes ( )
inline

Definition at line 1217 of file sodium.h.

1218 {
1220 }

References crypto_stream_xchacha20_KEYBYTES.

◆ crypto_stream_xchacha20_keygen()

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

Definition at line 1247 of file sodium.h.

1248 {
1250 }

References crypto_stream_xchacha20_KEYBYTES, and randombytes_buf().

◆ crypto_stream_xchacha20_messagebytes_max()

size_t Botan::Sodium::crypto_stream_xchacha20_messagebytes_max ( )
inline

Definition at line 1227 of file sodium.h.

1228 {
1230 }

References crypto_stream_xchacha20_MESSAGEBYTES_MAX.

◆ crypto_stream_xchacha20_noncebytes()

size_t Botan::Sodium::crypto_stream_xchacha20_noncebytes ( )
inline

Definition at line 1222 of file sodium.h.

1223 {
1225 }

References crypto_stream_xchacha20_NONCEBYTES.

◆ crypto_stream_xchacha20_xor()

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.

89 {
90 return crypto_stream_xchacha20_xor_ic(out, in, in_len, nonce, 0, key);
91 }
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[])

References crypto_stream_xchacha20_xor_ic().

◆ crypto_stream_xchacha20_xor_ic()

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.

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 }

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

Referenced by crypto_stream_xchacha20_xor().

◆ crypto_stream_xor()

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.

1307 {
1308 return crypto_stream_xsalsa20_xor(out, in, in_len, nonce, key);
1309 }
int crypto_stream_xsalsa20_xor(uint8_t out[], const uint8_t ptext[], size_t ptext_len, const uint8_t nonce[], const uint8_t key[])

References crypto_stream_xsalsa20_xor().

◆ crypto_stream_xsalsa20()

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

◆ crypto_stream_xsalsa20_keybytes()

size_t Botan::Sodium::crypto_stream_xsalsa20_keybytes ( )
inline

Definition at line 978 of file sodium.h.

979 {
981 }

References crypto_stream_xsalsa20_KEYBYTES.

Referenced by crypto_stream_keybytes().

◆ crypto_stream_xsalsa20_keygen()

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

Definition at line 1008 of file sodium.h.

1009 {
1010 return randombytes_buf(k, 32);
1011 }

References randombytes_buf().

◆ crypto_stream_xsalsa20_messagebytes_max()

size_t Botan::Sodium::crypto_stream_xsalsa20_messagebytes_max ( )
inline

Definition at line 988 of file sodium.h.

989 {
991 }

References crypto_stream_xsalsa20_MESSAGEBYTES_MAX.

◆ crypto_stream_xsalsa20_noncebytes()

size_t Botan::Sodium::crypto_stream_xsalsa20_noncebytes ( )
inline

Definition at line 983 of file sodium.h.

984 {
986 }

References crypto_stream_xsalsa20_NONCEBYTES.

Referenced by crypto_stream_noncebytes().

◆ crypto_stream_xsalsa20_xor()

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.

104 {
105 return crypto_stream_xsalsa20_xor_ic(out, in, in_len, nonce, 0, key);
106 }
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[])

References crypto_stream_xsalsa20_xor_ic().

Referenced by crypto_stream_xor().

◆ crypto_stream_xsalsa20_xor_ic()

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.

112 {
113 if((ic >> 6) != 0) // otherwise multiply overflows
114 return -1;
115
116 Salsa20 salsa;
119 salsa.seek(ic * 64);
120 salsa.cipher(in, out, in_len);
121 return 0;
122 }

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().

◆ crypto_verify_16()

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

Definition at line 46 of file sodium_utils.cpp.

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

References Botan::same_mem().

Referenced by crypto_onetimeauth_poly1305_verify().

◆ crypto_verify_32()

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

Definition at line 51 of file sodium_utils.cpp.

52 {
53 return same_mem(x, y, 32);
54 }

References Botan::same_mem().

Referenced by crypto_auth_hmacsha256_verify(), and crypto_auth_hmacsha512256_verify().

◆ crypto_verify_64()

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

Definition at line 56 of file sodium_utils.cpp.

57 {
58 return same_mem(x, y, 64);
59 }

References Botan::same_mem().

Referenced by crypto_auth_hmacsha512_verify().

◆ randombytes()

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

Definition at line 237 of file sodium.h.

238 {
239 return randombytes_buf(buf, buf_len);
240 }

References randombytes_buf().

◆ randombytes_buf()

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

◆ randombytes_buf_deterministic()

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

Definition at line 34 of file sodium_utils.cpp.

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

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

◆ randombytes_close()

int Botan::Sodium::randombytes_close ( )
inline

Definition at line 230 of file sodium.h.

230{ return 0; }

◆ randombytes_implementation_name()

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

Definition at line 232 of file sodium.h.

233 {
234 return "botan";
235 }

◆ randombytes_random()

uint32_t Botan::Sodium::randombytes_random ( )
inline

Definition at line 221 of file sodium.h.

222 {
223 uint32_t x = 0;
224 randombytes_buf(&x, 4);
225 return x;
226 }

References randombytes_buf().

◆ randombytes_seedbytes()

size_t Botan::Sodium::randombytes_seedbytes ( )
inline

Definition at line 209 of file sodium.h.

209{ return randombytes_SEEDBYTES; }

References randombytes_SEEDBYTES.

◆ randombytes_stir()

void Botan::Sodium::randombytes_stir ( )
inline

Definition at line 228 of file sodium.h.

228{}

◆ randombytes_uniform()

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

Definition at line 23 of file sodium_utils.cpp.

24 {
25 if(upper_bound <= 1)
26 return 0;
27
28 // Not completely uniform
29 uint64_t x;
30 randombytes_buf(&x, sizeof(x));
31 return x % upper_bound;
32 }

References randombytes_buf().

◆ sodium_add()

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

Definition at line 108 of file sodium_utils.cpp.

109 {
110 uint8_t carry = 0;
111 for(size_t i = 0; i != len; ++i)
112 {
113 a[i] += b[i] + carry;
114 carry = (a[i] < b[i]);
115 }
116 }
PolynomialVector b
Definition: kyber.cpp:821
void carry(int64_t &h0, int64_t &h1)

References b, and Botan::carry().

◆ sodium_allocarray()

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

Definition at line 141 of file sodium_utils.cpp.

142 {
143 const size_t bytes = count * size;
144 if(bytes < count || bytes < size)
145 return nullptr;
146 return sodium_malloc(bytes);
147 }
void * sodium_malloc(size_t size)

References sodium_malloc().

◆ sodium_compare()

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

Definition at line 72 of file sodium_utils.cpp.

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

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

◆ sodium_free()

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

Definition at line 130 of file sodium_utils.cpp.

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

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

◆ sodium_increment()

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

Definition at line 98 of file sodium_utils.cpp.

99 {
100 uint8_t carry = 1;
101 for(size_t i = 0; i != len; ++i)
102 {
103 b[i] += carry;
104 carry &= (b[i] == 0);
105 }
106 }

References b, and Botan::carry().

◆ sodium_init()

int Botan::Sodium::sodium_init ( )
inline

Definition at line 160 of file sodium.h.

160{ return 0; }

◆ sodium_is_zero()

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

Definition at line 90 of file sodium_utils.cpp.

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

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

◆ sodium_library_minimal()

int Botan::Sodium::sodium_library_minimal ( )
inline

Definition at line 158 of file sodium.h.

158{ return 0; }

◆ sodium_library_version_major()

int Botan::Sodium::sodium_library_version_major ( )
inline

Definition at line 154 of file sodium.h.

154{ return 0; }

◆ sodium_library_version_minor()

int Botan::Sodium::sodium_library_version_minor ( )
inline

Definition at line 156 of file sodium.h.

156{ return 0; }

◆ sodium_malloc()

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

Definition at line 118 of file sodium_utils.cpp.

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

References Botan::store_le().

Referenced by sodium_allocarray().

◆ sodium_memcmp()

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

Definition at line 66 of file sodium_utils.cpp.

67 {
68 const bool same = constant_time_compare(static_cast<const uint8_t*>(x), static_cast<const uint8_t*>(y), len);
69 return same ? 0 : -1;
70 }

References Botan::constant_time_compare().

◆ sodium_memzero()

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

Definition at line 61 of file sodium_utils.cpp.

62 {
63 secure_scrub_memory(ptr, len);
64 }

References Botan::secure_scrub_memory().

◆ sodium_mprotect_noaccess()

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

Definition at line 149 of file sodium_utils.cpp.

150 {
152 return 0;
153 }
void page_prohibit_access(void *page)
Definition: os_utils.cpp:629

References Botan::OS::page_prohibit_access().

◆ sodium_mprotect_readwrite()

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

Definition at line 155 of file sodium_utils.cpp.

156 {
158 return 0;
159 }
void page_allow_access(void *page)
Definition: os_utils.cpp:614

References Botan::OS::page_allow_access().

◆ sodium_version_string()

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

Definition at line 152 of file sodium.h.

152{ return "Botan Sodium Compat"; }