From 59b774dcfe65ac398e56813bc4af774fcbbdc716 Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Thu, 21 Apr 2016 16:06:38 +0200 Subject: [PATCH] yaca_open_init() needs key length to generate EVP_CIPHER Change-Id: I5d12ca2ac41c54a6a73844033c9ab6a0118b954f --- api/yaca/seal.h | 14 ++++++++------ examples/seal.c | 2 +- src/seal.c | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/yaca/seal.h b/api/yaca/seal.h index a080247..3467291 100644 --- a/api/yaca/seal.h +++ b/api/yaca/seal.h @@ -97,12 +97,13 @@ int yaca_seal_final(yaca_ctx_h ctx, /** * @brief yaca_open_init Initializes an asymmetric decryption context. * - * @param[out] ctx Newly created context. Must be freed by @see yaca_ctx_free. - * @param[in] prv_key Private key, part of the pair that was used for the encryption. - * @param[in] algo Symmetric algorithm that was used for the encryption. - * @param[in] bcm Block chaining mode for the symmetric algorithm. - * @param[in] sym_key Symmetric key, encrypted with the public key, that was used to encrypt the data. - * @param[in] iv Initialization vector that was used for the encryption. + * @param[out] ctx Newly created context. Must be freed by @see yaca_ctx_free. + * @param[in] prv_key Private key, part of the pair that was used for the encryption. + * @param[in] algo Symmetric algorithm that was used for the encryption. + * @param[in] bcm Block chaining mode for the symmetric algorithm. + * @param[in] sym_key_bits Symmetric key length (in bits) that was used for the encryption. + * @param[in] sym_key Symmetric key, encrypted with the public key, that was used to encrypt the data. + * @param[in] iv Initialization vector that was used for the encryption. * * @return 0 on success, negative on error (@see error.h). */ @@ -110,6 +111,7 @@ int yaca_open_init(yaca_ctx_h *ctx, const yaca_key_h prv_key, yaca_enc_algo_e algo, yaca_block_cipher_mode_e bcm, + yaca_key_bits_e sym_key_bits, const yaca_key_h sym_key, const yaca_key_h iv); diff --git a/examples/seal.c b/examples/seal.c index 985f5dc..c913b48 100644 --- a/examples/seal.c +++ b/examples/seal.c @@ -100,7 +100,7 @@ void encrypt_seal(void) size_t rem; ret = yaca_open_init(&ctx, key_priv, - YACA_ENC_AES, YACA_BCM_CBC, + YACA_ENC_AES, YACA_BCM_CBC, YACA_KEY_192BIT, aes_key, iv); if (ret < 0) { yaca_free(enc); diff --git a/src/seal.c b/src/seal.c index 7b9308a..cc4b1c9 100644 --- a/src/seal.c +++ b/src/seal.c @@ -61,6 +61,7 @@ API int yaca_open_init(yaca_ctx_h *ctx, const yaca_key_h prv_key, yaca_enc_algo_e algo, yaca_block_cipher_mode_e bcm, + yaca_key_bits_e sym_key_bits, const yaca_key_h sym_key, const yaca_key_h iv) { -- 2.7.4