- uid_t uid = capa->lc_uid;
- int capa_op = capa->lc_op;
- __u64 mdsid = capa->lc_mdsid;
- unsigned long ino = capa->lc_ino;
- struct obd_capa *ocapa, *old;
-
- ocapa = alloc_capa();
- if (!ocapa)
- return NULL;
-
- spin_lock(&capa_lock);
- old = find_capa(head, uid, capa_op, mdsid, ino, type);
- if (!old) {
- do_update_capa(ocapa, capa);
- ocapa->c_type = type;
- list_add_capa(ocapa, &capa_list[type]);
- hlist_add_head(&ocapa->c_hash, capa_hash);
- if (type == CLIENT_CAPA)
- INIT_LIST_HEAD(&ocapa->c_lli_list);
-
- capa_count[type]++;
-
- DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "new %s",
- capa_type_name[type]);
-
- if (type != CLIENT_CAPA && capa_count[type] > CAPA_CACHE_SIZE) {
- struct list_head *node = capa_list[type].next;
- struct obd_capa *tcapa;
- int count = 0;
-
- /* free 12 unused capa from head */
- while (node->next != &capa_list[type] && count < 12) {
- tcapa = list_entry(node, struct obd_capa,
- c_list);
- node = node->next;
- if (atomic_read(&tcapa->c_refc) > 0)
- continue;
- DEBUG_CAPA(D_CACHE, &tcapa->c_capa,
- "free unused %s",
- capa_type_name[type]);
- __capa_put(tcapa);
- destroy_capa(tcapa);
- count++;
- }
- }
-
- spin_unlock(&capa_lock);
- return ocapa;
+ struct ll_crypto_cipher *tfm;
+ struct scatterlist sd;
+ struct scatterlist ss;
+ struct blkcipher_desc desc;
+ unsigned int min;
+ int rc;
+ char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
+ ENTRY;
+
+ /* passing "aes" in a variable instead of a constant string keeps gcc
+ * 4.3.2 happy */
+ tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
+ if (IS_ERR(tfm)) {
+ CERROR("failed to load transform for aes\n");
+ RETURN(PTR_ERR(tfm));
+ }
+
+ min = ll_crypto_tfm_alg_min_keysize(tfm);
+ if (keylen < min) {
+ CERROR("keylen at least %d bits for aes\n", min * 8);
+ GOTO(out, rc = -EINVAL);