73 lines
2.3 KiB
Diff
73 lines
2.3 KiB
Diff
From 610d7a09f99c601224ae2aa3d3de7e75b1d284dd Mon Sep 17 00:00:00 2001
|
|
From: Jakub Jelen <jjelen@redhat.com>
|
|
Date: Fri, 15 Dec 2023 10:30:09 +0100
|
|
Subject: [PATCH 15/20] CVE-2023-6918: kdf: Reformat
|
|
|
|
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
---
|
|
src/kdf.c | 20 +++++++++++---------
|
|
1 file changed, 11 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/src/kdf.c b/src/kdf.c
|
|
index 44f06631..987ae972 100644
|
|
--- a/src/kdf.c
|
|
+++ b/src/kdf.c
|
|
@@ -58,7 +58,7 @@ static ssh_mac_ctx ssh_mac_ctx_init(enum ssh_kdf_digest type)
|
|
}
|
|
|
|
ctx->digest_type = type;
|
|
- switch(type){
|
|
+ switch (type) {
|
|
case SSH_KDF_SHA1:
|
|
ctx->ctx.sha1_ctx = sha1_init();
|
|
return ctx;
|
|
@@ -79,7 +79,7 @@ static ssh_mac_ctx ssh_mac_ctx_init(enum ssh_kdf_digest type)
|
|
|
|
static void ssh_mac_update(ssh_mac_ctx ctx, const void *data, size_t len)
|
|
{
|
|
- switch(ctx->digest_type){
|
|
+ switch (ctx->digest_type) {
|
|
case SSH_KDF_SHA1:
|
|
sha1_update(ctx->ctx.sha1_ctx, data, len);
|
|
break;
|
|
@@ -97,26 +97,28 @@ static void ssh_mac_update(ssh_mac_ctx ctx, const void *data, size_t len)
|
|
|
|
static void ssh_mac_final(unsigned char *md, ssh_mac_ctx ctx)
|
|
{
|
|
- switch(ctx->digest_type){
|
|
+ switch (ctx->digest_type) {
|
|
case SSH_KDF_SHA1:
|
|
- sha1_final(md,ctx->ctx.sha1_ctx);
|
|
+ sha1_final(md, ctx->ctx.sha1_ctx);
|
|
break;
|
|
case SSH_KDF_SHA256:
|
|
- sha256_final(md,ctx->ctx.sha256_ctx);
|
|
+ sha256_final(md, ctx->ctx.sha256_ctx);
|
|
break;
|
|
case SSH_KDF_SHA384:
|
|
- sha384_final(md,ctx->ctx.sha384_ctx);
|
|
+ sha384_final(md, ctx->ctx.sha384_ctx);
|
|
break;
|
|
case SSH_KDF_SHA512:
|
|
- sha512_final(md,ctx->ctx.sha512_ctx);
|
|
+ sha512_final(md, ctx->ctx.sha512_ctx);
|
|
break;
|
|
}
|
|
SAFE_FREE(ctx);
|
|
}
|
|
|
|
int sshkdf_derive_key(struct ssh_crypto_struct *crypto,
|
|
- unsigned char *key, size_t key_len,
|
|
- uint8_t key_type, unsigned char *output,
|
|
+ unsigned char *key,
|
|
+ size_t key_len,
|
|
+ uint8_t key_type,
|
|
+ unsigned char *output,
|
|
size_t requested_len)
|
|
{
|
|
/* Can't use VLAs with Visual Studio, so allocate the biggest
|
|
--
|
|
2.33.0
|
|
|