diff options
author | Cyrille Pitchen <cyrille.pitchen@atmel.com> | 2015-12-17 12:13:02 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-12-23 05:19:56 -0500 |
commit | afbac17e676fb3a8b8821e67e642f3bc1691f50a (patch) | |
tree | a7e29f83bed32e06f173d808ac75036d1154d5ca | |
parent | 2bfd04cde2b34e65d0954ff8372a7edf116afe41 (diff) |
crypto: atmel-aes - fix typo and indentation
Dummy patch to fix typo and indentation.
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/atmel-aes.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 176ab3878583..208fa8dce7f7 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c | |||
@@ -80,9 +80,9 @@ | |||
80 | 80 | ||
81 | 81 | ||
82 | struct atmel_aes_caps { | 82 | struct atmel_aes_caps { |
83 | bool has_dualbuff; | 83 | bool has_dualbuff; |
84 | bool has_cfb64; | 84 | bool has_cfb64; |
85 | u32 max_burst_size; | 85 | u32 max_burst_size; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | struct atmel_aes_dev; | 88 | struct atmel_aes_dev; |
@@ -92,13 +92,11 @@ typedef int (*atmel_aes_fn_t)(struct atmel_aes_dev *); | |||
92 | 92 | ||
93 | 93 | ||
94 | struct atmel_aes_base_ctx { | 94 | struct atmel_aes_base_ctx { |
95 | struct atmel_aes_dev *dd; | 95 | struct atmel_aes_dev *dd; |
96 | atmel_aes_fn_t start; | 96 | atmel_aes_fn_t start; |
97 | 97 | int keylen; | |
98 | int keylen; | 98 | u32 key[AES_KEYSIZE_256 / sizeof(u32)]; |
99 | u32 key[AES_KEYSIZE_256 / sizeof(u32)]; | 99 | u16 block_size; |
100 | |||
101 | u16 block_size; | ||
102 | }; | 100 | }; |
103 | 101 | ||
104 | struct atmel_aes_ctx { | 102 | struct atmel_aes_ctx { |
@@ -106,7 +104,7 @@ struct atmel_aes_ctx { | |||
106 | }; | 104 | }; |
107 | 105 | ||
108 | struct atmel_aes_reqctx { | 106 | struct atmel_aes_reqctx { |
109 | unsigned long mode; | 107 | unsigned long mode; |
110 | }; | 108 | }; |
111 | 109 | ||
112 | struct atmel_aes_dma { | 110 | struct atmel_aes_dma { |
@@ -131,7 +129,7 @@ struct atmel_aes_dev { | |||
131 | 129 | ||
132 | struct device *dev; | 130 | struct device *dev; |
133 | struct clk *iclk; | 131 | struct clk *iclk; |
134 | int irq; | 132 | int irq; |
135 | 133 | ||
136 | unsigned long flags; | 134 | unsigned long flags; |
137 | 135 | ||
@@ -155,7 +153,7 @@ struct atmel_aes_dev { | |||
155 | 153 | ||
156 | struct atmel_aes_caps caps; | 154 | struct atmel_aes_caps caps; |
157 | 155 | ||
158 | u32 hw_version; | 156 | u32 hw_version; |
159 | }; | 157 | }; |
160 | 158 | ||
161 | struct atmel_aes_drv { | 159 | struct atmel_aes_drv { |
@@ -782,11 +780,11 @@ static void atmel_aes_buff_cleanup(struct atmel_aes_dev *dd) | |||
782 | 780 | ||
783 | static int atmel_aes_crypt(struct ablkcipher_request *req, unsigned long mode) | 781 | static int atmel_aes_crypt(struct ablkcipher_request *req, unsigned long mode) |
784 | { | 782 | { |
785 | struct atmel_aes_base_ctx *ctx = crypto_ablkcipher_ctx( | 783 | struct atmel_aes_base_ctx *ctx; |
786 | crypto_ablkcipher_reqtfm(req)); | 784 | struct atmel_aes_reqctx *rctx; |
787 | struct atmel_aes_reqctx *rctx = ablkcipher_request_ctx(req); | ||
788 | struct atmel_aes_dev *dd; | 785 | struct atmel_aes_dev *dd; |
789 | 786 | ||
787 | ctx = crypto_ablkcipher_ctx(crypto_ablkcipher_reqtfm(req)); | ||
790 | switch (mode & AES_FLAGS_OPMODE_MASK) { | 788 | switch (mode & AES_FLAGS_OPMODE_MASK) { |
791 | case AES_FLAGS_CFB8: | 789 | case AES_FLAGS_CFB8: |
792 | ctx->block_size = CFB8_BLOCK_SIZE; | 790 | ctx->block_size = CFB8_BLOCK_SIZE; |
@@ -813,6 +811,7 @@ static int atmel_aes_crypt(struct ablkcipher_request *req, unsigned long mode) | |||
813 | if (!dd) | 811 | if (!dd) |
814 | return -ENODEV; | 812 | return -ENODEV; |
815 | 813 | ||
814 | rctx = ablkcipher_request_ctx(req); | ||
816 | rctx->mode = mode; | 815 | rctx->mode = mode; |
817 | 816 | ||
818 | return atmel_aes_handle_queue(dd, &req->base); | 817 | return atmel_aes_handle_queue(dd, &req->base); |
@@ -873,8 +872,9 @@ static int atmel_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key, | |||
873 | { | 872 | { |
874 | struct atmel_aes_base_ctx *ctx = crypto_ablkcipher_ctx(tfm); | 873 | struct atmel_aes_base_ctx *ctx = crypto_ablkcipher_ctx(tfm); |
875 | 874 | ||
876 | if (keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_192 && | 875 | if (keylen != AES_KEYSIZE_128 && |
877 | keylen != AES_KEYSIZE_256) { | 876 | keylen != AES_KEYSIZE_192 && |
877 | keylen != AES_KEYSIZE_256) { | ||
878 | crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); | 878 | crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); |
879 | return -EINVAL; | 879 | return -EINVAL; |
880 | } | 880 | } |
@@ -897,26 +897,22 @@ static int atmel_aes_ecb_decrypt(struct ablkcipher_request *req) | |||
897 | 897 | ||
898 | static int atmel_aes_cbc_encrypt(struct ablkcipher_request *req) | 898 | static int atmel_aes_cbc_encrypt(struct ablkcipher_request *req) |
899 | { | 899 | { |
900 | return atmel_aes_crypt(req, | 900 | return atmel_aes_crypt(req, AES_FLAGS_CBC | AES_FLAGS_ENCRYPT); |
901 | AES_FLAGS_ENCRYPT | AES_FLAGS_CBC); | ||
902 | } | 901 | } |
903 | 902 | ||
904 | static int atmel_aes_cbc_decrypt(struct ablkcipher_request *req) | 903 | static int atmel_aes_cbc_decrypt(struct ablkcipher_request *req) |
905 | { | 904 | { |
906 | return atmel_aes_crypt(req, | 905 | return atmel_aes_crypt(req, AES_FLAGS_CBC); |
907 | AES_FLAGS_CBC); | ||
908 | } | 906 | } |
909 | 907 | ||
910 | static int atmel_aes_ofb_encrypt(struct ablkcipher_request *req) | 908 | static int atmel_aes_ofb_encrypt(struct ablkcipher_request *req) |
911 | { | 909 | { |
912 | return atmel_aes_crypt(req, | 910 | return atmel_aes_crypt(req, AES_FLAGS_OFB | AES_FLAGS_ENCRYPT); |
913 | AES_FLAGS_ENCRYPT | AES_FLAGS_OFB); | ||
914 | } | 911 | } |
915 | 912 | ||
916 | static int atmel_aes_ofb_decrypt(struct ablkcipher_request *req) | 913 | static int atmel_aes_ofb_decrypt(struct ablkcipher_request *req) |
917 | { | 914 | { |
918 | return atmel_aes_crypt(req, | 915 | return atmel_aes_crypt(req, AES_FLAGS_OFB); |
919 | AES_FLAGS_OFB); | ||
920 | } | 916 | } |
921 | 917 | ||
922 | static int atmel_aes_cfb_encrypt(struct ablkcipher_request *req) | 918 | static int atmel_aes_cfb_encrypt(struct ablkcipher_request *req) |
@@ -971,14 +967,12 @@ static int atmel_aes_cfb8_decrypt(struct ablkcipher_request *req) | |||
971 | 967 | ||
972 | static int atmel_aes_ctr_encrypt(struct ablkcipher_request *req) | 968 | static int atmel_aes_ctr_encrypt(struct ablkcipher_request *req) |
973 | { | 969 | { |
974 | return atmel_aes_crypt(req, | 970 | return atmel_aes_crypt(req, AES_FLAGS_CTR | AES_FLAGS_ENCRYPT); |
975 | AES_FLAGS_ENCRYPT | AES_FLAGS_CTR); | ||
976 | } | 971 | } |
977 | 972 | ||
978 | static int atmel_aes_ctr_decrypt(struct ablkcipher_request *req) | 973 | static int atmel_aes_ctr_decrypt(struct ablkcipher_request *req) |
979 | { | 974 | { |
980 | return atmel_aes_crypt(req, | 975 | return atmel_aes_crypt(req, AES_FLAGS_CTR); |
981 | AES_FLAGS_CTR); | ||
982 | } | 976 | } |
983 | 977 | ||
984 | static int atmel_aes_cra_init(struct crypto_tfm *tfm) | 978 | static int atmel_aes_cra_init(struct crypto_tfm *tfm) |
@@ -1196,7 +1190,7 @@ static void atmel_aes_queue_task(unsigned long data) | |||
1196 | 1190 | ||
1197 | static void atmel_aes_done_task(unsigned long data) | 1191 | static void atmel_aes_done_task(unsigned long data) |
1198 | { | 1192 | { |
1199 | struct atmel_aes_dev *dd = (struct atmel_aes_dev *) data; | 1193 | struct atmel_aes_dev *dd = (struct atmel_aes_dev *)data; |
1200 | 1194 | ||
1201 | dd->is_async = true; | 1195 | dd->is_async = true; |
1202 | (void)dd->resume(dd); | 1196 | (void)dd->resume(dd); |