diff options
| author | Jan Chadima <jchadima@redhat.com> | 2010-08-02 10:56:34 +0200 |
|---|---|---|
| committer | Miloslav Trmač <mitr@redhat.com> | 2010-08-24 20:58:30 +0200 |
| commit | 71be5465628262f1a475b52eaf90c5caba5876ea (patch) | |
| tree | fff8c000bb3480741e5dc34d66196ddbc11ad6f2 /userspace/ncrypto_params.c | |
| parent | af2c2e1da1a898c8968281824ba8a4d9616670dc (diff) | |
Initial userspace library version
Diffstat (limited to 'userspace/ncrypto_params.c')
| -rw-r--r-- | userspace/ncrypto_params.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/userspace/ncrypto_params.c b/userspace/ncrypto_params.c new file mode 100644 index 0000000..c6b9002 --- /dev/null +++ b/userspace/ncrypto_params.c @@ -0,0 +1,50 @@ + +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include "../ncr.h" +#include "ncrypto.h" + +int +ncr_key_params_init(ncr_key_params_t *params) +{ + ncr_key_params_t rv; + + if (!params) { + errno = EINVAL; + return -1; + } + if (!(rv = calloc(1, sizeof(*rv)))) { + errno = ENOMEM; + return -1; + } + *params = rv; + return 0; +} + +void +ncr_key_params_deinit(ncr_key_params_t params) +{ + if (params) + free(params); +} + +int +ncr_key_params_set_cipher_iv(ncr_key_params_t params, void* iv, unsigned int iv_size) +{ + if (!params || (iv_size > NCR_CIPHER_MAX_BLOCK_LEN)) { + errno = EINVAL; + return -1; + } + memmove(params->params.cipher.iv, iv, iv_size); + params->params.cipher.iv_size = iv_size; + return 0; +} + +int +ncr_key_params_set_dh_key(ncr_key_params_t params, ncr_key_t dh_priv) +{ + errno = EINVAL; +} + |
