mv_cesa.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. /*
  2. * Support for Marvell's crypto engine which can be found on some Orion5X
  3. * boards.
  4. *
  5. * Author: Sebastian Andrzej Siewior < sebastian at breakpoint dot cc >
  6. * License: GPLv2
  7. *
  8. */
  9. #include <crypto/aes.h>
  10. #include <crypto/algapi.h>
  11. #include <linux/crypto.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/io.h>
  14. #include <linux/kthread.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/scatterlist.h>
  17. #include <linux/slab.h>
  18. #include <linux/module.h>
  19. #include <linux/clk.h>
  20. #include <crypto/internal/hash.h>
  21. #include <crypto/sha.h>
  22. #include <linux/of.h>
  23. #include <linux/of_platform.h>
  24. #include <linux/of_irq.h>
  25. #include "mv_cesa.h"
  26. #define MV_CESA "MV-CESA:"
  27. #define MAX_HW_HASH_SIZE 0xFFFF
  28. #define MV_CESA_EXPIRE 500 /* msec */
  29. /*
  30. * STM:
  31. * /---------------------------------------\
  32. * | | request complete
  33. * \./ |
  34. * IDLE -> new request -> BUSY -> done -> DEQUEUE
  35. * /°\ |
  36. * | | more scatter entries
  37. * \________________/
  38. */
  39. enum engine_status {
  40. ENGINE_IDLE,
  41. ENGINE_BUSY,
  42. ENGINE_W_DEQUEUE,
  43. };
  44. /**
  45. * struct req_progress - used for every crypt request
  46. * @src_sg_it: sg iterator for src
  47. * @dst_sg_it: sg iterator for dst
  48. * @sg_src_left: bytes left in src to process (scatter list)
  49. * @src_start: offset to add to src start position (scatter list)
  50. * @crypt_len: length of current hw crypt/hash process
  51. * @hw_nbytes: total bytes to process in hw for this request
  52. * @copy_back: whether to copy data back (crypt) or not (hash)
  53. * @sg_dst_left: bytes left dst to process in this scatter list
  54. * @dst_start: offset to add to dst start position (scatter list)
  55. * @hw_processed_bytes: number of bytes processed by hw (request).
  56. *
  57. * sg helper are used to iterate over the scatterlist. Since the size of the
  58. * SRAM may be less than the scatter size, this struct struct is used to keep
  59. * track of progress within current scatterlist.
  60. */
  61. struct req_progress {
  62. struct sg_mapping_iter src_sg_it;
  63. struct sg_mapping_iter dst_sg_it;
  64. void (*complete) (void);
  65. void (*process) (int is_first);
  66. /* src mostly */
  67. int sg_src_left;
  68. int src_start;
  69. int crypt_len;
  70. int hw_nbytes;
  71. /* dst mostly */
  72. int copy_back;
  73. int sg_dst_left;
  74. int dst_start;
  75. int hw_processed_bytes;
  76. };
  77. struct crypto_priv {
  78. void __iomem *reg;
  79. void __iomem *sram;
  80. int irq;
  81. struct clk *clk;
  82. struct task_struct *queue_th;
  83. /* the lock protects queue and eng_st */
  84. spinlock_t lock;
  85. struct crypto_queue queue;
  86. enum engine_status eng_st;
  87. struct timer_list completion_timer;
  88. struct crypto_async_request *cur_req;
  89. struct req_progress p;
  90. int max_req_size;
  91. int sram_size;
  92. int has_sha1;
  93. int has_hmac_sha1;
  94. };
  95. static struct crypto_priv *cpg;
  96. struct mv_ctx {
  97. u8 aes_enc_key[AES_KEY_LEN];
  98. u32 aes_dec_key[8];
  99. int key_len;
  100. u32 need_calc_aes_dkey;
  101. };
  102. enum crypto_op {
  103. COP_AES_ECB,
  104. COP_AES_CBC,
  105. };
  106. struct mv_req_ctx {
  107. enum crypto_op op;
  108. int decrypt;
  109. };
  110. enum hash_op {
  111. COP_SHA1,
  112. COP_HMAC_SHA1
  113. };
  114. struct mv_tfm_hash_ctx {
  115. struct crypto_shash *fallback;
  116. struct crypto_shash *base_hash;
  117. u32 ivs[2 * SHA1_DIGEST_SIZE / 4];
  118. int count_add;
  119. enum hash_op op;
  120. };
  121. struct mv_req_hash_ctx {
  122. u64 count;
  123. u32 state[SHA1_DIGEST_SIZE / 4];
  124. u8 buffer[SHA1_BLOCK_SIZE];
  125. int first_hash; /* marks that we don't have previous state */
  126. int last_chunk; /* marks that this is the 'final' request */
  127. int extra_bytes; /* unprocessed bytes in buffer */
  128. enum hash_op op;
  129. int count_add;
  130. };
  131. static void mv_completion_timer_callback(unsigned long unused)
  132. {
  133. int active = readl(cpg->reg + SEC_ACCEL_CMD) & SEC_CMD_EN_SEC_ACCL0;
  134. printk(KERN_ERR MV_CESA
  135. "completion timer expired (CESA %sactive), cleaning up.\n",
  136. active ? "" : "in");
  137. del_timer(&cpg->completion_timer);
  138. writel(SEC_CMD_DISABLE_SEC, cpg->reg + SEC_ACCEL_CMD);
  139. while(readl(cpg->reg + SEC_ACCEL_CMD) & SEC_CMD_DISABLE_SEC)
  140. printk(KERN_INFO MV_CESA "%s: waiting for engine finishing\n", __func__);
  141. cpg->eng_st = ENGINE_W_DEQUEUE;
  142. wake_up_process(cpg->queue_th);
  143. }
  144. static void mv_setup_timer(void)
  145. {
  146. setup_timer(&cpg->completion_timer, &mv_completion_timer_callback, 0);
  147. mod_timer(&cpg->completion_timer,
  148. jiffies + msecs_to_jiffies(MV_CESA_EXPIRE));
  149. }
  150. static void compute_aes_dec_key(struct mv_ctx *ctx)
  151. {
  152. struct crypto_aes_ctx gen_aes_key;
  153. int key_pos;
  154. if (!ctx->need_calc_aes_dkey)
  155. return;
  156. crypto_aes_expand_key(&gen_aes_key, ctx->aes_enc_key, ctx->key_len);
  157. key_pos = ctx->key_len + 24;
  158. memcpy(ctx->aes_dec_key, &gen_aes_key.key_enc[key_pos], 4 * 4);
  159. switch (ctx->key_len) {
  160. case AES_KEYSIZE_256:
  161. key_pos -= 2;
  162. /* fall */
  163. case AES_KEYSIZE_192:
  164. key_pos -= 2;
  165. memcpy(&ctx->aes_dec_key[4], &gen_aes_key.key_enc[key_pos],
  166. 4 * 4);
  167. break;
  168. }
  169. ctx->need_calc_aes_dkey = 0;
  170. }
  171. static int mv_setkey_aes(struct crypto_ablkcipher *cipher, const u8 *key,
  172. unsigned int len)
  173. {
  174. struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher);
  175. struct mv_ctx *ctx = crypto_tfm_ctx(tfm);
  176. switch (len) {
  177. case AES_KEYSIZE_128:
  178. case AES_KEYSIZE_192:
  179. case AES_KEYSIZE_256:
  180. break;
  181. default:
  182. crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN);
  183. return -EINVAL;
  184. }
  185. ctx->key_len = len;
  186. ctx->need_calc_aes_dkey = 1;
  187. memcpy(ctx->aes_enc_key, key, AES_KEY_LEN);
  188. return 0;
  189. }
  190. static void copy_src_to_buf(struct req_progress *p, char *dbuf, int len)
  191. {
  192. int ret;
  193. void *sbuf;
  194. int copy_len;
  195. while (len) {
  196. if (!p->sg_src_left) {
  197. ret = sg_miter_next(&p->src_sg_it);
  198. BUG_ON(!ret);
  199. p->sg_src_left = p->src_sg_it.length;
  200. p->src_start = 0;
  201. }
  202. sbuf = p->src_sg_it.addr + p->src_start;
  203. copy_len = min(p->sg_src_left, len);
  204. memcpy(dbuf, sbuf, copy_len);
  205. p->src_start += copy_len;
  206. p->sg_src_left -= copy_len;
  207. len -= copy_len;
  208. dbuf += copy_len;
  209. }
  210. }
  211. static void setup_data_in(void)
  212. {
  213. struct req_progress *p = &cpg->p;
  214. int data_in_sram =
  215. min(p->hw_nbytes - p->hw_processed_bytes, cpg->max_req_size);
  216. copy_src_to_buf(p, cpg->sram + SRAM_DATA_IN_START + p->crypt_len,
  217. data_in_sram - p->crypt_len);
  218. p->crypt_len = data_in_sram;
  219. }
  220. static void mv_process_current_q(int first_block)
  221. {
  222. struct ablkcipher_request *req = ablkcipher_request_cast(cpg->cur_req);
  223. struct mv_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
  224. struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req);
  225. struct sec_accel_config op;
  226. switch (req_ctx->op) {
  227. case COP_AES_ECB:
  228. op.config = CFG_OP_CRYPT_ONLY | CFG_ENCM_AES | CFG_ENC_MODE_ECB;
  229. break;
  230. case COP_AES_CBC:
  231. default:
  232. op.config = CFG_OP_CRYPT_ONLY | CFG_ENCM_AES | CFG_ENC_MODE_CBC;
  233. op.enc_iv = ENC_IV_POINT(SRAM_DATA_IV) |
  234. ENC_IV_BUF_POINT(SRAM_DATA_IV_BUF);
  235. if (first_block)
  236. memcpy(cpg->sram + SRAM_DATA_IV, req->info, 16);
  237. break;
  238. }
  239. if (req_ctx->decrypt) {
  240. op.config |= CFG_DIR_DEC;
  241. memcpy(cpg->sram + SRAM_DATA_KEY_P, ctx->aes_dec_key,
  242. AES_KEY_LEN);
  243. } else {
  244. op.config |= CFG_DIR_ENC;
  245. memcpy(cpg->sram + SRAM_DATA_KEY_P, ctx->aes_enc_key,
  246. AES_KEY_LEN);
  247. }
  248. switch (ctx->key_len) {
  249. case AES_KEYSIZE_128:
  250. op.config |= CFG_AES_LEN_128;
  251. break;
  252. case AES_KEYSIZE_192:
  253. op.config |= CFG_AES_LEN_192;
  254. break;
  255. case AES_KEYSIZE_256:
  256. op.config |= CFG_AES_LEN_256;
  257. break;
  258. }
  259. op.enc_p = ENC_P_SRC(SRAM_DATA_IN_START) |
  260. ENC_P_DST(SRAM_DATA_OUT_START);
  261. op.enc_key_p = SRAM_DATA_KEY_P;
  262. setup_data_in();
  263. op.enc_len = cpg->p.crypt_len;
  264. memcpy(cpg->sram + SRAM_CONFIG, &op,
  265. sizeof(struct sec_accel_config));
  266. /* GO */
  267. mv_setup_timer();
  268. writel(SEC_CMD_EN_SEC_ACCL0, cpg->reg + SEC_ACCEL_CMD);
  269. }
  270. static void mv_crypto_algo_completion(void)
  271. {
  272. struct ablkcipher_request *req = ablkcipher_request_cast(cpg->cur_req);
  273. struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req);
  274. sg_miter_stop(&cpg->p.src_sg_it);
  275. sg_miter_stop(&cpg->p.dst_sg_it);
  276. if (req_ctx->op != COP_AES_CBC)
  277. return ;
  278. memcpy(req->info, cpg->sram + SRAM_DATA_IV_BUF, 16);
  279. }
  280. static void mv_process_hash_current(int first_block)
  281. {
  282. struct ahash_request *req = ahash_request_cast(cpg->cur_req);
  283. const struct mv_tfm_hash_ctx *tfm_ctx = crypto_tfm_ctx(req->base.tfm);
  284. struct mv_req_hash_ctx *req_ctx = ahash_request_ctx(req);
  285. struct req_progress *p = &cpg->p;
  286. struct sec_accel_config op = { 0 };
  287. int is_last;
  288. switch (req_ctx->op) {
  289. case COP_SHA1:
  290. default:
  291. op.config = CFG_OP_MAC_ONLY | CFG_MACM_SHA1;
  292. break;
  293. case COP_HMAC_SHA1:
  294. op.config = CFG_OP_MAC_ONLY | CFG_MACM_HMAC_SHA1;
  295. memcpy(cpg->sram + SRAM_HMAC_IV_IN,
  296. tfm_ctx->ivs, sizeof(tfm_ctx->ivs));
  297. break;
  298. }
  299. op.mac_src_p =
  300. MAC_SRC_DATA_P(SRAM_DATA_IN_START) | MAC_SRC_TOTAL_LEN((u32)
  301. req_ctx->
  302. count);
  303. setup_data_in();
  304. op.mac_digest =
  305. MAC_DIGEST_P(SRAM_DIGEST_BUF) | MAC_FRAG_LEN(p->crypt_len);
  306. op.mac_iv =
  307. MAC_INNER_IV_P(SRAM_HMAC_IV_IN) |
  308. MAC_OUTER_IV_P(SRAM_HMAC_IV_OUT);
  309. is_last = req_ctx->last_chunk
  310. && (p->hw_processed_bytes + p->crypt_len >= p->hw_nbytes)
  311. && (req_ctx->count <= MAX_HW_HASH_SIZE);
  312. if (req_ctx->first_hash) {
  313. if (is_last)
  314. op.config |= CFG_NOT_FRAG;
  315. else
  316. op.config |= CFG_FIRST_FRAG;
  317. req_ctx->first_hash = 0;
  318. } else {
  319. if (is_last)
  320. op.config |= CFG_LAST_FRAG;
  321. else
  322. op.config |= CFG_MID_FRAG;
  323. if (first_block) {
  324. writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A);
  325. writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B);
  326. writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C);
  327. writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D);
  328. writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E);
  329. }
  330. }
  331. memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config));
  332. /* GO */
  333. mv_setup_timer();
  334. writel(SEC_CMD_EN_SEC_ACCL0, cpg->reg + SEC_ACCEL_CMD);
  335. }
  336. static inline int mv_hash_import_sha1_ctx(const struct mv_req_hash_ctx *ctx,
  337. struct shash_desc *desc)
  338. {
  339. int i;
  340. struct sha1_state shash_state;
  341. shash_state.count = ctx->count + ctx->count_add;
  342. for (i = 0; i < 5; i++)
  343. shash_state.state[i] = ctx->state[i];
  344. memcpy(shash_state.buffer, ctx->buffer, sizeof(shash_state.buffer));
  345. return crypto_shash_import(desc, &shash_state);
  346. }
  347. static int mv_hash_final_fallback(struct ahash_request *req)
  348. {
  349. const struct mv_tfm_hash_ctx *tfm_ctx = crypto_tfm_ctx(req->base.tfm);
  350. struct mv_req_hash_ctx *req_ctx = ahash_request_ctx(req);
  351. struct {
  352. struct shash_desc shash;
  353. char ctx[crypto_shash_descsize(tfm_ctx->fallback)];
  354. } desc;
  355. int rc;
  356. desc.shash.tfm = tfm_ctx->fallback;
  357. desc.shash.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
  358. if (unlikely(req_ctx->first_hash)) {
  359. crypto_shash_init(&desc.shash);
  360. crypto_shash_update(&desc.shash, req_ctx->buffer,
  361. req_ctx->extra_bytes);
  362. } else {
  363. /* only SHA1 for now....
  364. */
  365. rc = mv_hash_import_sha1_ctx(req_ctx, &desc.shash);
  366. if (rc)
  367. goto out;
  368. }
  369. rc = crypto_shash_final(&desc.shash, req->result);
  370. out:
  371. return rc;
  372. }
  373. static void mv_save_digest_state(struct mv_req_hash_ctx *ctx)
  374. {
  375. ctx->state[0] = readl(cpg->reg + DIGEST_INITIAL_VAL_A);
  376. ctx->state[1] = readl(cpg->reg + DIGEST_INITIAL_VAL_B);
  377. ctx->state[2] = readl(cpg->reg + DIGEST_INITIAL_VAL_C);
  378. ctx->state[3] = readl(cpg->reg + DIGEST_INITIAL_VAL_D);
  379. ctx->state[4] = readl(cpg->reg + DIGEST_INITIAL_VAL_E);
  380. }
  381. static void mv_hash_algo_completion(void)
  382. {
  383. struct ahash_request *req = ahash_request_cast(cpg->cur_req);
  384. struct mv_req_hash_ctx *ctx = ahash_request_ctx(req);
  385. if (ctx->extra_bytes)
  386. copy_src_to_buf(&cpg->p, ctx->buffer, ctx->extra_bytes);
  387. sg_miter_stop(&cpg->p.src_sg_it);
  388. if (likely(ctx->last_chunk)) {
  389. if (likely(ctx->count <= MAX_HW_HASH_SIZE)) {
  390. memcpy(req->result, cpg->sram + SRAM_DIGEST_BUF,
  391. crypto_ahash_digestsize(crypto_ahash_reqtfm
  392. (req)));
  393. } else {
  394. mv_save_digest_state(ctx);
  395. mv_hash_final_fallback(req);
  396. }
  397. } else {
  398. mv_save_digest_state(ctx);
  399. }
  400. }
  401. static void dequeue_complete_req(void)
  402. {
  403. struct crypto_async_request *req = cpg->cur_req;
  404. void *buf;
  405. int ret;
  406. cpg->p.hw_processed_bytes += cpg->p.crypt_len;
  407. if (cpg->p.copy_back) {
  408. int need_copy_len = cpg->p.crypt_len;
  409. int sram_offset = 0;
  410. do {
  411. int dst_copy;
  412. if (!cpg->p.sg_dst_left) {
  413. ret = sg_miter_next(&cpg->p.dst_sg_it);
  414. BUG_ON(!ret);
  415. cpg->p.sg_dst_left = cpg->p.dst_sg_it.length;
  416. cpg->p.dst_start = 0;
  417. }
  418. buf = cpg->p.dst_sg_it.addr;
  419. buf += cpg->p.dst_start;
  420. dst_copy = min(need_copy_len, cpg->p.sg_dst_left);
  421. memcpy(buf,
  422. cpg->sram + SRAM_DATA_OUT_START + sram_offset,
  423. dst_copy);
  424. sram_offset += dst_copy;
  425. cpg->p.sg_dst_left -= dst_copy;
  426. need_copy_len -= dst_copy;
  427. cpg->p.dst_start += dst_copy;
  428. } while (need_copy_len > 0);
  429. }
  430. cpg->p.crypt_len = 0;
  431. BUG_ON(cpg->eng_st != ENGINE_W_DEQUEUE);
  432. if (cpg->p.hw_processed_bytes < cpg->p.hw_nbytes) {
  433. /* process next scatter list entry */
  434. cpg->eng_st = ENGINE_BUSY;
  435. cpg->p.process(0);
  436. } else {
  437. cpg->p.complete();
  438. cpg->eng_st = ENGINE_IDLE;
  439. local_bh_disable();
  440. req->complete(req, 0);
  441. local_bh_enable();
  442. }
  443. }
  444. static int count_sgs(struct scatterlist *sl, unsigned int total_bytes)
  445. {
  446. int i = 0;
  447. size_t cur_len;
  448. while (sl) {
  449. cur_len = sl[i].length;
  450. ++i;
  451. if (total_bytes > cur_len)
  452. total_bytes -= cur_len;
  453. else
  454. break;
  455. }
  456. return i;
  457. }
  458. static void mv_start_new_crypt_req(struct ablkcipher_request *req)
  459. {
  460. struct req_progress *p = &cpg->p;
  461. int num_sgs;
  462. cpg->cur_req = &req->base;
  463. memset(p, 0, sizeof(struct req_progress));
  464. p->hw_nbytes = req->nbytes;
  465. p->complete = mv_crypto_algo_completion;
  466. p->process = mv_process_current_q;
  467. p->copy_back = 1;
  468. num_sgs = count_sgs(req->src, req->nbytes);
  469. sg_miter_start(&p->src_sg_it, req->src, num_sgs, SG_MITER_FROM_SG);
  470. num_sgs = count_sgs(req->dst, req->nbytes);
  471. sg_miter_start(&p->dst_sg_it, req->dst, num_sgs, SG_MITER_TO_SG);
  472. mv_process_current_q(1);
  473. }
  474. static void mv_start_new_hash_req(struct ahash_request *req)
  475. {
  476. struct req_progress *p = &cpg->p;
  477. struct mv_req_hash_ctx *ctx = ahash_request_ctx(req);
  478. int num_sgs, hw_bytes, old_extra_bytes, rc;
  479. cpg->cur_req = &req->base;
  480. memset(p, 0, sizeof(struct req_progress));
  481. hw_bytes = req->nbytes + ctx->extra_bytes;
  482. old_extra_bytes = ctx->extra_bytes;
  483. ctx->extra_bytes = hw_bytes % SHA1_BLOCK_SIZE;
  484. if (ctx->extra_bytes != 0
  485. && (!ctx->last_chunk || ctx->count > MAX_HW_HASH_SIZE))
  486. hw_bytes -= ctx->extra_bytes;
  487. else
  488. ctx->extra_bytes = 0;
  489. num_sgs = count_sgs(req->src, req->nbytes);
  490. sg_miter_start(&p->src_sg_it, req->src, num_sgs, SG_MITER_FROM_SG);
  491. if (hw_bytes) {
  492. p->hw_nbytes = hw_bytes;
  493. p->complete = mv_hash_algo_completion;
  494. p->process = mv_process_hash_current;
  495. if (unlikely(old_extra_bytes)) {
  496. memcpy(cpg->sram + SRAM_DATA_IN_START, ctx->buffer,
  497. old_extra_bytes);
  498. p->crypt_len = old_extra_bytes;
  499. }
  500. mv_process_hash_current(1);
  501. } else {
  502. copy_src_to_buf(p, ctx->buffer + old_extra_bytes,
  503. ctx->extra_bytes - old_extra_bytes);
  504. sg_miter_stop(&p->src_sg_it);
  505. if (ctx->last_chunk)
  506. rc = mv_hash_final_fallback(req);
  507. else
  508. rc = 0;
  509. cpg->eng_st = ENGINE_IDLE;
  510. local_bh_disable();
  511. req->base.complete(&req->base, rc);
  512. local_bh_enable();
  513. }
  514. }
  515. static int queue_manag(void *data)
  516. {
  517. cpg->eng_st = ENGINE_IDLE;
  518. do {
  519. struct crypto_async_request *async_req = NULL;
  520. struct crypto_async_request *backlog;
  521. __set_current_state(TASK_INTERRUPTIBLE);
  522. if (cpg->eng_st == ENGINE_W_DEQUEUE)
  523. dequeue_complete_req();
  524. spin_lock_irq(&cpg->lock);
  525. if (cpg->eng_st == ENGINE_IDLE) {
  526. backlog = crypto_get_backlog(&cpg->queue);
  527. async_req = crypto_dequeue_request(&cpg->queue);
  528. if (async_req) {
  529. BUG_ON(cpg->eng_st != ENGINE_IDLE);
  530. cpg->eng_st = ENGINE_BUSY;
  531. }
  532. }
  533. spin_unlock_irq(&cpg->lock);
  534. if (backlog) {
  535. backlog->complete(backlog, -EINPROGRESS);
  536. backlog = NULL;
  537. }
  538. if (async_req) {
  539. if (async_req->tfm->__crt_alg->cra_type !=
  540. &crypto_ahash_type) {
  541. struct ablkcipher_request *req =
  542. ablkcipher_request_cast(async_req);
  543. mv_start_new_crypt_req(req);
  544. } else {
  545. struct ahash_request *req =
  546. ahash_request_cast(async_req);
  547. mv_start_new_hash_req(req);
  548. }
  549. async_req = NULL;
  550. }
  551. schedule();
  552. } while (!kthread_should_stop());
  553. return 0;
  554. }
  555. static int mv_handle_req(struct crypto_async_request *req)
  556. {
  557. unsigned long flags;
  558. int ret;
  559. spin_lock_irqsave(&cpg->lock, flags);
  560. ret = crypto_enqueue_request(&cpg->queue, req);
  561. spin_unlock_irqrestore(&cpg->lock, flags);
  562. wake_up_process(cpg->queue_th);
  563. return ret;
  564. }
  565. static int mv_enc_aes_ecb(struct ablkcipher_request *req)
  566. {
  567. struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req);
  568. req_ctx->op = COP_AES_ECB;
  569. req_ctx->decrypt = 0;
  570. return mv_handle_req(&req->base);
  571. }
  572. static int mv_dec_aes_ecb(struct ablkcipher_request *req)
  573. {
  574. struct mv_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
  575. struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req);
  576. req_ctx->op = COP_AES_ECB;
  577. req_ctx->decrypt = 1;
  578. compute_aes_dec_key(ctx);
  579. return mv_handle_req(&req->base);
  580. }
  581. static int mv_enc_aes_cbc(struct ablkcipher_request *req)
  582. {
  583. struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req);
  584. req_ctx->op = COP_AES_CBC;
  585. req_ctx->decrypt = 0;
  586. return mv_handle_req(&req->base);
  587. }
  588. static int mv_dec_aes_cbc(struct ablkcipher_request *req)
  589. {
  590. struct mv_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
  591. struct mv_req_ctx *req_ctx = ablkcipher_request_ctx(req);
  592. req_ctx->op = COP_AES_CBC;
  593. req_ctx->decrypt = 1;
  594. compute_aes_dec_key(ctx);
  595. return mv_handle_req(&req->base);
  596. }
  597. static int mv_cra_init(struct crypto_tfm *tfm)
  598. {
  599. tfm->crt_ablkcipher.reqsize = sizeof(struct mv_req_ctx);
  600. return 0;
  601. }
  602. static void mv_init_hash_req_ctx(struct mv_req_hash_ctx *ctx, int op,
  603. int is_last, unsigned int req_len,
  604. int count_add)
  605. {
  606. memset(ctx, 0, sizeof(*ctx));
  607. ctx->op = op;
  608. ctx->count = req_len;
  609. ctx->first_hash = 1;
  610. ctx->last_chunk = is_last;
  611. ctx->count_add = count_add;
  612. }
  613. static void mv_update_hash_req_ctx(struct mv_req_hash_ctx *ctx, int is_last,
  614. unsigned req_len)
  615. {
  616. ctx->last_chunk = is_last;
  617. ctx->count += req_len;
  618. }
  619. static int mv_hash_init(struct ahash_request *req)
  620. {
  621. const struct mv_tfm_hash_ctx *tfm_ctx = crypto_tfm_ctx(req->base.tfm);
  622. mv_init_hash_req_ctx(ahash_request_ctx(req), tfm_ctx->op, 0, 0,
  623. tfm_ctx->count_add);
  624. return 0;
  625. }
  626. static int mv_hash_update(struct ahash_request *req)
  627. {
  628. if (!req->nbytes)
  629. return 0;
  630. mv_update_hash_req_ctx(ahash_request_ctx(req), 0, req->nbytes);
  631. return mv_handle_req(&req->base);
  632. }
  633. static int mv_hash_final(struct ahash_request *req)
  634. {
  635. struct mv_req_hash_ctx *ctx = ahash_request_ctx(req);
  636. ahash_request_set_crypt(req, NULL, req->result, 0);
  637. mv_update_hash_req_ctx(ctx, 1, 0);
  638. return mv_handle_req(&req->base);
  639. }
  640. static int mv_hash_finup(struct ahash_request *req)
  641. {
  642. mv_update_hash_req_ctx(ahash_request_ctx(req), 1, req->nbytes);
  643. return mv_handle_req(&req->base);
  644. }
  645. static int mv_hash_digest(struct ahash_request *req)
  646. {
  647. const struct mv_tfm_hash_ctx *tfm_ctx = crypto_tfm_ctx(req->base.tfm);
  648. mv_init_hash_req_ctx(ahash_request_ctx(req), tfm_ctx->op, 1,
  649. req->nbytes, tfm_ctx->count_add);
  650. return mv_handle_req(&req->base);
  651. }
  652. static void mv_hash_init_ivs(struct mv_tfm_hash_ctx *ctx, const void *istate,
  653. const void *ostate)
  654. {
  655. const struct sha1_state *isha1_state = istate, *osha1_state = ostate;
  656. int i;
  657. for (i = 0; i < 5; i++) {
  658. ctx->ivs[i] = cpu_to_be32(isha1_state->state[i]);
  659. ctx->ivs[i + 5] = cpu_to_be32(osha1_state->state[i]);
  660. }
  661. }
  662. static int mv_hash_setkey(struct crypto_ahash *tfm, const u8 * key,
  663. unsigned int keylen)
  664. {
  665. int rc;
  666. struct mv_tfm_hash_ctx *ctx = crypto_tfm_ctx(&tfm->base);
  667. int bs, ds, ss;
  668. if (!ctx->base_hash)
  669. return 0;
  670. rc = crypto_shash_setkey(ctx->fallback, key, keylen);
  671. if (rc)
  672. return rc;
  673. /* Can't see a way to extract the ipad/opad from the fallback tfm
  674. so I'm basically copying code from the hmac module */
  675. bs = crypto_shash_blocksize(ctx->base_hash);
  676. ds = crypto_shash_digestsize(ctx->base_hash);
  677. ss = crypto_shash_statesize(ctx->base_hash);
  678. {
  679. struct {
  680. struct shash_desc shash;
  681. char ctx[crypto_shash_descsize(ctx->base_hash)];
  682. } desc;
  683. unsigned int i;
  684. char ipad[ss];
  685. char opad[ss];
  686. desc.shash.tfm = ctx->base_hash;
  687. desc.shash.flags = crypto_shash_get_flags(ctx->base_hash) &
  688. CRYPTO_TFM_REQ_MAY_SLEEP;
  689. if (keylen > bs) {
  690. int err;
  691. err =
  692. crypto_shash_digest(&desc.shash, key, keylen, ipad);
  693. if (err)
  694. return err;
  695. keylen = ds;
  696. } else
  697. memcpy(ipad, key, keylen);
  698. memset(ipad + keylen, 0, bs - keylen);
  699. memcpy(opad, ipad, bs);
  700. for (i = 0; i < bs; i++) {
  701. ipad[i] ^= 0x36;
  702. opad[i] ^= 0x5c;
  703. }
  704. rc = crypto_shash_init(&desc.shash) ? :
  705. crypto_shash_update(&desc.shash, ipad, bs) ? :
  706. crypto_shash_export(&desc.shash, ipad) ? :
  707. crypto_shash_init(&desc.shash) ? :
  708. crypto_shash_update(&desc.shash, opad, bs) ? :
  709. crypto_shash_export(&desc.shash, opad);
  710. if (rc == 0)
  711. mv_hash_init_ivs(ctx, ipad, opad);
  712. return rc;
  713. }
  714. }
  715. static int mv_cra_hash_init(struct crypto_tfm *tfm, const char *base_hash_name,
  716. enum hash_op op, int count_add)
  717. {
  718. const char *fallback_driver_name = tfm->__crt_alg->cra_name;
  719. struct mv_tfm_hash_ctx *ctx = crypto_tfm_ctx(tfm);
  720. struct crypto_shash *fallback_tfm = NULL;
  721. struct crypto_shash *base_hash = NULL;
  722. int err = -ENOMEM;
  723. ctx->op = op;
  724. ctx->count_add = count_add;
  725. /* Allocate a fallback and abort if it failed. */
  726. fallback_tfm = crypto_alloc_shash(fallback_driver_name, 0,
  727. CRYPTO_ALG_NEED_FALLBACK);
  728. if (IS_ERR(fallback_tfm)) {
  729. printk(KERN_WARNING MV_CESA
  730. "Fallback driver '%s' could not be loaded!\n",
  731. fallback_driver_name);
  732. err = PTR_ERR(fallback_tfm);
  733. goto out;
  734. }
  735. ctx->fallback = fallback_tfm;
  736. if (base_hash_name) {
  737. /* Allocate a hash to compute the ipad/opad of hmac. */
  738. base_hash = crypto_alloc_shash(base_hash_name, 0,
  739. CRYPTO_ALG_NEED_FALLBACK);
  740. if (IS_ERR(base_hash)) {
  741. printk(KERN_WARNING MV_CESA
  742. "Base driver '%s' could not be loaded!\n",
  743. base_hash_name);
  744. err = PTR_ERR(base_hash);
  745. goto err_bad_base;
  746. }
  747. }
  748. ctx->base_hash = base_hash;
  749. crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
  750. sizeof(struct mv_req_hash_ctx) +
  751. crypto_shash_descsize(ctx->fallback));
  752. return 0;
  753. err_bad_base:
  754. crypto_free_shash(fallback_tfm);
  755. out:
  756. return err;
  757. }
  758. static void mv_cra_hash_exit(struct crypto_tfm *tfm)
  759. {
  760. struct mv_tfm_hash_ctx *ctx = crypto_tfm_ctx(tfm);
  761. crypto_free_shash(ctx->fallback);
  762. if (ctx->base_hash)
  763. crypto_free_shash(ctx->base_hash);
  764. }
  765. static int mv_cra_hash_sha1_init(struct crypto_tfm *tfm)
  766. {
  767. return mv_cra_hash_init(tfm, NULL, COP_SHA1, 0);
  768. }
  769. static int mv_cra_hash_hmac_sha1_init(struct crypto_tfm *tfm)
  770. {
  771. return mv_cra_hash_init(tfm, "sha1", COP_HMAC_SHA1, SHA1_BLOCK_SIZE);
  772. }
  773. irqreturn_t crypto_int(int irq, void *priv)
  774. {
  775. u32 val;
  776. val = readl(cpg->reg + SEC_ACCEL_INT_STATUS);
  777. if (!(val & SEC_INT_ACCEL0_DONE))
  778. return IRQ_NONE;
  779. if (!del_timer(&cpg->completion_timer)) {
  780. printk(KERN_WARNING MV_CESA
  781. "got an interrupt but no pending timer?\n");
  782. }
  783. val &= ~SEC_INT_ACCEL0_DONE;
  784. writel(val, cpg->reg + FPGA_INT_STATUS);
  785. writel(val, cpg->reg + SEC_ACCEL_INT_STATUS);
  786. BUG_ON(cpg->eng_st != ENGINE_BUSY);
  787. cpg->eng_st = ENGINE_W_DEQUEUE;
  788. wake_up_process(cpg->queue_th);
  789. return IRQ_HANDLED;
  790. }
  791. struct crypto_alg mv_aes_alg_ecb = {
  792. .cra_name = "ecb(aes)",
  793. .cra_driver_name = "mv-ecb-aes",
  794. .cra_priority = 300,
  795. .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER |
  796. CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
  797. .cra_blocksize = 16,
  798. .cra_ctxsize = sizeof(struct mv_ctx),
  799. .cra_alignmask = 0,
  800. .cra_type = &crypto_ablkcipher_type,
  801. .cra_module = THIS_MODULE,
  802. .cra_init = mv_cra_init,
  803. .cra_u = {
  804. .ablkcipher = {
  805. .min_keysize = AES_MIN_KEY_SIZE,
  806. .max_keysize = AES_MAX_KEY_SIZE,
  807. .setkey = mv_setkey_aes,
  808. .encrypt = mv_enc_aes_ecb,
  809. .decrypt = mv_dec_aes_ecb,
  810. },
  811. },
  812. };
  813. struct crypto_alg mv_aes_alg_cbc = {
  814. .cra_name = "cbc(aes)",
  815. .cra_driver_name = "mv-cbc-aes",
  816. .cra_priority = 300,
  817. .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER |
  818. CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
  819. .cra_blocksize = AES_BLOCK_SIZE,
  820. .cra_ctxsize = sizeof(struct mv_ctx),
  821. .cra_alignmask = 0,
  822. .cra_type = &crypto_ablkcipher_type,
  823. .cra_module = THIS_MODULE,
  824. .cra_init = mv_cra_init,
  825. .cra_u = {
  826. .ablkcipher = {
  827. .ivsize = AES_BLOCK_SIZE,
  828. .min_keysize = AES_MIN_KEY_SIZE,
  829. .max_keysize = AES_MAX_KEY_SIZE,
  830. .setkey = mv_setkey_aes,
  831. .encrypt = mv_enc_aes_cbc,
  832. .decrypt = mv_dec_aes_cbc,
  833. },
  834. },
  835. };
  836. struct ahash_alg mv_sha1_alg = {
  837. .init = mv_hash_init,
  838. .update = mv_hash_update,
  839. .final = mv_hash_final,
  840. .finup = mv_hash_finup,
  841. .digest = mv_hash_digest,
  842. .halg = {
  843. .digestsize = SHA1_DIGEST_SIZE,
  844. .base = {
  845. .cra_name = "sha1",
  846. .cra_driver_name = "mv-sha1",
  847. .cra_priority = 300,
  848. .cra_flags =
  849. CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY |
  850. CRYPTO_ALG_NEED_FALLBACK,
  851. .cra_blocksize = SHA1_BLOCK_SIZE,
  852. .cra_ctxsize = sizeof(struct mv_tfm_hash_ctx),
  853. .cra_init = mv_cra_hash_sha1_init,
  854. .cra_exit = mv_cra_hash_exit,
  855. .cra_module = THIS_MODULE,
  856. }
  857. }
  858. };
  859. struct ahash_alg mv_hmac_sha1_alg = {
  860. .init = mv_hash_init,
  861. .update = mv_hash_update,
  862. .final = mv_hash_final,
  863. .finup = mv_hash_finup,
  864. .digest = mv_hash_digest,
  865. .setkey = mv_hash_setkey,
  866. .halg = {
  867. .digestsize = SHA1_DIGEST_SIZE,
  868. .base = {
  869. .cra_name = "hmac(sha1)",
  870. .cra_driver_name = "mv-hmac-sha1",
  871. .cra_priority = 300,
  872. .cra_flags =
  873. CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY |
  874. CRYPTO_ALG_NEED_FALLBACK,
  875. .cra_blocksize = SHA1_BLOCK_SIZE,
  876. .cra_ctxsize = sizeof(struct mv_tfm_hash_ctx),
  877. .cra_init = mv_cra_hash_hmac_sha1_init,
  878. .cra_exit = mv_cra_hash_exit,
  879. .cra_module = THIS_MODULE,
  880. }
  881. }
  882. };
  883. static int mv_probe(struct platform_device *pdev)
  884. {
  885. struct crypto_priv *cp;
  886. struct resource *res;
  887. int irq;
  888. int ret;
  889. if (cpg) {
  890. printk(KERN_ERR MV_CESA "Second crypto dev?\n");
  891. return -EEXIST;
  892. }
  893. res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
  894. if (!res)
  895. return -ENXIO;
  896. cp = kzalloc(sizeof(*cp), GFP_KERNEL);
  897. if (!cp)
  898. return -ENOMEM;
  899. spin_lock_init(&cp->lock);
  900. crypto_init_queue(&cp->queue, 50);
  901. cp->reg = ioremap(res->start, resource_size(res));
  902. if (!cp->reg) {
  903. ret = -ENOMEM;
  904. goto err;
  905. }
  906. res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
  907. if (!res) {
  908. ret = -ENXIO;
  909. goto err_unmap_reg;
  910. }
  911. cp->sram_size = resource_size(res);
  912. cp->max_req_size = cp->sram_size - SRAM_CFG_SPACE;
  913. cp->sram = ioremap(res->start, cp->sram_size);
  914. if (!cp->sram) {
  915. ret = -ENOMEM;
  916. goto err_unmap_reg;
  917. }
  918. if (pdev->dev.of_node)
  919. irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
  920. else
  921. irq = platform_get_irq(pdev, 0);
  922. if (irq < 0 || irq == NO_IRQ) {
  923. ret = irq;
  924. goto err_unmap_sram;
  925. }
  926. cp->irq = irq;
  927. platform_set_drvdata(pdev, cp);
  928. cpg = cp;
  929. cp->queue_th = kthread_run(queue_manag, cp, "mv_crypto");
  930. if (IS_ERR(cp->queue_th)) {
  931. ret = PTR_ERR(cp->queue_th);
  932. goto err_unmap_sram;
  933. }
  934. ret = request_irq(irq, crypto_int, IRQF_DISABLED, dev_name(&pdev->dev),
  935. cp);
  936. if (ret)
  937. goto err_thread;
  938. /* Not all platforms can gate the clock, so it is not
  939. an error if the clock does not exists. */
  940. cp->clk = clk_get(&pdev->dev, NULL);
  941. if (!IS_ERR(cp->clk))
  942. clk_prepare_enable(cp->clk);
  943. writel(0, cpg->reg + SEC_ACCEL_INT_STATUS);
  944. writel(SEC_INT_ACCEL0_DONE, cpg->reg + SEC_ACCEL_INT_MASK);
  945. writel(SEC_CFG_STOP_DIG_ERR, cpg->reg + SEC_ACCEL_CFG);
  946. writel(SRAM_CONFIG, cpg->reg + SEC_ACCEL_DESC_P0);
  947. ret = crypto_register_alg(&mv_aes_alg_ecb);
  948. if (ret) {
  949. printk(KERN_WARNING MV_CESA
  950. "Could not register aes-ecb driver\n");
  951. goto err_irq;
  952. }
  953. ret = crypto_register_alg(&mv_aes_alg_cbc);
  954. if (ret) {
  955. printk(KERN_WARNING MV_CESA
  956. "Could not register aes-cbc driver\n");
  957. goto err_unreg_ecb;
  958. }
  959. ret = crypto_register_ahash(&mv_sha1_alg);
  960. if (ret == 0)
  961. cpg->has_sha1 = 1;
  962. else
  963. printk(KERN_WARNING MV_CESA "Could not register sha1 driver\n");
  964. ret = crypto_register_ahash(&mv_hmac_sha1_alg);
  965. if (ret == 0) {
  966. cpg->has_hmac_sha1 = 1;
  967. } else {
  968. printk(KERN_WARNING MV_CESA
  969. "Could not register hmac-sha1 driver\n");
  970. }
  971. return 0;
  972. err_unreg_ecb:
  973. crypto_unregister_alg(&mv_aes_alg_ecb);
  974. err_irq:
  975. free_irq(irq, cp);
  976. if (!IS_ERR(cp->clk)) {
  977. clk_disable_unprepare(cp->clk);
  978. clk_put(cp->clk);
  979. }
  980. err_thread:
  981. kthread_stop(cp->queue_th);
  982. err_unmap_sram:
  983. iounmap(cp->sram);
  984. err_unmap_reg:
  985. iounmap(cp->reg);
  986. err:
  987. kfree(cp);
  988. cpg = NULL;
  989. platform_set_drvdata(pdev, NULL);
  990. return ret;
  991. }
  992. static int mv_remove(struct platform_device *pdev)
  993. {
  994. struct crypto_priv *cp = platform_get_drvdata(pdev);
  995. crypto_unregister_alg(&mv_aes_alg_ecb);
  996. crypto_unregister_alg(&mv_aes_alg_cbc);
  997. if (cp->has_sha1)
  998. crypto_unregister_ahash(&mv_sha1_alg);
  999. if (cp->has_hmac_sha1)
  1000. crypto_unregister_ahash(&mv_hmac_sha1_alg);
  1001. kthread_stop(cp->queue_th);
  1002. free_irq(cp->irq, cp);
  1003. memset(cp->sram, 0, cp->sram_size);
  1004. iounmap(cp->sram);
  1005. iounmap(cp->reg);
  1006. if (!IS_ERR(cp->clk)) {
  1007. clk_disable_unprepare(cp->clk);
  1008. clk_put(cp->clk);
  1009. }
  1010. kfree(cp);
  1011. cpg = NULL;
  1012. return 0;
  1013. }
  1014. static const struct of_device_id mv_cesa_of_match_table[] = {
  1015. { .compatible = "marvell,orion-crypto", },
  1016. {}
  1017. };
  1018. MODULE_DEVICE_TABLE(of, mv_cesa_of_match_table);
  1019. static struct platform_driver marvell_crypto = {
  1020. .probe = mv_probe,
  1021. .remove = mv_remove,
  1022. .driver = {
  1023. .owner = THIS_MODULE,
  1024. .name = "mv_crypto",
  1025. .of_match_table = of_match_ptr(mv_cesa_of_match_table),
  1026. },
  1027. };
  1028. MODULE_ALIAS("platform:mv_crypto");
  1029. module_platform_driver(marvell_crypto);
  1030. MODULE_AUTHOR("Sebastian Andrzej Siewior <sebastian@breakpoint.cc>");
  1031. MODULE_DESCRIPTION("Support for Marvell's cryptographic engine");
  1032. MODULE_LICENSE("GPL");