Skip to content

Commit

Permalink
Made doc varnames bold instead of monospaced to fix excess height
Browse files Browse the repository at this point in the history
  • Loading branch information
ldillinger committed Feb 13, 2024
1 parent bb0fb20 commit 96fc319
Show file tree
Hide file tree
Showing 68 changed files with 1,280 additions and 1,278 deletions.
16 changes: 8 additions & 8 deletions botan-bindings/src/Botan/Bindings/Bcrypt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ Output is formatted bcrypt $2a$...
-}
foreign import capi safe "botan/ffi.h botan_bcrypt_generate"
botan_bcrypt_generate
:: Ptr Word8 -- ^ @out@: buffer holding the password hash, should be of length 64 bytes
-> Ptr CSize -- ^ @out_len@: the desired output length in bytes
-> ConstPtr CChar -- ^ @password@: the password
-> BotanRNG -- ^ @rng@: a random number generator
-> CSize -- ^ @work_factor@: how much work to do to slow down guessing attacks
-> Word32 -- ^ @flags@: should be 0 in current API revision, all other uses are reserved
:: Ptr Word8 -- ^ __out__: buffer holding the password hash, should be of length 64 bytes
-> Ptr CSize -- ^ __out_len__: the desired output length in bytes
-> ConstPtr CChar -- ^ __password__: the password
-> BotanRNG -- ^ __rng__: a random number generator
-> CSize -- ^ __work_factor__: how much work to do to slow down guessing attacks
-> Word32 -- ^ __flags__: should be 0 in current API revision, all other uses are reserved
-- and return BOTAN_FFI_ERROR_BAD_FLAG
-> IO CInt -- ^ 0 on success, a negative value on failure

-- | Check a previously created password hash
foreign import capi safe "botan/ffi.h botan_bcrypt_is_valid"
botan_bcrypt_is_valid
:: ConstPtr CChar -- ^ @pass@: the password to check against
-> ConstPtr CChar -- ^ @hash@: the stored hash to check against
:: ConstPtr CChar -- ^ __pass__: the password to check against
-> ConstPtr CChar -- ^ __hash__: the stored hash to check against
-> IO CInt -- ^ 0 if if this password/hash combination is valid,
-- 1 if the combination is not valid (but otherwise well formed),
-- negative on error
44 changes: 22 additions & 22 deletions botan-bindings/src/Botan/Bindings/BlockCipher.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,61 +84,61 @@ pattern BOTAN_BLOCK_CIPHER_THREEFISH_512 = "Threefish-512"
-- | Initialize a block cipher object
foreign import capi safe "botan/ffi.h botan_block_cipher_init"
botan_block_cipher_init
:: Ptr BotanBlockCipher -- ^ @bc@
-> ConstPtr CChar -- ^ @cipher_name@
:: Ptr BotanBlockCipher -- ^ __bc__
-> ConstPtr CChar -- ^ __cipher_name__
-> IO CInt

-- | Reinitializes the block cipher
foreign import capi safe "botan/ffi.h botan_block_cipher_clear"
botan_block_cipher_clear
:: BotanBlockCipher -- ^ @bc@
:: BotanBlockCipher -- ^ __bc__
-> IO CInt -- ^ 0 on success, a negative value on failure

-- | Set the key for a block cipher instance
foreign import capi safe "botan/ffi.h botan_block_cipher_set_key"
botan_block_cipher_set_key
:: BotanBlockCipher -- ^ @bc@
-> ConstPtr Word8 -- ^ @key[]@
-> CSize -- ^ @len@
:: BotanBlockCipher -- ^ __bc__
-> ConstPtr Word8 -- ^ __key[]__
-> CSize -- ^ __len__
-> IO CInt

-- | Return the positive block size of this block cipher, or negative to indicate an error
foreign import capi safe "botan/ffi.h botan_block_cipher_block_size"
botan_block_cipher_block_size
:: BotanBlockCipher -- ^ @bc@
:: BotanBlockCipher -- ^ __bc__
-> IO CInt

