summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-08-05 23:45:34 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-08-23 20:01:59 +0200
commita575a898c2e9a322e6a0db9cb3e9d0e6f3876c06 (patch)
tree88f80eed213214321a8c35f8415221a7a92a758b
parentdd226b2e01069c3657f6f76c887d7675cc390b20 (diff)
downloadcryptodev-linux-a575a898c2e9a322e6a0db9cb3e9d0e6f3876c06.tar.gz
cryptodev-linux-a575a898c2e9a322e6a0db9cb3e9d0e6f3876c06.tar.xz
cryptodev-linux-a575a898c2e9a322e6a0db9cb3e9d0e6f3876c06.zip
Fix and reenable unwrapping test
-rw-r--r--examples/ncr_lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/ncr_lib.c b/examples/ncr_lib.c
index 26c94c6..c041ca7 100644
--- a/examples/ncr_lib.c
+++ b/examples/ncr_lib.c
@@ -129,7 +129,7 @@ test_ncr_wrap_key(void)
{
ncr_key_t key, key2;
uint8_t data[WRAPPED_KEY_DATA_SIZE];
- ssize_t output_size;
+ ssize_t output_size, data_size;
fprintf(stdout, "Tests on Keys:\n");
@@ -146,6 +146,7 @@ test_ncr_wrap_key(void)
DIAGNOSTIC_CALL(ncr_key_import, key2, DKEY, 16, "ba", 2, NCR_ALG_AES_CBC, NCR_KEY_TYPE_SECRET, NCR_KEY_FLAG_EXPORTABLE|NCR_KEY_FLAG_WRAPPABLE);
/* now try wrapping key2 using key */
DIAGNOSTIC_CALL(ncr_key_wrap, key, NCR_WALG_AES_RFC3394, NULL, key2, data, sizeof(data));
+ data_size = output_size;
if (output_size != 24 || memcmp(data, "\x1F\xA6\x8B\x0A\x81\x12\xB4\x47\xAE\xF3\x4B\xD8\xFB\x5A\x7B\x82\x9D\x3E\x86\x23\x71\xD2\xCF\xE5", 24) != 0) {
DIAGNOSTIC_ERROR("Wrapped data do not match.\nData[%d]: ", (int) output_size);
DIAGNOSTIC_DUMP(data, output_size);
@@ -157,7 +158,7 @@ test_ncr_wrap_key(void)
/* create empty key2 */
DIAGNOSTIC_CALL(ncr_key_init, &key2);
-// DIAGNOSTIC_CALL(ncr_key_unwrap, key, NCR_WALG_AES_RFC3394, NULL, key2, data, sizeof(data));
+ DIAGNOSTIC_CALL(ncr_key_unwrap, key, NCR_WALG_AES_RFC3394, NULL, key2, data, data_size);
/* now export the unwrapped */
#if 0
/* this cannot be performed like that, because unwrap