/* Functions for ciphers. */
const cipher_entry_st *cipher_to_entry(gnutls_cipher_algorithm_t c);
+const cipher_entry_st *cipher_name_to_entry(const char *name);
inline static cipher_type_t _gnutls_cipher_type(const cipher_entry_st * e)
{
return NULL;
}
+const cipher_entry_st * cipher_name_to_entry(const char *name)
+{
+ GNUTLS_CIPHER_LOOP(
+ if (strcasecmp(p->name, name) == 0) {
+ if (p->id == GNUTLS_CIPHER_NULL || _gnutls_cipher_exists(p->id))
+ return p;
+ break;
+ }
+ );
+
+ return NULL;
+}
+
/**
* gnutls_cipher_get_block_size:
* @algorithm: is an encryption algorithm
/* this function sends the client extension data */
if (session->security_parameters.entity == GNUTLS_CLIENT) {
- return GNUTLS_E_INT_RET_0;
+ if (session->internals.priorities.have_cbc != 0)
+ return GNUTLS_E_INT_RET_0;
+ else
+ return 0;
} else { /* server side */
const cipher_entry_st *c;
int ret;
bulk_rmadd_func *func;
unsigned profile = 0;
unsigned i;
+ int j;
+ const cipher_entry_st *centry;
if (add)
func = _add_priority;
}
SET_LEVEL(pgroups[i].sec_param); /* set DH params level */
priority_cache->no_tickets = pgroups[i].no_tickets;
+ if (priority_cache->have_cbc == 0) {
+ for (j=0;(*pgroups[i].cipher_list)[j]!=0;j++) {
+ centry = cipher_to_entry((*pgroups[i].cipher_list)[j]);
+ if (centry != NULL && centry->type == CIPHER_BLOCK) {
+ priority_cache->have_cbc = 1;
+ break;
+ }
+ }
+ }
return 1;
}
}
rmadd_func *fn;
bulk_rmadd_func *bulk_fn;
bulk_rmadd_func *bulk_given_fn;
+ const cipher_entry_st *centry;
if (err_pos)
*err_pos = priorities;
gnutls_mac_get_id(&broken_list[i][1]))
!= GNUTLS_MAC_UNKNOWN)
fn(&(*priority_cache)->mac, algo);
- else if ((algo =
- gnutls_cipher_get_id(&broken_list[i][1]))
- != GNUTLS_CIPHER_UNKNOWN)
- fn(&(*priority_cache)->cipher, algo);
- else if ((algo =
+ else if ((centry = cipher_name_to_entry(&broken_list[i][1])) != NULL) {
+ fn(&(*priority_cache)->cipher, centry->id);
+ if (centry->type == CIPHER_BLOCK)
+ (*priority_cache)->have_cbc = 1;
+ } else if ((algo =
gnutls_kx_get_id(&broken_list[i][1])) !=
GNUTLS_KX_UNKNOWN)
fn(&(*priority_cache)->kx, algo);