-- | Encrypt one or more blocks with the cipher
foreign import capi safe "botan/ffi.h botan_block_cipher_encrypt_blocks"
botan_block_cipher_encrypt_blocks
:: BotanBlockCipher -- ^ @bc@
-> ConstPtr Word8 -- ^ @in[]@
-> Ptr Word8 -- ^ @out[]@
-> CSize -- ^ @blocks@
:: BotanBlockCipher -- ^ __bc__
-> ConstPtr Word8 -- ^ __in[]__
-> Ptr Word8 -- ^ __out[]__
-> CSize -- ^ __blocks__
-> IO CInt

-- | Decrypt one or more blocks with the cipher
foreign import capi safe "botan/ffi.h botan_block_cipher_decrypt_blocks"
botan_block_cipher_decrypt_blocks
:: BotanBlockCipher -- ^ @bc@
-> ConstPtr Word8 -- ^ @in[]@
-> Ptr Word8 -- ^ @out[]@
-> CSize -- ^ @blocks@
:: BotanBlockCipher -- ^ __bc__
-> ConstPtr Word8 -- ^ __in[]__
-> Ptr Word8 -- ^ __out[]__
-> CSize -- ^ __blocks__
-> IO CInt

-- | Get the name of this block cipher
foreign import capi safe "botan/ffi.h botan_block_cipher_name"
botan_block_cipher_name
:: BotanBlockCipher -- ^ @cipher@: the object to read
-> Ptr CChar -- ^ @name@: output buffer
-> Ptr CSize -- ^ @name_len@: on input, the length of buffer, on success the number of bytes written
:: BotanBlockCipher -- ^ __cipher__: the object to read
-> Ptr CChar -- ^ __name__: output buffer
-> Ptr CSize -- ^ __name_len__: on input, the length of buffer, on success the number of bytes written
-> IO CInt

-- | Get the key length limits of this block cipher
foreign import capi safe "botan/ffi.h botan_block_cipher_get_keyspec"
botan_block_cipher_get_keyspec
:: BotanBlockCipher -- ^ @cipher@: the object to read
-> Ptr CSize -- ^ @out_minimum_keylength@: if non-NULL, will be set to minimum keylength of cipher
-> Ptr CSize -- ^ @out_maximum_keylength@: if non-NULL, will be set to maximum keylength of cipher
-> Ptr CSize -- ^ @out_keylength_modulo@: if non-NULL will be set to byte multiple of valid keys
:: BotanBlockCipher -- ^ __cipher__: the object to read
-> Ptr CSize -- ^ __out_minimum_keylength__: if non-NULL, will be set to minimum keylength of cipher
-> Ptr CSize -- ^ __out_maximum_keylength__: if non-NULL, will be set to maximum keylength of cipher
-> Ptr CSize -- ^ __out_keylength_modulo__: if non-NULL will be set to byte multiple of valid keys
-> IO CInt
90 changes: 45 additions & 45 deletions botan-bindings/src/Botan/Bindings/Cipher.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -87,55 +87,55 @@ pattern BOTAN_CIPHER_INIT_FLAG_DECRYPT = #const BOTAN_CIPHER_INIT_FLAG_DE
-- | Initialize a cipher object
foreign import capi safe "botan/ffi.h botan_cipher_init"
botan_cipher_init
:: Ptr BotanCipher -- ^ @cipher@
-> ConstPtr CChar -- ^ @name@
-> Word32 -- ^ @flags@
:: Ptr BotanCipher -- ^ __cipher__
-> ConstPtr CChar -- ^ __name__
-> Word32 -- ^ __flags__
-> IO CInt

-- | Return the name of the cipher object
foreign import capi safe "botan/ffi.h botan_cipher_name"
botan_cipher_name
:: BotanCipher -- ^ @cipher@
-> Ptr CChar -- ^ @name@
-> Ptr CSize -- ^ @name_len@
:: BotanCipher -- ^ __cipher__
-> Ptr CChar -- ^ __name__
-> Ptr CSize -- ^ __name_len__
-> IO CInt

