aes_glue.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Glue Code for the asm optimized version of the AES Cipher Algorithm
  3. *
  4. */
  5. #include <crypto/aes.h>
  6. asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in);
  7. asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in);
  8. static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
  9. {
  10. aes_enc_blk(tfm, dst, src);
  11. }
  12. static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
  13. {
  14. aes_dec_blk(tfm, dst, src);
  15. }
  16. static struct crypto_alg aes_alg = {
  17. .cra_name = "aes",
  18. .cra_driver_name = "aes-asm",
  19. .cra_priority = 200,
  20. .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
  21. .cra_blocksize = AES_BLOCK_SIZE,
  22. .cra_ctxsize = sizeof(struct crypto_aes_ctx),
  23. .cra_module = THIS_MODULE,
  24. .cra_list = LIST_HEAD_INIT(aes_alg.cra_list),
  25. .cra_u = {
  26. .cipher = {
  27. .cia_min_keysize = AES_MIN_KEY_SIZE,
  28. .cia_max_keysize = AES_MAX_KEY_SIZE,
  29. .cia_setkey = crypto_aes_set_key,
  30. .cia_encrypt = aes_encrypt,
  31. .cia_decrypt = aes_decrypt
  32. }
  33. }
  34. };
  35. static int __init aes_init(void)
  36. {
  37. return crypto_register_alg(&aes_alg);
  38. }
  39. static void __exit aes_fini(void)
  40. {
  41. crypto_unregister_alg(&aes_alg);
  42. }
  43. module_init(aes_init);
  44. module_exit(aes_fini);
  45. MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized");
  46. MODULE_LICENSE("GPL");
  47. MODULE_ALIAS("aes");
  48. MODULE_ALIAS("aes-asm");