diff --git a/openssh-8.7p1-evp-fips-compl-dh.patch b/openssh-8.7p1-evp-fips-compl-dh.patch index e36ef60..ec04910 100644 --- a/openssh-8.7p1-evp-fips-compl-dh.patch +++ b/openssh-8.7p1-evp-fips-compl-dh.patch @@ -1,6 +1,6 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x config.status -x configure~ -x configure.ac openssh-8.7p1/dh.c openssh-8.7p1-patched/dh.c ---- openssh-8.7p1/dh.c 2023-05-16 15:38:53.461326047 +0200 -+++ openssh-8.7p1-patched/dh.c 2023-05-16 15:37:14.785260359 +0200 +--- openssh-8.7p1/dh.c 2023-05-25 09:01:23.295627077 +0200 ++++ openssh-8.7p1-patched/dh.c 2023-05-25 09:00:56.519332820 +0200 @@ -37,6 +37,9 @@ #include #include @@ -126,8 +126,8 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x DH * diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x config.status -x configure~ -x configure.ac openssh-8.7p1/kex.c openssh-8.7p1-patched/kex.c ---- openssh-8.7p1/kex.c 2023-05-16 15:38:53.465326090 +0200 -+++ openssh-8.7p1-patched/kex.c 2023-05-16 15:37:14.785260359 +0200 +--- openssh-8.7p1/kex.c 2023-05-25 09:01:23.299627122 +0200 ++++ openssh-8.7p1-patched/kex.c 2023-05-25 09:00:56.519332820 +0200 @@ -1603,3 +1603,47 @@ return r; } @@ -177,8 +177,8 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x +} +#endif /* WITH_OPENSSL */ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x config.status -x configure~ -x configure.ac openssh-8.7p1/kexdh.c openssh-8.7p1-patched/kexdh.c ---- openssh-8.7p1/kexdh.c 2023-05-16 15:38:53.403325420 +0200 -+++ openssh-8.7p1-patched/kexdh.c 2023-05-16 15:37:34.097468928 +0200 +--- openssh-8.7p1/kexdh.c 2023-05-25 09:01:23.237626425 +0200 ++++ openssh-8.7p1-patched/kexdh.c 2023-05-25 09:03:21.817957988 +0200 @@ -35,6 +35,10 @@ #include "openbsd-compat/openssl-compat.h" @@ -204,7 +204,7 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x #ifdef DEBUG_KEXDH fprintf(stderr, "dh_pub= "); -@@ -100,24 +107,64 @@ +@@ -100,24 +107,59 @@ r = SSH_ERR_MESSAGE_INCOMPLETE; goto out; } @@ -222,7 +222,6 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x + /* import peer key + * the parameters should be the same as with pkey + */ -+ debug_f("import peer key to evp"); + r = kex_create_evp_dh(&dh_pkey, p, q, g, dh_pub, NULL); + if (r != 0) { + error_f("Could not import peer key for dh"); @@ -230,13 +229,11 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x + goto out; + } + -+ debug_f("creating EVP_PKEY_CTX"); + if ((ctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL)) == NULL) { + error_f("Could not init EVP_PKEY_CTX for dh"); + r = SSH_ERR_ALLOC_FAIL; + goto out; + } -+ debug_f("Deriving - init context"); + if (EVP_PKEY_derive_init(ctx) != 1 || + EVP_PKEY_derive_set_peer(ctx, dh_pkey) != 1 || + EVP_PKEY_derive(ctx, NULL, &klen) != 1) { @@ -244,7 +241,6 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x + r = SSH_ERR_LIBCRYPTO_ERROR; + goto out; + } -+ debug_f("Deriving - buffer size is %d", (int)klen); if ((kbuf = malloc(klen)) == NULL || (shared_secret = BN_new()) == NULL) { r = SSH_ERR_ALLOC_FAIL; @@ -252,7 +248,6 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x } - if ((kout = DH_compute_key(kbuf, dh_pub, kex->dh)) < 0 || - BN_bin2bn(kbuf, kout, shared_secret) == NULL) { -+ debug_f("Deriving - using real buffer"); + if (EVP_PKEY_derive(ctx, kbuf, &klen) != 1 || + BN_bin2bn(kbuf, klen, shared_secret) == NULL) { + error_f("Could not derive key"); @@ -274,8 +269,8 @@ diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x } diff --color -ru -x regress -x autom4te.cache -x '*.o' -x '*.lo' -x Makefile -x config.status -x configure~ -x configure.ac openssh-8.7p1/kex.h openssh-8.7p1-patched/kex.h ---- openssh-8.7p1/kex.h 2023-05-16 15:38:53.465326090 +0200 -+++ openssh-8.7p1-patched/kex.h 2023-05-16 15:37:14.786260370 +0200 +--- openssh-8.7p1/kex.h 2023-05-25 09:01:23.299627122 +0200 ++++ openssh-8.7p1-patched/kex.h 2023-05-25 09:00:56.519332820 +0200 @@ -33,6 +33,9 @@ # include # include