~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/x86/crypto/aesni-intel_glue.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
                              const u8 *in, unsigned int len, u8 *iv);
95
95
asmlinkage void aesni_cbc_dec(struct crypto_aes_ctx *ctx, u8 *out,
96
96
                              const u8 *in, unsigned int len, u8 *iv);
 
97
 
 
98
int crypto_fpu_init(void);
 
99
void crypto_fpu_exit(void);
 
100
 
97
101
#ifdef CONFIG_X86_64
98
102
asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out,
99
103
                              const u8 *in, unsigned int len, u8 *iv);
879
883
        crypto_ablkcipher_clear_flags(ctr_tfm, ~0);
880
884
 
881
885
        ret = crypto_ablkcipher_setkey(ctr_tfm, key, key_len);
882
 
        if (ret) {
883
 
                crypto_free_ablkcipher(ctr_tfm);
884
 
                return ret;
885
 
        }
 
886
        if (ret)
 
887
                goto out_free_ablkcipher;
886
888
 
 
889
        ret = -ENOMEM;
887
890
        req = ablkcipher_request_alloc(ctr_tfm, GFP_KERNEL);
888
 
        if (!req) {
889
 
                crypto_free_ablkcipher(ctr_tfm);
890
 
                return -EINVAL;
891
 
        }
 
891
        if (!req)
 
892
                goto out_free_ablkcipher;
892
893
 
893
894
        req_data = kmalloc(sizeof(*req_data), GFP_KERNEL);
894
 
        if (!req_data) {
895
 
                crypto_free_ablkcipher(ctr_tfm);
896
 
                return -ENOMEM;
897
 
        }
 
895
        if (!req_data)
 
896
                goto out_free_request;
 
897
 
898
898
        memset(req_data->iv, 0, sizeof(req_data->iv));
899
899
 
900
900
        /* Clear the data in the hash sub key container to zero.*/
919
919
                if (!ret)
920
920
                        ret = req_data->result.err;
921
921
        }
 
922
        kfree(req_data);
 
923
out_free_request:
922
924
        ablkcipher_request_free(req);
923
 
        kfree(req_data);
 
925
out_free_ablkcipher:
924
926
        crypto_free_ablkcipher(ctr_tfm);
925
927
        return ret;
926
928
}
1259
1261
                return -ENODEV;
1260
1262
        }
1261
1263
 
 
1264
        if ((err = crypto_fpu_init()))
 
1265
                goto fpu_err;
1262
1266
        if ((err = crypto_register_alg(&aesni_alg)))
1263
1267
                goto aes_err;
1264
1268
        if ((err = crypto_register_alg(&__aesni_alg)))
1336
1340
__aes_err:
1337
1341
        crypto_unregister_alg(&aesni_alg);
1338
1342
aes_err:
 
1343
fpu_err:
1339
1344
        return err;
1340
1345
}
1341
1346
 
1365
1370
        crypto_unregister_alg(&blk_ecb_alg);
1366
1371
        crypto_unregister_alg(&__aesni_alg);
1367
1372
        crypto_unregister_alg(&aesni_alg);
 
1373
 
 
1374
        crypto_fpu_exit();
1368
1375
}
1369
1376
 
1370
1377
module_init(aesni_init);