-- | Return the output length of this cipher, for a particular input length.
foreign import capi safe "botan/ffi.h botan_cipher_output_length"
botan_cipher_output_length
:: BotanCipher -- ^ @cipher@
-> CSize -- ^ @in_len@
-> Ptr CSize -- ^ @out_len@
:: BotanCipher -- ^ __cipher__
-> CSize -- ^ __in_len__
-> Ptr CSize -- ^ __out_len__
-> IO CInt

-- | Return if the specified nonce length is valid for this cipher
-- (0 / SUCCESS if valid, 1 / INVALID_IDENTIFIER if not)
foreign import capi safe "botan/ffi.h botan_cipher_valid_nonce_length"
botan_cipher_valid_nonce_length
:: BotanCipher -- ^ @cipher@
-> CSize -- ^ @nl@
:: BotanCipher -- ^ __cipher__
-> CSize -- ^ __nl__
-> IO CInt

-- | Get the tag length of the cipher (0 for non-AEAD modes)
foreign import capi safe "botan/ffi.h botan_cipher_get_tag_length"
botan_cipher_get_tag_length
:: BotanCipher -- ^ @cipher@
-> Ptr CSize -- ^ @tag_size@
:: BotanCipher -- ^ __cipher__
-> Ptr CSize -- ^ __tag_size__
-> IO CInt

-- | Get the default nonce length of this cipher
foreign import capi safe "botan/ffi.h botan_cipher_get_default_nonce_length"
botan_cipher_get_default_nonce_length
:: BotanCipher -- ^ @cipher@
-> Ptr CSize -- ^ @nl@
:: BotanCipher -- ^ __cipher__
-> Ptr CSize -- ^ __nl__
-> IO CInt

-- | Return the update granularity of the cipher;
-- botan_cipher_update must be called with blocks of this size, except for the final.
foreign import capi safe "botan/ffi.h botan_cipher_get_update_granularity"
botan_cipher_get_update_granularity
:: BotanCipher -- ^ @cipher@
-> Ptr CSize -- ^ @ug@
:: BotanCipher -- ^ __cipher__
-> Ptr CSize -- ^ __ug__
-> IO CInt

{-
Expand All @@ -145,33 +145,33 @@ reflecting possibilities for optimization.
-}
foreign import capi safe "botan/ffi.h botan_cipher_get_ideal_update_granularity"
botan_cipher_get_ideal_update_granularity
:: BotanCipher -- ^ @cipher@
-> Ptr CSize -- ^ @ug@
:: BotanCipher -- ^ __cipher__
-> Ptr CSize -- ^ __ug__
-> IO CInt

-- | Get information about the key lengths. Prefer botan_cipher_get_keyspec
foreign import capi safe "botan/ffi.h botan_cipher_query_keylen"
botan_cipher_query_keylen
:: BotanCipher -- ^ @cipher@
-> Ptr CSize -- ^ @out_minimum_keylength@
-> Ptr CSize -- ^ @out_maximum_keylength@
:: BotanCipher -- ^ __cipher__
-> Ptr CSize -- ^ __out_minimum_keylength__
-> Ptr CSize -- ^ __out_maximum_keylength__
-> IO CInt

-- | Get information about the supported key lengths.
foreign import capi safe "botan/ffi.h botan_cipher_get_keyspec"
botan_cipher_get_keyspec
:: BotanCipher -- ^ @cipher@
-> Ptr CSize -- ^ @min_keylen@
-> Ptr CSize -- ^ @max_keylen@
-> Ptr CSize -- ^ @mod_keylen@
:: BotanCipher -- ^ __cipher__
-> Ptr CSize -- ^ __min_keylen__
-> Ptr CSize -- ^ __max_keylen__
-> Ptr CSize -- ^ __mod_keylen__
-> IO CInt

