[openssh-commits] [openssh] 02/02: upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Oct 28 13:49:09 AEDT 2022


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 25c8a2bbcc10c493d27faea57c42a6bf13fa51f2
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Oct 28 02:47:04 2022 +0000

    upstream: put sshkey_check_rsa_length() back in sshkey.c to unbreak
    
    OPENSSL=no builds
    
    OpenBSD-Commit-ID: 99eec58abe382ecd14b14043b195ee1babb9cf6e
---
 ssh-rsa.c | 22 +---------------------
 sshkey.c  | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/ssh-rsa.c b/ssh-rsa.c
index 395ee6b2..6516ddc1 100644
--- a/ssh-rsa.c
+++ b/ssh-rsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-rsa.c,v 1.77 2022/10/28 00:44:44 djm Exp $ */
+/* $OpenBSD: ssh-rsa.c,v 1.78 2022/10/28 02:47:04 djm Exp $ */
 /*
  * Copyright (c) 2000, 2003 Markus Friedl <markus at openbsd.org>
  *
@@ -39,26 +39,6 @@
 
 static int openssh_RSA_verify(int, u_char *, size_t, u_char *, size_t, RSA *);
 
-int
-sshkey_check_rsa_length(const struct sshkey *k, int min_size)
-{
-#ifdef WITH_OPENSSL
-	const BIGNUM *rsa_n;
-	int nbits;
-
-	if (k == NULL || k->rsa == NULL ||
-	    (k->type != KEY_RSA && k->type != KEY_RSA_CERT))
-		return 0;
-	RSA_get0_key(k->rsa, &rsa_n, NULL, NULL);
-	nbits = BN_num_bits(rsa_n);
-	if (nbits < SSH_RSA_MINIMUM_MODULUS_SIZE ||
-	    (min_size > 0 && nbits < min_size))
-		return SSH_ERR_KEY_LENGTH;
-#endif /* WITH_OPENSSL */
-	return 0;
-}
-
-
 static u_int
 ssh_rsa_size(const struct sshkey *key)
 {
diff --git a/sshkey.c b/sshkey.c
index f6a54fa3..43712253 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.133 2022/10/28 00:44:44 djm Exp $ */
+/* $OpenBSD: sshkey.c,v 1.134 2022/10/28 02:47:04 djm Exp $ */
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
  * Copyright (c) 2008 Alexander von Gernler.  All rights reserved.
@@ -1319,6 +1319,25 @@ sshkey_cert_type(const struct sshkey *k)
 	}
 }
 
+int
+sshkey_check_rsa_length(const struct sshkey *k, int min_size)
+{
+#ifdef WITH_OPENSSL
+	const BIGNUM *rsa_n;
+	int nbits;
+
+	if (k == NULL || k->rsa == NULL ||
+	    (k->type != KEY_RSA && k->type != KEY_RSA_CERT))
+		return 0;
+	RSA_get0_key(k->rsa, &rsa_n, NULL, NULL);
+	nbits = BN_num_bits(rsa_n);
+	if (nbits < SSH_RSA_MINIMUM_MODULUS_SIZE ||
+	    (min_size > 0 && nbits < min_size))
+		return SSH_ERR_KEY_LENGTH;
+#endif /* WITH_OPENSSL */
+	return 0;
+}
+
 #ifdef WITH_OPENSSL
 # ifdef OPENSSL_HAS_ECC
 int

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list