blob: b0d033ff0a48fb0f2a0422cca6f0d19a117c462f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/**
@defgroup CryptoKernel Cryptographic Kernel
All of the cryptographic functions are contained in a kernel.
*/
/**
@defgroup CipherImplementations Ciphers
@ingroup CryptoKernel
@brief A generic cipher type enables cipher agility, that is, the
ability to write code that runs with multiple cipher types.
Ciphers can be used through the crypto kernel, or can be accessed
directly, if need be.
@{
*/
/**
* @brief Allocates a cipher of a particular type.
* @warning May be implemented as a macro.
*/
err_status_t
cipher_type_alloc(cipher_type_t *ctype, cipher_t **cipher,
unsigned key_len);
/**
* @brief Initialized a cipher to use a particular key. May
* be invoked more than once on the same cipher.
* @warning May be implemented as a macro.
*/
err_status_t
cipher_init(cipher_t *cipher, const uint8_t *key);
/**
* @brief Sets the initialization vector of a given cipher.
* @warning May be implemented as a macro.
*/
err_status_t
cipher_set_iv(cipher_t *cipher, void *iv);
/**
* @brief Encrypts a buffer with a given cipher.
* @warning May be implemented as a macro.
*/
err_status_t
cipher_encrypt(cipher_t *cipher, void *buf, unsigned int *len);
/**
* @brief Sets a buffer to the keystream generated by the cipher.
* @warning May be implemented as a macro.
*/
err_status_t
cipher_output(cipher_t *c, uint8_t *buffer, int num_octets_to_output);
/**
* @brief Deallocates a cipher.
* @warning May be implemented as a macro.
*/
err_status_t
cipher_dealloc(cipher_t *cipher);
/**
* @}
*/
*/
|