2 * CAAM Protocol Data Block (PDB) definition header file
4 * Copyright 2008-2012 Freescale Semiconductor, Inc.
12 * PDB- IPSec ESP Header Modification Options
14 #define PDBHMO_ESP_DECAP_SHIFT 12
15 #define PDBHMO_ESP_ENCAP_SHIFT 4
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).
22 #define PDBHMO_ESP_DECAP_DEC_TTL (0x02 << PDBHMO_ESP_DECAP_SHIFT)
23 #define PDBHMO_ESP_ENCAP_DEC_TTL (0x02 << PDBHMO_ESP_ENCAP_SHIFT)
25 * Decap - DiffServ Copy - Copy the IPv4 TOS or IPv6 Traffic Class byte
26 * from the outer IP header to the inner IP header.
28 #define PDBHMO_ESP_DIFFSERV (0x01 << PDBHMO_ESP_DECAP_SHIFT)
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.
33 #define PDBHMO_ESP_DFBIT (0x04 << PDBHMO_ESP_ENCAP_SHIFT)
36 * PDB - IPSec ESP Encap/Decap Options
38 #define PDBOPTS_ESP_ARSNONE 0x00 /* no antireplay window */
39 #define PDBOPTS_ESP_ARS32 0x40 /* 32-entry antireplay window */
40 #define PDBOPTS_ESP_ARS64 0xc0 /* 64-entry antireplay window */
41 #define PDBOPTS_ESP_IVSRC 0x20 /* IV comes from internal random gen */
42 #define PDBOPTS_ESP_ESN 0x10 /* extended sequence included */
43 #define PDBOPTS_ESP_OUTFMT 0x08 /* output only decapsulation (decap) */
44 #define PDBOPTS_ESP_IPHDRSRC 0x08 /* IP header comes from PDB (encap) */
45 #define PDBOPTS_ESP_INCIPHDR 0x04 /* Prepend IP header to output frame */
46 #define PDBOPTS_ESP_IPVSN 0x02 /* process IPv6 header */
47 #define PDBOPTS_ESP_AOFL 0x04 /* adjust out frame len (decap, SEC>=5.3)*/
48 #define PDBOPTS_ESP_TUNNEL 0x01 /* tunnel mode next-header byte */
49 #define PDBOPTS_ESP_IPV6 0x02 /* ip header version is V6 */
50 #define PDBOPTS_ESP_DIFFSERV 0x40 /* copy TOS/TC from inner iphdr */
51 #define PDBOPTS_ESP_UPDATE_CSUM 0x80 /* encap-update ip header checksum */
52 #define PDBOPTS_ESP_VERIFY_CSUM 0x20 /* decap-validate ip header checksum */
55 * General IPSec encap/decap PDB definitions
57 struct ipsec_encap_cbc
{
61 struct ipsec_encap_ctr
{
67 struct ipsec_encap_ccm
{
68 u32 salt
; /* lower 24 bits */
75 struct ipsec_encap_gcm
{
76 u32 salt
; /* lower 24 bits */
81 struct ipsec_encap_pdb
{
89 struct ipsec_encap_cbc cbc
;
90 struct ipsec_encap_ctr ctr
;
91 struct ipsec_encap_ccm ccm
;
92 struct ipsec_encap_gcm gcm
;
97 u32 ip_hdr
[0]; /* optional IP Header content */
100 struct ipsec_decap_cbc
{
104 struct ipsec_decap_ctr
{
109 struct ipsec_decap_ccm
{
116 struct ipsec_decap_gcm
{
121 struct ipsec_decap_pdb
{
126 struct ipsec_decap_cbc cbc
;
127 struct ipsec_decap_ctr ctr
;
128 struct ipsec_decap_ccm ccm
;
129 struct ipsec_decap_gcm gcm
;
138 * IPSec ESP Datapath Protocol Override Register (DPOVRD)
140 struct ipsec_deco_dpovrd
{
141 #define IPSEC_ENCAP_DECO_DPOVRD_USE 0x80
145 u8 next_header
; /* reserved if decap */
149 * IEEE 802.11i WiFi Protocol Data Block
151 #define WIFI_PDBOPTS_FCS 0x01
152 #define WIFI_PDBOPTS_AR 0x40
154 struct wifi_encap_pdb
{
172 struct wifi_decap_pdb
{
189 * IEEE 802.16 WiMAX Protocol Data Block
191 #define WIMAX_PDBOPTS_FCS 0x01
192 #define WIMAX_PDBOPTS_AR 0x40 /* decap only */
194 struct wimax_encap_pdb
{
201 /* begin DECO writeback region */
203 /* end DECO writeback region */
206 struct wimax_decap_pdb
{
213 /* begin DECO writeback region */
217 u64 antireplay_scorecard
;
218 /* end DECO writeback region */
222 * IEEE 801.AE MacSEC Protocol Data Block
224 #define MACSEC_PDBOPTS_FCS 0x01
225 #define MACSEC_PDBOPTS_AR 0x40 /* used in decap only */
227 struct macsec_encap_pdb
{
235 /* begin DECO writeback region */
237 /* end DECO writeback region */
240 struct macsec_decap_pdb
{
246 /* begin DECO writeback region */
249 u64 antireplay_scorecard
;
250 /* end DECO writeback region */
254 * SSL/TLS/DTLS Protocol Data Blocks
257 #define TLS_PDBOPTS_ARS32 0x40
258 #define TLS_PDBOPTS_ARS64 0xc0
259 #define TLS_PDBOPTS_OUTFMT 0x08
260 #define TLS_PDBOPTS_IV_WRTBK 0x02 /* 1.1/1.2/DTLS only */
261 #define TLS_PDBOPTS_EXP_RND_IV 0x01 /* 1.1/1.2/DTLS only */
263 struct tls_block_encap_pdb
{
271 struct tls_stream_encap_pdb
{
281 struct dtls_block_encap_pdb
{
290 struct tls_block_decap_pdb
{
297 struct tls_stream_decap_pdb
{
306 struct dtls_block_decap_pdb
{
312 u64 antireplay_scorecard
;
316 * SRTP Protocol Data Blocks
318 #define SRTP_PDBOPTS_MKI 0x08
319 #define SRTP_PDBOPTS_AR 0x40
321 struct srtp_encap_pdb
{
336 struct srtp_decap_pdb
{
349 u64 antireplay_scorecard
;
353 * DSA/ECDSA Protocol Data Blocks
354 * Two of these exist: DSA-SIGN, and DSA-VERIFY. They are similar
355 * except for the treatment of "w" for verify, "s" for sign,
356 * and the placement of "a,b".
358 #define DSA_PDB_SGF_SHIFT 24
359 #define DSA_PDB_SGF_MASK (0xff << DSA_PDB_SGF_SHIFT)
360 #define DSA_PDB_SGF_Q (0x80 << DSA_PDB_SGF_SHIFT)
361 #define DSA_PDB_SGF_R (0x40 << DSA_PDB_SGF_SHIFT)
362 #define DSA_PDB_SGF_G (0x20 << DSA_PDB_SGF_SHIFT)
363 #define DSA_PDB_SGF_W (0x10 << DSA_PDB_SGF_SHIFT)
364 #define DSA_PDB_SGF_S (0x10 << DSA_PDB_SGF_SHIFT)
365 #define DSA_PDB_SGF_F (0x08 << DSA_PDB_SGF_SHIFT)
366 #define DSA_PDB_SGF_C (0x04 << DSA_PDB_SGF_SHIFT)
367 #define DSA_PDB_SGF_D (0x02 << DSA_PDB_SGF_SHIFT)
368 #define DSA_PDB_SGF_AB_SIGN (0x02 << DSA_PDB_SGF_SHIFT)
369 #define DSA_PDB_SGF_AB_VERIFY (0x01 << DSA_PDB_SGF_SHIFT)
371 #define DSA_PDB_L_SHIFT 7
372 #define DSA_PDB_L_MASK (0x3ff << DSA_PDB_L_SHIFT)
374 #define DSA_PDB_N_MASK 0x7f
376 struct dsa_sign_pdb
{
377 u32 sgf_ln
; /* Use DSA_PDB_ defintions per above */
385 u8
*ab
; /* ECC only */
389 struct dsa_verify_pdb
{
398 u8
*tmp
; /* temporary data block */
399 u8
*ab
; /* only used if ECC processing */