comparison src/cipher.h @ 11183:8dca96cbcd64

[gaim-migrate @ 13295] I changed the cipher API to use guchar instead of guint8 This seems to be what gtk/glib uses for random bits of data I don't know what got into me committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 03 Aug 2005 02:57:00 +0000
parents b256ce6b85b8
children fc464a0abccc
comparison
equal deleted inserted replaced
11182:5389d7d497ce 11183:8dca96cbcd64
75 75
76 /** The uninit function */ 76 /** The uninit function */
77 void (*uninit)(GaimCipherContext *context); 77 void (*uninit)(GaimCipherContext *context);
78 78
79 /** The set initialization vector function */ 79 /** The set initialization vector function */
80 void (*set_iv)(GaimCipherContext *context, guint8 *iv, size_t len); 80 void (*set_iv)(GaimCipherContext *context, guchar *iv, size_t len);
81 81
82 /** The append data function */ 82 /** The append data function */
83 void (*append)(GaimCipherContext *context, const guint8 *data, size_t len); 83 void (*append)(GaimCipherContext *context, const guchar *data, size_t len);
84 84
85 /** The digest function */ 85 /** The digest function */
86 gboolean (*digest)(GaimCipherContext *context, size_t in_len, guint8 digest[], size_t *out_len); 86 gboolean (*digest)(GaimCipherContext *context, size_t in_len, guchar digest[], size_t *out_len);
87 87
88 /** The encrypt function */ 88 /** The encrypt function */
89 int (*encrypt)(GaimCipherContext *context, const guint8 data[], size_t len, guint8 output[], size_t *outlen); 89 int (*encrypt)(GaimCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen);
90 90
91 /** The decrypt function */ 91 /** The decrypt function */
92 int (*decrypt)(GaimCipherContext *context, const guint8 data[], size_t len, guint8 output[], size_t *outlen); 92 int (*decrypt)(GaimCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen);
93 93
94 /** The set salt function */ 94 /** The set salt function */
95 void (*set_salt)(GaimCipherContext *context, guint8 *salt); 95 void (*set_salt)(GaimCipherContext *context, guchar *salt);
96 96
97 /** The get salt size function */ 97 /** The get salt size function */
98 size_t (*get_salt_size)(GaimCipherContext *context); 98 size_t (*get_salt_size)(GaimCipherContext *context);
99 99
100 /** The set key function */ 100 /** The set key function */
101 void (*set_key)(GaimCipherContext *context, guint8 *key); 101 void (*set_key)(GaimCipherContext *context, guchar *key);
102 102
103 /** The get key size function */ 103 /** The get key size function */
104 size_t (*get_key_size)(GaimCipherContext *context); 104 size_t (*get_key_size)(GaimCipherContext *context);
105 }; 105 };
106 106
141 * @param digest The returned digest 141 * @param digest The returned digest
142 * @param out_len The length written 142 * @param out_len The length written
143 * 143 *
144 * @return @c TRUE if successful, @c FALSE otherwise 144 * @return @c TRUE if successful, @c FALSE otherwise
145 */ 145 */
146 gboolean gaim_cipher_digest_region(const gchar *name, const guint8 *data, size_t data_len, size_t in_len, guint8 digest[], size_t *out_len); 146 gboolean gaim_cipher_digest_region(const gchar *name, const guchar *data, size_t data_len, size_t in_len, guchar digest[], size_t *out_len);
147 147
148 /*@}*/ 148 /*@}*/
149 /******************************************************************************/ 149 /******************************************************************************/
150 /** @name GaimCiphers API */ 150 /** @name GaimCiphers API */
151 /******************************************************************************/ 151 /******************************************************************************/
276 * 276 *
277 * @param context The context to set the IV to 277 * @param context The context to set the IV to
278 * @param iv The initialization vector to set 278 * @param iv The initialization vector to set
279 * @param len The len of the IV 279 * @param len The len of the IV
280 */ 280 */
281 void gaim_cipher_context_set_iv(GaimCipherContext *context, guint8 *iv, size_t len); 281 void gaim_cipher_context_set_iv(GaimCipherContext *context, guchar *iv, size_t len);
282 282
283 /** 283 /**
284 * Appends data to the context 284 * Appends data to the context
285 * 285 *
286 * @param context The context to append data to 286 * @param context The context to append data to
287 * @param data The data to append 287 * @param data The data to append
288 * @param len The length of the data 288 * @param len The length of the data
289 */ 289 */
290 void gaim_cipher_context_append(GaimCipherContext *context, const guint8 *data, size_t len); 290 void gaim_cipher_context_append(GaimCipherContext *context, const guchar *data, size_t len);
291 291
292 /** 292 /**
293 * Digests a context 293 * Digests a context
294 * 294 *
295 * @param context The context to digest 295 * @param context The context to digest
296 * @param in_len The length of the buffer 296 * @param in_len The length of the buffer
297 * @param digest The return buffer for the digest 297 * @param digest The return buffer for the digest
298 * @param out_len The length of the returned value 298 * @param out_len The length of the returned value
299 */ 299 */
300 gboolean gaim_cipher_context_digest(GaimCipherContext *context, size_t in_len, guint8 digest[], size_t *out_len); 300 gboolean gaim_cipher_context_digest(GaimCipherContext *context, size_t in_len, guchar digest[], size_t *out_len);
301 301
302 /** 302 /**
303 * Converts a guint8 digest into a hex string 303 * Converts a guchar digest into a hex string
304 * 304 *
305 * @param context The context to get a digest from 305 * @param context The context to get a digest from
306 * @param in_len The length of the buffer 306 * @param in_len The length of the buffer
307 * @param digest_s The return buffer for the string digest 307 * @param digest_s The return buffer for the string digest
308 * @param out_len The length of the returned value 308 * @param out_len The length of the returned value
318 * @param output The output buffer 318 * @param output The output buffer
319 * @param outlen The len of data that was outputed 319 * @param outlen The len of data that was outputed
320 * 320 *
321 * @return A cipher specific status code 321 * @return A cipher specific status code
322 */ 322 */
323 gint gaim_cipher_context_encrypt(GaimCipherContext *context, const guint8 data[], size_t len, guint8 output[], size_t *outlen); 323 gint gaim_cipher_context_encrypt(GaimCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen);
324 324
325 /** 325 /**
326 * Decrypts data using the context 326 * Decrypts data using the context
327 * 327 *
328 * @param context The context 328 * @param context The context
331 * @param output The output buffer 331 * @param output The output buffer
332 * @param outlen The len of data that was outputed 332 * @param outlen The len of data that was outputed
333 * 333 *
334 * @return A cipher specific status code 334 * @return A cipher specific status code
335 */ 335 */
336 gint gaim_cipher_context_decrypt(GaimCipherContext *context, const guint8 data[], size_t len, guint8 output[], size_t *outlen); 336 gint gaim_cipher_context_decrypt(GaimCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen);
337 337
338 /** 338 /**
339 * Sets the salt on a context 339 * Sets the salt on a context
340 * 340 *
341 * @param context The context who's salt to set 341 * @param context The context who's salt to set
342 * @param salt The salt 342 * @param salt The salt
343 */ 343 */
344 void gaim_cipher_context_set_salt(GaimCipherContext *context, guint8 *salt); 344 void gaim_cipher_context_set_salt(GaimCipherContext *context, guchar *salt);
345 345
346 /** 346 /**
347 * Gets the size of the salt if the cipher supports it 347 * Gets the size of the salt if the cipher supports it
348 * 348 *
349 * @param context The context who's salt size to get 349 * @param context The context who's salt size to get
356 * Sets the key on a context 356 * Sets the key on a context
357 * 357 *
358 * @param context The context who's key to set 358 * @param context The context who's key to set
359 * @param key The key 359 * @param key The key
360 */ 360 */
361 void gaim_cipher_context_set_key(GaimCipherContext *context, guint8 *key); 361 void gaim_cipher_context_set_key(GaimCipherContext *context, guchar *key);
362 362
363 /** 363 /**
364 * Gets the key size for a context 364 * Gets the key size for a context
365 * 365 *
366 * @param context The context who's key size to get 366 * @param context The context who's key size to get