ffi.cpp |
|
8146 |
ffi.h |
This header exports some of botan's functionality via a C89 interface. This API
is uesd by the Python, OCaml, Rust and Ruby bindings via those languages
respective ctypes/FFI libraries.
The API is intended to be as easy as possible to call from other
languages, which often have easy ways to call C, because C. But some C
code is easier to deal with than others, so to make things easy this
API follows a few simple rules:
- All interactions are via pointers to opaque structs. No need to worry about
structure padding issues and the like.
- All functions return an int error code (except the version calls, which are
assumed to always have something to say).
- Use simple types: size_t for lengths, const char* NULL terminated strings,
uint8_t for binary.
- No ownership of memory transfers across the API boundary. The API will
consume data from const pointers, and will produce output by writing to
buffers provided by (and allocated by) the caller.
- If exporting a value (a string or a blob) the function takes a pointer to the
output array and a read/write pointer to the length. If the length is insufficient, an
error is returned. So passing nullptr/0 allows querying the final value.
Note this does not apply to all functions, like `botan_hash_final`
which is not idempotent and are documented specially. But it's a
general theory of operation.
TODO:
- Doxygen comments for all functions/params
- TLS
|
65311 |
ffi_block.cpp |
Destroy a block cipher object
|
3487 |
ffi_cert.cpp |
|
16683 |
ffi_cipher.cpp |
|
7136 |
ffi_fpe.cpp |
|
2251 |
ffi_hash.cpp |
|
2491 |
ffi_hotp.cpp |
|
2392 |
ffi_kdf.cpp |
|
5345 |
ffi_keywrap.cpp |
|
1588 |
ffi_mac.cpp |
|
2509 |
ffi_mp.cpp |
|
8935 |
ffi_mp.h |
|
310 |
ffi_pk_op.cpp |
Public Key Decryption
|
8492 |
ffi_pkey.cpp |
|
9632 |
ffi_pkey.h |
|
403 |
ffi_pkey_algs.cpp |
|
29876 |
ffi_rng.cpp |
|
5251 |
ffi_rng.h |
|
325 |
ffi_totp.cpp |
|
2309 |
ffi_util.h |
Like BOTAN_FFI_DO but with no trailing return with the expectation
that the block always returns a value. This exists because otherwise
MSVC warns about the dead return after the block in FFI_DO.
|
5057 |
info.txt |
|
270 |