zcrypt_msgtype50.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright IBM Corp. 2001, 2012
  4. * Author(s): Robert Burroughs
  5. * Eric Rossman (edrossma@us.ibm.com)
  6. *
  7. * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
  8. * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
  9. * Ralph Wuerthner <rwuerthn@de.ibm.com>
  10. * MSGTYPE restruct: Holger Dengler <hd@linux.vnet.ibm.com>
  11. */
  12. #define KMSG_COMPONENT "zcrypt"
  13. #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  14. #include <linux/module.h>
  15. #include <linux/slab.h>
  16. #include <linux/init.h>
  17. #include <linux/err.h>
  18. #include <linux/atomic.h>
  19. #include <linux/uaccess.h>
  20. #include "ap_bus.h"
  21. #include "zcrypt_api.h"
  22. #include "zcrypt_error.h"
  23. #include "zcrypt_msgtype50.h"
  24. /* >= CEX3A: 4096 bits */
  25. #define CEX3A_MAX_MOD_SIZE 512
  26. /* CEX2A: max outputdatalength + type80_hdr */
  27. #define CEX2A_MAX_RESPONSE_SIZE 0x110
  28. /* >= CEX3A: 512 bit modulus, (max outputdatalength) + type80_hdr */
  29. #define CEX3A_MAX_RESPONSE_SIZE 0x210
  30. MODULE_AUTHOR("IBM Corporation");
  31. MODULE_DESCRIPTION("Cryptographic Accelerator (message type 50), " \
  32. "Copyright IBM Corp. 2001, 2012");
  33. MODULE_LICENSE("GPL");
  34. /**
  35. * The type 50 message family is associated with a CEXxA cards.
  36. *
  37. * The four members of the family are described below.
  38. *
  39. * Note that all unsigned char arrays are right-justified and left-padded
  40. * with zeroes.
  41. *
  42. * Note that all reserved fields must be zeroes.
  43. */
  44. struct type50_hdr {
  45. unsigned char reserved1;
  46. unsigned char msg_type_code; /* 0x50 */
  47. unsigned short msg_len;
  48. unsigned char reserved2;
  49. unsigned char ignored;
  50. unsigned short reserved3;
  51. } __packed;
  52. #define TYPE50_TYPE_CODE 0x50
  53. #define TYPE50_MEB1_FMT 0x0001
  54. #define TYPE50_MEB2_FMT 0x0002
  55. #define TYPE50_MEB3_FMT 0x0003
  56. #define TYPE50_CRB1_FMT 0x0011
  57. #define TYPE50_CRB2_FMT 0x0012
  58. #define TYPE50_CRB3_FMT 0x0013
  59. /* Mod-Exp, with a small modulus */
  60. struct type50_meb1_msg {
  61. struct type50_hdr header;
  62. unsigned short keyblock_type; /* 0x0001 */
  63. unsigned char reserved[6];
  64. unsigned char exponent[128];
  65. unsigned char modulus[128];
  66. unsigned char message[128];
  67. } __packed;
  68. /* Mod-Exp, with a large modulus */
  69. struct type50_meb2_msg {
  70. struct type50_hdr header;
  71. unsigned short keyblock_type; /* 0x0002 */
  72. unsigned char reserved[6];
  73. unsigned char exponent[256];
  74. unsigned char modulus[256];
  75. unsigned char message[256];
  76. } __packed;
  77. /* Mod-Exp, with a larger modulus */
  78. struct type50_meb3_msg {
  79. struct type50_hdr header;
  80. unsigned short keyblock_type; /* 0x0003 */
  81. unsigned char reserved[6];
  82. unsigned char exponent[512];
  83. unsigned char modulus[512];
  84. unsigned char message[512];
  85. } __packed;
  86. /* CRT, with a small modulus */
  87. struct type50_crb1_msg {
  88. struct type50_hdr header;
  89. unsigned short keyblock_type; /* 0x0011 */
  90. unsigned char reserved[6];
  91. unsigned char p[64];
  92. unsigned char q[64];
  93. unsigned char dp[64];
  94. unsigned char dq[64];
  95. unsigned char u[64];
  96. unsigned char message[128];
  97. } __packed;
  98. /* CRT, with a large modulus */
  99. struct type50_crb2_msg {
  100. struct type50_hdr header;
  101. unsigned short keyblock_type; /* 0x0012 */
  102. unsigned char reserved[6];
  103. unsigned char p[128];
  104. unsigned char q[128];
  105. unsigned char dp[128];
  106. unsigned char dq[128];
  107. unsigned char u[128];
  108. unsigned char message[256];
  109. } __packed;
  110. /* CRT, with a larger modulus */
  111. struct type50_crb3_msg {
  112. struct type50_hdr header;
  113. unsigned short keyblock_type; /* 0x0013 */
  114. unsigned char reserved[6];
  115. unsigned char p[256];
  116. unsigned char q[256];
  117. unsigned char dp[256];
  118. unsigned char dq[256];
  119. unsigned char u[256];
  120. unsigned char message[512];
  121. } __packed;
  122. /**
  123. * The type 80 response family is associated with a CEXxA cards.
  124. *
  125. * Note that all unsigned char arrays are right-justified and left-padded
  126. * with zeroes.
  127. *
  128. * Note that all reserved fields must be zeroes.
  129. */
  130. #define TYPE80_RSP_CODE 0x80
  131. struct type80_hdr {
  132. unsigned char reserved1;
  133. unsigned char type; /* 0x80 */
  134. unsigned short len;
  135. unsigned char code; /* 0x00 */
  136. unsigned char reserved2[3];
  137. unsigned char reserved3[8];
  138. } __packed;
  139. unsigned int get_rsa_modex_fc(struct ica_rsa_modexpo *mex, int *fcode)
  140. {
  141. if (!mex->inputdatalength)
  142. return -EINVAL;
  143. if (mex->inputdatalength <= 128) /* 1024 bit */
  144. *fcode = MEX_1K;
  145. else if (mex->inputdatalength <= 256) /* 2048 bit */
  146. *fcode = MEX_2K;
  147. else /* 4096 bit */
  148. *fcode = MEX_4K;
  149. return 0;
  150. }
  151. unsigned int get_rsa_crt_fc(struct ica_rsa_modexpo_crt *crt, int *fcode)
  152. {
  153. if (!crt->inputdatalength)
  154. return -EINVAL;
  155. if (crt->inputdatalength <= 128) /* 1024 bit */
  156. *fcode = CRT_1K;
  157. else if (crt->inputdatalength <= 256) /* 2048 bit */
  158. *fcode = CRT_2K;
  159. else /* 4096 bit */
  160. *fcode = CRT_4K;
  161. return 0;
  162. }
  163. /**
  164. * Convert a ICAMEX message to a type50 MEX message.
  165. *
  166. * @zq: crypto queue pointer
  167. * @ap_msg: crypto request pointer
  168. * @mex: pointer to user input data
  169. *
  170. * Returns 0 on success or -EFAULT.
  171. */
  172. static int ICAMEX_msg_to_type50MEX_msg(struct zcrypt_queue *zq,
  173. struct ap_message *ap_msg,
  174. struct ica_rsa_modexpo *mex)
  175. {
  176. unsigned char *mod, *exp, *inp;
  177. int mod_len;
  178. mod_len = mex->inputdatalength;
  179. if (mod_len <= 128) {
  180. struct type50_meb1_msg *meb1 = ap_msg->msg;
  181. memset(meb1, 0, sizeof(*meb1));
  182. ap_msg->len = sizeof(*meb1);
  183. meb1->header.msg_type_code = TYPE50_TYPE_CODE;
  184. meb1->header.msg_len = sizeof(*meb1);
  185. meb1->keyblock_type = TYPE50_MEB1_FMT;
  186. mod = meb1->modulus + sizeof(meb1->modulus) - mod_len;
  187. exp = meb1->exponent + sizeof(meb1->exponent) - mod_len;
  188. inp = meb1->message + sizeof(meb1->message) - mod_len;
  189. } else if (mod_len <= 256) {
  190. struct type50_meb2_msg *meb2 = ap_msg->msg;
  191. memset(meb2, 0, sizeof(*meb2));
  192. ap_msg->len = sizeof(*meb2);
  193. meb2->header.msg_type_code = TYPE50_TYPE_CODE;
  194. meb2->header.msg_len = sizeof(*meb2);
  195. meb2->keyblock_type = TYPE50_MEB2_FMT;
  196. mod = meb2->modulus + sizeof(meb2->modulus) - mod_len;
  197. exp = meb2->exponent + sizeof(meb2->exponent) - mod_len;
  198. inp = meb2->message + sizeof(meb2->message) - mod_len;
  199. } else if (mod_len <= 512) {
  200. struct type50_meb3_msg *meb3 = ap_msg->msg;
  201. memset(meb3, 0, sizeof(*meb3));
  202. ap_msg->len = sizeof(*meb3);
  203. meb3->header.msg_type_code = TYPE50_TYPE_CODE;
  204. meb3->header.msg_len = sizeof(*meb3);
  205. meb3->keyblock_type = TYPE50_MEB3_FMT;
  206. mod = meb3->modulus + sizeof(meb3->modulus) - mod_len;
  207. exp = meb3->exponent + sizeof(meb3->exponent) - mod_len;
  208. inp = meb3->message + sizeof(meb3->message) - mod_len;
  209. } else
  210. return -EINVAL;
  211. if (copy_from_user(mod, mex->n_modulus, mod_len) ||
  212. copy_from_user(exp, mex->b_key, mod_len) ||
  213. copy_from_user(inp, mex->inputdata, mod_len))
  214. return -EFAULT;
  215. #ifdef CONFIG_ZCRYPT_DEBUG
  216. if (ap_msg->fi.flags & AP_FI_FLAG_TOGGLE_SPECIAL)
  217. ap_msg->flags ^= AP_MSG_FLAG_SPECIAL;
  218. #endif
  219. return 0;
  220. }
  221. /**
  222. * Convert a ICACRT message to a type50 CRT message.
  223. *
  224. * @zq: crypto queue pointer
  225. * @ap_msg: crypto request pointer
  226. * @crt: pointer to user input data
  227. *
  228. * Returns 0 on success or -EFAULT.
  229. */
  230. static int ICACRT_msg_to_type50CRT_msg(struct zcrypt_queue *zq,
  231. struct ap_message *ap_msg,
  232. struct ica_rsa_modexpo_crt *crt)
  233. {
  234. int mod_len, short_len;
  235. unsigned char *p, *q, *dp, *dq, *u, *inp;
  236. mod_len = crt->inputdatalength;
  237. short_len = (mod_len + 1) / 2;
  238. /*
  239. * CEX2A and CEX3A w/o FW update can handle requests up to
  240. * 256 byte modulus (2k keys).
  241. * CEX3A with FW update and newer CEXxA cards are able to handle
  242. * 512 byte modulus (4k keys).
  243. */
  244. if (mod_len <= 128) { /* up to 1024 bit key size */
  245. struct type50_crb1_msg *crb1 = ap_msg->msg;
  246. memset(crb1, 0, sizeof(*crb1));
  247. ap_msg->len = sizeof(*crb1);
  248. crb1->header.msg_type_code = TYPE50_TYPE_CODE;
  249. crb1->header.msg_len = sizeof(*crb1);
  250. crb1->keyblock_type = TYPE50_CRB1_FMT;
  251. p = crb1->p + sizeof(crb1->p) - short_len;
  252. q = crb1->q + sizeof(crb1->q) - short_len;
  253. dp = crb1->dp + sizeof(crb1->dp) - short_len;
  254. dq = crb1->dq + sizeof(crb1->dq) - short_len;
  255. u = crb1->u + sizeof(crb1->u) - short_len;
  256. inp = crb1->message + sizeof(crb1->message) - mod_len;
  257. } else if (mod_len <= 256) { /* up to 2048 bit key size */
  258. struct type50_crb2_msg *crb2 = ap_msg->msg;
  259. memset(crb2, 0, sizeof(*crb2));
  260. ap_msg->len = sizeof(*crb2);
  261. crb2->header.msg_type_code = TYPE50_TYPE_CODE;
  262. crb2->header.msg_len = sizeof(*crb2);
  263. crb2->keyblock_type = TYPE50_CRB2_FMT;
  264. p = crb2->p + sizeof(crb2->p) - short_len;
  265. q = crb2->q + sizeof(crb2->q) - short_len;
  266. dp = crb2->dp + sizeof(crb2->dp) - short_len;
  267. dq = crb2->dq + sizeof(crb2->dq) - short_len;
  268. u = crb2->u + sizeof(crb2->u) - short_len;
  269. inp = crb2->message + sizeof(crb2->message) - mod_len;
  270. } else if ((mod_len <= 512) && /* up to 4096 bit key size */
  271. (zq->zcard->max_mod_size == CEX3A_MAX_MOD_SIZE)) {
  272. struct type50_crb3_msg *crb3 = ap_msg->msg;
  273. memset(crb3, 0, sizeof(*crb3));
  274. ap_msg->len = sizeof(*crb3);
  275. crb3->header.msg_type_code = TYPE50_TYPE_CODE;
  276. crb3->header.msg_len = sizeof(*crb3);
  277. crb3->keyblock_type = TYPE50_CRB3_FMT;
  278. p = crb3->p + sizeof(crb3->p) - short_len;
  279. q = crb3->q + sizeof(crb3->q) - short_len;
  280. dp = crb3->dp + sizeof(crb3->dp) - short_len;
  281. dq = crb3->dq + sizeof(crb3->dq) - short_len;
  282. u = crb3->u + sizeof(crb3->u) - short_len;
  283. inp = crb3->message + sizeof(crb3->message) - mod_len;
  284. } else
  285. return -EINVAL;
  286. /*
  287. * correct the offset of p, bp and mult_inv according zcrypt.h
  288. * block size right aligned (skip the first byte)
  289. */
  290. if (copy_from_user(p, crt->np_prime + MSGTYPE_ADJUSTMENT, short_len) ||
  291. copy_from_user(q, crt->nq_prime, short_len) ||
  292. copy_from_user(dp, crt->bp_key + MSGTYPE_ADJUSTMENT, short_len) ||
  293. copy_from_user(dq, crt->bq_key, short_len) ||
  294. copy_from_user(u, crt->u_mult_inv + MSGTYPE_ADJUSTMENT, short_len) ||
  295. copy_from_user(inp, crt->inputdata, mod_len))
  296. return -EFAULT;
  297. #ifdef CONFIG_ZCRYPT_DEBUG
  298. if (ap_msg->fi.flags & AP_FI_FLAG_TOGGLE_SPECIAL)
  299. ap_msg->flags ^= AP_MSG_FLAG_SPECIAL;
  300. #endif
  301. return 0;
  302. }
  303. /**
  304. * Copy results from a type 80 reply message back to user space.
  305. *
  306. * @zq: crypto device pointer
  307. * @reply: reply AP message.
  308. * @data: pointer to user output data
  309. * @length: size of user output data
  310. *
  311. * Returns 0 on success or -EFAULT.
  312. */
  313. static int convert_type80(struct zcrypt_queue *zq,
  314. struct ap_message *reply,
  315. char __user *outputdata,
  316. unsigned int outputdatalength)
  317. {
  318. struct type80_hdr *t80h = reply->msg;
  319. unsigned char *data;
  320. if (t80h->len < sizeof(*t80h) + outputdatalength) {
  321. /* The result is too short, the CEXxA card may not do that.. */
  322. zq->online = 0;
  323. pr_err("Crypto dev=%02x.%04x code=0x%02x => online=0 rc=EAGAIN\n",
  324. AP_QID_CARD(zq->queue->qid),
  325. AP_QID_QUEUE(zq->queue->qid),
  326. t80h->code);
  327. ZCRYPT_DBF_ERR("dev=%02x.%04x code=0x%02x => online=0 rc=EAGAIN\n",
  328. AP_QID_CARD(zq->queue->qid),
  329. AP_QID_QUEUE(zq->queue->qid),
  330. t80h->code);
  331. return -EAGAIN;
  332. }
  333. if (zq->zcard->user_space_type == ZCRYPT_CEX2A)
  334. BUG_ON(t80h->len > CEX2A_MAX_RESPONSE_SIZE);
  335. else
  336. BUG_ON(t80h->len > CEX3A_MAX_RESPONSE_SIZE);
  337. data = reply->msg + t80h->len - outputdatalength;
  338. if (copy_to_user(outputdata, data, outputdatalength))
  339. return -EFAULT;
  340. return 0;
  341. }
  342. static int convert_response_cex2a(struct zcrypt_queue *zq,
  343. struct ap_message *reply,
  344. char __user *outputdata,
  345. unsigned int outputdatalength)
  346. {
  347. /* Response type byte is the second byte in the response. */
  348. unsigned char rtype = ((unsigned char *) reply->msg)[1];
  349. switch (rtype) {
  350. case TYPE82_RSP_CODE:
  351. case TYPE88_RSP_CODE:
  352. return convert_error(zq, reply);
  353. case TYPE80_RSP_CODE:
  354. return convert_type80(zq, reply,
  355. outputdata, outputdatalength);
  356. default: /* Unknown response type, this should NEVER EVER happen */
  357. zq->online = 0;
  358. pr_err("Crypto dev=%02x.%04x unknown response type 0x%02x => online=0 rc=EAGAIN\n",
  359. AP_QID_CARD(zq->queue->qid),
  360. AP_QID_QUEUE(zq->queue->qid),
  361. (int) rtype);
  362. ZCRYPT_DBF_ERR("dev=%02x.%04x unknown response type 0x%02x => online=0 rc=EAGAIN\n",
  363. AP_QID_CARD(zq->queue->qid),
  364. AP_QID_QUEUE(zq->queue->qid),
  365. (int) rtype);
  366. return -EAGAIN;
  367. }
  368. }
  369. /**
  370. * This function is called from the AP bus code after a crypto request
  371. * "msg" has finished with the reply message "reply".
  372. * It is called from tasklet context.
  373. * @aq: pointer to the AP device
  374. * @msg: pointer to the AP message
  375. * @reply: pointer to the AP reply message
  376. */
  377. static void zcrypt_cex2a_receive(struct ap_queue *aq,
  378. struct ap_message *msg,
  379. struct ap_message *reply)
  380. {
  381. static struct error_hdr error_reply = {
  382. .type = TYPE82_RSP_CODE,
  383. .reply_code = REP82_ERROR_MACHINE_FAILURE,
  384. };
  385. struct type80_hdr *t80h;
  386. int len;
  387. /* Copy the reply message to the request message buffer. */
  388. if (!reply)
  389. goto out; /* ap_msg->rc indicates the error */
  390. t80h = reply->msg;
  391. if (t80h->type == TYPE80_RSP_CODE) {
  392. if (aq->ap_dev.device_type == AP_DEVICE_TYPE_CEX2A)
  393. len = min_t(int, CEX2A_MAX_RESPONSE_SIZE, t80h->len);
  394. else
  395. len = min_t(int, CEX3A_MAX_RESPONSE_SIZE, t80h->len);
  396. memcpy(msg->msg, reply->msg, len);
  397. } else
  398. memcpy(msg->msg, reply->msg, sizeof(error_reply));
  399. out:
  400. complete((struct completion *) msg->private);
  401. }
  402. static atomic_t zcrypt_step = ATOMIC_INIT(0);
  403. /**
  404. * The request distributor calls this function if it picked the CEXxA
  405. * device to handle a modexpo request.
  406. * @zq: pointer to zcrypt_queue structure that identifies the
  407. * CEXxA device to the request distributor
  408. * @mex: pointer to the modexpo request buffer
  409. */
  410. static long zcrypt_cex2a_modexpo(struct zcrypt_queue *zq,
  411. struct ica_rsa_modexpo *mex,
  412. struct ap_message *ap_msg)
  413. {
  414. struct completion work;
  415. int rc;
  416. if (zq->zcard->user_space_type == ZCRYPT_CEX2A)
  417. ap_msg->msg = kmalloc(MSGTYPE50_CRB2_MAX_MSG_SIZE, GFP_KERNEL);
  418. else
  419. ap_msg->msg = kmalloc(MSGTYPE50_CRB3_MAX_MSG_SIZE, GFP_KERNEL);
  420. if (!ap_msg->msg)
  421. return -ENOMEM;
  422. ap_msg->receive = zcrypt_cex2a_receive;
  423. ap_msg->psmid = (((unsigned long long) current->pid) << 32) +
  424. atomic_inc_return(&zcrypt_step);
  425. ap_msg->private = &work;
  426. rc = ICAMEX_msg_to_type50MEX_msg(zq, ap_msg, mex);
  427. if (rc)
  428. goto out;
  429. init_completion(&work);
  430. rc = ap_queue_message(zq->queue, ap_msg);
  431. if (rc)
  432. goto out;
  433. rc = wait_for_completion_interruptible(&work);
  434. if (rc == 0) {
  435. rc = ap_msg->rc;
  436. if (rc == 0)
  437. rc = convert_response_cex2a(zq, ap_msg,
  438. mex->outputdata,
  439. mex->outputdatalength);
  440. } else
  441. /* Signal pending. */
  442. ap_cancel_message(zq->queue, ap_msg);
  443. out:
  444. ap_msg->private = NULL;
  445. return rc;
  446. }
  447. /**
  448. * The request distributor calls this function if it picked the CEXxA
  449. * device to handle a modexpo_crt request.
  450. * @zq: pointer to zcrypt_queue structure that identifies the
  451. * CEXxA device to the request distributor
  452. * @crt: pointer to the modexpoc_crt request buffer
  453. */
  454. static long zcrypt_cex2a_modexpo_crt(struct zcrypt_queue *zq,
  455. struct ica_rsa_modexpo_crt *crt,
  456. struct ap_message *ap_msg)
  457. {
  458. struct completion work;
  459. int rc;
  460. if (zq->zcard->user_space_type == ZCRYPT_CEX2A)
  461. ap_msg->msg = kmalloc(MSGTYPE50_CRB2_MAX_MSG_SIZE, GFP_KERNEL);
  462. else
  463. ap_msg->msg = kmalloc(MSGTYPE50_CRB3_MAX_MSG_SIZE, GFP_KERNEL);
  464. if (!ap_msg->msg)
  465. return -ENOMEM;
  466. ap_msg->receive = zcrypt_cex2a_receive;
  467. ap_msg->psmid = (((unsigned long long) current->pid) << 32) +
  468. atomic_inc_return(&zcrypt_step);
  469. ap_msg->private = &work;
  470. rc = ICACRT_msg_to_type50CRT_msg(zq, ap_msg, crt);
  471. if (rc)
  472. goto out;
  473. init_completion(&work);
  474. rc = ap_queue_message(zq->queue, ap_msg);
  475. if (rc)
  476. goto out;
  477. rc = wait_for_completion_interruptible(&work);
  478. if (rc == 0) {
  479. rc = ap_msg->rc;
  480. if (rc == 0)
  481. rc = convert_response_cex2a(zq, ap_msg,
  482. crt->outputdata,
  483. crt->outputdatalength);
  484. } else
  485. /* Signal pending. */
  486. ap_cancel_message(zq->queue, ap_msg);
  487. out:
  488. ap_msg->private = NULL;
  489. return rc;
  490. }
  491. /**
  492. * The crypto operations for message type 50.
  493. */
  494. static struct zcrypt_ops zcrypt_msgtype50_ops = {
  495. .rsa_modexpo = zcrypt_cex2a_modexpo,
  496. .rsa_modexpo_crt = zcrypt_cex2a_modexpo_crt,
  497. .owner = THIS_MODULE,
  498. .name = MSGTYPE50_NAME,
  499. .variant = MSGTYPE50_VARIANT_DEFAULT,
  500. };
  501. void __init zcrypt_msgtype50_init(void)
  502. {
  503. zcrypt_msgtype_register(&zcrypt_msgtype50_ops);
  504. }
  505. void __exit zcrypt_msgtype50_exit(void)
  506. {
  507. zcrypt_msgtype_unregister(&zcrypt_msgtype50_ops);
  508. }