diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2015-03-17 08:50:39 +0100 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-03-17 09:58:20 +0100 |
commit | f4c5b3fd701277e13fe5c08a758552203b4824fb (patch) | |
tree | bd8d9f6092f7b20917b3204c3ca1a124d1247a9a /src/lib/emile | |
parent | d6a2f0cad5c71dc2e34fab916a8f0d4bc46835b8 (diff) |
emile: document the stable cipher function.
Diffstat (limited to 'src/lib/emile')
-rw-r--r-- | src/lib/emile/emile_cipher.h | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/src/lib/emile/emile_cipher.h b/src/lib/emile/emile_cipher.h index 435772f2ad..086c16f9b0 100644 --- a/src/lib/emile/emile_cipher.h +++ b/src/lib/emile/emile_cipher.h | |||
@@ -1,18 +1,76 @@ | |||
1 | #ifndef EMILE_CIPHER_H_ | 1 | #ifndef EMILE_CIPHER_H_ |
2 | #define EMILE_CIPHER_H_ | 2 | #define EMILE_CIPHER_H_ |
3 | 3 | ||
4 | typedef enum | 4 | /** |
5 | * @defgroup Emile_Cipher_Group Top level functions | ||
6 | * @ingroup Emile | ||
7 | * Function that allow ciphering content. | ||
8 | * | ||
9 | * @{ | ||
10 | */ | ||
11 | |||
12 | /** | ||
13 | * @typedef Emile_Cipher_Algorithm | ||
14 | * | ||
15 | * Flags describing known cipher algorithm. | ||
16 | * | ||
17 | * @since 1.14 | ||
18 | */ | ||
19 | typedef enum _Emile_Cipher_Algorithm | ||
5 | { | 20 | { |
6 | EMILE_AES256_CBC | 21 | EMILE_AES256_CBC |
7 | } Emile_Cipher_Algorithm; | 22 | } Emile_Cipher_Algorithm; |
8 | 23 | ||
24 | /** | ||
25 | * Force the initialization of the underlying cipher library. | ||
26 | * | ||
27 | * This call force the initialisation of GNUTLS or OpenSSL, so | ||
28 | * that you get the same setup for everyone. | ||
29 | * | ||
30 | * @return EINA_TRUE on success, EINA_FALSE otherwise. | ||
31 | * @see emile_cipher_module_get | ||
32 | * | ||
33 | * @since 1.14.0 | ||
34 | */ | ||
9 | EAPI Eina_Bool emile_cipher_init(void); | 35 | EAPI Eina_Bool emile_cipher_init(void); |
36 | /** | ||
37 | * Get the name of the current used backend. | ||
38 | * | ||
39 | * @return the name of the current cipher backend. | ||
40 | * @since 1.14.0 | ||
41 | */ | ||
10 | EAPI const char *emile_cipher_module_get(void); | 42 | EAPI const char *emile_cipher_module_get(void); |
11 | 43 | ||
44 | /** | ||
45 | * Cipher a buffer with a defined algorithm and key. | ||
46 | * | ||
47 | * @param algo The algorithm to use to cipher the buffer. | ||
48 | * @param in The buffer to cipher. | ||
49 | * @param key The symetric key to use for ciphering. | ||
50 | * @param length The length of the symetric key to be used. | ||
51 | * @return the ciphered buffer or NULL on error. | ||
52 | * | ||
53 | * @since 1.14.0 | ||
54 | */ | ||
12 | EAPI Eina_Binbuf *emile_binbuf_cipher(Emile_Cipher_Algorithm algo, | 55 | EAPI Eina_Binbuf *emile_binbuf_cipher(Emile_Cipher_Algorithm algo, |
13 | const Eina_Binbuf *in, | 56 | const Eina_Binbuf *in, |
14 | const char *key, unsigned int length); | 57 | const char *key, unsigned int length); |
15 | 58 | ||
59 | /** | ||
60 | * Decipher a buffer with a defined algorithm and key. | ||
61 | * | ||
62 | * @param algo The algorithm to use to decipher the buffer. | ||
63 | * @param in The ciphered buffer to decipher. | ||
64 | * @param key The symetric key used to cipher the buffer. | ||
65 | * @param length The length of the symetric key used to cipher the buffer. | ||
66 | * @return the clear buffer or NULL on error. | ||
67 | * | ||
68 | * @note This won't detect if the given key is the correct one or not. You | ||
69 | * have to check that the returned data make sense. You should also not treat | ||
70 | * them as safe. | ||
71 | * | ||
72 | * @since 1.14.0 | ||
73 | */ | ||
16 | EAPI Eina_Binbuf *emile_binbuf_decipher(Emile_Cipher_Algorithm algo, | 74 | EAPI Eina_Binbuf *emile_binbuf_decipher(Emile_Cipher_Algorithm algo, |
17 | const Eina_Binbuf *in, | 75 | const Eina_Binbuf *in, |
18 | const char *key, unsigned int length); | 76 | const char *key, unsigned int length); |
@@ -62,4 +120,8 @@ EAPI Eina_Bool emile_cipher_verify_basic_get(const Emile_SSL *emile); | |||
62 | 120 | ||
63 | #endif | 121 | #endif |
64 | 122 | ||
123 | /** | ||
124 | * @} | ||
125 | */ | ||
126 | |||
65 | #endif | 127 | #endif |