aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_abe_lib.h
diff options
context:
space:
mode:
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-01-04 15:28:02 +0100
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-01-04 15:29:45 +0100
commit78705d5a49d7066a01b832546d2507456a3c5d2c (patch)
treeb0e5f72bdde4574f20c0b89ee56295f83b954800 /src/include/gnunet_abe_lib.h
parent272921672ec094644a1ddbbfacb96581e72ed443 (diff)
downloadgnunet-78705d5a49d7066a01b832546d2507456a3c5d2c.tar.gz
gnunet-78705d5a49d7066a01b832546d2507456a3c5d2c.zip
-cleanup doc; fixes
Diffstat (limited to 'src/include/gnunet_abe_lib.h')
-rw-r--r--src/include/gnunet_abe_lib.h74
1 files changed, 62 insertions, 12 deletions
diff --git a/src/include/gnunet_abe_lib.h b/src/include/gnunet_abe_lib.h
index 77b0f9e99..f73ea2431 100644
--- a/src/include/gnunet_abe_lib.h
+++ b/src/include/gnunet_abe_lib.h
@@ -19,8 +19,8 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_crypto_lib.h 22 * @file include/gnunet_abe_lib.h
23 * @brief cryptographic primitives for GNUnet 23 * @brief Attribute-Based Encryption primitives for GNUnet
24 * 24 *
25 * @author Martin Schanzenbach 25 * @author Martin Schanzenbach
26 * 26 *
@@ -57,10 +57,18 @@ struct GNUNET_CRYPTO_AbeKey;
57 * @ingroup abe 57 * @ingroup abe
58 * Create a new CP-ABE master key. Caller must free return value. 58 * Create a new CP-ABE master key. Caller must free return value.
59 * 59 *
60 * @return fresh private key; free using #GNUNET_free 60 * @return fresh private key; free using #GNUNET_ABE_cpabe_delete_master_key
61 */ 61 */
62struct GNUNET_ABE_AbeMasterKey * 62struct GNUNET_ABE_AbeMasterKey *
63GNUNET_ABE_cpabe_create_master_key (void); 63GNUNET_ABE_cpabe_create_master_key (void);
64
65/**
66 * @ingroup abe
67 * Delete a CP-ABE master key.
68 *
69 * @param key the master key
70 * @return fresh private key; free using #GNUNET_free
71 */
64void 72void
65GNUNET_ABE_cpabe_delete_master_key (struct GNUNET_ABE_AbeMasterKey *key); 73GNUNET_ABE_cpabe_delete_master_key (struct GNUNET_ABE_AbeMasterKey *key);
66 74
@@ -68,11 +76,22 @@ GNUNET_ABE_cpabe_delete_master_key (struct GNUNET_ABE_AbeMasterKey *key);
68 * @ingroup abe 76 * @ingroup abe
69 * Create a new CP-ABE key. Caller must free return value. 77 * Create a new CP-ABE key. Caller must free return value.
70 * 78 *
71 * @return fresh private key; free using #GNUNET_free 79 * @param key the master key
80 * @param attrs the attributes to append to the key
81 * @return fresh private key; free using #GNUNET_ABE_cpabe_delete_key
72 */ 82 */
73struct GNUNET_ABE_AbeKey * 83struct GNUNET_ABE_AbeKey *
74GNUNET_ABE_cpabe_create_key (struct GNUNET_ABE_AbeMasterKey *msk, 84GNUNET_ABE_cpabe_create_key (struct GNUNET_ABE_AbeMasterKey *key,
75 char **attrs); 85 char **attrs);
86
87/**
88 * @ingroup abe
89 * Delete a CP-ABE key.
90 *
91 * @param key the key to delete
92 * @param delete_pub GNUNE_YES if the public key should also be freed (bug in gabe)
93 * @return fresh private key; free using #GNUNET_free
94 */
76void 95void
77GNUNET_ABE_cpabe_delete_key (struct GNUNET_ABE_AbeKey *key, 96GNUNET_ABE_cpabe_delete_key (struct GNUNET_ABE_AbeKey *key,
78 int delete_pub); 97 int delete_pub);
@@ -84,9 +103,9 @@ GNUNET_ABE_cpabe_delete_key (struct GNUNET_ABE_AbeKey *key,
84 * 103 *
85 * @param block the block to encrypt 104 * @param block the block to encrypt
86 * @param size the size of the @a block 105 * @param size the size of the @a block
87 * @param sessionkey the key used to encrypt 106 * @param policy the ABE policy
88 * @param iv the initialization vector to use, use INITVALUE 107 * @param key the key used to encrypt
89 * for streams. 108 * @param result the result buffer. Will be allocated. Free using #GNUNET_free
90 * @return the size of the encrypted block, -1 for errors 109 * @return the size of the encrypted block, -1 for errors
91 */ 110 */
92ssize_t 111ssize_t
@@ -98,13 +117,12 @@ GNUNET_ABE_cpabe_encrypt (const void *block,
98 117
99/** 118/**
100 * @ingroup abe 119 * @ingroup abe
101 * Encrypt a block using sessionkey. 120 * Decrypt a block using the ABE key.
102 * 121 *
103 * @param block the block to encrypt 122 * @param block the block to encrypt
104 * @param size the size of the @a block 123 * @param size the size of the @a block
105 * @param sessionkey the key used to encrypt 124 * @param key the key used to decrypt
106 * @param iv the initialization vector to use, use INITVALUE 125 * @param result the result buffer. Will be allocated. Free using #GNUNET_free
107 * for streams.
108 * @return the size of the encrypted block, -1 for errors 126 * @return the size of the encrypted block, -1 for errors
109 */ 127 */
110ssize_t 128ssize_t
@@ -113,18 +131,50 @@ GNUNET_ABE_cpabe_decrypt (const void *block,
113 const struct GNUNET_ABE_AbeKey *key, 131 const struct GNUNET_ABE_AbeKey *key,
114 void **result); 132 void **result);
115 133
134/**
135 * @ingroup abe
136 * Serialize an ABE key.
137 *
138 * @param key the key to serialize
139 * @param result the result buffer. Will be allocated. Free using #GNUNET_free
140 * @return the size of the encrypted block, -1 for errors
141 */
116ssize_t 142ssize_t
117GNUNET_ABE_cpabe_serialize_key (const struct GNUNET_ABE_AbeKey *key, 143GNUNET_ABE_cpabe_serialize_key (const struct GNUNET_ABE_AbeKey *key,
118 void **result); 144 void **result);
119 145
146/**
147 * @ingroup abe
148 * Deserialize a serialized ABE key.
149 *
150 * @param data the data to deserialize
151 * @param len the length of the data.
152 * @return the ABE key. NULL of unsuccessful
153 */
120struct GNUNET_ABE_AbeKey* 154struct GNUNET_ABE_AbeKey*
121GNUNET_ABE_cpabe_deserialize_key (const void *data, 155GNUNET_ABE_cpabe_deserialize_key (const void *data,
122 size_t len); 156 size_t len);
123 157
158/**
159 * @ingroup abe
160 * Serialize an ABE master key.
161 *
162 * @param key the key to serialize
163 * @param result the result buffer. Will be allocated. Free using #GNUNET_free
164 * @return the size of the encrypted block, -1 for errors
165 */
124ssize_t 166ssize_t
125GNUNET_ABE_cpabe_serialize_master_key (const struct GNUNET_ABE_AbeMasterKey *key, 167GNUNET_ABE_cpabe_serialize_master_key (const struct GNUNET_ABE_AbeMasterKey *key,
126 void **result); 168 void **result);
127 169
170/**
171 * @ingroup abe
172 * Deserialize an ABE master key.
173 *
174 * @param data the data to deserialize
175 * @param len the length of the data.
176 * @return the ABE key. NULL of unsuccessful
177 */
128struct GNUNET_ABE_AbeMasterKey* 178struct GNUNET_ABE_AbeMasterKey*
129GNUNET_ABE_cpabe_deserialize_master_key (const void *data, 179GNUNET_ABE_cpabe_deserialize_master_key (const void *data,
130 size_t len); 180 size_t len);