-- | Set the key for this cipher object
foreign import capi safe "botan/ffi.h botan_cipher_set_key"
botan_cipher_set_key
:: BotanCipher -- ^ @cipher@
-> ConstPtr Word8 -- ^ @key@
-> CSize -- ^ @key_len@
:: BotanCipher -- ^ __cipher__
-> ConstPtr Word8 -- ^ __key__
-> CSize -- ^ __key_len__
-> IO CInt

{-
Expand All @@ -184,23 +184,23 @@ by botan_cipher_set_key with the original key.
-}
foreign import capi safe "botan/ffi.h botan_cipher_reset"
botan_cipher_reset
:: BotanCipher -- ^ @cipher@
:: BotanCipher -- ^ __cipher__
-> IO CInt

-- | Set the associated data. Will fail if cipher is not an AEAD
foreign import capi safe "botan/ffi.h botan_cipher_set_associated_data"
botan_cipher_set_associated_data
:: BotanCipher -- ^ @cipher@
-> ConstPtr Word8 -- ^ @ad@
-> CSize -- ^ @ad_len@
:: BotanCipher -- ^ __cipher__
-> ConstPtr Word8 -- ^ __ad__
-> CSize -- ^ __ad_len__
-> IO CInt

-- | Begin processing a new message using the provided nonce
foreign import capi safe "botan/ffi.h botan_cipher_start"
botan_cipher_start
:: BotanCipher -- ^ @cipher@
-> ConstPtr Word8 -- ^ @nonce@
-> CSize -- ^ @nonce_len@
:: BotanCipher -- ^ __cipher__
-> ConstPtr Word8 -- ^ __nonce__
-> CSize -- ^ __nonce_len__
-> IO CInt

pattern BOTAN_CIPHER_UPDATE_FLAG_NONE
Expand All @@ -212,18 +212,18 @@ pattern BOTAN_CIPHER_UPDATE_FLAG_FINAL = #const BOTAN_CIPHER_UPDATE_FLAG_FINAL
-- | Encrypt some data
foreign import capi safe "botan/ffi.h botan_cipher_update"
botan_cipher_update
:: BotanCipher -- ^ @cipher@
-> Word32 -- ^ @flags@
-> Ptr Word8 -- ^ @output[]@
-> CSize -- ^ @output_size@
-> Ptr CSize -- ^ @output_written@
-> ConstPtr Word8 -- ^ @input_bytes[]@
-> CSize -- ^ @input_size@
-> Ptr CSize -- ^ @input_consumed@
:: BotanCipher -- ^ __cipher__
-> Word32 -- ^ __flags__
-> Ptr Word8 -- ^ __output[]__
-> CSize -- ^ __output_size__
-> Ptr CSize -- ^ __output_written__
-> ConstPtr Word8 -- ^ __input_bytes[]__
-> CSize -- ^ __input_size__
-> Ptr CSize -- ^ __input_consumed__
-> IO CInt

-- | Reset the key, nonce, AD and all other state on this cipher object
foreign import capi safe "botan/ffi.h botan_cipher_clear"
botan_cipher_clear
:: BotanCipher -- ^ @hash@
:: BotanCipher -- ^ __hash__
-> IO CInt
2 changes: 1 addition & 1 deletion botan-bindings/src/Botan/Bindings/Error.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pattern BOTAN_FFI_ERROR_UNKNOWN_ERROR = #const BOTAN_FFI_ERROR_UNKNOWN_ERROR

foreign import capi safe "botan/ffi.h botan_error_description"
botan_error_description
:: CInt -- ^ @err@
:: CInt -- ^ __err__
-> IO (ConstPtr CChar)

foreign import capi safe "botan/ffi.h botan_error_last_exception_message"
Expand Down
28 changes: 14 additions & 14 deletions botan-bindings/src/Botan/Bindings/FPE.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,26 @@ pattern BOTAN_FPE_FLAG_FE1_COMPAT_MODE = #const BOTAN_FPE_FLAG_FE1_COMPAT_MODE

