Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pdb.h
Go to the documentation of this file.
1 /*
2  * CAAM Protocol Data Block (PDB) definition header file
3  *
4  * Copyright 2008-2012 Freescale Semiconductor, Inc.
5  *
6  */
7 
8 #ifndef CAAM_PDB_H
9 #define CAAM_PDB_H
10 
11 /*
12  * PDB- IPSec ESP Header Modification Options
13  */
14 #define PDBHMO_ESP_DECAP_SHIFT 12
15 #define PDBHMO_ESP_ENCAP_SHIFT 4
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 
35 /*
36  * PDB - IPSec ESP Encap/Decap Options
37  */
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_TUNNEL 0x01 /* tunnel mode next-header byte */
48 #define PDBOPTS_ESP_IPV6 0x02 /* ip header version is V6 */
49 #define PDBOPTS_ESP_DIFFSERV 0x40 /* copy TOS/TC from inner iphdr */
50 #define PDBOPTS_ESP_UPDATE_CSUM 0x80 /* encap-update ip header checksum */
51 #define PDBOPTS_ESP_VERIFY_CSUM 0x20 /* decap-validate ip header checksum */
52 
53 /*
54  * General IPSec encap/decap PDB definitions
55  */
57  u32 iv[4];
58 };
59 
63  u32 iv[2];
64 };
65 
67  u32 salt; /* lower 24 bits */
71  u32 iv[2];
72 };
73 
75  u32 salt; /* lower 24 bits */
77  u32 iv[2];
78 };
79 
87  union {
92  };
96  u32 ip_hdr[0]; /* optional IP Header content */
97 };
98 
100  u32 rsvd[2];
101 };
102 
106 };
107 
113 };
114 
118 };
119 
124  union {
129  };
134 };
135 
136 /*
137  * IPSec ESP Datapath Protocol Override Register (DPOVRD)
138  */
140 #define IPSEC_ENCAP_DECO_DPOVRD_USE 0x80
144  u8 next_header; /* reserved if decap */
145 };
146 
147 /*
148  * IEEE 802.11i WiFi Protocol Data Block
149  */
150 #define WIFI_PDBOPTS_FCS 0x01
151 #define WIFI_PDBOPTS_AR 0x40
152 
163  u8 rsvd1[2];
169 };
170 
181  u8 rsvd1[4];
185 };
186 
187 /*
188  * IEEE 802.16 WiMAX Protocol Data Block
189  */
190 #define WIMAX_PDBOPTS_FCS 0x01
191 #define WIMAX_PDBOPTS_AR 0x40 /* decap only */
192 
194  u8 rsvd[3];
200  /* begin DECO writeback region */
202  /* end DECO writeback region */
203 };
204 
206  u8 rsvd[3];
212  /* begin DECO writeback region */
214  u8 rsvd1[2];
217  /* end DECO writeback region */
218 };
219 
220 /*
221  * IEEE 801.AE MacSEC Protocol Data Block
222  */
223 #define MACSEC_PDBOPTS_FCS 0x01
224 #define MACSEC_PDBOPTS_AR 0x40 /* used in decap only */
225 
234  /* begin DECO writeback region */
236  /* end DECO writeback region */
237 };
238 
244  u8 rsvd1[3];
245  /* begin DECO writeback region */
249  /* end DECO writeback region */
250 };
251 
252 /*
253  * SSL/TLS/DTLS Protocol Data Blocks
254  */
255 
256 #define TLS_PDBOPTS_ARS32 0x40
257 #define TLS_PDBOPTS_ARS64 0xc0
258 #define TLS_PDBOPTS_OUTFMT 0x08
259 #define TLS_PDBOPTS_IV_WRTBK 0x02 /* 1.1/1.2/DTLS only */
260 #define TLS_PDBOPTS_EXP_RND_IV 0x01 /* 1.1/1.2/DTLS only */
261 
267  u32 iv[4];
268 };
269 
275  u8 i;
276  u8 j;
277  u8 rsvd1[2];
278 };
279 
286  u32 iv[4];
287 };
288 
290  u8 rsvd[3];
293  u32 iv[4];
294 };
295 
297  u8 rsvd[3];
300  u8 i;
301  u8 j;
302  u8 rsvd1[2];
303 };
304 
306  u8 rsvd[3];
310  u32 iv[4];
312 };
313 
314 /*
315  * SRTP Protocol Data Blocks
316  */
317 #define SRTP_PDBOPTS_MKI 0x08
318 #define SRTP_PDBOPTS_AR 0x40
319 
326  u8 rsvd[2];
328  u16 salt[7];
333 };
334 
341  u8 rsvd[2];
343  u16 salt[7];
349 };
350 
351 /*
352  * DSA/ECDSA Protocol Data Blocks
353  * Two of these exist: DSA-SIGN, and DSA-VERIFY. They are similar
354  * except for the treatment of "w" for verify, "s" for sign,
355  * and the placement of "a,b".
356  */
357 #define DSA_PDB_SGF_SHIFT 24
358 #define DSA_PDB_SGF_MASK (0xff << DSA_PDB_SGF_SHIFT)
359 #define DSA_PDB_SGF_Q (0x80 << DSA_PDB_SGF_SHIFT)
360 #define DSA_PDB_SGF_R (0x40 << DSA_PDB_SGF_SHIFT)
361 #define DSA_PDB_SGF_G (0x20 << DSA_PDB_SGF_SHIFT)
362 #define DSA_PDB_SGF_W (0x10 << DSA_PDB_SGF_SHIFT)
363 #define DSA_PDB_SGF_S (0x10 << DSA_PDB_SGF_SHIFT)
364 #define DSA_PDB_SGF_F (0x08 << DSA_PDB_SGF_SHIFT)
365 #define DSA_PDB_SGF_C (0x04 << DSA_PDB_SGF_SHIFT)
366 #define DSA_PDB_SGF_D (0x02 << DSA_PDB_SGF_SHIFT)
367 #define DSA_PDB_SGF_AB_SIGN (0x02 << DSA_PDB_SGF_SHIFT)
368 #define DSA_PDB_SGF_AB_VERIFY (0x01 << DSA_PDB_SGF_SHIFT)
369 
370 #define DSA_PDB_L_SHIFT 7
371 #define DSA_PDB_L_MASK (0x3ff << DSA_PDB_L_SHIFT)
372 
373 #define DSA_PDB_N_MASK 0x7f
374 
375 struct dsa_sign_pdb {
376  u32 sgf_ln; /* Use DSA_PDB_ defintions per above */
377  u8 *q;
378  u8 *r;
379  u8 *g; /* or Gx,y */
380  u8 *s;
381  u8 *f;
382  u8 *c;
383  u8 *d;
384  u8 *ab; /* ECC only */
385  u8 *u;
386 };
387 
390  u8 *q;
391  u8 *r;
392  u8 *g; /* or Gx,y */
393  u8 *w; /* or Wx,y */
394  u8 *f;
395  u8 *c;
396  u8 *d;
397  u8 *tmp; /* temporary data block */
398  u8 *ab; /* only used if ECC processing */
399 };
400 
401 #endif