summaryrefslogtreecommitdiffstats
path: root/ncr-key-wrap.c
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-08-24 20:56:09 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-08-24 22:07:12 +0200
commit1ba66cab0563708d551e3462c249f1da21695882 (patch)
treecdfdf543d99a54c62b8440e873e6543244a5a8f8 /ncr-key-wrap.c
parentf9b9503e757b5fc69ab93bc1e4f7e80de85f0831 (diff)
downloadcryptodev-linux-1ba66cab0563708d551e3462c249f1da21695882.tar.gz
cryptodev-linux-1ba66cab0563708d551e3462c249f1da21695882.tar.xz
cryptodev-linux-1ba66cab0563708d551e3462c249f1da21695882.zip
Make it possible to import private keys
Diffstat (limited to 'ncr-key-wrap.c')
-rw-r--r--ncr-key-wrap.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ncr-key-wrap.c b/ncr-key-wrap.c
index eea252e..0f9f0fe 100644
--- a/ncr-key-wrap.c
+++ b/ncr-key-wrap.c
@@ -39,8 +39,10 @@ typedef uint8_t val64_t[8];
static const val64_t initA = "\xA6\xA6\xA6\xA6\xA6\xA6\xA6\xA6";
static int key_to_packed_data( uint8_t** sdata, size_t * sdata_size, const struct key_item_st *key);
-static int key_from_packed_data(ncr_algorithm_t algorithm, unsigned int flags,
- struct key_item_st* key, const void* data, size_t data_size);
+static int key_from_packed_data(ncr_algorithm_t algorithm,
+ ncr_key_type_t key_type, unsigned int flags,
+ struct key_item_st* key, const void* data,
+ size_t data_size);
static void val64_xor( val64_t val, uint32_t x)
@@ -303,8 +305,10 @@ size_t sdata_size = KEY_DATA_MAX_SIZE;
goto fail;
}
- ret = key_from_packed_data(wrap_st->wrapped_key_algorithm, wrap_st->wrapped_key_flags,
- output, sdata, sdata_size);
+ ret = key_from_packed_data(wrap_st->wrapped_key_algorithm,
+ wrap_st->wrapped_key_type,
+ wrap_st->wrapped_key_flags, output, sdata,
+ sdata_size);
if (ret < 0) {
err();
goto fail;
@@ -852,8 +856,10 @@ fail:
return ret;
}
-static int key_from_packed_data(ncr_algorithm_t algorithm, unsigned int flags,
- struct key_item_st* key, const void* data, size_t data_size)
+static int key_from_packed_data(ncr_algorithm_t algorithm,
+ ncr_key_type_t key_type, unsigned int flags,
+ struct key_item_st* key, const void* data,
+ size_t data_size)
{
int ret;
@@ -868,7 +874,7 @@ static int key_from_packed_data(ncr_algorithm_t algorithm, unsigned int flags,
return -EINVAL;
}
- key->type = key->algorithm->key_type;
+ key->type = key_type;
ret = ncr_key_assign_flags(key, flags);
if (ret != 0) {
err();