Граф коммитов

667 Коммитов

Автор SHA1 Сообщение Дата
Han-Wen Nienhuys beb2a9779c ssh/knownhosts: disregard IP address if the hostname is available
This fixes the following vulnerability scenario:

* Victim logs into SAFE-HOST on SAFE-IP-ADDRESS regularly.

* Victim is cajoled into connecting to attacker controlled
  ATTACK-HOST, on ATTACK-IP-ADDRESS. ATTACK-HOST uses a different host
  key type (e.g. Ed25519 vs RSA). The new key is added at the end of
  known_hosts.

* Attacker makes DNS system return ATTACK-IP-ADDRESS for SAFE-HOST.

* Victim logs into SAFE-HOST, but is not warned because the host key
  matches ATTACK-IP-ADDRESS.

For this attack to work, the key type has to be different, because
knownhosts gives precedence to the first key found for each type. Add
a test that asserts this behavior.

The new semantics simplify the code, but callers that modify
.ssh/known_host interactviely must now take an extra step to remain
OpenSSH compatible: on successful login, the IP address must be
checked without hostname, and if it is not known, added separately to
the known_hosts file, so future logins that use an IP address only
will be protected too.

Thanks to Daniel Parks <security@demonhorse.net> for finding this
vulnerability.

Change-Id: I62b1b60ceb02e2f583a4657213feac1a8885dd42
Reviewed-on: https://go-review.googlesource.com/104939
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-09 15:00:46 +00:00
Han-Wen Nienhuys b2aa35443f ssh: drop extra connection Close call in TestMuxReadWrite
The extra Close call runs in a separate goroutine, and races with the
deferred Close call, leading to test flakes if the extra call fails

Change-Id: Ia1a2fb3932906da7cd0a8854b55f82785bb33716
Reviewed-on: https://go-review.googlesource.com/104335
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-03 16:09:46 +00:00
ValarDragon 12892e8c23 blake2b,blake2s: implement BinaryMarshaler, BinaryUnmarshaler
The marshal method allows the hash's internal state to be serialized and
unmarshaled at a later time, without having the re-write the entire stream
of data that was already written to the hash.

Fixes golang/go#24548

Change-Id: I82358c34181fc815f85d5d1509fb2fe0e62e40bd
Reviewed-on: https://go-review.googlesource.com/103241
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
2018-03-30 21:03:55 +00:00
Mark Rushakoff 88942b9c40 xtea: comment cleanup
Change-Id: Ibd61a57fbbaa2775adb370a7e91b6dc0f8ca8782
GitHub-Last-Rev: f0111f4a5f
GitHub-Pull-Request: golang/crypto#36
Reviewed-on: https://go-review.googlesource.com/102035
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-22 17:52:30 +00:00
Florian Uekermann 80db560fac nacl/sign: add package
This change adds the equivalents of crypto_sign, crypto_sign_open and
crypto_sign_keypair in TweetNaCl and libsodium using the Ed25519 system.
The original NaCl codebase does not contain functions with identical
semantics but its documentation stated the intent of using Ed25519 in
future releases.

Fixes golang/go#24350

Change-Id: I4c3c86b4875f2f718ad9299c2274b4ad9e11fbeb
Reviewed-on: https://go-review.googlesource.com/100578
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2018-03-20 22:59:59 +00:00
Brad Morgan c3a3ad6d03 acme/autocert: use valid certificates from the cache during renewal
Currently, the renewal flow will check the cache before renewing to make
sure it is actually necessary. This change modifies this flow to update
the local state so the cached cert is actually used by the manager.

Fixes golang/go#22960

Change-Id: I16668e8098616190938ee52858294b59bc1a5160
Reviewed-on: https://go-review.googlesource.com/89995
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-19 06:17:31 +00:00
Filippo Valsorda 374053ea96 openpgp/packet: improve handling of short MPIs for RSA values
MPIs are (supposed to be) stripped of leading zeroes. Avoid passing
such short values into crypto/rsa, even if it currently happens to work.

