blob: c2786ee5afd5468808652fe64d2e55635a6bd501 [file] [log] [blame]
Damjan Marion91f17dc2019-03-18 18:59:25 +01001/*
2 * Copyright (c) 2019 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include <stdbool.h>
17#include <vlib/vlib.h>
18#include <vnet/crypto/crypto.h>
19
20u8 *
21format_vnet_crypto_alg (u8 * s, va_list * args)
22{
23 vnet_crypto_alg_t alg = va_arg (*args, vnet_crypto_alg_t);
24 vnet_crypto_main_t *cm = &crypto_main;
25 vnet_crypto_alg_data_t *d = vec_elt_at_index (cm->algs, alg);
26 return format (s, "%s", d->name);
27}
28
29u8 *
30format_vnet_crypto_op (u8 * s, va_list * args)
31{
32 vnet_crypto_main_t *cm = &crypto_main;
Damjan Mariond709cbc2019-03-26 13:16:42 +010033 vnet_crypto_op_type_t op = va_arg (*args, int); // vnet_crypto_op_type_t);
Damjan Marion91f17dc2019-03-18 18:59:25 +010034 vnet_crypto_op_type_data_t *otd = cm->opt_data + op;
35
36 return format (s, "%s-%U", otd->desc, format_vnet_crypto_alg, otd->alg);
37}
38
39u8 *
40format_vnet_crypto_engine (u8 * s, va_list * args)
41{
42 vnet_crypto_main_t *cm = &crypto_main;
43 u32 crypto_engine_index = va_arg (*args, u32);
44 vnet_crypto_engine_t *e;
45
46 if (crypto_engine_index == ~0)
47 return s;
48
49 e = vec_elt_at_index (cm->engines, crypto_engine_index);
50
51 return format (s, "%s", e->name);
52}
53
54
55/*
56 * fd.io coding-style-patch-verification: ON
57 *
58 * Local Variables:
59 * eval: (c-set-style "gnu")
60 * End:
61 */