2 * IPSEC_GLUE interface code.
3 * Copyright 2002 Intel Corporation All Rights Reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 RCSID $Id: ipsec_sa_glue.h,v 1.0 2003/04/18 09:23:47 rgb Exp $
25 #include <IxCryptoAcc.h>
29 * Constants value for glue code
31 #define IPSEC_GLUE_STATUS_SUCCESS 0
32 #define IPSEC_GLUE_STATUS_FAIL 1
33 #define IPSEC_GLUE_STATUS_NOT_SUPPORTED 2
34 #define IPSEC_GLUE_BITS 8
36 /* SA->ips_crypto_state for valid context */
37 #define IPSEC_GLUE_VALID_CTXID 0
38 /* SA->ips_crypto_state for unsupported SA */
39 #define IPSEC_GLUE_UNSUPPORTED_CTXID 1
40 /* SA->ips_crypto_state intial value */
41 #define IPSEC_GLUE_INIT_CTXID 2
43 /* IPSec cryptoAcc return status */
45 #define IPSEC_SUCCESS 1
47 #define IPSEC_AUTH_FAIL 3
49 /* ICV location in AH */
50 #define AUTH_DATA_IN_AH_OFFSET 12
53 * Initialize the crypto context
57 void ipsec_glue_crypto_ctx_init(void);
65 void ipsec_glue_update_state(struct ipsec_sa *ips,
66 IxCryptoAccStatus state);
69 * Create crypto cipher context from the the freeswan security association
71 * Param: ips [in] Pointer to ipsec security association.
74 * STATUS_SUCCESS - The parameters to create crypto context are valid
75 * STATUS_FAIL - Some of parameters to create crypto cihper context are invalid
77 UINT32 ipsec_glue_create_cipher(struct ipsec_sa *ips);
80 * Create crypto authentication context from the the freeswan security association
82 * Param: ips [in] Pointer to ipsec security association.
85 * STATUS_SUCCESS - The parameters to create authentication context are valid
86 * STATUS_FAIL - Some of parameters to create crypto authentication
89 UINT32 ipsec_glue_create_auth(struct ipsec_sa *ips);
92 * Create crypto context from freeswan security association
94 * Param: ips [in] Pointer to ipsec security association.
97 * STATUS_SUCCESS - Successfully to create crypto context from ipsec
98 * security association
99 * STATUS_FAIL - Failed to create crypto context from ipsec
100 * security association
101 * STATUS_NOT_SUPPORTED - IPSEC protocol not supported (e.g. IPPROTO_COMP)
104 UINT32 ipsec_compose_context(struct ipsec_sa *ips);
107 * Register crypto context with IXP4XX hardware accelarator
108 * Param: ips [in] Pointer to ipsec security association.
111 * STATUS_SUCCESS - Successfully to register crypto context to hardware accelarator
112 * STATUS_FAIL - Failed to register crypto context to hardware accelarator
115 UINT32 ipsec_glue_crypto_context_put(struct ipsec_sa *ips);
118 * Unregister crypto context with hardware accelarator
120 * Param: crypto_context_id [in] crypto context id. The id is given when registration to
121 * hardware accelarator
124 * STATUS_SUCCESS - Ssuccessfully unregister the crypto context Id.
125 * STATUS_FAIL - Unregistration failed for some internal reasons
126 * (detail refer to IxCryptoAcc.h)
129 UINT32 ipsec_glue_crypto_context_del (UINT32 crypto_context_id);
132 * Get the security assication from the mapping table
134 * Param: crypto_context_id [in] crypto context id. The id is given when registration to
135 * hardware accelarator
137 * ips [out] ipsec security association
142 * The tdb table better *NOT* be locked before it is handed in,
143 * or semaphore locks will happen
146 ipsec_glue_sa_get (UINT32 cryptoCtxId);
149 * Crypto context register callback function
151 * Refer to IxCryptoAcc.h for detail.
153 * The tdb table better *NOT* be locked before it is handed in,
154 * or semaphore locks will happen
156 void register_crypto_cb(UINT32 cryptoCtxId, IX_MBUF *empty_mbuf, IxCryptoAccStatus state);
158 #endif /* _IPSEC_GLUE_H */