Change-Id: I5a5f4813b8358e83fcc2deeda1272d2733814542
Reviewed-on: https://go-review.googlesource.com/100844
Reviewed-by: Adam Langley <agl@golang.org>
2018-03-16 18:01:49 +00:00
Mike Tsao b4956d363a openpgp: serialize correct bitlength for generated ECC keys
Rather than rounding the `type || X || Y` byte sequence to the next
8-bit boundary, packet.NewECDSAPublicKey() now rounds the X and Y
coordinates individually, then adds the bitlength 3 of type 4
(compressed). For NIST P-256, this leads to a bit length of 515,
rather than 520. GnuPG calculates 515 as well, and
https://tools.ietf.org/html/rfc6637#section-6 explicitly states that
"the exact size of the MPI payload is 515 bits for 'Curve P-256,'"
so the new formula is consistent.

Fixes golang/go#23460

Change-Id: I64b340d1c761bfd795a1a64dc2f7a831c8b2ff32
Reviewed-on: https://go-review.googlesource.com/87995
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-15 20:43:35 +00:00
Lars Lehtonen 819dbedbcb openpgp/packet: fix swallowed errors in (*EncryptedKey).parse
Change-Id: I23da7bcda044417804a4c827501437d506002e8e
Reviewed-on: https://go-review.googlesource.com/63430
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-03-15 20:41:12 +00:00
Andrew Bonventre 21652f85b0 CONTRIBUTING.md: remove note about not accepting Pull Requests
Updates golang/go#24185

Change-Id: I99281b2bd1c1ca82c02269d232d7714852a3b94c
Reviewed-on: https://go-review.googlesource.com/100679
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-14 18:02:59 +00:00
Adam Langley c4a91bd4f5 ed25519: require canonical signatures
https://tools.ietf.org/html/rfc8032#section-5.1.7 requires that s be in
the range [0, order) in order to prevent signature malleability. This is
a new requirement in the RFC so the ed25519 package predates it. This
change aligns the code with the RFC.

The linked bug says that libsodium is also enforcing this check by
default.

See golang/go#24350

Change-Id: Ib69ce7c9e5a58971cbe225318d9fd87660bd5e4b
Reviewed-on: https://go-review.googlesource.com/100436
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-13 19:52:38 +00:00
Kyle Spiers 182114d582 sha3: fix typo in Shake256 docs
Change-Id: I1d8d1016a956bf185d3a5af76188b8287fce6391
Reviewed-on: https://go-review.googlesource.com/100195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-12 19:55:33 +00:00
Ilya Tocar c7dcf104e3 ripemd160: use bits.Rotate for rotates
Replace x << k | x >> (32 - k) with bits.RotateLeft32 and add
benchmark to check performance. This makes code cleaner and improves performance:

MillionA-6  34.8ms ± 1%  26.7ms ± 1%  -23.41%  (p=0.000 n=10+10)

Change-Id: I1b0c45f5ea12c7b53ab1ec5a26efc1903555fa66
Reviewed-on: https://go-review.googlesource.com/97915
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-08 18:56:24 +00:00
Tobias Klauser 7effd64e11 ssh/terminal: store termios copy in terminal state on Solaris
TestMakeRawState currently fails on Solaris:

  --- FAIL: TestMakeRawState (0.00s)
          terminal_test.go:334: states do not match; was &{0xc420015dd0}, expected &{0xc420015da0}

Change terminal.State to include a copy to the unix.Termios (like the
implementation for Linux and the BSDs) which also makes terminal.MakeRaw behave
as expected and lets TestMakeRawState pass.

Change-Id: I29382f83b84ff301991e1db170f32f41e144aec8
Reviewed-on: https://go-review.googlesource.com/99456
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-08 17:26:49 +00:00
Tobias Klauser 526a373fd7 ssh/terminal: simplify defer
Directly use unix.IoctlSetTermios and windows.SetConsoleMode instead of
wrapping them with a closure.

