diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-07 13:56:43 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-07 13:57:11 +0200 |
commit | 32db6ad28c5b3d1a3b8e0094c931522c69f514da (patch) | |
tree | 8deb113caf0308bcaf72d7fb11d2a9bcd032d9f0 /ncr-key-storage.c | |
parent | 115f165b6e3bb74f45e13a65c5f4f82f28664a2c (diff) | |
download | cryptodev-linux-32db6ad28c5b3d1a3b8e0094c931522c69f514da.tar.gz cryptodev-linux-32db6ad28c5b3d1a3b8e0094c931522c69f514da.tar.xz cryptodev-linux-32db6ad28c5b3d1a3b8e0094c931522c69f514da.zip |
Added ability to generate DSA and RSA keys and store them.
Diffstat (limited to 'ncr-key-storage.c')
-rw-r--r-- | ncr-key-storage.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ncr-key-storage.c b/ncr-key-storage.c index a7b995d..bd39a33 100644 --- a/ncr-key-storage.c +++ b/ncr-key-storage.c @@ -28,8 +28,6 @@ #include "ncr_int.h" #include "cryptodev_int.h" -#define KEY_DATA_MAX_SIZE 2048 - struct packed_key { uint8_t type; uint32_t flags; @@ -61,6 +59,13 @@ int key_to_storage_data( uint8_t** sdata, size_t * sdata_size, const struct key_ if (key->type == NCR_KEY_TYPE_SECRET) { pkey->raw_size = key->key.secret.size; memcpy(pkey->raw, key->key.secret.data, pkey->raw_size); + } else if (key->type == NCR_KEY_TYPE_PRIVATE || key->type == NCR_KEY_TYPE_PUBLIC) { + pkey->raw_size = sizeof(pkey->raw); + ret = ncr_pk_pack( key, pkey->raw, &pkey->raw_size); + if (ret < 0) { + err(); + goto fail; + } } else { err(); ret = -EINVAL; |