aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/crypto
AgeCommit message (Collapse)Author
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.
2014-09-07crypto/tls: print unexpected error in testRuss Cox
Maybe will help us understand Solaris build failure. TBR=aram CC=golang-codereviews https://golang.org/cl/139290043
2014-09-02crypto: Add SHA3 functions in go.crypto/sha3 to the Hash enum.David Leon Gil
Reverse dependency of https://golang.org/cl/130950043/ LGTM=agl R=golang-codereviews, agl CC=agl, golang-codereviews https://golang.org/cl/138800043
2014-08-29crypto: add SignerAdam Langley
Signer is an interface to support opaque private keys. These keys typically result from being kept in special hardware (i.e. a TPM) although sometimes operating systems provide a similar interface using process isolation for security rather than hardware boundaries. This changes provides interfaces for representing them and alters crypto/tls so that client certificates can use opaque keys. LGTM=bradfitz R=bradfitz CC=golang-codereviews, jdeprez https://golang.org/cl/114680043
2014-08-28crypto/md5: use go generate to create md5block.goChaiShushan
LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/129650043
2014-08-25crypto/cipher: add CFB test vectors.Adam Langley
Fixes #8576. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/136720043
2014-08-15crypto/x509: SystemRootsError style tweaks, document in VerifyBrad Fitzpatrick
In retrospect this should've been a variable instead of a type, but oh well. LGTM=agl R=agl CC=golang-codereviews https://golang.org/cl/129250044
2014-08-12all: copy cmd/ld/textflag.h into pkg/GOOS_GOARCHRob Pike
The file is used by assembly code to define symbols like NOSPLIT. Having it hidden inside the cmd directory makes it hard to access outside the standard repository. Solution: As with a couple of other files used by cgo, copy the file into the pkg directory and add a -I argument to the assembler to access it. Thus one can write just #include "textflag.h" in .s files. The names in runtime are not updated because in the boot sequence the file has not been copied yet when runtime is built. All other .s files in the repository are updated. Changes to doc/asm.html, src/cmd/dist/build.c, and src/cmd/go/build.go are hand-made. The rest are just the renaming done by a global substitution. (Yay sam). LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/128050043
2014-08-12crypto/rand: use getrandom system call on LinuxBrad Fitzpatrick
Adds internal/syscall package. Fixes #8520 LGTM=r, agl R=agl, rsc, r CC=golang-codereviews, iant https://golang.org/cl/123260044
2014-08-11crypto/tls: implement tls-unique channel binding (RFC 5929 section 3).Andres Erbsen
Tested against GnuTLS and Python. LGTM=agl R=golang-codereviews, agl, ashankar CC=agl, golang-codereviews https://golang.org/cl/117100043
2014-08-06crypto/tls: Added dynamic alternative to NameToCertificate map for SNIPercy Wegmann
Revised version of https://golang.org/cl/81260045/ LGTM=agl R=golang-codereviews, gobot, agl, ox CC=golang-codereviews https://golang.org/cl/107400043
2014-08-05crypto/tls: add ALPN support.Adam Langley
Fixes #6736. LGTM=mikioh.mikioh R=bradfitz, mikioh.mikioh CC=golang-codereviews https://golang.org/cl/108710046
2014-07-28crypto/tls: check curve equation in ECDHE.Adam Langley
This change causes a TLS client and server to verify that received elliptic curve points are on the expected curve. This isn't actually necessary in the Go TLS stack, but Watson Ladd has convinced me that it's worthwhile because it's pretty cheap and it removes the possibility that some change in the future (e.g. tls-unique) will depend on it without the author checking that precondition. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/115290046
2014-07-28crypto/tls: Support ECDSA keys in generate_cert.goAsim Shankar
R=golang-codereviews, bradfitz, agl CC=golang-codereviews https://golang.org/cl/117180043
2014-07-22crypto/subtle: make ConstantTimeCompare return zero for args of different ↵David Symonds
length. This is more useful than panicking, since otherwise every caller needs to do the length check before calling; some will forget, and have a potential submarine crasher as a result. Other implementations of this functionality do a length check. This is backward compatible, except if someone has written code that relies on this panicking with different length args. However, that was not the case before Go 1.3 either. Updates #7304. LGTM=agl R=agl, minux, hanwen CC=golang-codereviews https://golang.org/cl/118750043
2014-07-10crypto/rc4: disable assembly implementation for nacl/arm.Shenghou Ma
It uses an unsupported addressing mode. LGTM=iant, rsc R=rsc, iant CC=golang-codereviews https://golang.org/cl/106370043
2014-07-08crypto/x509: skip test on android (no Go tool)David Crawshaw
LGTM=minux R=golang-codereviews, minux CC=golang-codereviews https://golang.org/cl/111970043
2014-07-03crypto/x509: fix format strings in testDmitriy Vyukov
Currently it says: --- PASS: TestDecrypt-2 (0.11s) pem_decrypt_test.go:17: test 0. %!s(x509.PEMCipher=1) --- PASS: TestEncrypt-2 (0.00s) pem_decrypt_test.go:42: test 0. %!s(x509.PEMCipher=1) LGTM=alex.brainman R=golang-codereviews, alex.brainman CC=golang-codereviews https://golang.org/cl/108400044
2014-07-02crypto/rsa: fix out-of-bound access with short session keys.Adam Langley
Thanks to Cedric Staub for noting that a short session key would lead to an out-of-bounds access when conditionally copying the too short buffer over the random session key. LGTM=davidben, bradfitz R=davidben, bradfitz CC=golang-codereviews https://golang.org/cl/102670044
2014-07-02crypto/cipher: fix typo in example commentPreetam Jinka
LGTM=josharian R=golang-codereviews, josharian CC=golang-codereviews https://golang.org/cl/110330043
2014-07-01src, misc: applied gofmt -w -sRobert Griesemer
TBR=rsc R=golang-codereviews CC=golang-codereviews https://golang.org/cl/111770043
2014-06-28crypto/cipher: Fix typo in example commentPreetam Jinka
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/101510047
2014-06-03crypto/tls: fix typo referencing the required Config fieldBrad Fitzpatrick
Thanks to Frithjof Schulze for noticing. LGTM=adg R=adg CC=agl, golang-codereviews, r https://golang.org/cl/107740043
2014-05-20build: make nacl passRuss Cox
Add nacl.bash, the NaCl version of all.bash. It's a separate script because it builds a variant of package syscall with a large zip file embedded in it, containing all the input files needed for tests. Disable various tests new since the last round, mostly the ones using os/exec. Fixes #7945. LGTM=dave R=golang-codereviews, remyoudompheng, dave, bradfitz CC=golang-codereviews https://golang.org/cl/100590044
2014-05-15crypto/sha256, crypto/sha512: fix argument size in assemblyRuss Cox
The function takes 32 bytes of arguments: 8 for the *block and then 3*8 for the slice. The 24 is not causing a bug (today at least) because the final word is the cap of the slice, which the assembly does not use. Identified by 'go vet std'. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/96360043
2014-05-09crypto/aes: fix overrun in assembly encrypt/decryptRuss Cox
Fixes #7928. LGTM=bradfitz R=golang-codereviews CC=agl, bradfitz, golang-codereviews https://golang.org/cl/91320043
2014-05-02std lib: fix various typos in commentsRobert Griesemer
Where the spelling changed from British to US norm (e.g., optimise -> optimize) it follows the style in that file. LGTM=adonovan R=golang-codereviews, adonovan CC=golang-codereviews https://golang.org/cl/96980043
2014-04-29all: spelling tweaks, A-GRobert Hencke
LGTM=ruiu, bradfitz R=golang-codereviews, bradfitz, ruiu CC=golang-codereviews https://golang.org/cl/91840044
2014-04-26src: fix issues found by go vet stdRobert Hencke
LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/96850043
2014-04-16all: fix typosRui Ueyama
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/88670043
2014-04-15crypto/tls: don't block on Read of zero bytesBrad Fitzpatrick
Fixes #7775 LGTM=rsc R=agl, rsc CC=golang-codereviews https://golang.org/cl/88340043
2014-04-14crypto/x509: fix Windows build.Adam Langley
Windows is building a chain to the AddTrust root which is different from the native Go code and causing a build failure. This change alters the test so that both should build to the AddTrust root. R=bradfitz LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/87570044
2014-04-14crypto/x509: support SHA-512 by default.Adam Langley
Comodo are now using a SHA-384 signed intermediate. The crypto/x509 package seeks to import hash functions needed for typical operation without needing to import every hash function possible. Since a SHA-384 certificate is being used by Comodo, crypto/sha512 now appears to fall into the scope of "typical operation". R=bradfitz LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/87670045
2014-04-08crypto/(ec)dsa: use Fermat's inversion.Adam Langley
Now that we have a constant-time P-256 implementation, it's worth paying more attention elsewhere. The inversion of k in (EC)DSA was using Euclid's algorithm which isn't constant-time. This change switches to Fermat's algorithm, which is much better. However, it's important to note that math/big itself isn't constant time and is using a 4-bit window for exponentiation with variable memory access patterns. (Since math/big depends quite deeply on its values being in minimal (as opposed to fixed-length) represetation, perhaps crypto/elliptic should grow a constant-time implementation of exponentiation in the scalar field.) R=bradfitz Fixes #7652. LGTM=rsc R=golang-codereviews, bradfitz, rsc CC=golang-codereviews https://golang.org/cl/82740043
2014-04-02crypto/tls: deflake TestConnReadNonzeroAndEOFBrad Fitzpatrick
Fixes #7683 LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/83080048
2014-03-28crypto/x509: unbreak Windows build.Adam Langley
This change sets systemSkip on a test where Go and CAPI have different chain building behaviour. CAPI is correct, but aligning the Go code is probably too large a change prior to 1.3. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/81620043
2014-03-27crypto/x509: update tests because Windows removed the Verisign root.Adam Langley
The root update on 3/11/2014 removed the Verisign root cert that the Go tests use. This only affects the 'TestSystemVerify' test in crypto/x509. Fixes #7523. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/80000044
2014-03-25crypto/tls: make Conn.Read return (n, io.EOF) when EOF is next in bufferBrad Fitzpatrick
Update #3514 An io.Reader is permitted to return either (n, nil) or (n, io.EOF) on EOF or other error. The tls package previously always returned (n, nil) for a read of size n if n bytes were available, not surfacing errors at the same time. Amazon's HTTPS frontends like to hang up on clients without sending the appropriate HTTP headers. (In their defense, they're allowed to hang up any time, but generally a server hangs up after a bit of inactivity, not immediately.) In any case, the Go HTTP client tries to re-use connections by looking at whether the response headers say to keep the connection open, and because the connection looks okay, under heavy load it's possible we'll reuse it immediately, writing the next request, just as the Transport's always-reading goroutine returns from tls.Conn.Read and sees (0, io.EOF). But because Amazon does send an AlertCloseNotify record before it hangs up on us, and the tls package does its own internal buffering (up to 1024 bytes) of pending data, we have the AlertCloseNotify in an unread buffer when our Conn.Read (to the HTTP Transport code) reads its final bit of data in the HTTP response body. This change makes that final Read return (n, io.EOF) when an AlertCloseNotify record is buffered right after, if we'd otherwise return (n, nil). A dependent change in the HTTP code then notes whether a client connection has seen an io.EOF and uses that as an additional signal to not reuse a HTTPS connection. With both changes, the majority of Amazon request failures go away. Without either one, 10-20 goroutines hitting the S3 API leads to such an error rate that empirically up to 5 retries are needed to complete an API call. LGTM=agl, rsc R=agl, rsc CC=golang-codereviews https://golang.org/cl/76400046
2014-03-21encoding/asn1: use GeneralizedTime for times outside the range of UTCTime.Adam Langley
Fixes issue #6976. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/72080044
2014-03-20crypto/tls: clarify concurrent use of ConfigBrad Fitzpatrick
LGTM=r, agl R=agl, r CC=golang-codereviews https://golang.org/cl/77530044
2014-03-11crypto/rsa: fix docs for PrecomputedValues.QinvShenghou Ma
Fixes #7507. LGTM=agl R=agl CC=golang-codereviews https://golang.org/cl/74090043
2014-03-08crypto/md5, crypto/sha1: exclude amd64p32 from generic implementations.Dave Cheney
We provide amd64p32 implementations for md5 and sha1 so we need to exclude amd64p32 from the generic implementations in those packages. Fixes build once CL 72360044 lands. LGTM=agl, remyoudompheng R=rsc, bradfitz, agl, remyoudompheng CC=golang-codereviews https://golang.org/cl/72460043
2014-03-04crypto/cipher: fix AEAD.Open documentation nitBrad Fitzpatrick
It mentioned true and false for error values. Instead, just don't mention the error semantics, as they match normal Go conventions (if error is non-nil, the other value is meaningless). We generally only document error values when they're interesting (where non-nil, non-nil is valid, or the error value can be certain known values or types). Fixes #7464 LGTM=agl R=agl CC=golang-codereviews https://golang.org/cl/68440044
2014-03-03crypto/tls: split connErr to avoid read/write races.Adam Langley
Currently a write error will cause future reads to return that same error. However, there may have been extra information from a peer pending on the read direction that is now unavailable. This change splits the single connErr into errors for the read, write and handshake. (Splitting off the handshake error is needed because both read and write paths check the handshake error.) Fixes #7414. LGTM=bradfitz, r R=golang-codereviews, r, bradfitz CC=golang-codereviews https://golang.org/cl/69090044
2014-02-28crypto/tls: add DialWithDialer.Adam Langley
While reviewing uses of the lower-level Client API in code, I found that in many cases, code was using Client only because it needed a timeout on the connection. DialWithDialer allows a timeout (and other values) to be specified without resorting to the low-level API. LGTM=r R=golang-codereviews, r, bradfitz CC=golang-codereviews https://golang.org/cl/68920045
2014-02-25crypto/sha1: restore accidental removal of arm build tagBrad Fitzpatrick
Regression from https://golang.org/cl/68490043/diff/60001/src/pkg/crypto/sha1/sha1block_decl.go Fixes arm build. TBR=rsc R=rsc CC=golang-codereviews https://golang.org/cl/68080046
2014-02-25all: merge NaCl branch (part 1)Dave Cheney
See golang.org/s/go13nacl for design overview. This CL is the mostly mechanical changes from rsc's Go 1.2 based NaCl branch, specifically 39cb35750369 to 500771b477cf from https://code.google.com/r/rsc-go13nacl. This CL does not include working NaCl support, there are probably two or three more large merges to come. CL 15750044 is not included as it involves more invasive changes to the linker which will need to be merged separately. The exact change lists included are 15050047: syscall: support for Native Client 15360044: syscall: unzip implementation for Native Client 15370044: syscall: Native Client SRPC implementation 15400047: cmd/dist, cmd/go, go/build, test: support for Native Client 15410048: runtime: support for Native Client 15410049: syscall: file descriptor table for Native Client 15410050: syscall: in-memory file system for Native Client 15440048: all: update +build lines for Native Client port 15540045: cmd/6g, cmd/8g, cmd/gc: support for Native Client 15570045: os: support for Native Client 15680044: crypto/..., hash/crc32, reflect, sync/atomic: support for amd64p32 15690044: net: support for Native Client 15690048: runtime: support for fake time like on Go Playground 15690051: build: disable various tests on Native Client LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/68150047
2014-02-24crypto/tls: report TLS version in ConnectionState.Adam Langley
Fixes #7231. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/68250043
2014-02-24crypto/tls: pick ECDHE curves based on server preference.Adam Langley
Currently an ECDHE handshake uses the client's curve preference. This generally means that we use P-521. However, P-521's strength is mismatched with the rest of the cipher suite in most cases and we have a fast, constant-time implementation of P-256. With this change, Go servers will use P-256 where the client supports it although that can be overridden in the Config. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/66060043
2014-02-24crypto/md5,sha1: add examples for SumRob Pike
LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/66900044