ipsec.h (3988B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_IPSEC_H__ 14 #define __BCM_IPSEC_H__ 15 16 #include <bcm/types.h> 17 18 typedef struct bcm_ipsec_config_s { 19 uint32 num_of_ipsec_channels; 20 uint32 num_of_bfd_channels; 21 } bcm_ipsec_config_t; 22 23 #ifndef BCM_HIDE_DISPATCHABLE 24 25 /* configure the IPSEC feature. */ 26 extern int bcm_ipsec_config_set( 27 int unit, 28 bcm_ipsec_config_t *config); 29 30 #endif /* BCM_HIDE_DISPATCHABLE */ 31 32 typedef struct bcm_ipsec_tunnel_info_s { 33 uint32 context_id; 34 bcm_ipv4_ipv6_addr_t local_ip; /* Local tunnel endpoint; IPV4 or IPV6 */ 35 bcm_ipv4_ipv6_addr_t remote_ip; /* Remote tunnel endpoint; IPV4 or IPV6 */ 36 uint32 protocol; /* Tunnel protocol; IPV4 or IPV6 */ 37 uint8 ttl; 38 uint8 dscp; 39 bcm_port_t port; /* Port id will determine the lif port for 40 ipsec output packets */ 41 } bcm_ipsec_tunnel_info_t; 42 43 #ifndef BCM_HIDE_DISPATCHABLE 44 45 /* This API will be used to add an IPSEC Tunnel from BRCM data plane. */ 46 extern int bcm_ipsec_tunnel_create( 47 int unit, 48 uint32 flags, 49 uint32 *tunnel_id, 50 bcm_ipsec_tunnel_info_t *tunnel_info); 51 52 /* This API will be used to delete an IPSEC Tunnel from BRCM data plane. */ 53 extern int bcm_ipsec_tunnel_delete( 54 int unit, 55 uint32 flags, 56 uint32 tunnel_id); 57 58 #endif /* BCM_HIDE_DISPATCHABLE */ 59 60 typedef enum bcm_ipsec_algo_type_e { 61 bcmEncNone = 0, 62 bcmAES128 = 1, 63 bcmAES256 = 2 64 } bcm_ipsec_algo_type_t; 65 66 typedef enum bcm_ipsec_auth_type_e { 67 bcmAuthNone = 0, 68 bcmSHA1 = 1, 69 bcmSHA256 = 2 70 } bcm_ipsec_auth_type_t; 71 72 typedef enum bcm_ipsec_direction_e { 73 bcmENCRYPTION = 0, 74 bcmDECRYPTION = 1 75 } bcm_ipsec_direction_t; 76 77 typedef struct bcm_ipsec_sa_info_s { 78 uint32 initial_seq_num; 79 uint32 mtu; 80 uint8 fragmentation_enable; 81 bcm_ipsec_algo_type_t encrypt_type; 82 bcm_ipsec_auth_type_t auth_type; 83 bcm_ipsec_direction_t sa_direction; 84 uint32 spi; 85 } bcm_ipsec_sa_info_t; 86 87 #ifndef BCM_HIDE_DISPATCHABLE 88 89 /* 90 * This API will be used to add an IPSEC SA (In SA or Out SA) to BRCM 91 * data plane and to associate the SA to the IPSEC program in PRGE. 92 */ 93 extern int bcm_ipsec_sa_create( 94 int unit, 95 uint32 flags, 96 uint32 *sa_id, 97 bcm_ipsec_sa_info_t *sa); 98 99 #endif /* BCM_HIDE_DISPATCHABLE */ 100 101 #define BCM_IPSEC_MAX_ENCR_KEY_LEN 256 102 103 #define BCM_IPSEC_MAX_AUTH_KEY_LEN 256 104 105 #define BCM_IPSEC_ENCR_KEY_MAX_NUM_WORDS 8 106 #define BCM_IPSEC_AUTH_KEY_MAX_NUM_WORDS 8 107 108 #define BCM_IPSEC_SA_CREATE_WITH_ID 1 << 0 /* IPSEC SA create API optional 109 flags. */ 110 111 #define BCM_IPSEC_TUNNEL_CREATE_WITH_ID 1 << 0 /* IPSEC TUNNEL create API 112 optional flags. */ 113 114 typedef struct bcm_ipsec_sa_keys_s { 115 uint32 enc_key[BCM_IPSEC_ENCR_KEY_MAX_NUM_WORDS]; 116 uint32 auth_key[BCM_IPSEC_AUTH_KEY_MAX_NUM_WORDS]; 117 } bcm_ipsec_sa_keys_t; 118 119 #ifndef BCM_HIDE_DISPATCHABLE 120 121 /* This API will be used to update keys for the IPSEC SA. */ 122 extern int bcm_ipsec_sa_key_update( 123 int unit, 124 uint32 flags, 125 uint32 sa_id, 126 bcm_ipsec_sa_keys_t *sa_keys); 127 128 /* This API will be used to delete an IPSEC SA from BRCM data plane. */ 129 extern int bcm_ipsec_sa_delete( 130 int unit, 131 uint32 flags, 132 uint32 sa_id); 133 134 /* This API will be map the sa to policy. */ 135 extern int bcm_ipsec_sa_to_tunnel_map_set( 136 int unit, 137 uint32 tunnel_id, 138 uint32 sa_id); 139 140 extern int bcm_ipsec_sa_to_tunnel_map_get( 141 int unit, 142 uint32 sa_id, 143 uint32 *tunnel_id); 144 145 #endif /* BCM_HIDE_DISPATCHABLE */ 146 147 #endif /* __BCM_IPSEC_H__ */