libsodium-1.0.18.1: Low-level bindings to the libsodium C library

Safe HaskellNone
LanguageHaskell2010

Libsodium

Contents

Description

This module exports raw bindings to the libsodium C library.

You can find libsodium's documentation at https://libsodium.gitbook.io

Regarding the version of the C libsodium library supported by this library: Haskell's library libsodium-A.B.C.D is designed to work with the C library libsodium-A.B.C.

Synopsis

Functions

In Libsodium, each function parameter shows up as “name ::: x”, where x is the actual parameter type and name is the name the parameter is given in the C library.

This is for documentation purposes only. The type checker will ignore the “name :::” part.

type (:::) name x = x Source #

name ::: x” is a type synonym for x.

crypto_aead_aes256gcm_decrypt :: (m ::: Ptr CUChar) -> (mlen_p ::: Ptr CULLong) -> (nsec ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_aes256gcm_decrypt_detached :: (m ::: Ptr CUChar) -> (nsec ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (mac ::: Ptr CUChar) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_aes256gcm_encrypt :: (c ::: Ptr CUChar) -> (clen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_aes256gcm_encrypt_detached :: (c ::: Ptr CUChar) -> (mac ::: Ptr CUChar) -> (maclen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_chacha20poly1305_decrypt :: (m ::: Ptr CUChar) -> (mlen_p ::: Ptr CULLong) -> (nsec ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_chacha20poly1305_decrypt_detached :: (m ::: Ptr CUChar) -> (nsec ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (mac ::: Ptr CUChar) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_chacha20poly1305_encrypt :: (c ::: Ptr CUChar) -> (clen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_chacha20poly1305_encrypt_detached :: (c ::: Ptr CUChar) -> (mac ::: Ptr CUChar) -> (maclen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_chacha20poly1305_ietf_decrypt :: (m ::: Ptr CUChar) -> (mlen_p ::: Ptr CULLong) -> (nsec ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_chacha20poly1305_ietf_encrypt :: (c ::: Ptr CUChar) -> (clen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_chacha20poly1305_ietf_encrypt_detached :: (c ::: Ptr CUChar) -> (mac ::: Ptr CUChar) -> (maclen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_xchacha20poly1305_ietf_decrypt :: (m ::: Ptr CUChar) -> (mlen_p ::: Ptr CULLong) -> (nsec ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_xchacha20poly1305_ietf_encrypt :: (c ::: Ptr CUChar) -> (clen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_aead_xchacha20poly1305_ietf_encrypt_detached :: (c ::: Ptr CUChar) -> (mac ::: Ptr CUChar) -> (maclen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (ad ::: Ptr CUChar) -> (adlen ::: CULLong) -> (nsec ::: Ptr CUChar) -> (npub ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_auth :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_auth_hmacsha256 :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_auth_hmacsha512 :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_auth_verify :: (h ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_box :: (c ::: Ptr CUChar) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (n ::: Ptr CUChar) -> (pk ::: Ptr CUChar) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_box_detached :: (c ::: Ptr CUChar) -> (mac ::: Ptr CUChar) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (n ::: Ptr CUChar) -> (pk ::: Ptr CUChar) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_box_easy :: (c ::: Ptr CUChar) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (n ::: Ptr CUChar) -> (pk ::: Ptr CUChar) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_box_open :: (m ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (n ::: Ptr CUChar) -> (pk ::: Ptr CUChar) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_box_open_detached :: (m ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (mac ::: Ptr CUChar) -> (clen ::: CULLong) -> (n ::: Ptr CUChar) -> (pk ::: Ptr CUChar) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_box_open_easy :: (m ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (n ::: Ptr CUChar) -> (pk ::: Ptr CUChar) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_box_seal :: (c ::: Ptr CUChar) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (pk ::: Ptr CUChar) -> IO CInt Source #

crypto_box_seal_open :: (m ::: Ptr CUChar) -> (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (pk ::: Ptr CUChar) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_generichash :: (out ::: Ptr CUChar) -> (outlen ::: CSize) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (key ::: Ptr CUChar) -> (keylen ::: CSize) -> IO CInt Source #

crypto_generichash_blake2b :: (out ::: Ptr CUChar) -> (outlen ::: CSize) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (key ::: Ptr CUChar) -> (keylen ::: CSize) -> IO CInt Source #

crypto_generichash_blake2b_salt_personal :: (out ::: Ptr CUChar) -> (outlen ::: CSize) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (key ::: Ptr CUChar) -> (keylen ::: CSize) -> (salt ::: Ptr CUChar) -> (personal ::: Ptr CUChar) -> IO CInt Source #

crypto_hash :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> IO CInt Source #

crypto_hash_sha256 :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> IO CInt Source #

crypto_hash_sha512 :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> IO CInt Source #

crypto_kdf_blake2b_derive_from_key :: (subkey ::: Ptr CUChar) -> (subkey_len ::: CSize) -> (subkey_id ::: Word64) -> (ctx ::: Ptr CChar) -> (key ::: Ptr CUChar) -> IO CInt Source #

crypto_kdf_derive_from_key :: (subkey ::: Ptr CUChar) -> (subkey_len ::: CSize) -> (subkey_id ::: Word64) -> (ctx ::: Ptr CChar) -> (key ::: Ptr CUChar) -> IO CInt Source #

crypto_kx_client_session_keys :: (rx ::: Ptr CUChar) -> (tx ::: Ptr CUChar) -> (client_pk ::: Ptr CUChar) -> (client_sk ::: Ptr CUChar) -> (server_pk ::: Ptr CUChar) -> IO CInt Source #

crypto_kx_server_session_keys :: (rx ::: Ptr CUChar) -> (tx ::: Ptr CUChar) -> (server_pk ::: Ptr CUChar) -> (server_sk ::: Ptr CUChar) -> (client_pk ::: Ptr CUChar) -> IO CInt Source #

crypto_onetimeauth :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_pwhash :: (out ::: Ptr CUChar) -> (outlen ::: CULLong) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (salt ::: Ptr CUChar) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> (alg ::: CInt) -> IO CInt Source #

crypto_pwhash_argon2i :: (out ::: Ptr CUChar) -> (outlen ::: CULLong) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (salt ::: Ptr CUChar) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> (alg ::: CInt) -> IO CInt Source #

crypto_pwhash_argon2id :: (out ::: Ptr CUChar) -> (outlen ::: CULLong) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (salt ::: Ptr CUChar) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> (alg ::: CInt) -> IO CInt Source #

crypto_pwhash_argon2id_str :: (out ::: Ptr CChar) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> IO CInt Source #

crypto_pwhash_argon2i_str :: (out ::: Ptr CChar) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> IO CInt Source #

crypto_pwhash_scryptsalsa208sha256 :: (out ::: Ptr CUChar) -> (outlen ::: CULLong) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (salt ::: Ptr CUChar) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> IO CInt Source #

crypto_pwhash_scryptsalsa208sha256_ll :: (passwd ::: Ptr Word8) -> (passwdlen ::: CSize) -> (salt ::: Ptr Word8) -> (saltlen ::: CSize) -> (n ::: Word64) -> (r ::: Word32) -> (p ::: Word32) -> (buf ::: Ptr Word8) -> (buflen ::: CSize) -> IO CInt Source #

crypto_pwhash_scryptsalsa208sha256_str :: (out ::: Ptr CChar) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> IO CInt Source #

crypto_pwhash_str :: (out ::: Ptr CChar) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> IO CInt Source #

crypto_pwhash_str_alg :: (out ::: Ptr CChar) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> (alg ::: CInt) -> IO CInt Source #

crypto_pwhash_str_needs_rehash :: (str ::: Ptr CChar) -> (opslimit ::: CULLong) -> (memlimit ::: CSize) -> IO CInt Source #

crypto_pwhash_str_verify :: (str ::: Ptr CChar) -> (passwd ::: Ptr CChar) -> (passwdlen ::: CULLong) -> IO CInt Source #

crypto_secretbox :: (c ::: Ptr CUChar) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (n ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_shorthash :: (out ::: Ptr CUChar) -> (in_ ::: Ptr CUChar) -> (inlen ::: CULLong) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_sign :: (sm ::: Ptr CUChar) -> (smlen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_sign_detached :: (sig ::: Ptr CUChar) -> (siglen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_sign_ed25519 :: (sm ::: Ptr CUChar) -> (smlen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_sign_ed25519_detached :: (sig ::: Ptr CUChar) -> (siglen_p ::: Ptr CULLong) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (sk ::: Ptr CUChar) -> IO CInt Source #

crypto_sign_ed25519_open :: (m ::: Ptr CUChar) -> (mlen_p ::: Ptr CULLong) -> (sm ::: Ptr CUChar) -> (smlen ::: CULLong) -> (pk ::: Ptr CUChar) -> IO CInt Source #

crypto_sign_open :: (m ::: Ptr CUChar) -> (mlen_p ::: Ptr CULLong) -> (sm ::: Ptr CUChar) -> (smlen ::: CULLong) -> (pk ::: Ptr CUChar) -> IO CInt Source #

crypto_stream :: (c ::: Ptr CUChar) -> (clen ::: CULLong) -> (n ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

crypto_stream_xor :: (c ::: Ptr CUChar) -> (m ::: Ptr CUChar) -> (mlen ::: CULLong) -> (n ::: Ptr CUChar) -> (k ::: Ptr CUChar) -> IO CInt Source #

randombytes :: (buf ::: Ptr CUChar) -> (buf_len ::: CULLong) -> IO () Source #

randombytes_buf :: (buf ::: Ptr x) -> (size ::: CSize) -> IO () Source #

randombytes_buf_deterministic :: (buf ::: Ptr x) -> (size ::: CSize) -> (seed ::: Ptr CUChar) -> IO () Source #

sodium_add :: (a ::: Ptr CUChar) -> (b ::: Ptr CUChar) -> (len ::: CSize) -> IO () Source #

sodium_allocarray :: (count ::: CSize) -> (size ::: CSize) -> IO (Ptr a) Source #

sodium_base642bin :: (bin ::: Ptr CUChar) -> (bin_maxlen ::: CSize) -> (b64 ::: Ptr CChar) -> (b64_len ::: CSize) -> (ignore ::: Ptr CChar) -> (bin_len ::: Ptr CSize) -> (b64_end ::: Ptr (Ptr CChar)) -> (variant ::: CInt) -> IO CInt Source #

sodium_base64_encoded_len :: (bin_len ::: CSize) -> (variant ::: CInt) -> IO CInt Source #

sodium_bin2base64 :: (b64 ::: Ptr CChar) -> (b64_maxlen ::: CSize) -> (bin ::: Ptr CUChar) -> (bin_len ::: CSize) -> (variant ::: CInt) -> IO CString Source #

sodium_bin2hex :: (hex ::: Ptr CChar) -> (hex_maxlen ::: CSize) -> (bin ::: Ptr CUChar) -> (bin_len ::: CSize) -> IO CString Source #

sodium_compare :: (b1_ ::: Ptr CUChar) -> (b2_ ::: Ptr CUChar) -> (len ::: CSize) -> IO CInt Source #

sodium_hex2bin :: (bin ::: Ptr CUChar) -> (bin_maxlen ::: CSize) -> (hex ::: Ptr CChar) -> (hex_len ::: CSize) -> (ignore ::: Ptr CChar) -> (bin_len ::: Ptr CSize) -> (hex_end ::: Ptr (Ptr CChar)) -> IO CInt Source #

sodium_increment :: (n ::: Ptr CUChar) -> (nlen ::: CSize) -> IO () Source #

sodium_malloc :: (size ::: CSize) -> IO (Ptr a) Source #

sodium_memcmp :: (b1 ::: Ptr a) -> (b2 ::: Ptr a) -> (len ::: CSize) -> IO CInt Source #

sodium_memzero :: (pnt ::: Ptr x) -> (len ::: CSize) -> IO () Source #

sodium_mlock :: (addr ::: Ptr x) -> (len ::: CSize) -> IO CInt Source #

sodium_munlock :: (addr ::: Ptr x) -> (len ::: CSize) -> IO CInt Source #

sodium_pad :: (padded_buflen_p ::: Ptr CSize) -> (buf ::: Ptr CUChar) -> (unpadded_buflen ::: CSize) -> (blocksize ::: CSize) -> (max_buflen ::: CSize) -> IO CInt Source #

sodium_sub :: (a ::: Ptr CUChar) -> (b ::: Ptr CUChar) -> (len ::: CSize) -> IO () Source #

sodium_unpad :: (unpadded_buflen_p ::: Ptr CSize) -> (buf ::: Ptr CUChar) -> (padded_buflen ::: CSize) -> (blocksize ::: CSize) -> IO CInt Source #

Types

These are types used by some of the functions in Libsodium. They are exported as opaque types having a particular size and alignment described by their Storable instance.

Use the xxx'malloc functions to allocate values of type Xxx. These will be freed from memory as soon as they become unused.

Use the xxx'ptr function to obtain a Ptr Xxx suitable for passing to functions.

Constants

Constants are exported in uppercase letters as type-level Nats or Symbols, and in lowercase letters as term-level values having the appropriate C types.

type CRYPTO_AUTH_BYTES = (32 :: Nat) Source #

type CRYPTO_BOX_MESSAGEBYTES_MAX = (18446744073709551599 :: Nat) Source #