libpurple/cipher.h

changeset 33910
5749f2724b12
parent 33909
773899cbd05a
child 33911
a924aacd5a37
equal deleted inserted replaced
33909:773899cbd05a 33910:5749f2724b12
48 48
49 /** 49 /**
50 * The operation flags for a cipher 50 * The operation flags for a cipher
51 */ 51 */
52 typedef enum { 52 typedef enum {
53 PURPLE_CIPHER_CAPS_SET_OPT = 1 << 1, /**< Set option flag */ 53 PURPLE_CIPHER_CAPS_SET_OPT = 1 << 1, /**< Set option flag */
54 PURPLE_CIPHER_CAPS_GET_OPT = 1 << 2, /**< Get option flag */ 54 PURPLE_CIPHER_CAPS_GET_OPT = 1 << 2, /**< Get option flag */
55 PURPLE_CIPHER_CAPS_INIT = 1 << 3, /**< Init flag */ 55 PURPLE_CIPHER_CAPS_INIT = 1 << 3, /**< Init flag */
56 PURPLE_CIPHER_CAPS_RESET = 1 << 4, /**< Reset flag */ 56 PURPLE_CIPHER_CAPS_RESET = 1 << 4, /**< Reset flag */
57 PURPLE_CIPHER_CAPS_UNINIT = 1 << 5, /**< Uninit flag */ 57 PURPLE_CIPHER_CAPS_UNINIT = 1 << 5, /**< Uninit flag */
58 PURPLE_CIPHER_CAPS_SET_IV = 1 << 6, /**< Set IV flag */ 58 PURPLE_CIPHER_CAPS_SET_IV = 1 << 6, /**< Set IV flag */
59 PURPLE_CIPHER_CAPS_APPEND = 1 << 7, /**< Append flag */ 59 PURPLE_CIPHER_CAPS_APPEND = 1 << 7, /**< Append flag */
60 PURPLE_CIPHER_CAPS_DIGEST = 1 << 8, /**< Digest flag */ 60 PURPLE_CIPHER_CAPS_DIGEST = 1 << 8, /**< Digest flag */
61 PURPLE_CIPHER_CAPS_GET_DIGEST_SIZE = 1 << 9, /**< The get digest size flag */ 61 PURPLE_CIPHER_CAPS_GET_DIGEST_SIZE = 1 << 9, /**< The get digest size flag */
62 PURPLE_CIPHER_CAPS_ENCRYPT = 1 << 10, /**< Encrypt flag */ 62 PURPLE_CIPHER_CAPS_ENCRYPT = 1 << 10, /**< Encrypt flag */
63 PURPLE_CIPHER_CAPS_DECRYPT = 1 << 11, /**< Decrypt flag */ 63 PURPLE_CIPHER_CAPS_DECRYPT = 1 << 11, /**< Decrypt flag */
64 PURPLE_CIPHER_CAPS_SET_SALT = 1 << 12, /**< Set salt flag */ 64 PURPLE_CIPHER_CAPS_SET_SALT = 1 << 12, /**< Set salt flag */
65 PURPLE_CIPHER_CAPS_GET_SALT_SIZE = 1 << 13, /**< Get salt size flag */ 65 PURPLE_CIPHER_CAPS_GET_SALT_SIZE = 1 << 13, /**< Get salt size flag */
66 PURPLE_CIPHER_CAPS_SET_KEY = 1 << 14, /**< Set key flag */ 66 PURPLE_CIPHER_CAPS_SET_KEY = 1 << 14, /**< Set key flag */
67 PURPLE_CIPHER_CAPS_SET_BATCH_MODE = 1 << 15, /**< Set batch mode flag */ 67 PURPLE_CIPHER_CAPS_GET_KEY_SIZE = 1 << 15, /**< Get key size flag */
68 PURPLE_CIPHER_CAPS_GET_BATCH_MODE = 1 << 16, /**< Get batch mode flag */ 68 PURPLE_CIPHER_CAPS_SET_BATCH_MODE = 1 << 16, /**< Set batch mode flag */
69 PURPLE_CIPHER_CAPS_GET_BLOCK_SIZE = 1 << 17, /**< The get block size flag */ 69 PURPLE_CIPHER_CAPS_GET_BATCH_MODE = 1 << 17, /**< Get batch mode flag */
70 PURPLE_CIPHER_CAPS_UNKNOWN = 1 << 18 /**< Unknown */ 70 PURPLE_CIPHER_CAPS_GET_BLOCK_SIZE = 1 << 18, /**< The get block size flag */
71 PURPLE_CIPHER_CAPS_UNKNOWN = 1 << 19 /**< Unknown */
71 } PurpleCipherCaps; 72 } PurpleCipherCaps;
72 73
73 /** 74 /**
74 * The operations of a cipher. Every cipher must implement one of these. 75 * The operations of a cipher. Every cipher must implement one of these.
75 */ 76 */
113 /** The get salt size function */ 114 /** The get salt size function */
114 size_t (*get_salt_size)(PurpleCipherContext *context); 115 size_t (*get_salt_size)(PurpleCipherContext *context);
115 116
116 /** The set key function */ 117 /** The set key function */
117 void (*set_key)(PurpleCipherContext *context, const guchar *key, size_t len); 118 void (*set_key)(PurpleCipherContext *context, const guchar *key, size_t len);
119
120 /** The get key size function */
121 size_t (*get_key_size)(PurpleCipherContext *context);
118 122
119 /** The set batch mode function */ 123 /** The set batch mode function */
120 void (*set_batch_mode)(PurpleCipherContext *context, PurpleCipherBatchMode mode); 124 void (*set_batch_mode)(PurpleCipherContext *context, PurpleCipherBatchMode mode);
121 125
122 /** The get batch mode function */ 126 /** The get batch mode function */
390 * @param context The context whose key to set 394 * @param context The context whose key to set
391 * @param key The key 395 * @param key The key
392 * @param len The size of the key 396 * @param len The size of the key
393 */ 397 */
394 void purple_cipher_context_set_key(PurpleCipherContext *context, const guchar *key, size_t len); 398 void purple_cipher_context_set_key(PurpleCipherContext *context, const guchar *key, size_t len);
399
400 /**
401 * Gets the size of the key if the cipher supports it
402 *
403 * @param context The context whose key size to get
404 *
405 * @return The size of the key
406 */
407 size_t purple_cipher_context_get_key_size(PurpleCipherContext *context);
395 408
396 /** 409 /**
397 * Sets the batch mode of a context 410 * Sets the batch mode of a context
398 * 411 *
399 * @param context The context whose batch mode to set 412 * @param context The context whose batch mode to set

mercurial