Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/crypto/dist/ssh Pull up revisions 1.1-1.2 (requested by...



details:   https://anonhg.NetBSD.org/src/rev/d31731dc314d
branches:  netbsd-1-5
changeset: 490709:d31731dc314d
user:      he <he%NetBSD.org@localhost>
date:      Mon Feb 26 20:27:13 2001 +0000

description:
Pull up revisions 1.1-1.2 (requested by itojun):
  Update SSH to version found on trunk as of 26 Feb 2001.

diffstat:

 crypto/dist/ssh/atomicio.h   |   33 ++++++++
 crypto/dist/ssh/auth-chall.c |   62 ++++++++++++++++
 crypto/dist/ssh/dh.c         |  158 +++++++++++++++++++++++++++++++++++++++++++
 crypto/dist/ssh/random.h     |   41 +++++++++++
 crypto/dist/ssh/ssh_config   |   37 ++++++++++
 crypto/dist/ssh/sshd_config  |   65 +++++++++++++++++
 6 files changed, 396 insertions(+), 0 deletions(-)

diffs (truncated from 420 to 300 lines):

diff -r 968f305e1477 -r d31731dc314d crypto/dist/ssh/atomicio.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/atomicio.h        Mon Feb 26 20:27:13 2001 +0000
@@ -0,0 +1,33 @@
+/*     $OpenBSD: atomicio.h,v 1.2 2001/01/29 01:58:14 niklas Exp $     */
+
+/*
+ * Copyright (c) 1995,1999 Theo de Raadt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * `Atomic' read and write operations, to ensure that all the
+ * data makes it through a socket (handles signals, etc.).
+ */
+ssize_t        atomic_read(int, void *, size_t);
+ssize_t atomic_write(int, const void *, size_t);
diff -r 968f305e1477 -r d31731dc314d crypto/dist/ssh/auth-chall.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/auth-chall.c      Mon Feb 26 20:27:13 2001 +0000
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2001 Markus Friedl. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "includes.h"
+RCSID("$OpenBSD: auth-chall.c,v 1.4 2001/02/04 15:32:22 stevesk Exp $");
+
+#include "auth.h"
+
+#ifdef SKEY
+#include <skey.h>
+
+char *
+get_challenge(Authctxt *authctxt, char *devs)
+{
+       static char challenge[1024];
+       struct skey skey;
+       if (skeychallenge(&skey, authctxt->user, challenge, sizeof(challenge)) == -1)
+               return NULL;
+       strlcat(challenge, "\nS/Key Password: ", sizeof challenge);
+       return challenge;
+}
+int
+verify_response(Authctxt *authctxt, char *response)
+{
+       return (authctxt->valid &&
+           skey_haskey(authctxt->pw->pw_name) == 0 &&
+           skey_passcheck(authctxt->pw->pw_name, response) != -1);
+}
+#else
+/* not available */
+char *
+get_challenge(Authctxt *authctxt, char *devs)
+{
+       return NULL;
+}
+int
+verify_response(Authctxt *authctxt, char *response)
+{
+       return 0;
+}
+#endif
diff -r 968f305e1477 -r d31731dc314d crypto/dist/ssh/dh.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/dh.c      Mon Feb 26 20:27:13 2001 +0000
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2000 Niels Provos.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "includes.h"
+RCSID("$OpenBSD: dh.c,v 1.6 2001/01/21 19:05:49 markus Exp $");
+
+#include "xmalloc.h"
+
+#include <openssl/bn.h>
+#include <openssl/dh.h>
+#include <openssl/evp.h>
+
+#include "buffer.h"
+#include "cipher.h"
+#include "kex.h"
+#include "dh.h"
+#include "pathnames.h"
+#include "log.h"
+#include "misc.h"
+
+static int
+parse_prime(int linenum, char *line, struct dhgroup *dhg)
+{
+       char *cp, *arg;
+       char *strsize, *gen, *prime;
+
+       cp = line;
+       arg = strdelim(&cp);
+       /* Ignore leading whitespace */
+       if (*arg == '\0')
+               arg = strdelim(&cp);
+       if (!*arg || *arg == '#')
+               return 0;
+
+       /* time */
+       if (cp == NULL || *arg == '\0')
+               goto fail;
+       arg = strsep(&cp, " "); /* type */
+       if (cp == NULL || *arg == '\0')
+               goto fail;
+       arg = strsep(&cp, " "); /* tests */
+       if (cp == NULL || *arg == '\0')
+               goto fail;
+       arg = strsep(&cp, " "); /* tries */
+       if (cp == NULL || *arg == '\0')
+               goto fail;
+       strsize = strsep(&cp, " "); /* size */
+       if (cp == NULL || *strsize == '\0' ||
+           (dhg->size = atoi(strsize)) == 0)
+               goto fail;
+       gen = strsep(&cp, " "); /* gen */
+       if (cp == NULL || *gen == '\0')
+               goto fail;
+       prime = strsep(&cp, " "); /* prime */
+       if (cp != NULL || *prime == '\0')
+               goto fail;
+
+       dhg->g = BN_new();
+       if (BN_hex2bn(&dhg->g, gen) < 0) {
+               BN_free(dhg->g);
+               goto fail;
+       }
+       dhg->p = BN_new();
+       if (BN_hex2bn(&dhg->p, prime) < 0) {
+               BN_free(dhg->g);
+               BN_free(dhg->p);
+               goto fail;
+       }
+
+       return (1);
+ fail:
+       error("Bad prime description in line %d\n", linenum);
+       return (0);
+}
+
+DH *
+choose_dh(int minbits)
+{
+       FILE *f;
+       char line[1024];
+       int best, bestcount, which;
+       int linenum;
+       struct dhgroup dhg;
+
+       f = fopen(_PATH_DH_PRIMES, "r");
+       if (!f) {
+               log("WARNING: %s does not exist, using old prime", _PATH_DH_PRIMES);
+               return (dh_new_group1());
+       }
+
+       linenum = 0;
+       best = bestcount = 0;
+       while (fgets(line, sizeof(line), f)) {
+               linenum++;
+               if (!parse_prime(linenum, line, &dhg))
+                       continue;
+               BN_free(dhg.g);
+               BN_free(dhg.p);
+
+               if ((dhg.size > minbits && dhg.size < best) ||
+                   (dhg.size > best && best < minbits)) {
+                       best = dhg.size;
+                       bestcount = 0;
+               }
+               if (dhg.size == best)
+                       bestcount++;
+       }
+       fclose (f);
+
+       if (bestcount == 0) {
+               log("WARNING: no primes in %s, using old prime", _PATH_DH_PRIMES);
+               return (dh_new_group1());
+       }
+
+       f = fopen(_PATH_DH_PRIMES, "r");
+       if (!f) {
+               fatal("WARNING: %s dissappeared, giving up", _PATH_DH_PRIMES);
+       }
+
+       linenum = 0;
+       which = arc4random() % bestcount;
+       while (fgets(line, sizeof(line), f)) {
+               if (!parse_prime(linenum, line, &dhg))
+                       continue;
+               if (dhg.size != best)
+                       continue;
+               if (linenum++ != which) {
+                       BN_free(dhg.g);
+                       BN_free(dhg.p);
+                       continue;
+               }
+               break;
+       }
+       fclose(f);
+
+       return (dh_new_group(dhg.g, dhg.p));
+}
diff -r 968f305e1477 -r d31731dc314d crypto/dist/ssh/random.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/random.h  Mon Feb 26 20:27:13 2001 +0000
@@ -0,0 +1,41 @@
+/*     $NetBSD: random.h,v 1.2.2.2 2001/02/26 20:27:14 he Exp $        */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF



Home | Main Index | Thread Index | Old Index