external/openssh: update to 6.8p1.

In preparation for some updates to external/openssh to make it work with
BoringSSL, this change updates the code to a recent version. The current
version (5.9p1) is coming up on four years old now.

  * Confirmed that f5c67b478bef9992de9e9ec91ce10af4f6205e0d matches
    OpenSSH 5.9p1 exactly (save for the removal of the scard
    subdirectory).

  * Downloaded openssh-6.8p1.tar.gz (SHA256:
    3ff64ce73ee124480b5bf767b9830d7d3c03bbcb6abe716b78f0192c37ce160e)
    and verified with PGP signature. (I've verified Damien's key in
    person previously.)

  * Applied changes between f5c67b478bef9992de9e9ec91ce10af4f6205e0d and
    OpenSSH 5.9p1 to 6.8p1 and updated the build as best I can. The
    ugliest change is probably the duplication of umac.c to umac128.c
    because Android conditionally compiles that file twice. See the
    comment in those files.

Change-Id: I63cb07a8118afb5a377f116087a0882914cea486
diff --git a/ssh-keygen.0 b/ssh-keygen.0
index 6c1763d..784ad03 100644
--- a/ssh-keygen.0
+++ b/ssh-keygen.0
@@ -1,17 +1,17 @@
-SSH-KEYGEN(1)              OpenBSD Reference Manual              SSH-KEYGEN(1)
+SSH-KEYGEN(1)               General Commands Manual              SSH-KEYGEN(1)
 
 NAME
-     ssh-keygen - authentication key generation, management and conversion
+     ssh-keygen M-bM-^@M-^S authentication key generation, management and conversion
 
 SYNOPSIS
-     ssh-keygen [-q] [-b bits] -t type [-N new_passphrase] [-C comment]
-                [-f output_keyfile]
+     ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
+                [-N new_passphrase] [-C comment] [-f output_keyfile]
      ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
      ssh-keygen -i [-m key_format] [-f input_keyfile]
      ssh-keygen -e [-m key_format] [-f input_keyfile]
      ssh-keygen -y [-f input_keyfile]
      ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
-     ssh-keygen -l [-f input_keyfile]
+     ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
      ssh-keygen -B [-f input_keyfile]
      ssh-keygen -D pkcs11
      ssh-keygen -F hostname [-f known_hosts_file] [-l]
@@ -19,41 +19,48 @@
      ssh-keygen -R hostname [-f known_hosts_file]
      ssh-keygen -r hostname [-f input_keyfile] [-g]
      ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
-     ssh-keygen -T output_file -f input_file [-v] [-a num_trials]
-                [-W generator]
+     ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
+                [-j start_line] [-K checkpt] [-W generator]
      ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
                 [-O option] [-V validity_interval] [-z serial_number] file ...
      ssh-keygen -L [-f input_keyfile]
      ssh-keygen -A
+     ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
+                file ...
+     ssh-keygen -Q -f krl_file file ...
 
 DESCRIPTION
      ssh-keygen generates, manages and converts authentication keys for
      ssh(1).  ssh-keygen can create RSA keys for use by SSH protocol version 1
-     and DSA, ECDSA or RSA keys for use by SSH protocol version 2.  The type
-     of key to be generated is specified with the -t option.  If invoked
-     without any arguments, ssh-keygen will generate an RSA key for use in SSH
-     protocol 2 connections.
+     and DSA, ECDSA, Ed25519 or RSA keys for use by SSH protocol version 2.
+     The type of key to be generated is specified with the -t option.  If
+     invoked without any arguments, ssh-keygen will generate an RSA key for
+     use in SSH protocol 2 connections.
 
      ssh-keygen is also used to generate groups for use in Diffie-Hellman
      group exchange (DH-GEX).  See the MODULI GENERATION section for details.
 
+     Finally, ssh-keygen can be used to generate and update Key Revocation
+     Lists, and to test whether given keys have been revoked by one.  See the
+     KEY REVOCATION LISTS section for details.
+
      Normally each user wishing to use SSH with public key authentication runs
      this once to create the authentication key in ~/.ssh/identity,
