~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/crypto/aes-cipher-glue.c

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.11 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.84 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.154 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.201 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.201 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.77 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Scalar AES core transform
  3  *
  4  * Copyright (C) 2017 Linaro Ltd.
  5  * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
  6  *
  7  * This program is free software; you can redistribute it and/or modify
  8  * it under the terms of the GNU General Public License version 2 as
  9  * published by the Free Software Foundation.
 10  */
 11 
 12 #include <crypto/aes.h>
 13 #include <linux/crypto.h>
 14 #include <linux/module.h>
 15 
 16 asmlinkage void __aes_arm_encrypt(u32 *rk, int rounds, const u8 *in, u8 *out);
 17 EXPORT_SYMBOL(__aes_arm_encrypt);
 18 
 19 asmlinkage void __aes_arm_decrypt(u32 *rk, int rounds, const u8 *in, u8 *out);
 20 EXPORT_SYMBOL(__aes_arm_decrypt);
 21 
 22 static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 23 {
 24         struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
 25         int rounds = 6 + ctx->key_length / 4;
 26 
 27         __aes_arm_encrypt(ctx->key_enc, rounds, in, out);
 28 }
 29 
 30 static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 31 {
 32         struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
 33         int rounds = 6 + ctx->key_length / 4;
 34 
 35         __aes_arm_decrypt(ctx->key_dec, rounds, in, out);
 36 }
 37 
 38 static struct crypto_alg aes_alg = {
 39         .cra_name                       = "aes",
 40         .cra_driver_name                = "aes-arm",
 41         .cra_priority                   = 200,
 42         .cra_flags                      = CRYPTO_ALG_TYPE_CIPHER,
 43         .cra_blocksize                  = AES_BLOCK_SIZE,
 44         .cra_ctxsize                    = sizeof(struct crypto_aes_ctx),
 45         .cra_module                     = THIS_MODULE,
 46 
 47         .cra_cipher.cia_min_keysize     = AES_MIN_KEY_SIZE,
 48         .cra_cipher.cia_max_keysize     = AES_MAX_KEY_SIZE,
 49         .cra_cipher.cia_setkey          = crypto_aes_set_key,
 50         .cra_cipher.cia_encrypt         = aes_encrypt,
 51         .cra_cipher.cia_decrypt         = aes_decrypt,
 52 
 53 #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 54         .cra_alignmask                  = 3,
 55 #endif
 56 };
 57 
 58 static int __init aes_init(void)
 59 {
 60         return crypto_register_alg(&aes_alg);
 61 }
 62 
 63 static void __exit aes_fini(void)
 64 {
 65         crypto_unregister_alg(&aes_alg);
 66 }
 67 
 68 module_init(aes_init);
 69 module_exit(aes_fini);
 70 
 71 MODULE_DESCRIPTION("Scalar AES cipher for ARM");
 72 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
 73 MODULE_LICENSE("GPL v2");
 74 MODULE_ALIAS_CRYPTO("aes");
 75 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp