From 32833b40bc033bc15f5f48435ad3cda698003d2a Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Wed, 14 May 2025 13:57:24 +0200 Subject: [PATCH] libgcrypto: Reformat ssh_kdf() Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- src/libcrypto.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/libcrypto.c b/src/libcrypto.c index 5a974203..e50bd297 100644 --- a/src/libcrypto.c +++ b/src/libcrypto.c @@ -202,7 +202,8 @@ int ssh_kdf(struct ssh_crypto_struct *crypto, } #if OPENSSL_VERSION_NUMBER < 0x30000000L - rc = EVP_KDF_ctrl(ctx, EVP_KDF_CTRL_SET_MD, + rc = EVP_KDF_ctrl(ctx, + EVP_KDF_CTRL_SET_MD, sshkdf_digest_to_md(crypto->digest_type)); if (rc != 1) { goto out; @@ -211,8 +212,10 @@ int ssh_kdf(struct ssh_crypto_struct *crypto, if (rc != 1) { goto out; } - rc = EVP_KDF_ctrl(ctx, EVP_KDF_CTRL_SET_SSHKDF_XCGHASH, - crypto->secret_hash, crypto->digest_len); + rc = EVP_KDF_ctrl(ctx, + EVP_KDF_CTRL_SET_SSHKDF_XCGHASH, + crypto->secret_hash, + crypto->digest_len); if (rc != 1) { goto out; } @@ -220,8 +223,10 @@ int ssh_kdf(struct ssh_crypto_struct *crypto, if (rc != 1) { goto out; } - rc = EVP_KDF_ctrl(ctx, EVP_KDF_CTRL_SET_SSHKDF_SESSION_ID, - crypto->session_id, crypto->session_id_len); + rc = EVP_KDF_ctrl(ctx, + EVP_KDF_CTRL_SET_SSHKDF_SESSION_ID, + crypto->session_id, + crypto->session_id_len); if (rc != 1) { goto out; } @@ -230,14 +235,18 @@ int ssh_kdf(struct ssh_crypto_struct *crypto, goto out; } #else - rc = OSSL_PARAM_BLD_push_utf8_string(param_bld, OSSL_KDF_PARAM_DIGEST, - md, strlen(md)); + rc = OSSL_PARAM_BLD_push_utf8_string(param_bld, + OSSL_KDF_PARAM_DIGEST, + md, + strlen(md)); if (rc != 1) { rc = -1; goto out; } - rc = OSSL_PARAM_BLD_push_octet_string(param_bld, OSSL_KDF_PARAM_KEY, - key, key_len); + rc = OSSL_PARAM_BLD_push_octet_string(param_bld, + OSSL_KDF_PARAM_KEY, + key, + key_len); if (rc != 1) { rc = -1; goto out; @@ -258,8 +267,10 @@ int ssh_kdf(struct ssh_crypto_struct *crypto, rc = -1; goto out; } - rc = OSSL_PARAM_BLD_push_utf8_string(param_bld, OSSL_KDF_PARAM_SSHKDF_TYPE, - (const char*)&key_type, 1); + rc = OSSL_PARAM_BLD_push_utf8_string(param_bld, + OSSL_KDF_PARAM_SSHKDF_TYPE, + (const char *)&key_type, + 1); if (rc != 1) { rc = -1; goto out;