ipsec: API cleanup
[vpp.git] / src / vnet / ipsec / ipsec_types.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2015-2016 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 option version = "3.0.0";
18
19 import "vnet/ip/ip_types.api";
20
21 /*
22  * @brief Support cryptographic algorithms
23  */
24 enum ipsec_crypto_alg
25 {
26   IPSEC_API_CRYPTO_ALG_NONE = 0,
27   IPSEC_API_CRYPTO_ALG_AES_CBC_128,
28   IPSEC_API_CRYPTO_ALG_AES_CBC_192,
29   IPSEC_API_CRYPTO_ALG_AES_CBC_256,
30   IPSEC_API_CRYPTO_ALG_AES_CTR_128,
31   IPSEC_API_CRYPTO_ALG_AES_CTR_192,
32   IPSEC_API_CRYPTO_ALG_AES_CTR_256,
33   IPSEC_API_CRYPTO_ALG_AES_GCM_128,
34   IPSEC_API_CRYPTO_ALG_AES_GCM_192,
35   IPSEC_API_CRYPTO_ALG_AES_GCM_256,
36   IPSEC_API_CRYPTO_ALG_DES_CBC,
37   IPSEC_API_CRYPTO_ALG_3DES_CBC,
38 };
39
40 /*
41  * @brief Supported Integrity Algorithms
42  */
43 enum ipsec_integ_alg
44 {
45   IPSEC_API_INTEG_ALG_NONE = 0,
46   /* RFC2403 */
47   IPSEC_API_INTEG_ALG_MD5_96,
48   /* RFC2404 */
49   IPSEC_API_INTEG_ALG_SHA1_96,
50   /* draft-ietf-ipsec-ciph-sha-256-00 */
51   IPSEC_API_INTEG_ALG_SHA_256_96,
52   /* RFC4868 */
53   IPSEC_API_INTEG_ALG_SHA_256_128,
54   /* RFC4868 */
55   IPSEC_API_INTEG_ALG_SHA_384_192,
56   /* RFC4868 */
57   IPSEC_API_INTEG_ALG_SHA_512_256,
58 };
59
60 enum ipsec_sad_flags
61 {
62   IPSEC_API_SAD_FLAG_NONE = 0,
63   /* Enable extended sequence numbers */
64   IPSEC_API_SAD_FLAG_USE_ESN = 0x01,
65   /* Enable Anti-replay */
66   IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY = 0x02,
67   /* IPsec tunnel mode if non-zero, else transport mode */
68   IPSEC_API_SAD_FLAG_IS_TUNNEL = 0x04,
69   /* IPsec tunnel mode is IPv6 if non-zero,
70    *  else IPv4 tunnel only valid if is_tunnel is non-zero */
71   IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 = 0x08,
72   /* enable UDP encapsulation for NAT traversal */
73   IPSEC_API_SAD_FLAG_UDP_ENCAP = 0x10,
74   /* IPsec SA is for inbound traffic */
75   IPSEC_API_SAD_FLAG_IS_INBOUND = 0x40,
76 };
77
78 enum ipsec_proto
79 {
80   IPSEC_API_PROTO_ESP = 50,
81   IPSEC_API_PROTO_AH = 51,
82 };
83
84 typedef key
85 {
86   /* the length of the key */
87   u8 length;
88   /* The data for the key */
89   u8 data[128];
90 };
91
92 /** \brief IPsec: Security Association Database entry
93     @param client_index - opaque cookie to identify the sender
94     @param context - sender context, to match reply w/ request
95     @param is_add - add SAD entry if non-zero, else delete
96     @param sad_id - sad id
97     @param spi - security parameter index
98     @param protocol - 0 = AH, 1 = ESP
99     @param crypto_algorithm - a supported crypto algorithm
100     @param crypto_key - crypto keying material
101     @param integrity_algorithm - one of the supported algorithms
102     @param integrity_key - integrity keying material
103     @param tunnel_src_address - IPsec tunnel source address IPv6 if is_tunnel_ipv6 is non-zero, else IPv4. Only valid if is_tunnel is non-zero
104     @param tunnel_dst_address - IPsec tunnel destination address IPv6 if is_tunnel_ipv6 is non-zero, else IPv4. Only valid if is_tunnel is non-zero
105     @param tx_table_id - the FIB id used for encapsulated packets
106     @param salt - for use with counter mode ciphers
107  */
108 typedef ipsec_sad_entry
109 {
110   u32 sad_id;
111
112   u32 spi;
113
114   vl_api_ipsec_proto_t protocol;
115
116   vl_api_ipsec_crypto_alg_t crypto_algorithm;
117   vl_api_key_t crypto_key;
118
119   vl_api_ipsec_integ_alg_t integrity_algorithm;
120   vl_api_key_t integrity_key;
121
122   vl_api_ipsec_sad_flags_t flags;
123
124   vl_api_address_t tunnel_src;
125   vl_api_address_t tunnel_dst;
126   u32 tx_table_id;
127   u32 salt;
128 };
129
130 /*
131  * Local Variables:
132  * eval: (c-set-style "gnu")
133  * End:
134  */