libpurple/cipher.c

changeset 33910
5749f2724b12
parent 33909
773899cbd05a
child 33911
a924aacd5a37
equal deleted inserted replaced
33909:773899cbd05a 33910:5749f2724b12
106 caps |= PURPLE_CIPHER_CAPS_SET_SALT; 106 caps |= PURPLE_CIPHER_CAPS_SET_SALT;
107 if(ops->get_salt_size) 107 if(ops->get_salt_size)
108 caps |= PURPLE_CIPHER_CAPS_GET_SALT_SIZE; 108 caps |= PURPLE_CIPHER_CAPS_GET_SALT_SIZE;
109 if(ops->set_key) 109 if(ops->set_key)
110 caps |= PURPLE_CIPHER_CAPS_SET_KEY; 110 caps |= PURPLE_CIPHER_CAPS_SET_KEY;
111 if (ops->get_key_size)
112 caps |= PURPLE_CIPHER_CAPS_GET_KEY_SIZE;
111 if(ops->set_batch_mode) 113 if(ops->set_batch_mode)
112 caps |= PURPLE_CIPHER_CAPS_SET_BATCH_MODE; 114 caps |= PURPLE_CIPHER_CAPS_SET_BATCH_MODE;
113 if(ops->get_batch_mode) 115 if(ops->get_batch_mode)
114 caps |= PURPLE_CIPHER_CAPS_GET_BATCH_MODE; 116 caps |= PURPLE_CIPHER_CAPS_GET_BATCH_MODE;
115 if(ops->get_block_size) 117 if(ops->get_block_size)
566 if(cipher->ops && cipher->ops->set_key) 568 if(cipher->ops && cipher->ops->set_key)
567 cipher->ops->set_key(context, key, len); 569 cipher->ops->set_key(context, key, len);
568 else 570 else
569 purple_debug_warning("cipher", "the %s cipher does not support the " 571 purple_debug_warning("cipher", "the %s cipher does not support the "
570 "set_key operation\n", cipher->name); 572 "set_key operation\n", cipher->name);
573 }
574
575 size_t
576 purple_cipher_context_get_key_size(PurpleCipherContext *context) {
577 PurpleCipher *cipher = NULL;
578
579 g_return_val_if_fail(context, 0);
580
581 cipher = context->cipher;
582 g_return_val_if_fail(cipher, 0);
583
584 if (cipher->ops && cipher->ops->get_key_size)
585 return cipher->ops->get_key_size(context);
586 else {
587 purple_debug_warning("cipher", "the %s cipher does not support "
588 "the get_key_size operation\n", cipher->name);
589
590 return 0;
591 }
571 } 592 }
572 593
573 void 594 void
574 purple_cipher_context_set_batch_mode(PurpleCipherContext *context, 595 purple_cipher_context_set_batch_mode(PurpleCipherContext *context,
575 PurpleCipherBatchMode mode) 596 PurpleCipherBatchMode mode)

mercurial