string: factorize skip_spaces and export it to be generally available
[safe/jmp/linux-2.6] / crypto / ecb.c
index f239aa9..a46838e 100644 (file)
@@ -99,12 +99,13 @@ static int crypto_ecb_init_tfm(struct crypto_tfm *tfm)
        struct crypto_instance *inst = (void *)tfm->__crt_alg;
        struct crypto_spawn *spawn = crypto_instance_ctx(inst);
        struct crypto_ecb_ctx *ctx = crypto_tfm_ctx(tfm);
+       struct crypto_cipher *cipher;
 
-       tfm = crypto_spawn_tfm(spawn);
-       if (IS_ERR(tfm))
-               return PTR_ERR(tfm);
+       cipher = crypto_spawn_cipher(spawn);
+       if (IS_ERR(cipher))
+               return PTR_ERR(cipher);
 
-       ctx->child = crypto_cipher_cast(tfm);
+       ctx->child = cipher;
        return 0;
 }
 
@@ -114,15 +115,20 @@ static void crypto_ecb_exit_tfm(struct crypto_tfm *tfm)
        crypto_free_cipher(ctx->child);
 }
 
-static struct crypto_instance *crypto_ecb_alloc(void *param, unsigned int len)
+static struct crypto_instance *crypto_ecb_alloc(struct rtattr **tb)
 {
        struct crypto_instance *inst;
        struct crypto_alg *alg;
+       int err;
+
+       err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_BLKCIPHER);
+       if (err)
+               return ERR_PTR(err);
 
-       alg = crypto_get_attr_alg(param, len, CRYPTO_ALG_TYPE_CIPHER,
-                                 CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC);
+       alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER,
+                                 CRYPTO_ALG_TYPE_MASK);
        if (IS_ERR(alg))
-               return ERR_PTR(PTR_ERR(alg));
+               return ERR_CAST(alg);
 
        inst = crypto_alloc_instance("ecb", alg);
        if (IS_ERR(inst))