diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 01:23:49 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 01:23:49 +0200 |
commit | 9ea47f5b396bb1e767d4a231bc7166efd3dffd3e (patch) | |
tree | 4af8aeed00c3cb2aa47c67367abc58d2bb33d352 /ncr-key.c | |
parent | 7188e485061fc6bbad9075333a289941f38a131e (diff) | |
download | cryptodev-linux-9ea47f5b396bb1e767d4a231bc7166efd3dffd3e.tar.gz cryptodev-linux-9ea47f5b396bb1e767d4a231bc7166efd3dffd3e.tar.xz cryptodev-linux-9ea47f5b396bb1e767d4a231bc7166efd3dffd3e.zip |
Use algo_properties_st in ncr_algorithm_to_key_type
An intermediary patch, the function will be removed in next commit.
Diffstat (limited to 'ncr-key.c')
-rw-r--r-- | ncr-key.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -419,6 +419,7 @@ int ncr_key_generate(struct list_sem_st* lst, void __user* arg) { struct ncr_key_generate_st gen; struct key_item_st* item = NULL; +const struct algo_properties_st *algo; int ret; size_t size; @@ -437,7 +438,12 @@ size_t size; /* we generate only secret keys */ item->flags = gen.params.keyflags; - item->type = ncr_algorithm_to_key_type(gen.params.algorithm); + algo = _ncr_algo_to_properties(gen.params.algorithm); + if (algo == NULL) { + err(); + return ret; + } + item->type = ncr_algorithm_to_key_type(algo); if (item->type == NCR_KEY_TYPE_SECRET) { /* arbitrary */ item->algorithm = _ncr_algo_to_properties(NCR_ALG_AES_CBC); @@ -527,14 +533,14 @@ int ret; /* we generate only secret keys */ private->flags = public->flags = gen.params.keyflags; - public->type = ncr_algorithm_to_key_type(gen.params.algorithm); - private->type = NCR_KEY_TYPE_PRIVATE; private->algorithm = public->algorithm = _ncr_algo_to_properties(gen.params.algorithm); if (private->algorithm == NULL) { err(); ret = -EINVAL; goto fail; } + public->type = ncr_algorithm_to_key_type(public->algorithm); + private->type = NCR_KEY_TYPE_PRIVATE; public->flags |= (NCR_KEY_FLAG_EXPORTABLE|NCR_KEY_FLAG_WRAPPABLE); if (public->type == NCR_KEY_TYPE_PUBLIC) { |