No empty .Rs/.Re
[netbsd-mini2440.git] / sys / dev / pci / n8 / common / api / n8_packet.h
blob2a39bd45a32b48648d021929630ae2a8d144c81a
1 /*-
2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
3 * All rights reserved.
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software. Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /*****************************************************************************
36 * @(#) n8_packet.h 1.18@(#)
37 *****************************************************************************/
39 /*****************************************************************************/
40 /** @file n8_packet.h
41 * @brief Contains definitions for Packet Interface.
44 *****************************************************************************/
46 /*****************************************************************************
47 * Revision history:
48 * 08/18/03 brr Eliminate unused parameters.
49 * 07/01/03 brr Added option to use no hashing algorithm.
50 * 05/20/03 brr Added function ptr types for context load & enc/decrypte ops.
51 * 04/17/03 brr Moved key size constants to public include file.
52 * 11/12/01 hml Changed PI_PROTOCOL_* to N8_PROTOCOL_*.
53 * 10/30/01 bac Removed signatures for handleSSL and handleIPsec.
54 * 10/12/01 dkm Moved public portion to n8_pub_common.h and n8_pub_packet.h.
55 * 10/01/01 hml Added multi-unit support.
56 * 09/14/01 msz Moved some values to n8_common.h to remove a circular
57 * include dependency.
58 * 09/07/01 bac Removed unused defines USE_CONTEXT_MEMORY and
59 * DONOT_USE_CONTEXT_MEMORY
60 * 09/06/01 bac Renumbered enums to start with non-zero (BUG #190).
61 * 07/26/01 mel Added N8_RC4_t structure to make SAPI independent from open SSL.
62 * 05/30/01 mel Changed keys and IVs to be a char[] instead of uint32_t[].
63 * 05/23/01 bac Changed macSecret to be a char[] instead of uint32_t[].
64 * 05/21/01 bac Converted to use N8_ContextHandle_t and N8_Packet_t
65 * with integrated cipher and hash packet.
66 * 05/18/01 mel Change declaration hmacKeyLength to uint32_t.
67 * Change comments.
68 * 05/11/01 bac Fixed some merge problems and naming standardization.
69 * 05/10/01 bac Added preCompute values to keyDES_t, macro-ized computation
70 * of PROTOCOL/CIPHER/HASH,
71 * 05/09/01 bac Added useContext to N8_Packet_t.
72 * 05/04/01 mel Change function declaration and name for
73 * N8_PI_PacketInitialize. New name is N8_PacketInitialize
74 * 04/18/01 mel Original version.
75 ****************************************************************************/
77 #ifndef N8_PACKET_H
78 #define N8_PACKET_H
79 #include "n8_common.h"
80 #include "n8_pub_packet.h"
81 #include "n8_hash.h"
83 typedef N8_Status_t (*n8_ctxLoadFcn_t)(API_Request_t *req_p,
84 EA_CMD_BLOCK_t *cb_p,
85 const N8_Packet_t *packetObject_p,
86 const N8_CipherInfo_t *cipherInfo_p,
87 const N8_HashAlgorithm_t hashAlgorithm,
88 N8_Buffer_t *ctx_p,
89 const uint32_t ctx_a,
90 EA_CMD_BLOCK_t **next_cb_pp);
92 typedef N8_Status_t (*n8_SSLTLSFcn_t)(EA_CMD_BLOCK_t *cb_p,
93 N8_Packet_t *packetObj_p,
94 const N8_SSLTLSPacket_t *packet_p,
95 const uint32_t input_a,
96 const uint32_t result_a,
97 const unsigned int opCode);
101 /* protocol mask definitions*/
102 /* SSL */
103 #define PROTOCOL_CIPHER_HASH(PROTO, CIPHER, HASH) \
104 (PROTO | (CIPHER << 4) | (HASH << 8))
105 #define PACKET_SSL_ARC4_MD5 \
106 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_SSL,N8_CIPHER_ARC4,N8_MD5)
107 #define PACKET_SSL_ARC4_SHA1 \
108 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_SSL,N8_CIPHER_ARC4,N8_SHA1)
109 #define PACKET_SSL_DES_MD5 \
110 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_SSL,N8_CIPHER_DES,N8_MD5)
111 #define PACKET_SSL_DES_SHA1 \
112 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_SSL,N8_CIPHER_DES,N8_SHA1)
113 /* TLS */
114 #define PACKET_TLS_ARC4_HMAC_MD5 \
115 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_TLS,N8_CIPHER_ARC4,N8_HMAC_MD5)
116 #define PACKET_TLS_ARC4_HMAC_SHA1 \
117 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_TLS,N8_CIPHER_ARC4,N8_HMAC_SHA1)
118 #define PACKET_TLS_DES_HMAC_MD5 \
119 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_TLS,N8_CIPHER_DES,N8_HMAC_MD5)
120 #define PACKET_TLS_DES_HMAC_SHA1 \
121 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_TLS,N8_CIPHER_DES,N8_HMAC_SHA1)
122 /* IPSec */
123 #define PACKET_IPSEC_DES_HMAC_MD5_96 \
124 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_IPSEC,N8_CIPHER_DES,N8_HMAC_MD5_96)
125 #define PACKET_IPSEC_DES_HMAC_SHA1_96 \
126 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_IPSEC,N8_CIPHER_DES,N8_HMAC_SHA1_96)
127 #define PACKET_IPSEC_DES_HASH_NONE \
128 PROTOCOL_CIPHER_HASH(N8_PROTOCOL_IPSEC,N8_CIPHER_DES,N8_HASH_NONE)
130 #endif /* N8_PACKET_H */