-     ~/.ssh/id_ecdsa, ~/.ssh/id_dsa or ~/.ssh/id_rsa.  Additionally, the
-     system administrator may use this to generate host keys, as seen in
-     /etc/rc.
+     ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 or ~/.ssh/id_rsa.
+     Additionally, the system administrator may use this to generate host
+     keys, as seen in /etc/rc.
 
      Normally this program generates the key and asks for a file in which to
      store the private key.  The public key is stored in a file with the same
-     name but ``.pub'' appended.  The program also asks for a passphrase.  The
+     name but M-bM-^@M-^\.pubM-bM-^@M-^] appended.  The program also asks for a passphrase.  The
      passphrase may be empty to indicate no passphrase (host keys must have an
      empty passphrase), or it may be a string of arbitrary length.  A
      passphrase is similar to a password, except it can be a phrase with a
      series of words, punctuation, numbers, whitespace, or any string of
      characters you want.  Good passphrases are 10-30 characters long, are not
-     simple sentences or otherwise easily guessable (English prose has only 1-
-     2 bits of entropy per character, and provides very bad passphrases), and
-     contain a mix of upper and lowercase letters, numbers, and non-
+     simple sentences or otherwise easily guessable (English prose has only
+     1-2 bits of entropy per character, and provides very bad passphrases),
+     and contain a mix of upper and lowercase letters, numbers, and non-
      alphanumeric characters.  The passphrase can be changed later by using
      the -p option.
 
@@ -64,7 +71,7 @@
      For RSA1 keys, there is also a comment field in the key file that is only
      for convenience to the user to help identify the key.  The comment can
      tell what the key is for, or whatever is useful.  The comment is
-     initialized to ``user@host'' when the key is created, but can be changed
+     initialized to M-bM-^@M-^\user@hostM-bM-^@M-^] when the key is created, but can be changed
      using the -c option.
 
      After a key is generated, instructions below detail where the keys should
@@ -72,15 +79,22 @@
 
      The options are as follows:
 
-     -A      For each of the key types (rsa1, rsa, dsa and ecdsa) for which
-             host keys do not exist, generate the host keys with the default
-             key file path, an empty passphrase, default bits for the key
-             type, and default comment.  This is used by /etc/rc to generate
-             new host keys.
+     -A      For each of the key types (rsa1, rsa, dsa, ecdsa and ed25519) for
+             which host keys do not exist, generate the host keys with the
+             default key file path, an empty passphrase, default bits for the
+             key type, and default comment.  This is used by /etc/rc to
+             generate new host keys.
 
-     -a trials
-             Specifies the number of primality tests to perform when screening
-             DH-GEX candidates using the -T command.
+     -a rounds
+             When saving a new-format private key (i.e. an ed25519 key or any
+             SSH protocol 2 key when the -o flag is set), this option
+             specifies the number of KDF (key derivation function) rounds
+             used.  Higher numbers result in slower passphrase verification
+             and increased resistance to brute-force password cracking (should
+             the keys be stolen).
+
+             When screening DH-GEX candidates ( using the -T command).  This
+             option specifies the number of primality tests to perform.
 
      -B      Show the bubblebabble digest of specified private or public key
              file.
@@ -90,10 +104,11 @@
              the minimum size is 768 bits and the default is 2048 bits.
              Generally, 2048 bits is considered sufficient.  DSA keys must be
              exactly 1024 bits as specified by FIPS 186-2.  For ECDSA keys,
-             the -b flag determines they key length by selecting from one of
+             the -b flag determines the key length by selecting from one of
              three elliptic curve sizes: 256, 384 or 521 bits.  Attempting to
              use bit lengths other than these three values for ECDSA keys will
-             fail.
+             fail.  Ed25519 keys have a fixed length and the -b flag will be
+             ignored.
 
      -C comment
              Provides a new comment.