Change-Id: I6309253fbb6e59e029424273b48aaa608873ea17
Reviewed-on: https://go-review.googlesource.com/99455
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-08 17:19:52 +00:00
Mark Rushakoff 85f98707c9 argon2: fix typo and code formatting in comments
Change-Id: I31fde79e91dd2f19a688bd62ac421d564634d5b3
GitHub-Last-Rev: caab01d661
GitHub-Pull-Request: golang/crypto#33
Reviewed-on: https://go-review.googlesource.com/97798
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-06 22:39:34 +00:00
Jake Burkhead 0b6b69c7d2 acme/autocert: return error from cachePut
Fixes https://github.com/golang/go/issues/23569

Change-Id: I0f3ffab74acd2b69da0bbec2e0e90e42c2618071
GitHub-Last-Rev: e66a888d64
GitHub-Pull-Request: golang/crypto#35
Reviewed-on: https://go-review.googlesource.com/98756
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-06 22:18:58 +00:00
Alex Vaghin 91a49db82a acme: stop polling authz on 4xx client errors
"At Let's Encrypt, we are seeing clients in the wild that continue
polling their challenges long after those challenges have expired and
started serving 404."

The 4xx response code errors are client errors and should not be
retried.

Fixes golang/go#24145

Change-Id: I012c584fc4defd3a0d64a653860c35705c5c6653
Reviewed-on: https://go-review.googlesource.com/97695
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-28 16:13:26 +00:00
Han-Wen Nienhuys 8c653846df ssh: document how to unmarshal public keys
Fixes golang/go#21491.

Change-Id: I5c720f1f6c6acfa7f4cd50920f65db7e57ba3792
Reviewed-on: https://go-review.googlesource.com/95115
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-27 08:58:43 +00:00
Brad Fitzpatrick beaf6a3570 ssh: fix error variable naming convention, add docs
Follow up to CL 96336

Change-Id: I038f3901919c5136273e5df051bc6e958082f830
Reviewed-on: https://go-review.googlesource.com/96415
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-26 09:37:11 +00:00
Han-Wen Nienhuys 49796115aa ssh: use a variable rather than type for NoAuthError
Change-Id: Ib61e0bc7d953cefde0436f77fe6a610201043c85
Reviewed-on: https://go-review.googlesource.com/96336
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Spencer Tung <spencertung@google.com>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2018-02-22 18:24:04 +00:00
Spencer Tung 432090b8f5 Adding a unique error when no authentication method has been passed in
yet.

Since ServerAuthError returns all errors collected during the
userAuthLoop, it will always include the generic error "no auth passed
yet" (assuming the connection fails).

Change-Id: I5f6c67f3f0762b023618178d4028600d2b6c9253
Reviewed-on: https://go-review.googlesource.com/92737
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-19 16:34:59 +00:00
Damien Tournoud 650f4a345a openpgp: allow NewEntity to specify the default cipher
The openpgp package promotes bad defaults by not setting the
preferred cipher and hash of new entities created by
`openpgp.NewEntity`.

The preferred hash can be set by passing a `packet.Config`
with a `DefaultHash` set, but the same cannot be done for
the preferred cipher.

This change copies the DefaultCipher into the self-signature, similar to
DefaultHash.

Change-Id: I80e1289d67b7cd4079be8c1d5ba603a555dbe5c1
Reviewed-on: https://go-review.googlesource.com/66430
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2018-02-14 00:00:28 +00:00
Yaron de Leeuw 3a6c3ce65c openpgp: correct NewEntity name creation
Confusingly, `Identity.Name` should actually refer to `uid.Id` and not
`uid.Name`. This fixes the code in NewEntity, and creates a test case to
verify.

Change-Id: Id46de876fc7b0359faecfeb9b09a8e454710d485
Reviewed-on: https://go-review.googlesource.com/92595
Reviewed-by: Adam Langley <agl@golang.org>
2018-02-13 22:19:55 +00:00
Ingo Gottwald 9de5f2eaf7 acme/autocert: Remove unused retryAfter func
Change-Id: I607d3d2c28aa5a125bddc3fea4f9508942bc1365
Reviewed-on: https://go-review.googlesource.com/93315
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-11 21:16:03 +00:00
Han-Wen Nienhuys 5119cf507e ssh: clarify how to parse out Certificates
Fixes golang/go#22046

