yaca_seal_init() needs key length to generate EVP_CIPHER 01/66401/2
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 18 Apr 2016 14:56:42 +0000 (16:56 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Tue, 19 Apr 2016 08:00:02 +0000 (10:00 +0200)
Change-Id: I65f40910983d5d8928174807dbdc7c622eee70d8

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

index aa1a10b..a080247 100644 (file)
@@ -46,12 +46,13 @@ extern "C" {
 /**
  * @brief yaca_seal_init  Initializes an asymmetric encryption context.
  *
- * @param[out] ctx      Newly created context (must be freed with @see yaca_ctx_free).
- * @param[in]  pub_key  Public key of the peer that will receive the encrypted data.
- * @param[in]  algo     Symmetric algorithm that will be used.
- * @param[in]  bcm      Block chaining mode for the symmetric algorithm.
- * @param[out] sym_key  Generated symmetric key that will be used. It is encrypted with peer's public key.
- * @param[out] iv       Generated initialization vector that will be used.
+ * @param[out] ctx           Newly created context (must be freed with @see yaca_ctx_free).
+ * @param[in]  pub_key       Public key of the peer that will receive the encrypted data.
+ * @param[in]  algo          Symmetric algorithm that will be used.
+ * @param[in]  bcm           Block chaining mode for the symmetric algorithm.
+ * @param[in]  sym_key_bits  Symmetric key length (in bits) that will be generated.
+ * @param[out] sym_key       Generated symmetric key that will be used. It is encrypted with peer's public key.
+ * @param[out] iv            Generated initialization vector that will be used.
  *
  * @return 0 on success, negative on error (@see error.h).
  */
@@ -59,6 +60,7 @@ int yaca_seal_init(yaca_ctx_h *ctx,
                   const yaca_key_h pub_key,
                   yaca_enc_algo_e algo,
                   yaca_block_cipher_mode_e bcm,
+                  yaca_key_bits_e sym_key_bits,
                   yaca_key_h *sym_key,
                   yaca_key_h *iv);
 
index a96dfd0..e2377a1 100644 (file)
@@ -57,7 +57,7 @@ void encrypt_seal(void)
                size_t rem;
 
                ret = yaca_seal_init(&ctx, key_pub,
-                                    YACA_ENC_AES, YACA_BCM_CBC,
+                                    YACA_ENC_AES, YACA_BCM_CBC, YACA_KEY_192BIT,
                                     &aes_key, &iv);
                if (ret < 0)
                        goto ex_pk;
index fb5b50e..7b9308a 100644 (file)
@@ -34,6 +34,7 @@ API int yaca_seal_init(yaca_ctx_h *ctx,
                       const yaca_key_h pub_key,
                       yaca_enc_algo_e algo,
                       yaca_block_cipher_mode_e bcm,
+                      yaca_key_bits_e sym_key_bits,
                       yaca_key_h *sym_key,
                       yaca_key_h *iv)
 {