foreign import capi safe "botan/ffi.h botan_fpe_fe1_init"
botan_fpe_fe1_init
:: Ptr BotanFPE -- ^ @fpe@
-> BotanMP -- ^ @n@
-> ConstPtr Word8 -- ^ @key[]@
-> CSize -- ^ @key_len@
-> CSize -- ^ @rounds@
-> Word32 -- ^ @flags@
:: Ptr BotanFPE -- ^ __fpe__
-> BotanMP -- ^ __n__
-> ConstPtr Word8 -- ^ __key[]__
-> CSize -- ^ __key_len__
-> CSize -- ^ __rounds__
-> Word32 -- ^ __flags__
-> IO CInt

foreign import capi safe "botan/ffi.h botan_fpe_encrypt"
botan_fpe_encrypt
:: BotanFPE -- ^ @fpe@
-> BotanMP -- ^ @x@
-> ConstPtr Word8 -- ^ @tweak[]@
-> CSize -- ^ @tweak_len@
:: BotanFPE -- ^ __fpe__
-> BotanMP -- ^ __x__
-> ConstPtr Word8 -- ^ __tweak[]__
-> CSize -- ^ __tweak_len__
-> IO CInt

foreign import capi safe "botan/ffi.h botan_fpe_decrypt"
botan_fpe_decrypt
:: BotanFPE -- ^ @fpe@
-> BotanMP -- ^ @x@
-> ConstPtr Word8 -- ^ @tweak[]@
-> CSize -- ^ @tweak_len@
:: BotanFPE -- ^ __fpe__
-> BotanMP -- ^ __x__
-> ConstPtr Word8 -- ^ __tweak[]__
-> CSize -- ^ __tweak_len__
-> IO CInt
26 changes: 13 additions & 13 deletions botan-bindings/src/Botan/Bindings/HOTP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,28 @@ foreign import capi safe "botan/ffi.h &botan_hotp_destroy"
-- | Initialize a HOTP instance
foreign import capi safe "botan/ffi.h botan_hotp_init"
botan_hotp_init
:: Ptr BotanHOTP -- ^ @hotp@
-> ConstPtr Word8 -- ^ @key[]@
-> CSize -- ^ @key_len@
-> ConstPtr CChar -- ^ @hash_algo@
-> CSize -- ^ @digits@
:: Ptr BotanHOTP -- ^ __hotp__
-> ConstPtr Word8 -- ^ __key[]__
-> CSize -- ^ __key_len__
-> ConstPtr CChar -- ^ __hash_algo__
-> CSize -- ^ __digits__
-> IO CInt


-- | Generate a HOTP code for the provided counter
foreign import capi safe "botan/ffi.h botan_hotp_generate"
botan_hotp_generate
:: BotanHOTP -- ^ @hotp@
-> Ptr Word32 -- ^ @hotp_code@
-> Word64 -- ^ @hotp_counter@
:: BotanHOTP -- ^ __hotp__
-> Ptr Word32 -- ^ __hotp_code__
-> Word64 -- ^ __hotp_counter__
-> IO CInt

-- | Verify a HOTP code
foreign import capi safe "botan/ffi.h botan_hotp_check"
botan_hotp_check
:: BotanHOTP -- ^ @hotp@
-> Ptr Word64 -- ^ @next_hotp_counter@
-> Word32 -- ^ @hotp_code@
-> Word64 -- ^ @hotp_counter@
-> CSize -- ^ @resync_range@
:: BotanHOTP -- ^ __hotp__
-> Ptr Word64 -- ^ __next_hotp_counter__
-> Word32 -- ^ __hotp_code__
-> Word64 -- ^ __hotp_counter__
-> CSize -- ^ __resync_range__
-> IO CInt
Loading

0 comments on commit 96fc319

Please sign in to comment.