Change-Id: I9a9aff37ba0fd0ca1f5fa1a212c66b812f6b9f70
Reviewed-on: https://go-review.googlesource.com/88895
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-08 17:09:33 +00:00
Han-Wen Nienhuys dea6ea3747 ssh: compile multi_auth_test.go on linux only
LD_PRELOAD doesn't work on Windows, and needs tweaking for Darwin.

Change-Id: Ib153b9e63a0a8bcfefa6387f7910292585452c71
Reviewed-on: https://go-review.googlesource.com/92775
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2018-02-08 16:53:22 +00:00
Sami Pönkänen 9334d73e5f ssh: fix support for partial success authentication responses in client
The existing client side authentication does not handle correctly
the partial success flag in SSH_MSG_USERAUTH_FAILURE authentication
responses.

This commit fixes two problems in ssh library:
1) RetryableAuthMethod() now breaks out from the retry loop and
   returns  when underlying auth method fails with partial success
   set to true.
2) Book keeping of tried (and failed) auth methods in
   clientAuthenticate() does not mark an auth method failed if it
   fails with partial success set to true.

Fixes golang/go#23461

Change-Id: Ib2e1a1d54bfe2549496199bb2f66ebbce58d130d
Reviewed-on: https://go-review.googlesource.com/88035
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
2018-02-08 15:07:01 +00:00
Andreas Auernhammer d9133f5469 argon2: add Argon2id and update parameter recommendations
This change exports the Argon2 variant Argon2id and improves documenation.
The following parameter recommendations are added:
 - Argon2i:
   time=3 and max. memory for non-interactive scenarios as recommended by the
   RFC draft https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03#section-9.3
 - Argon2id:
   time=2 and memory=64MB for interactive scenarios as used by libsodium >= 1.0.9
   https://download.libsodium.org/doc/password_hashing/the_argon2i_function.html

   time=1 and max. memory for non-interactive scenarios as recommended by the
   RFC draft linked above.

Fixes golang/go#23602

Change-Id: Ia4d537e6126e5aff1243f2b5579df6bc8edb851a
Reviewed-on: https://go-review.googlesource.com/91935
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-06 19:08:13 +00:00
Sergey Lukjanov 1875d0a70c ssh/knownhosts: remove godoc about non-supported hashed hosts
Support for hashed hosts was added in:
https://go-review.googlesource.com/c/crypto/+/40532

Change-Id: Id18dd346d727c8bc94d0230588572e9c8ee2ccb0
Reviewed-on: https://go-review.googlesource.com/90355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-27 21:11:04 +00:00
Yasuhiro Matsumoto 0efb9460aa ssh/terminal: use duplicate handle in ReadPassword
os.NewFile assigns finalizer to close file handle
passed into ReadPassword. But that is not expected.
Make a duplicate of original file handle, and pass
copy handle into ReadPassword instead.

Fixes golang/go#23525

Change-Id: I4d6725e9a1cc20defd1b58afc383e35a7f9ee4e9
Reviewed-on: https://go-review.googlesource.com/89395
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-26 02:30:34 +00:00
Han-Wen Nienhuys 3d37316aaa ssh: return correct error on read failure
Change-Id: I6cc94ae8dbc65f394550551eaad88594d22eda42
Reviewed-on: https://go-review.googlesource.com/89095
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-23 09:55:55 +00:00
Han-Wen Nienhuys d94f6bc902 ssh: use io.ReadFull() for reading chacha20-poly1305 packets.
Incomplete reads leave (part of) the verification tag zeroed, leading
to a failing MAC, and this is more likely to happen with larger
packets. The test added in the previous commit should stop this from
regressing.

Reinstate chacha20-poly1305 as a default cipher and prefer it over AES
CTR flavors.

Fixes golang/go#23510

