aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/crypto
AgeCommit message (Collapse)Author
2013-09-23crypto/tls: document that the package supports TLS 1.2Russ Cox
Fixes #6456. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13740047
2013-09-20crypto/x509: update comment on system root cert locations.David Symonds
R=golang-dev, r CC=golang-dev https://golang.org/cl/13775045
2013-09-17crypto/tls: don't select ECDSA ciphersuites with only an RSA certificate.Adam Langley
47ec7a68b1a2 added support for ECDSA ciphersuites but didn't alter the cipher suite selection to take that into account. Thus Go servers could try and select an ECDSA cipher suite while only having an RSA certificate, leading to connection failures. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/13239053
2013-09-16crypto/tls: fix TLS 1.2 client certificates.Adam Langley
With TLS 1.2, when sending client certificates the code was omitting the new (in TLS 1.2) signature and hash fields. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/13413050
2013-09-12crypto/x509: allow ECDSA public keys to be marshaled.Nicholas Sullivan
The public key serialization from CreateCertificate is factored out to be used in MarshalPKIXPublicKey. Testcode with one P224 ECDSA keypair has been added. R=golang-dev, agl CC=agl, golang-dev https://golang.org/cl/13427044
2013-09-06crypto/rand: make Read use io.ReadFullBrad Fitzpatrick
Fixes #6084 R=golang-dev, rsc, dave CC=golang-dev https://golang.org/cl/13523044
2013-08-30crypto/x509: expose arbitary X.509 extensions.Adam Langley
This change allows people who want to parse or set odd X.509 extensions to do so without having to add support for them all to the package. I tried to make it so that only a single member: Extensions would be needed. However, that would mean detecting when the caller had altered the contents of it so that parsing and marshaling a certificate wouldn't ignore all changes to the other members. This ended up being messy, thus the current design where there are two members: one for reading and another for writing. As crypto/x509 adds support for more extensions in the future, the raw extensions will still be in Extensions for older code that expects it there. Also, future extensions will be overridden by any raw extensions added to ExtraExtensions by code that was written before support was added. R=golang-dev, r CC=golang-dev, jpsugar https://golang.org/cl/12056043
2013-08-29crypto/tls: support AES-GCM.Adam Langley
AES-GCM is the only current TLS ciphersuite that doesn't have cryptographic weaknesses (RC4), nor major construction issues (CBC mode ciphers) and has some deployment (i.e. not-CCM). R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13249044
2013-08-24all: dragonfly supportJoel Sing
Enable remaining packages (crypto, mime, path, time) to build on dragonfly. R=bradfitz CC=golang-dev https://golang.org/cl/13190043
2013-08-12all: change textflags from numbers to symbols.Keith Randall
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12774043
2013-08-12crypto/rand: simplify example to exploit properties of ReadFullRob Pike
No need for the complex condition. Fixes #6089 R=golang-dev, mischief, adg CC=golang-dev https://golang.org/cl/12731043
2013-08-05undo CL 12486043 / ab644299d124Brad Fitzpatrick
Uglier. ««« original CL description all: use strings.IndexByte instead of Index where possible R=golang-dev, khr CC=golang-dev https://golang.org/cl/12486043 »»» R=golang-dev CC=golang-dev https://golang.org/cl/12485044
2013-08-05all: use strings.IndexByte instead of Index where possibleBrad Fitzpatrick
R=golang-dev, khr CC=golang-dev https://golang.org/cl/12486043
2013-08-05crypto/cipher: add GCM mode.Adam Langley
GCM is Galois Counter Mode, an authenticated encryption mode that is, nearly always, used with AES. R=rsc CC=golang-dev https://golang.org/cl/12375043
2013-08-05crypto: include hash number in panic message.Adam Langley
In the event that code tries to use a hash function that isn't compiled in and panics, give the developer a fighting chance of figuring out which hash function it needed. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/12420045
2013-07-31crypto/des: faster permutation.Rémy Oudompheng
This patch introduces specialized functions for initial and final permutations, and precomputes the output of the third permutation on the S-box elements. benchmark old ns/op new ns/op delta BenchmarkEncrypt 3581 1226 -65.76% BenchmarkDecrypt 3590 1224 -65.91% benchmark old MB/s new MB/s speedup BenchmarkEncrypt 2.23 6.52 2.92x BenchmarkDecrypt 2.23 6.53 2.93x R=golang-dev, rsc CC=golang-dev https://golang.org/cl/12072045
2013-07-29all: move examples into package *_test.Rémy Oudompheng
Fixes #5677. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/11992043
2013-07-26crypto/des: faster block expansion.Rémy Oudompheng
On amd64: benchmark old ns/op new ns/op delta BenchmarkEncrypt 6170 3593 -41.77% BenchmarkDecrypt 6209 3564 -42.60% benchmark old MB/s new MB/s speedup BenchmarkEncrypt 1.30 2.23 1.72x BenchmarkDecrypt 1.29 2.24 1.74x Update #4299. R=golang-dev, agl, bradfitz, rsc CC=golang-dev https://golang.org/cl/11874043
2013-07-25crypto/md5: native arm assembler versionNick Craig-Wood
An ARM version of md5block.go with a big improvement in throughput (up to 2.5x) and a reduction in object size (21%). Code size Before 3100 bytes After 2424 bytes 21% smaller Benchmarks on Rasperry Pi benchmark old ns/op new ns/op delta BenchmarkHash8Bytes 11703 6636 -43.30% BenchmarkHash1K 38057 21881 -42.50% BenchmarkHash8K 208131 142735 -31.42% BenchmarkHash8BytesUnaligned 11457 6570 -42.66% BenchmarkHash1KUnaligned 69334 26841 -61.29% BenchmarkHash8KUnaligned 455120 182223 -59.96% benchmark old MB/s new MB/s speedup BenchmarkHash8Bytes 0.68 1.21 1.78x BenchmarkHash1K 26.91 46.80 1.74x BenchmarkHash8K 39.36 57.39 1.46x BenchmarkHash8BytesUnaligned 0.70 1.22 1.74x BenchmarkHash1KUnaligned 14.77 38.15 2.58x BenchmarkHash8KUnaligned 18.00 44.96 2.50x benchmark old allocs new allocs delta BenchmarkHash8Bytes 1 0 -100.00% BenchmarkHash1K 2 0 -100.00% BenchmarkHash8K 2 0 -100.00% BenchmarkHash8BytesUnaligned 1 0 -100.00% BenchmarkHash1KUnaligned 2 0 -100.00% BenchmarkHash8KUnaligned 2 0 -100.00% benchmark old bytes new bytes delta BenchmarkHash8Bytes 64 0 -100.00% BenchmarkHash1K 128 0 -100.00% BenchmarkHash8K 128 0 -100.00% BenchmarkHash8BytesUnaligned 64 0 -100.00% BenchmarkHash1KUnaligned 128 0 -100.00% BenchmarkHash8KUnaligned 128 0 -100.00% This also adds another test which makes sure that the sums over larger blocks work properly. I wrote this test when I was worried about memory corruption. R=golang-dev, dave, bradfitz, rsc, ajstarks CC=golang-dev, minux.ma, remyoudompheng https://golang.org/cl/11648043
2013-07-23all: be more idiomatic when documenting boolean return values.Rob Pike
Phrases like "returns whether or not the image is opaque" could be describing what the function does (it always returns, regardless of the opacity) or what it returns (a boolean indicating the opacity). Even when the "or not" is missing, the phrasing is bizarre. Go with "reports whether", which is still clunky but at least makes it clear we're talking about the return value. These were edited by hand. A few were cleaned up in other ways. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/11699043
2013-07-22all: change "true iff" to "whether" in public docsBrad Fitzpatrick
For consistency with Go documentation style. R=golang-dev, khr CC=golang-dev https://golang.org/cl/11697043
2013-07-17crypto/tls: Add support for ECDHE-ECDSAJoel Sing
Add support for ECDHE-ECDSA (RFC4492), which uses an ephemeral server key pair to perform ECDH with ECDSA signatures. Like ECDHE-RSA, ECDHE-ECDSA also provides PFS. R=agl CC=golang-dev https://golang.org/cl/7006047
2013-07-16crypto/rsa: remove obsolete TODO.Adam Langley
(PSS support is complete.) Thanks to Frithjof Schulze for noting this. R=golang-dev, r CC=golang-dev https://golang.org/cl/10871046
2013-07-02crypto/tls: implement TLS 1.2.Adam Langley
This does not include AES-GCM yet. Also, it assumes that the handshake and certificate signature hash are always SHA-256, which is true of the ciphersuites that we currently support. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/10762044
2013-06-27crypto/x509: Added RFC 5280, section 4.2.2.1 Authority Information AccessPaul van Brouwershaven
R=agl, agl CC=gobot, golang-dev https://golang.org/cl/10245048
2013-06-27crypto/tls: Change TLS version to 1.1 in the package comment.Frithjof Schulze
Also use 2048-bit RSA keys as default in generate_cert.go, as recommended by the NIST. R=golang-dev, rsc, bradfitz CC=golang-dev https://golang.org/cl/10676043
2013-06-27crypto/elliptic: add constant-time, P-256 implementation.Adam Langley
On my 64-bit machine, despite being 32-bit code, fixed-base multiplications are 7.1x faster and arbitary multiplications are 2.6x faster. It is difficult to review this change. However, the code is essentially the same as code that has been open-sourced in Chromium. There it has been successfully performing P-256 operations for several months on many machines so the arithmetic of the code should be sound. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/10551044
2013-06-27crypto/sha512: update comment for the Sum512 function.Robin Eklind
R=golang-dev, r CC=golang-dev https://golang.org/cl/10660043
2013-06-26crypto/sha512: provide top-level Sum512 and Sum384 functionsRob Pike
Makes it easy to ask the simple question, what is the hash of this data? Also fix the commentary and prints in Sum256. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/10630043
2013-06-26crypto/sha256: provide top-level Sum and Sum224 functionsRob Pike
Makes it easy to ask the simple question, what is the hash of this data? R=golang-dev, rsc CC=golang-dev https://golang.org/cl/10629043
2013-06-26crypto/md5: provide a top-level Sum functionRob Pike
Makes it easy to ask the simple question, what is the hash of this data? Also mark block as non-escaping. R=golang-dev, agl CC=golang-dev https://golang.org/cl/10624044
2013-06-25crypto/sha1: provide a top-level Sum functionRob Pike
Makes it easy to ask the simple question, what is the hash of this data? R=golang-dev, rsc, bradfitz CC=golang-dev https://golang.org/cl/10571043
2013-06-24crypto/sha1: mark block as non-escapingRob Pike
The compiler still gets the escape analysis wrong, but the annotation here is correct. R=golang-dev, dave, bradfitz CC=golang-dev https://golang.org/cl/10514046
2013-06-20crypto/x509: add function to marshal EC private keys.Adam Langley
This complements the parsing function that we already have. R=golang-dev, r CC=golang-dev https://golang.org/cl/10426043
2013-06-19crypto/tls: change advertised ciphersuite order.Adam Langley
TLS clients send ciphersuites in preference order (most prefereable first). This change alters the order so that ECDHE comes before plain RSA, and RC4 comes before AES (because of the Lucky13 attack). This is unlikely to have much effect: as a server, the code uses the client's ciphersuite order by default and, as a client, the non-Go server probably imposes its order. R=golang-dev, r, raggi, jsing CC=golang-dev https://golang.org/cl/10372045
2013-06-17crypto/x509: Added RFC 5280, section 4.2.1.14 to parseCertificate and ↵Paul van Brouwershaven
buildExtensions Support for CRL Distribution Points R=golang-dev, agl, bradfitz CC=golang-dev https://golang.org/cl/10258043
2013-06-17crypto/cipher: StreamWriter.Closer docs + behavior changeBrad Fitzpatrick
Don't panic when the underlying Writer isn't a Closer. And document what Close does and clarify that it's not a Flush. R=golang-dev, agl CC=golang-dev https://golang.org/cl/10310043
2013-06-10asn1: Improved encoding/decoding for OID typesGerasimos Dimitriadis
The first identifier in an Object Identifer must be between 0 and 2 inclusive. The range of values that the second one can take depends on the value of the first one. The two first identifiers are not necessarily encoded in a single octet, but in a varint. R=golang-dev, agl CC=golang-dev https://golang.org/cl/10140046
2013-06-04crypto/tls: support TLS 1.1.Adam Langley
The significant change between TLS 1.0 and 1.1 is the addition of an explicit IV in the case of CBC encrypted records. Support for TLS 1.1 is needed in order to support TLS 1.2. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7880043
2013-05-29 crypto/tls: Check all certificates in the path.John Shahid
Currently we only check the leaf node's issuer against the list of distinguished names in the server's CertificateRequest message. This will fail if the client certiciate has more than one certificate in the path and the leaf node issuer isn't in the list of distinguished names, but the issuer's issuer was in the distinguished names. R=agl, agl CC=gobot, golang-dev https://golang.org/cl/9795043
2013-05-24crypto/x509: harmonise error prefixes.Adam Langley
crypto/x509 has ended up with a variety of error formats. This change makes them all start with "x509: ". R=golang-dev, r CC=golang-dev https://golang.org/cl/9736043
2013-05-23crypto/rsa: implement PSS signatures.Nan Deng
This change contains an implementation of the RSASSA-PSS signature algorithm described in RFC 3447. R=agl, agl CC=gobot, golang-dev, r https://golang.org/cl/9438043
2013-05-21crypto/tls: don't send NPN extension if NextProtos is not set.Adam Langley
This isn't clearly a bug on Go's part, but it triggers a bug in Firefox which means that crypto/tls and net/http cannot be wired up together unless NextProtos includes "http/1.1". When net/http sets up the tls.Config, it does this and so works fine. But anyone setting up the tls.Config themselves will hit the Firefox bug. Fixes #5445. R=golang-dev, bradfitz, r CC=golang-dev https://golang.org/cl/9539045
2013-05-20crypto/x509: provide better error messages for X.509 verify failures.Adam Langley
Failures caused by errors like invalid signatures or missing hash functions cause rather generic, unhelpful error messages because no trust chain can be constructed: "x509: certificate signed by unknown authority." With this change, authority errors may contain the reason why an arbitary candidate step in the chain was rejected. For example, in the event of a missing hash function the error looks like: x509: certificate signed by unknown authority (possibly because of "crypto/x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate 'Thawte SGC CA') Fixes 5058. R=golang-dev, r CC=golang-dev https://golang.org/cl/9104051
2013-05-16crypto/tls: fix flakey test.Adam Langley
A test added in b37d2fdcc4d9 didn't work with some values of GOMAXPROCS because the defer statements were in the wrong order: the Pipe could be closed before the TLS Client was. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/9187047
2013-05-15crypto/rsa: check for minimal PKCS#1 v1.5 padding.Adam Langley
The PKCS#1 spec requires that the PS padding in an RSA message be at least 8 bytes long. We were not previously checking this. This isn't important in the most common situation (session key encryption), but the impact is unclear in other cases. This change enforces the specified minimum size. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/9222045
2013-05-15crypto/tls: ignore empty TLS records.Adam Langley
OpenSSL can be configured to send empty records in order to randomise the CBC IV. This is an early version of 1/n-1 record splitting (that Go does) and is quite reasonable, but it results in tls.Conn.Read returning (0, nil). This change ignores up to 100 consecutive, empty records to avoid returning (0, nil) to callers. Fixes 5309. R=golang-dev, r, minux.ma CC=golang-dev https://golang.org/cl/8852044
2013-04-17crypto/rand: better panic message for invalid Int argument.Rémy Oudompheng
Also document the panic to be consistent with math/rand. Fixes #5187. R=golang-dev, dave, bradfitz, r CC=golang-dev https://golang.org/cl/8303043
2013-04-13crypto/ecdsa: doc cleanupBrad Fitzpatrick
R=golang-dev, dsymonds, r CC=golang-dev https://golang.org/cl/8592044
2013-03-25crypto/rsa: don't correct private exponent unless needed.Adam Langley
At some point in the past, I believe the GCD algorithm was setting d to be negative. The RSA code has been correcting that ever since but, now, it appears to have changed and the correction isn't needed. Having d be too large is harmless, it's just a little odd and I happened to notice. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7948044