@@ -109,9 +124,14 @@
              indicates that a CA key resides in a PKCS#11 token (see the
              CERTIFICATES section for details).
 
+     -E fingerprint_hash
+             Specifies the hash algorithm used when displaying key
+             fingerprints.  Valid options are: M-bM-^@M-^\md5M-bM-^@M-^] and M-bM-^@M-^\sha256M-bM-^@M-^].  The
+             default is M-bM-^@M-^\sha256M-bM-^@M-^].
+
      -e      This option will read a private or public OpenSSH key file and
              print to stdout the key in one of the formats specified by the -m
-             option.  The default export format is ``RFC4716''.  This option
+             option.  The default export format is M-bM-^@M-^\RFC4716M-bM-^@M-^].  This option
              allows exporting OpenSSH keys for use by other programs,
              including several commercial SSH implementations.
 
@@ -151,7 +171,28 @@
              in the format specified by the -m option and print an OpenSSH
              compatible private (or public) key to stdout.  This option allows
              importing keys from other software, including several commercial
-             SSH implementations.  The default import format is ``RFC4716''.
+             SSH implementations.  The default import format is M-bM-^@M-^\RFC4716M-bM-^@M-^].
+
+     -J num_lines
+             Exit after screening the specified number of lines while
+             performing DH candidate screening using the -T option.
+
+     -j start_line
+             Start screening at the specified line number while performing DH
+             candidate screening using the -T option.
+
+     -K checkpt
+             Write the last line processed to the file checkpt while
+             performing DH candidate screening using the -T option.  This will
+             be used to skip lines in the input file that have already been
+             processed if the job is restarted.
+
+     -k      Generate a KRL file.  In this mode, ssh-keygen will generate a
+             KRL file at the location specified via the -f flag that revokes
+             every key or certificate presented on the command line.
+             Keys/certificates to be revoked may be specified by public key
+             file or using the format described in the KEY REVOCATION LISTS
+             section.
 
      -L      Prints the contents of a certificate.
 
@@ -167,10 +208,10 @@
 
      -m key_format
              Specify a key format for the -i (import) or -e (export)
-             conversion options.  The supported key formats are: ``RFC4716''
-             (RFC 4716/SSH2 public or private key), ``PKCS8'' (PEM PKCS8
-             public key) or ``PEM'' (PEM public key).  The default conversion
-             format is ``RFC4716''.
+             conversion options.  The supported key formats are: M-bM-^@M-^\RFC4716M-bM-^@M-^]
+             (RFC 4716/SSH2 public or private key), M-bM-^@M-^\PKCS8M-bM-^@M-^] (PEM PKCS8 public
+             key) or M-bM-^@M-^\PEMM-bM-^@M-^] (PEM public key).  The default conversion format is
+             M-bM-^@M-^\RFC4716M-bM-^@M-^].
 
      -N new_passphrase
              Provides the new passphrase.
@@ -234,6 +275,12 @@
 
              At present, no options are valid for host keys.
 
+     -o      Causes ssh-keygen to save SSH protocol 2 private keys using the
+             new OpenSSH format rather than the more compatible PEM format.
+             The new format has increased resistance to brute-force password
+             cracking but is not supported by versions of OpenSSH prior to
+             6.5.  Ed25519 keys always use the new private key format.
+
      -P passphrase
              Provides the (old) passphrase.
 
@@ -242,6 +289,8 @@
              containing the private key, for the old passphrase, and twice for
              the new passphrase.
 
+     -Q      Test whether keys have been revoked in a KRL.
+
      -q      Silence ssh-keygen.
 
      -R hostname
@@ -261,14 +310,22 @@
              Certify (sign) a public key using the specified CA key.  Please
              see the CERTIFICATES section for details.
 
+             When generating a KRL, -s specifies a path to a CA public key
+             file used to revoke certificates directly by key ID or serial
+             number.  See the KEY REVOCATION LISTS section for details.
+
      -T output_file
              Test DH group exchange candidate primes (generated using the -G
              option) for safety.
 
