@@ -28,6 +28,12 @@ enum crypto_results_e {
28
28
HW_ERROR
29
29
}
30
30
31
+ enum crypto_mode_e {
32
+ TUNNEL ,
33
+ TRANSPORT ,
34
+ TRANSPORT_NAT_T
35
+ }
36
+
31
37
// / special value to indicate that ICV is after the crypto payload
32
38
#define ICV_AFTER_PAYLOAD ((int <32 >)-1 )
33
39
@@ -122,6 +128,51 @@ extern crypto_accelerator {
122
128
void enable_encrypt <T >(in T enable_auth );
123
129
void enable_decrypt <T >(in T enable_auth );
124
130
131
+ // crypto accelerator runs immediately and returns control flow to the current pipeline
132
+ // stage. The method is responsible for defining the contents of the ESP header,
133
+ // calculating the payload offset and lengths, encrypting the payload appropriately and
134
+ // reparsing the packet. User can decide if to proceed or reinject.
135
+ //
136
+ // Pre-conditions: The parser must have been executed prior to this extern. The packet
137
+ // headers and metadata from the parser are provided as inout params.
138
+ // Post-conditions: The deparser will be executed with encapsulation, the packet bitstream
139
+ // will be updated and encryption will be performed on the payload. The packet will be
140
+ // reparsed and parser states updated.
141
+ // Side-effects: parser states will be re-evaluated if crypto has succeeded.
142
+ //
143
+ // H - inout Headers is the output of the parser block
144
+ // M - inout Metadata is from the parser block and shared with the control
145
+ // T - in enable_auth flag enables authentication check
146
+ // S - in seq is the optional sequence number
147
+ // I - in iv is the initialization vector
148
+ crypto_results_e encrypt_inline <H ,M ,T ,S ,I >(inout H hdr , inout M meta ,
149
+ in crypto_mode_e mode ,
150
+ in T enable_auth ,
151
+ in bit <32 > spi ,
152
+ in S seq ,
153
+ in I iv );
154
+
155
+ // crypto accelerator runs immediately and returns control flow to the current pipeline
156
+ // stage. The method is responsible for decrypting the payload appropriately, removing
157
+ // the ESP header, calculating the payload offset and lengths, and reparsing the packet.
158
+ // The user should then check the status.
159
+ //
160
+ // Pre-conditions: The parser will have been executed prior to this extern. The packet
161
+ // headers and metadata from the parser are provided as inout params.
162
+ // Post-conditions: The deparser will be executed with decapsulation, packet bitstream
163
+ // will be updated and decryption will be performed on the payload. The packet will be
164
+ // reparsed and parser states recalculated.
165
+ // Side-effects - parser states will be re-evaluated if crypto has succeeded.
166
+ //
167
+ // H - inout Headers is the output of the parser block
168
+ // M - inout Metadata is from the parser block and shared with the control
169
+ // T - in enable_auth flag enables authentication check
170
+ // S - in seq is the optional sequence number
171
+ crypto_results_e decrypt_inline <H ,M ,T ,S >(inout H hdr , inout M meta ,
172
+ in crypto_mode_e mode ,
173
+ in T enable_auth ,
174
+ in S seq );
175
+
125
176
// disable crypto engine. Between enable and disable methods,
126
177
// whichever method is called last overrides the previous calls
127
178
void disable ();
0 commit comments