diff options
author | Jack Lloyd <[email protected]> | 2017-04-04 14:55:11 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-04-04 14:55:11 -0400 |
commit | 686371913aeb6ad823320dfc6caf3a8e7d24e01e (patch) | |
tree | f7efac0deb7e994673ebca8b5d73748c5ccbc373 /doc/manual | |
parent | 6f153656b234c42a690ce898931ce534b29c3e69 (diff) |
Add block cipher interface to C API
Diffstat (limited to 'doc/manual')
-rw-r--r-- | doc/manual/ffi.rst | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/manual/ffi.rst b/doc/manual/ffi.rst index 5cf0dbac5..8acbf225a 100644 --- a/doc/manual/ffi.rst +++ b/doc/manual/ffi.rst @@ -89,6 +89,50 @@ Random Number Generators Destroy the object created by :cpp:func:`botan_rng_init`. +Block Ciphers +---------------------------------------- + +This is a 'raw' interface to ECB mode block ciphers. Most applications +want the higher level cipher API which provides authenticated +encryption. This API exists as an escape hatch for applications which +need to implement custom primitives using a PRP. + +.. cpp:type:: opaque* botan_block_cipher_t + + An opauqe data type for a block cipher. Don't mess with it. + +.. cpp:function:: int botan_block_cipher_init(botan_block_cipher_t* bc, const char* cipher_name) + + Create a new cipher mode object, `cipher_name` should be for example "AES-128" or "Threefish-512" + +.. cpp:function:: int botan_block_cipher_block_size(botan_block_cipher_t bc) + + Return the block size of this cipher. + +.. cpp:function:: int botan_block_cipher_clear(botan_block_cipher_t bc) + + Clear the internal state (such as keys) of this cipher object, but do not deallocate it. + +.. cpp:function:: int botan_block_cipher_set_key(botan_block_cipher_t bc, const uint8_t key[], size_t key_len) + + Set the cipher key, which is required before encrypting or decrypting. + +.. cpp:function:: int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks) + + The key must have been set first with + Encrypt *blocks* blocks of data stored in *in* and place the ciphertext into *out*. + The two parameters may be the same buffer, but must not overlap. + +.. cpp:function:: int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks) + + Decrypt *blocks* blocks of data stored in *in* and place the ciphertext into *out*. + The two parameters may be the same buffer, but must not overlap. + +.. cpp:function:: int botan_block_cipher_destroy(botan_block_cipher_t rng) + + Destroy the object created by :cpp:func:`botan_block_cipher_init`. + + Hash Functions ---------------------------------------- |