-     -t type
+     -t dsa | ecdsa | ed25519 | rsa | rsa1
              Specifies the type of key to create.  The possible values are
-             ``rsa1'' for protocol version 1 and ``dsa'', ``ecdsa'' or ``rsa''
-             for protocol version 2.
+             M-bM-^@M-^\rsa1M-bM-^@M-^] for protocol version 1 and M-bM-^@M-^\dsaM-bM-^@M-^], M-bM-^@M-^\ecdsaM-bM-^@M-^], M-bM-^@M-^\ed25519M-bM-^@M-^], or
+             M-bM-^@M-^\rsaM-bM-^@M-^] for protocol version 2.
+
+     -u      Update a KRL.  When specified with -k, keys listed via the
+             command line are added to the existing KRL rather than a new KRL
+             being created.
 
      -V validity_interval
              Specify a validity interval when signing a certificate.  A
@@ -283,12 +340,11 @@
              as a YYYYMMDD date, a YYYYMMDDHHMMSS time or a relative time
              starting with a plus character.
 
-             For example: ``+52w1d'' (valid from now to 52 weeks and one day
-             from now), ``-4w:+4w'' (valid from four weeks ago to four weeks
-             from now), ``20100101123000:20110101123000'' (valid from 12:30
-             PM, January 1st, 2010 to 12:30 PM, January 1st, 2011),
-             ``-1d:20110101'' (valid from yesterday to midnight, January 1st,
-             2011).
+             For example: M-bM-^@M-^\+52w1dM-bM-^@M-^] (valid from now to 52 weeks and one day
+             from now), M-bM-^@M-^\-4w:+4wM-bM-^@M-^] (valid from four weeks ago to four weeks
+             from now), M-bM-^@M-^\20100101123000:20110101123000M-bM-^@M-^] (valid from 12:30 PM,
+             January 1st, 2010 to 12:30 PM, January 1st, 2011), M-bM-^@M-^\-1d:20110101M-bM-^@M-^]
+             (valid from yesterday to midnight, January 1st, 2011).
 
      -v      Verbose mode.  Causes ssh-keygen to print debugging messages
              about its progress.  This is helpful for debugging moduli
@@ -307,6 +363,9 @@
              distinguish this certificate from others from the same CA.  The
              default serial number is zero.
 
+             When generating a KRL, the -z flag is used to specify a KRL
+             version number.
+
 MODULI GENERATION
      ssh-keygen may be used to generate groups for the Diffie-Hellman Group
      Exchange (DH-GEX) protocol.  Generating these groups is a two-step
@@ -323,7 +382,7 @@
      length range.  This may be overridden using the -S option, which
      specifies a different start point (in hex).
 
-     Once a set of candidates have been generated, they must be tested for
+     Once a set of candidates have been generated, they must be screened for
      suitability.  This may be performed using the -T option.  In this mode
      ssh-keygen will read candidates from standard input (or a file specified
      using the -f option).  For example:
@@ -390,13 +449,64 @@
      Finally, certificates may be defined with a validity lifetime.  The -V
      option allows specification of certificate start and end times.  A
      certificate that is presented at a time outside this range will not be
-     considered valid.  By default, certificates have a maximum validity
-     interval.
+     considered valid.  By default, certificates are valid from UNIX Epoch to
+     the distant future.
 
      For certificates to be used for user or host authentication, the CA
      public key must be trusted by sshd(8) or ssh(1).  Please refer to those
      manual pages for details.
 
