yaca_open_init() needs key length to generate EVP_CIPHER 71/66871/4
authorDariusz Michaluk <d.michaluk@samsung.com>
Thu, 21 Apr 2016 14:06:38 +0000 (16:06 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Tue, 26 Apr 2016 13:00:11 +0000 (15:00 +0200)
Change-Id: I5d12ca2ac41c54a6a73844033c9ab6a0118b954f

api/yaca/seal.h
examples/seal.c
src/seal.c

index a080247..3467291 100644 (file)
@@ -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);
 
index 985f5dc..c913b48 100644 (file)
@@ -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);
index 7b9308a..cc4b1c9 100644 (file)
@@ -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)
 {