Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
crypto crypto-openssl: support hashing operations
[vpp.git]
/
src
/
plugins
/
unittest
/
crypto_test.c
diff --git
a/src/plugins/unittest/crypto_test.c
b/src/plugins/unittest/crypto_test.c
index
16c87a2
..
ed21e86
100644
(file)
--- a/
src/plugins/unittest/crypto_test.c
+++ b/
src/plugins/unittest/crypto_test.c
@@
-75,6
+75,9
@@
print_results (vlib_main_t * vm, unittest_crypto_test_registration_t ** rv,
case VNET_CRYPTO_OP_TYPE_HMAC:
exp_digest = &r->digest;
break;
case VNET_CRYPTO_OP_TYPE_HMAC:
exp_digest = &r->digest;
break;
+ case VNET_CRYPTO_OP_TYPE_HASH:
+ exp_digest = &r->digest;
+ break;
default:
ASSERT (0);
}
default:
ASSERT (0);
}
@@
-207,7
+210,6
@@
generate_digest (vlib_main_t * vm,
static int
restore_engines (u32 * engs)
{
static int
restore_engines (u32 * engs)
{
- return 0;
vnet_crypto_main_t *cm = &crypto_main;
u32 i;
vnet_crypto_engine_t *ce;
vnet_crypto_main_t *cm = &crypto_main;
u32 i;
vnet_crypto_engine_t *ce;
@@
-230,7
+232,6
@@
restore_engines (u32 * engs)
static int
save_current_engines (u32 * engs)
{
static int
save_current_engines (u32 * engs)
{
- return 0;
vnet_crypto_main_t *cm = &crypto_main;
uword *p;
u32 i;
vnet_crypto_main_t *cm = &crypto_main;
uword *p;
u32 i;
@@
-536,6
+537,7
@@
test_crypto_static (vlib_main_t * vm, crypto_test_main_t * tm,
op->chunk_index = vec_len (chunks);
while (pt->data)
{
op->chunk_index = vec_len (chunks);
while (pt->data)
{
+ clib_memset (&ch, 0, sizeof (ch));
ch.src = pt->data;
ch.len = pt->length;
ch.dst = computed_data + computed_data_total_len;
ch.src = pt->data;
ch.len = pt->length;
ch.dst = computed_data + computed_data_total_len;
@@
-554,6
+556,7
@@
test_crypto_static (vlib_main_t * vm, crypto_test_main_t * tm,
op->chunk_index = vec_len (chunks);
while (ct->data)
{
op->chunk_index = vec_len (chunks);
while (ct->data)
{
+ clib_memset (&ch, 0, sizeof (ch));
ch.src = ct->data;
ch.len = ct->length;
ch.dst = computed_data + computed_data_total_len;
ch.src = ct->data;
ch.len = ct->length;
ch.dst = computed_data + computed_data_total_len;
@@
-608,6
+611,7
@@
test_crypto_static (vlib_main_t * vm, crypto_test_main_t * tm,
op->chunk_index = vec_len (chunks);
while (pt->data)
{
op->chunk_index = vec_len (chunks);
while (pt->data)
{
+ clib_memset (&ch, 0, sizeof (ch));
ch.src = pt->data;
ch.len = pt->length;
vec_add1 (chunks, ch);
ch.src = pt->data;
ch.len = pt->length;
vec_add1 (chunks, ch);
@@
-628,6
+632,12
@@
test_crypto_static (vlib_main_t * vm, crypto_test_main_t * tm,
op->len = r->plaintext.length;
}
break;
op->len = r->plaintext.length;
}
break;
+ case VNET_CRYPTO_OP_TYPE_HASH:
+ op->digest = computed_data + computed_data_total_len;
+ computed_data_total_len += r->digest.length;
+ op->src = r->plaintext.data;
+ op->len = r->plaintext.length;
+ break;
default:
break;
};
default:
break;
};
@@
-801,6
+811,10
@@
test_crypto (vlib_main_t * vm, crypto_test_main_t * tm)
n_ops_static += 1;
}
break;
n_ops_static += 1;
}
break;
+ case VNET_CRYPTO_OP_TYPE_HASH:
+ computed_data_total_len += r->digest.length;
+ n_ops_static += 1;
+ break;
default:
break;
};
default:
break;
};