+KEY REVOCATION LISTS
+     ssh-keygen is able to manage OpenSSH format Key Revocation Lists (KRLs).
+     These binary files specify keys or certificates to be revoked using a
+     compact format, taking as little as one bit per certificate if they are
+     being revoked by serial number.
+
+     KRLs may be generated using the -k flag.  This option reads one or more
+     files from the command line and generates a new KRL.  The files may
+     either contain a KRL specification (see below) or public keys, listed one
+     per line.  Plain public keys are revoked by listing their hash or
+     contents in the KRL and certificates revoked by serial number or key ID
+     (if the serial is zero or not available).
+
+     Revoking keys using a KRL specification offers explicit control over the
+     types of record used to revoke keys and may be used to directly revoke
+     certificates by serial number or key ID without having the complete
+     original certificate on hand.  A KRL specification consists of lines
+     containing one of the following directives followed by a colon and some
+     directive-specific information.
+
+     serial: serial_number[-serial_number]
+             Revokes a certificate with the specified serial number.  Serial
+             numbers are 64-bit values, not including zero and may be
+             expressed in decimal, hex or octal.  If two serial numbers are
+             specified separated by a hyphen, then the range of serial numbers
+             including and between each is revoked.  The CA key must have been
+             specified on the ssh-keygen command line using the -s option.
+
+     id: key_id
+             Revokes a certificate with the specified key ID string.  The CA
+             key must have been specified on the ssh-keygen command line using
+             the -s option.
+
+     key: public_key
+             Revokes the specified key.  If a certificate is listed, then it
+             is revoked as a plain public key.
+
+     sha1: public_key
+             Revokes the specified key by its SHA1 hash.
+
+     KRLs may be updated using the -u flag in addition to -k.  When this
+     option is specified, keys listed via the command line are merged into the
+     KRL, adding to those already there.
+
+     It is also possible, given a KRL, to test whether it revokes a particular
+     key (or keys).  The -Q flag will query an existing KRL, testing each key
+     specified on the commandline.  If any key listed on the command line has
+     been revoked (or an error encountered) then ssh-keygen will exit with a
+     non-zero exit status.  A zero exit status will only be returned if no key
+     was revoked.
+
 FILES
      ~/.ssh/identity
              Contains the protocol version 1 RSA authentication identity of
@@ -416,24 +526,26 @@
 
      ~/.ssh/id_dsa
      ~/.ssh/id_ecdsa
+     ~/.ssh/id_ed25519
      ~/.ssh/id_rsa
-             Contains the protocol version 2 DSA, ECDSA or RSA authentication
-             identity of the user.  This file should not be readable by anyone
-             but the user.  It is possible to specify a passphrase when
-             generating the key; that passphrase will be used to encrypt the
-             private part of this file using 128-bit AES.  This file is not
-             automatically accessed by ssh-keygen but it is offered as the
-             default file for the private key.  ssh(1) will read this file
-             when a login attempt is made.
+             Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA
+             authentication identity of the user.  This file should not be
+             readable by anyone but the user.  It is possible to specify a
+             passphrase when generating the key; that passphrase will be used
+             to encrypt the private part of this file using 128-bit AES.  This
+             file is not automatically accessed by ssh-keygen but it is
+             offered as the default file for the private key.  ssh(1) will
+             read this file when a login attempt is made.
 
      ~/.ssh/id_dsa.pub
      ~/.ssh/id_ecdsa.pub
+     ~/.ssh/id_ed25519.pub
      ~/.ssh/id_rsa.pub
-             Contains the protocol version 2 DSA, ECDSA or RSA public key for
-             authentication.  The contents of this file should be added to
-             ~/.ssh/authorized_keys on all machines where the user wishes to
-             log in using public key authentication.  There is no need to keep
-             the contents of this file secret.
+             Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA public
+             key for authentication.  The contents of this file should be
+             added to ~/.ssh/authorized_keys on all machines where the user
+             wishes to log in using public key authentication.  There is no
+             need to keep the contents of this file secret.
 
      /etc/moduli
              Contains Diffie-Hellman groups used for DH-GEX.  The file format
@@ -451,4 +563,4 @@
      created OpenSSH.  Markus Friedl contributed the support for SSH protocol
      versions 1.5 and 2.0.
 
-OpenBSD 5.0                     April 13, 2011                     OpenBSD 5.0
+OpenBSD 5.7                    February 24, 2015                   OpenBSD 5.7