Change-Id: I7599897e59448edb7b814eebcc8226ea15b365d6
Reviewed-on: https://go-review.googlesource.com/89075
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-22 21:37:07 +00:00
Han-Wen Nienhuys 31469a2049 ssh: remove chacha20-poly1305 from preferredCipher list
This effectively disables the cipher.

Add a test against OpenSSH which sends larger packets through the
tested ciphers. This reproduces the problem reported in golang/go#23510

Change-Id: I4b124c690c409c6a0af2621e58a964ff55815f57
Reviewed-on: https://go-review.googlesource.com/88995
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2018-01-22 20:00:59 +00:00
Han-Wen Nienhuys 39efaea5da ssh: cleanup cipher creation logic
Change-Id: I0e6ac0a381ffa53650304f0bea2ba79c3cf1d8c2
Reviewed-on: https://go-review.googlesource.com/87196
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-22 08:56:10 +00:00
Han-Wen Nienhuys 1c1f1399d0 ssh: remove redundant code
The CBC cipher modes haven't been commented out for a while.

Change-Id: I819d595ecfe2d314479a6850ee146577311e34da
Reviewed-on: https://go-review.googlesource.com/87195
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-22 08:55:56 +00:00
Han-Wen Nienhuys 1835319e08 ssh: remove arcfour ciphers from the default preference list
OpenSSH removed these ciphers from sshd's default configuration with
release 6.7 in 2014.

Change-Id: Ia8b6d671dc8fa5d0493bf933d3b541f8ae5707a3
Reviewed-on: https://go-review.googlesource.com/86955
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-22 08:55:39 +00:00
Alex Vaghin a660000891 argon2: add missing amd64 tags
The change fixes argon2_test build failure which currently
reads as follows when built with gccgo:

