summaryrefslogtreecommitdiffstats
path: root/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto.c')
-rw-r--r--crypto.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/crypto.c b/crypto.c
index 6f0a44e..d8d6656 100644
--- a/crypto.c
+++ b/crypto.c
@@ -438,12 +438,26 @@ init_key_ctx (struct key_ctx *ctx, struct key *key,
const struct key_type *kt, int enc,
const char *prefix)
{
+ struct gc_arena gc = gc_new ();
CLEAR (*ctx);
if (kt->cipher && kt->cipher_length > 0)
{
+
ALLOC_OBJ(ctx->cipher, cipher_ctx_t);
cipher_ctx_init (ctx->cipher, key->cipher, kt->cipher_length,
- kt->cipher, enc, prefix);
+ kt->cipher, enc);
+
+ msg (D_HANDSHAKE, "%s: Cipher '%s' initialized with %d bit key",
+ prefix,
+ cipher_kt_name(kt->cipher),
+ kt->cipher_length *8);
+
+ dmsg (D_SHOW_KEYS, "%s: CIPHER KEY: %s", prefix,
+ format_hex (key->cipher, kt->cipher_length, 0, &gc));
+ dmsg (D_CRYPTO_DEBUG, "%s: CIPHER block_size=%d iv_size=%d",
+ prefix,
+ cipher_kt_block_size(kt->cipher),
+ cipher_kt_iv_size(kt->cipher));
}
if (kt->digest && kt->hmac_length > 0)
{
@@ -451,6 +465,7 @@ init_key_ctx (struct key_ctx *ctx, struct key *key,
hmac_ctx_init (ctx->hmac, key->hmac, kt->hmac_length, kt->digest,
prefix);
}
+ gc_free (&gc);
}
void