pdb.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * CAAM Protocol Data Block (PDB) definition header file
  4. *
  5. * Copyright 2008-2016 Freescale Semiconductor, Inc.
  6. *
  7. */
  8. #ifndef CAAM_PDB_H
  9. #define CAAM_PDB_H
  10. #include "compat.h"
  11. /*
  12. * PDB- IPSec ESP Header Modification Options
  13. */
  14. #define PDBHMO_ESP_DECAP_SHIFT 28
  15. #define PDBHMO_ESP_ENCAP_SHIFT 28
  16. /*
  17. * Encap and Decap - Decrement TTL (Hop Limit) - Based on the value of the
  18. * Options Byte IP version (IPvsn) field:
  19. * if IPv4, decrement the inner IP header TTL field (byte 8);
  20. * if IPv6 decrement the inner IP header Hop Limit field (byte 7).
  21. */
  22. #define PDBHMO_ESP_DECAP_DEC_TTL (0x02 << PDBHMO_ESP_DECAP_SHIFT)
  23. #define PDBHMO_ESP_ENCAP_DEC_TTL (0x02 << PDBHMO_ESP_ENCAP_SHIFT)
  24. /*
  25. * Decap - DiffServ Copy - Copy the IPv4 TOS or IPv6 Traffic Class byte
  26. * from the outer IP header to the inner IP header.
  27. */
  28. #define PDBHMO_ESP_DIFFSERV (0x01 << PDBHMO_ESP_DECAP_SHIFT)
  29. /*
  30. * Encap- Copy DF bit -if an IPv4 tunnel mode outer IP header is coming from
  31. * the PDB, copy the DF bit from the inner IP header to the outer IP header.
  32. */
  33. #define PDBHMO_ESP_DFBIT (0x04 << PDBHMO_ESP_ENCAP_SHIFT)
  34. #define PDBNH_ESP_ENCAP_SHIFT 16
  35. #define PDBNH_ESP_ENCAP_MASK (0xff << PDBNH_ESP_ENCAP_SHIFT)
  36. #define PDBHDRLEN_ESP_DECAP_SHIFT 16
  37. #define PDBHDRLEN_MASK (0x0fff << PDBHDRLEN_ESP_DECAP_SHIFT)
  38. #define PDB_NH_OFFSET_SHIFT 8
  39. #define PDB_NH_OFFSET_MASK (0xff << PDB_NH_OFFSET_SHIFT)
  40. /*
  41. * PDB - IPSec ESP Encap/Decap Options
  42. */
  43. #define PDBOPTS_ESP_ARSNONE 0x00 /* no antireplay window */
  44. #define PDBOPTS_ESP_ARS32 0x40 /* 32-entry antireplay window */
  45. #define PDBOPTS_ESP_ARS128 0x80 /* 128-entry antireplay window */
  46. #define PDBOPTS_ESP_ARS64 0xc0 /* 64-entry antireplay window */
  47. #define PDBOPTS_ESP_ARS_MASK 0xc0 /* antireplay window mask */
  48. #define PDBOPTS_ESP_IVSRC 0x20 /* IV comes from internal random gen */
  49. #define PDBOPTS_ESP_ESN 0x10 /* extended sequence included */
  50. #define PDBOPTS_ESP_OUTFMT 0x08 /* output only decapsulation (decap) */
  51. #define PDBOPTS_ESP_IPHDRSRC 0x08 /* IP header comes from PDB (encap) */
  52. #define PDBOPTS_ESP_INCIPHDR 0x04 /* Prepend IP header to output frame */
  53. #define PDBOPTS_ESP_IPVSN 0x02 /* process IPv6 header */
  54. #define PDBOPTS_ESP_AOFL 0x04 /* adjust out frame len (decap, SEC>=5.3)*/
  55. #define PDBOPTS_ESP_TUNNEL 0x01 /* tunnel mode next-header byte */
  56. #define PDBOPTS_ESP_IPV6 0x02 /* ip header version is V6 */
  57. #define PDBOPTS_ESP_DIFFSERV 0x40 /* copy TOS/TC from inner iphdr */
  58. #define PDBOPTS_ESP_UPDATE_CSUM 0x80 /* encap-update ip header checksum */
  59. #define PDBOPTS_ESP_VERIFY_CSUM 0x20 /* decap-validate ip header checksum */
  60. /*
  61. * General IPSec encap/decap PDB definitions
  62. */
  63. /**
  64. * ipsec_encap_cbc - PDB part for IPsec CBC encapsulation
  65. * @iv: 16-byte array initialization vector
  66. */
  67. struct ipsec_encap_cbc {
  68. u8 iv[16];
  69. };
  70. /**
  71. * ipsec_encap_ctr - PDB part for IPsec CTR encapsulation
  72. * @ctr_nonce: 4-byte array nonce
  73. * @ctr_initial: initial count constant
  74. * @iv: initialization vector
  75. */
  76. struct ipsec_encap_ctr {
  77. u8 ctr_nonce[4];
  78. u32 ctr_initial;
  79. u64 iv;
  80. };
  81. /**
  82. * ipsec_encap_ccm - PDB part for IPsec CCM encapsulation
  83. * @salt: 3-byte array salt (lower 24 bits)
  84. * @ccm_opt: CCM algorithm options - MSB-LSB description:
  85. * b0_flags (8b) - CCM B0; use 0x5B for 8-byte ICV, 0x6B for 12-byte ICV,
  86. * 0x7B for 16-byte ICV (cf. RFC4309, RFC3610)
  87. * ctr_flags (8b) - counter flags; constant equal to 0x3
  88. * ctr_initial (16b) - initial count constant
  89. * @iv: initialization vector
  90. */
  91. struct ipsec_encap_ccm {
  92. u8 salt[4];
  93. u32 ccm_opt;
  94. u64 iv;
  95. };
  96. /**
  97. * ipsec_encap_gcm - PDB part for IPsec GCM encapsulation
  98. * @salt: 3-byte array salt (lower 24 bits)
  99. * @rsvd: reserved, do not use
  100. * @iv: initialization vector
  101. */
  102. struct ipsec_encap_gcm {
  103. u8 salt[4];
  104. u32 rsvd1;
  105. u64 iv;
  106. };
  107. /**
  108. * ipsec_encap_pdb - PDB for IPsec encapsulation
  109. * @options: MSB-LSB description
  110. * hmo (header manipulation options) - 4b
  111. * reserved - 4b
  112. * next header - 8b
  113. * next header offset - 8b
  114. * option flags (depend on selected algorithm) - 8b
  115. * @seq_num_ext_hi: (optional) IPsec Extended Sequence Number (ESN)
  116. * @seq_num: IPsec sequence number
  117. * @spi: IPsec SPI (Security Parameters Index)
  118. * @ip_hdr_len: optional IP Header length (in bytes)
  119. * reserved - 16b
  120. * Opt. IP Hdr Len - 16b
  121. * @ip_hdr: optional IP Header content
  122. */
  123. struct ipsec_encap_pdb {
  124. u32 options;
  125. u32 seq_num_ext_hi;
  126. u32 seq_num;
  127. union {
  128. struct ipsec_encap_cbc cbc;
  129. struct ipsec_encap_ctr ctr;
  130. struct ipsec_encap_ccm ccm;
  131. struct ipsec_encap_gcm gcm;
  132. };
  133. u32 spi;
  134. u32 ip_hdr_len;
  135. u32 ip_hdr[0];
  136. };
  137. /**
  138. * ipsec_decap_cbc - PDB part for IPsec CBC decapsulation
  139. * @rsvd: reserved, do not use
  140. */
  141. struct ipsec_decap_cbc {
  142. u32 rsvd[2];
  143. };
  144. /**
  145. * ipsec_decap_ctr - PDB part for IPsec CTR decapsulation
  146. * @ctr_nonce: 4-byte array nonce
  147. * @ctr_initial: initial count constant
  148. */
  149. struct ipsec_decap_ctr {
  150. u8 ctr_nonce[4];
  151. u32 ctr_initial;
  152. };
  153. /**
  154. * ipsec_decap_ccm - PDB part for IPsec CCM decapsulation
  155. * @salt: 3-byte salt (lower 24 bits)
  156. * @ccm_opt: CCM algorithm options - MSB-LSB description:
  157. * b0_flags (8b) - CCM B0; use 0x5B for 8-byte ICV, 0x6B for 12-byte ICV,
  158. * 0x7B for 16-byte ICV (cf. RFC4309, RFC3610)
  159. * ctr_flags (8b) - counter flags; constant equal to 0x3
  160. * ctr_initial (16b) - initial count constant
  161. */
  162. struct ipsec_decap_ccm {
  163. u8 salt[4];
  164. u32 ccm_opt;
  165. };
  166. /**
  167. * ipsec_decap_gcm - PDB part for IPsec GCN decapsulation
  168. * @salt: 4-byte salt
  169. * @rsvd: reserved, do not use
  170. */
  171. struct ipsec_decap_gcm {
  172. u8 salt[4];
  173. u32 resvd;
  174. };
  175. /**
  176. * ipsec_decap_pdb - PDB for IPsec decapsulation
  177. * @options: MSB-LSB description
  178. * hmo (header manipulation options) - 4b
  179. * IP header length - 12b
  180. * next header offset - 8b
  181. * option flags (depend on selected algorithm) - 8b
  182. * @seq_num_ext_hi: (optional) IPsec Extended Sequence Number (ESN)
  183. * @seq_num: IPsec sequence number
  184. * @anti_replay: Anti-replay window; size depends on ARS (option flags)
  185. */
  186. struct ipsec_decap_pdb {
  187. u32 options;
  188. union {
  189. struct ipsec_decap_cbc cbc;
  190. struct ipsec_decap_ctr ctr;
  191. struct ipsec_decap_ccm ccm;
  192. struct ipsec_decap_gcm gcm;
  193. };
  194. u32 seq_num_ext_hi;
  195. u32 seq_num;
  196. __be32 anti_replay[4];
  197. };
  198. /*
  199. * IPSec ESP Datapath Protocol Override Register (DPOVRD)
  200. */
  201. struct ipsec_deco_dpovrd {
  202. #define IPSEC_ENCAP_DECO_DPOVRD_USE 0x80
  203. u8 ovrd_ecn;
  204. u8 ip_hdr_len;
  205. u8 nh_offset;
  206. u8 next_header; /* reserved if decap */
  207. };
  208. /*
  209. * IEEE 802.11i WiFi Protocol Data Block
  210. */
  211. #define WIFI_PDBOPTS_FCS 0x01
  212. #define WIFI_PDBOPTS_AR 0x40
  213. struct wifi_encap_pdb {
  214. u16 mac_hdr_len;
  215. u8 rsvd;
  216. u8 options;
  217. u8 iv_flags;
  218. u8 pri;
  219. u16 pn1;
  220. u32 pn2;
  221. u16 frm_ctrl_mask;
  222. u16 seq_ctrl_mask;
  223. u8 rsvd1[2];
  224. u8 cnst;
  225. u8 key_id;
  226. u8 ctr_flags;
  227. u8 rsvd2;
  228. u16 ctr_init;
  229. };
  230. struct wifi_decap_pdb {
  231. u16 mac_hdr_len;
  232. u8 rsvd;
  233. u8 options;
  234. u8 iv_flags;
  235. u8 pri;
  236. u16 pn1;
  237. u32 pn2;
  238. u16 frm_ctrl_mask;
  239. u16 seq_ctrl_mask;
  240. u8 rsvd1[4];
  241. u8 ctr_flags;
  242. u8 rsvd2;
  243. u16 ctr_init;
  244. };
  245. /*
  246. * IEEE 802.16 WiMAX Protocol Data Block
  247. */
  248. #define WIMAX_PDBOPTS_FCS 0x01
  249. #define WIMAX_PDBOPTS_AR 0x40 /* decap only */
  250. struct wimax_encap_pdb {
  251. u8 rsvd[3];
  252. u8 options;
  253. u32 nonce;
  254. u8 b0_flags;
  255. u8 ctr_flags;
  256. u16 ctr_init;
  257. /* begin DECO writeback region */
  258. u32 pn;
  259. /* end DECO writeback region */
  260. };
  261. struct wimax_decap_pdb {
  262. u8 rsvd[3];
  263. u8 options;
  264. u32 nonce;
  265. u8 iv_flags;
  266. u8 ctr_flags;
  267. u16 ctr_init;
  268. /* begin DECO writeback region */
  269. u32 pn;
  270. u8 rsvd1[2];
  271. u16 antireplay_len;
  272. u64 antireplay_scorecard;
  273. /* end DECO writeback region */
  274. };
  275. /*
  276. * IEEE 801.AE MacSEC Protocol Data Block
  277. */
  278. #define MACSEC_PDBOPTS_FCS 0x01
  279. #define MACSEC_PDBOPTS_AR 0x40 /* used in decap only */
  280. struct macsec_encap_pdb {
  281. u16 aad_len;
  282. u8 rsvd;
  283. u8 options;
  284. u64 sci;
  285. u16 ethertype;
  286. u8 tci_an;
  287. u8 rsvd1;
  288. /* begin DECO writeback region */
  289. u32 pn;
  290. /* end DECO writeback region */
  291. };
  292. struct macsec_decap_pdb {
  293. u16 aad_len;
  294. u8 rsvd;
  295. u8 options;
  296. u64 sci;
  297. u8 rsvd1[3];
  298. /* begin DECO writeback region */
  299. u8 antireplay_len;
  300. u32 pn;
  301. u64 antireplay_scorecard;
  302. /* end DECO writeback region */
  303. };
  304. /*
  305. * SSL/TLS/DTLS Protocol Data Blocks
  306. */
  307. #define TLS_PDBOPTS_ARS32 0x40
  308. #define TLS_PDBOPTS_ARS64 0xc0
  309. #define TLS_PDBOPTS_OUTFMT 0x08
  310. #define TLS_PDBOPTS_IV_WRTBK 0x02 /* 1.1/1.2/DTLS only */
  311. #define TLS_PDBOPTS_EXP_RND_IV 0x01 /* 1.1/1.2/DTLS only */
  312. struct tls_block_encap_pdb {
  313. u8 type;
  314. u8 version[2];
  315. u8 options;
  316. u64 seq_num;
  317. u32 iv[4];
  318. };
  319. struct tls_stream_encap_pdb {
  320. u8 type;
  321. u8 version[2];
  322. u8 options;
  323. u64 seq_num;
  324. u8 i;
  325. u8 j;
  326. u8 rsvd1[2];
  327. };
  328. struct dtls_block_encap_pdb {
  329. u8 type;
  330. u8 version[2];
  331. u8 options;
  332. u16 epoch;
  333. u16 seq_num[3];
  334. u32 iv[4];
  335. };
  336. struct tls_block_decap_pdb {
  337. u8 rsvd[3];
  338. u8 options;
  339. u64 seq_num;
  340. u32 iv[4];
  341. };
  342. struct tls_stream_decap_pdb {
  343. u8 rsvd[3];
  344. u8 options;
  345. u64 seq_num;
  346. u8 i;
  347. u8 j;
  348. u8 rsvd1[2];
  349. };
  350. struct dtls_block_decap_pdb {
  351. u8 rsvd[3];
  352. u8 options;
  353. u16 epoch;
  354. u16 seq_num[3];
  355. u32 iv[4];
  356. u64 antireplay_scorecard;
  357. };
  358. /*
  359. * SRTP Protocol Data Blocks
  360. */
  361. #define SRTP_PDBOPTS_MKI 0x08
  362. #define SRTP_PDBOPTS_AR 0x40
  363. struct srtp_encap_pdb {
  364. u8 x_len;
  365. u8 mki_len;
  366. u8 n_tag;
  367. u8 options;
  368. u32 cnst0;
  369. u8 rsvd[2];
  370. u16 cnst1;
  371. u16 salt[7];
  372. u16 cnst2;
  373. u32 rsvd1;
  374. u32 roc;
  375. u32 opt_mki;
  376. };
  377. struct srtp_decap_pdb {
  378. u8 x_len;
  379. u8 mki_len;
  380. u8 n_tag;
  381. u8 options;
  382. u32 cnst0;
  383. u8 rsvd[2];
  384. u16 cnst1;
  385. u16 salt[7];
  386. u16 cnst2;
  387. u16 rsvd1;
  388. u16 seq_num;
  389. u32 roc;
  390. u64 antireplay_scorecard;
  391. };
  392. /*
  393. * DSA/ECDSA Protocol Data Blocks
  394. * Two of these exist: DSA-SIGN, and DSA-VERIFY. They are similar
  395. * except for the treatment of "w" for verify, "s" for sign,
  396. * and the placement of "a,b".
  397. */
  398. #define DSA_PDB_SGF_SHIFT 24
  399. #define DSA_PDB_SGF_MASK (0xff << DSA_PDB_SGF_SHIFT)
  400. #define DSA_PDB_SGF_Q (0x80 << DSA_PDB_SGF_SHIFT)
  401. #define DSA_PDB_SGF_R (0x40 << DSA_PDB_SGF_SHIFT)
  402. #define DSA_PDB_SGF_G (0x20 << DSA_PDB_SGF_SHIFT)
  403. #define DSA_PDB_SGF_W (0x10 << DSA_PDB_SGF_SHIFT)
  404. #define DSA_PDB_SGF_S (0x10 << DSA_PDB_SGF_SHIFT)
  405. #define DSA_PDB_SGF_F (0x08 << DSA_PDB_SGF_SHIFT)
  406. #define DSA_PDB_SGF_C (0x04 << DSA_PDB_SGF_SHIFT)
  407. #define DSA_PDB_SGF_D (0x02 << DSA_PDB_SGF_SHIFT)
  408. #define DSA_PDB_SGF_AB_SIGN (0x02 << DSA_PDB_SGF_SHIFT)
  409. #define DSA_PDB_SGF_AB_VERIFY (0x01 << DSA_PDB_SGF_SHIFT)
  410. #define DSA_PDB_L_SHIFT 7
  411. #define DSA_PDB_L_MASK (0x3ff << DSA_PDB_L_SHIFT)
  412. #define DSA_PDB_N_MASK 0x7f
  413. struct dsa_sign_pdb {
  414. u32 sgf_ln; /* Use DSA_PDB_ defintions per above */
  415. u8 *q;
  416. u8 *r;
  417. u8 *g; /* or Gx,y */
  418. u8 *s;
  419. u8 *f;
  420. u8 *c;
  421. u8 *d;
  422. u8 *ab; /* ECC only */
  423. u8 *u;
  424. };
  425. struct dsa_verify_pdb {
  426. u32 sgf_ln;
  427. u8 *q;
  428. u8 *r;
  429. u8 *g; /* or Gx,y */
  430. u8 *w; /* or Wx,y */
  431. u8 *f;
  432. u8 *c;
  433. u8 *d;
  434. u8 *tmp; /* temporary data block */
  435. u8 *ab; /* only used if ECC processing */
  436. };
  437. /* RSA Protocol Data Block */
  438. #define RSA_PDB_SGF_SHIFT 28
  439. #define RSA_PDB_E_SHIFT 12
  440. #define RSA_PDB_E_MASK (0xFFF << RSA_PDB_E_SHIFT)
  441. #define RSA_PDB_D_SHIFT 12
  442. #define RSA_PDB_D_MASK (0xFFF << RSA_PDB_D_SHIFT)
  443. #define RSA_PDB_Q_SHIFT 12
  444. #define RSA_PDB_Q_MASK (0xFFF << RSA_PDB_Q_SHIFT)
  445. #define RSA_PDB_SGF_F (0x8 << RSA_PDB_SGF_SHIFT)
  446. #define RSA_PDB_SGF_G (0x4 << RSA_PDB_SGF_SHIFT)
  447. #define RSA_PRIV_PDB_SGF_F (0x4 << RSA_PDB_SGF_SHIFT)
  448. #define RSA_PRIV_PDB_SGF_G (0x8 << RSA_PDB_SGF_SHIFT)
  449. #define RSA_PRIV_KEY_FRM_1 0
  450. #define RSA_PRIV_KEY_FRM_2 1
  451. #define RSA_PRIV_KEY_FRM_3 2
  452. /**
  453. * RSA Encrypt Protocol Data Block
  454. * @sgf: scatter-gather field
  455. * @f_dma: dma address of input data
  456. * @g_dma: dma address of encrypted output data
  457. * @n_dma: dma address of RSA modulus
  458. * @e_dma: dma address of RSA public exponent
  459. * @f_len: length in octets of the input data
  460. */
  461. struct rsa_pub_pdb {
  462. u32 sgf;
  463. dma_addr_t f_dma;
  464. dma_addr_t g_dma;
  465. dma_addr_t n_dma;
  466. dma_addr_t e_dma;
  467. u32 f_len;
  468. };
  469. #define SIZEOF_RSA_PUB_PDB (2 * sizeof(u32) + 4 * caam_ptr_sz)
  470. /**
  471. * RSA Decrypt PDB - Private Key Form #1
  472. * @sgf: scatter-gather field
  473. * @g_dma: dma address of encrypted input data
  474. * @f_dma: dma address of output data
  475. * @n_dma: dma address of RSA modulus
  476. * @d_dma: dma address of RSA private exponent
  477. */
  478. struct rsa_priv_f1_pdb {
  479. u32 sgf;
  480. dma_addr_t g_dma;
  481. dma_addr_t f_dma;
  482. dma_addr_t n_dma;
  483. dma_addr_t d_dma;
  484. };
  485. #define SIZEOF_RSA_PRIV_F1_PDB (sizeof(u32) + 4 * caam_ptr_sz)
  486. /**
  487. * RSA Decrypt PDB - Private Key Form #2
  488. * @sgf : scatter-gather field
  489. * @g_dma : dma address of encrypted input data
  490. * @f_dma : dma address of output data
  491. * @d_dma : dma address of RSA private exponent
  492. * @p_dma : dma address of RSA prime factor p of RSA modulus n
  493. * @q_dma : dma address of RSA prime factor q of RSA modulus n
  494. * @tmp1_dma: dma address of temporary buffer. CAAM uses this temporary buffer
  495. * as internal state buffer. It is assumed to be as long as p.
  496. * @tmp2_dma: dma address of temporary buffer. CAAM uses this temporary buffer
  497. * as internal state buffer. It is assumed to be as long as q.
  498. * @p_q_len : length in bytes of first two prime factors of the RSA modulus n
  499. */
  500. struct rsa_priv_f2_pdb {
  501. u32 sgf;
  502. dma_addr_t g_dma;
  503. dma_addr_t f_dma;
  504. dma_addr_t d_dma;
  505. dma_addr_t p_dma;
  506. dma_addr_t q_dma;
  507. dma_addr_t tmp1_dma;
  508. dma_addr_t tmp2_dma;
  509. u32 p_q_len;
  510. };
  511. #define SIZEOF_RSA_PRIV_F2_PDB (2 * sizeof(u32) + 7 * caam_ptr_sz)
  512. /**
  513. * RSA Decrypt PDB - Private Key Form #3
  514. * This is the RSA Chinese Reminder Theorem (CRT) form for two prime factors of
  515. * the RSA modulus.
  516. * @sgf : scatter-gather field
  517. * @g_dma : dma address of encrypted input data
  518. * @f_dma : dma address of output data
  519. * @c_dma : dma address of RSA CRT coefficient
  520. * @p_dma : dma address of RSA prime factor p of RSA modulus n
  521. * @q_dma : dma address of RSA prime factor q of RSA modulus n
  522. * @dp_dma : dma address of RSA CRT exponent of RSA prime factor p
  523. * @dp_dma : dma address of RSA CRT exponent of RSA prime factor q
  524. * @tmp1_dma: dma address of temporary buffer. CAAM uses this temporary buffer
  525. * as internal state buffer. It is assumed to be as long as p.
  526. * @tmp2_dma: dma address of temporary buffer. CAAM uses this temporary buffer
  527. * as internal state buffer. It is assumed to be as long as q.
  528. * @p_q_len : length in bytes of first two prime factors of the RSA modulus n
  529. */
  530. struct rsa_priv_f3_pdb {
  531. u32 sgf;
  532. dma_addr_t g_dma;
  533. dma_addr_t f_dma;
  534. dma_addr_t c_dma;
  535. dma_addr_t p_dma;
  536. dma_addr_t q_dma;
  537. dma_addr_t dp_dma;
  538. dma_addr_t dq_dma;
  539. dma_addr_t tmp1_dma;
  540. dma_addr_t tmp2_dma;
  541. u32 p_q_len;
  542. };
  543. #define SIZEOF_RSA_PRIV_F3_PDB (2 * sizeof(u32) + 9 * caam_ptr_sz)
  544. #endif