./argon2/blamka_ref.go:9:1: error: redefinition of 'processBlock'
 func processBlock(out, in1, in2 *block) {
 ^
./argon2/blamka_amd64.go:53:1: note: previous definition of 'processBlock' was here
 func processBlock(out, in1, in2 *block) {
 ^
./argon2/blamka_ref.go:13:1: error: redefinition of 'processBlockXOR'
 func processBlockXOR(out, in1, in2 *block) {
 ^
./argon2/blamka_amd64.go:57:1: note: previous definition of 'processBlockXOR' was here
 func processBlockXOR(out, in1, in2 *block) {
 ^

Change-Id: I5c1d7360a2a91a2ac27273a5c1da2a139b1537a7
Reviewed-on: https://go-review.googlesource.com/88455
Run-TryBot: Alex Vaghin <ddos@google.com>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2018-01-19 16:59:57 +00:00
Han-Wen Nienhuys ee41a25c63 ssh: support chacha20-poly1305 cipher
chacha20-poly1305 is an AEAD which performs well without hardware
support. It is recommended as a replacement for the aging arcfour128
and arcfour256 ciphers.

Fixes golang/go#9489

Change-Id: I5d5a4620a435e65997f0ba7e683a34c29d9a396b
Reviewed-on: https://go-review.googlesource.com/87077
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-19 07:46:36 +00:00
Alex Vaghin 13931e22f9 acme/autocert: support http-01 challenge type
The Manager now loops through known challenge types,
trying to fulfill one at a time until it succeeds or runs out
of supported challenges.

The provisioning of "http-01" challenges can be done
using the new Manager.HTTPHandler method.
It requires listening on unencrypted port 80.

Fixes golang/go#21890

Change-Id: I55de9501f0069a9f460fedd8b5b0a09b94f9ef05
Reviewed-on: https://go-review.googlesource.com/87201
Run-TryBot: Alex Vaghin <ddos@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-12 20:08:14 +00:00
Justin Gracenin 5f55bce93a ssh: fix protocol version exchange (for multi-line)
Fixes golang/go#23194

During SSH Protocol Version Exchange, a client may send metadata lines
prior to sending the SSH version string. To conform to the RFC, all SSH
implementations must support this (minimally, clients can ignore the
metadata lines).

For example, this is valid:
some-metadata
SSH-2.0-OpenSSH

The current Go implementation takes the first line it sees as
the version string (in this case, some-metadata). Then, it uses
the next line (SSH-2.0-OpenSSH) as part of key exchange, which
is guaranteed to fail.

Unfortunately, this SSH feature is used by some vendors and is part
of the official RFC: https://tools.ietf.org/html/rfc4253#section-4.2

Change-Id: I7be61700a07756353875bf43aad09a580ba533ff
Reviewed-on: https://go-review.googlesource.com/86675
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-11 10:11:23 +00:00
Han-Wen Nienhuys b3c9a1d25c ssh: use t.Run for testing multiple ciphers/macs
Change-Id: I410cecf0269cf2a88a8868d6b88f39f9b7026b6b
Reviewed-on: https://go-review.googlesource.com/87076
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-10 14:51:55 +00:00
Han-Wen Nienhuys 49373064ff internal/chacha20: move up from chacha20poly1305/internal/chacha20
This exposes the chacha20 stream cipher to the entire x/crypto
package, and in particular to the SSH package, which uses separate,
unauthenticated chacha20 encryption for packet lengths.

Change-Id: I0b705482128f0657c09292370f03d08b588f7fec
Reviewed-on: https://go-review.googlesource.com/87075
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-10 14:51:33 +00:00
Han-Wen Nienhuys 6bd909f163 ssh: specify InsecureIgnoreHostKey in the benchmarks
Change-Id: I06813be2b44ef8e5eb38fdac2d08a0f5cd840193
Reviewed-on: https://go-review.googlesource.com/86935
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-10 10:03:27 +00:00
Adam Langley 0fcca4842a bn256: don't claim a 128-bit security level.
It's no longer true.

Fixes golang/go#19479

Change-Id: I85b0ce850ebde60b816924a25368208527a8e617
Reviewed-on: https://go-review.googlesource.com/79877
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-12-31 21:50:28 +00:00
Andreas Auernhammer 2b4b18b6aa argon2: fix incorrect key derivation if parallelism > 1
This change fixes an incorrect key derivation if the
degree of parallelism is greater than 1.

This change adds additional test vectors generated by the
https://github.com/P-H-C/phc-winner-argon2 CLI.

Fixes golang/go#23200

Change-Id: I8add8382b9e9ebbf9a70493050867c9af4ed6aa7
Reviewed-on: https://go-review.googlesource.com/85055
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-31 21:46:28 +00:00
Mansour Rahimi 95a4943f35 crypto/ssh: fix typo in error message in certs.go
Fixes golang/go#23266

Change-Id: I8da14425ed69c44a7b0c56b1aa0ea951fe297608
Reviewed-on: https://go-review.googlesource.com/85595
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-28 08:17:15 +00:00
Andrew Ekstedt d585fd2cc9 pbkdf2: add benchmarks
Add benchmarks for PBKDF2-HMAC-SHA1 and PBKDF2-HMAC-SHA256.
This is to help measure the crypto/hmac changes in CL 27458.

Change-Id: I17ef12f3a4641ba44f7bb917a9d87a3ed7c97c67
Reviewed-on: https://go-review.googlesource.com/84380
Reviewed-by: Filippo Valsorda <hi@filippo.io>
2017-12-19 04:11:29 +00:00
Peter Moody 244f6ce1f0 ssh: accept ed25519 certs
Change-Id: I1cb0146c4b741f6d489edcf86412001ffc007f4f
Reviewed-on: https://go-review.googlesource.com/82256
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-18 18:48:59 +00:00
Andreas Auernhammer 625c6a7b44 argon2: add new package implementing the Argon2 PBKDF family
This CL adds the package argon2. The argon2 package implements
the Argon2 PBKDF family (Argon2i, Argon2d, Argon2id).

Argon2 is memory-hard key derivation function and is specified
at https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
It can be used to derive cryptographic keys with high entropy from low
entropy passwords.

Fixes golang/go#19896

Change-Id: I5b099682a8e3d7569ad18400cebddefc99a7e22f
Reviewed-on: https://go-review.googlesource.com/82575
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-12-18 18:31:08 +00:00