Commit Graph
24 Commits
Author SHA1 Message Date
cuishuang 1faea2975c all: fix some typos in comment
Change-Id: Ia209f0a6d9b19d14e655c65d1287a1416b48c487
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/707535
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Nicola Murino <nicola.murino@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-10-08 13:58:26 -07:00
Filippo Valsorda 8c9ba31836 all: freeze and deprecate more packages
Fixes golang/go#65250

Change-Id: I6a6a6964a2c87e529be50dd67fec462483b07b75
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/701535
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-09-09 12:19:31 -07:00
Filippo Valsorda a6a393ffd6 all: bump go.mod version and drop compatibility shims
Also, remove the legacy import annotations.

Fixes golang/go#68147

Change-Id: Ibfcc9322f27224c0ba92ea42cd56912a7d8783fd
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/594256
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2024-06-26 15:12:35 +00:00
Sebastiaan van Stijn b665ba6f6f all: use crypto/ed25519 instead of golang.org/x/crypto/ed25519
This is a follow-up to CL 317169, which dropped go1.12 compatibility,
and made the golang.org/x/crypto/ed25519 package an alias / wrapper for
crypto/ed25519 in stdlib.

This patch updates uses within this repository to use stdlib instead of
depending on the wrapper. With this patch applied, the only remaining
use of the wrapper is in ed25519_test, which appears to be in place to
verify compatibility of the wrapper itself.

Change-Id: I0195396102a75ae20bdd82ca8ab59855c0eb5cea
GitHub-Last-Rev: 24dbec563cbd84bc47bdc7736b0245fc83dd3353
GitHub-Pull-Request: golang/crypto#238
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/448238
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Nicola Murino <nicola.murino@gmail.com>
Reviewed-by: Nicola Murino <nicola.murino@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2023-09-27 14:30:17 +00:00
Russ Cox 04dced17f7 internal/subtle: rename to internal/alias
This avoids an import conflict in code that needs to import
crypto/subtle as well.

CL 424194 does the same for the main repo.

Change-Id: Ic54cb62bbfdcf5c2cb6f15ac47075ee1c41981ad
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/424175
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-08-17 18:37:53 +00:00
Filippo Valsorda c084706c22 poly1305: deprecate public package
Fixes golang/go#36646

Change-Id: Ic19dd2171c84472fc9d3f44803224b87fc5c0417
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/345649
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-09-15 21:47:49 +00:00
woat c90954cbb9 nacl/auth: use Size instead of KeySize for Sum output
Fixes golang/go#41692

Change-Id: If6e885ca2e016dfecf534093c989356142ec7823
GitHub-Last-Rev: fe67c18f18ccfc766687b8db4bda92b9f7879a2b
GitHub-Pull-Request: golang/crypto#154
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/258357
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
2020-10-02 09:40:18 +00:00
Ben Toews becbf705a9 nacl/box: support anonymous seal/open
This adds SealAnonymous and OpenAnonymous functions that implement the
libsodium "sealed box" functionality.

Fixes golang/go#35346

Change-Id: I22455f1b83595ec8a68d1861e635bd6cb0573f44
GitHub-Last-Rev: 7d334cf861942ec63ad613b7f28fb6dd7a1f9992
GitHub-Pull-Request: golang/crypto#107
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/205241
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-19 19:50:13 +00:00
Michael Cook b8fe1690c6 all: fix ineffectual assignments
audited using ineffassign tool from
github.com/gordonklaus/ineffassign
go generate does not generate any changes

Change-Id: Iabbec9ec1aae39081289d503d79fd7b4caadf17b
GitHub-Last-Rev: acd17cce410e9c68ce3c87b5546261be9153e3ea
GitHub-Pull-Request: golang/crypto#70
Reviewed-on: https://go-review.googlesource.com/c/155942
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-01-31 18:25:04 +00:00
Filippo Valsorda 37a17fe027 internal/subtle: add Any/InexactOverlap (new package) and apply them across packages
AnyOverlap and InexactOverlap implement checks for the aliasing
requirements defined by the crypto/cipher interfaces. Apply them to all
implementations as the actual requirement could be architecture-dependent
and user code should not rely on undefined behavior.

Updates golang/go#21624

Change-Id: I465de02fb3fec4e0c6f1fdee1ef6ae7ed5abff10
Reviewed-on: https://go-review.googlesource.com/112236
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 22:47:33 +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
Adam Langley 365904b0f3 nacl/auth: use KeySize constant consistently.
Fixes golang/go#21788

Change-Id: I9310b438ce90cd3bba48295c829d44779c9f09c5
Reviewed-on: https://go-review.googlesource.com/79875
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-11-27 23:00:03 +00:00
Filippo Valsorda 74b34b9dd6 all: make overlap rules wording consistent
Updates golang/go#21279

Change-Id: I686835c644f52e3d5ea2b7e6431ef096d188c19d
Reviewed-on: https://go-review.googlesource.com/61133
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-11 15:03:43 +00:00
Adam Langley 9ba3862cf6 nacl/[secret]box: clarify message size comment.
While package comments shouldn't be novels, this throwaway word was not
sufficient (and wasn't mirrored in the `box` package).

This change attempts to include more reasoning without using too many
words.

Fixes golang/go#17673,golang/go#21139

Change-Id: I7fa11e2cd5b8e2010420cc14d784f9b0c65db6d2
Reviewed-on: https://go-review.googlesource.com/35910
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-09 20:47:57 +00:00
Kevin Burke 81db3efc71 nacl/auth: add crypto_auth primitive
This matches the implementation in NaCL, so a user can generate
a crypto_auth digest in another language and verify it with Go, or
vice versa.

Fixes golang/go#20265.

Change-Id: Ice96abb9347a5318a16ced5152ebfa7d9ebdd285
Reviewed-on: https://go-review.googlesource.com/51932
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-07 22:21:51 +00:00
Jeff Hodges 93b5df3bf3 nacl/secretbox: add benchmarks
Initial results on an Ivy Bridge system for reference:

BenchmarkSeal8Bytes-8     	 5000000	       310 ns/op	  25.77 MB/s
BenchmarkSeal100Bytes-8   	 3000000	       599 ns/op	 166.76 MB/s
BenchmarkSeal1K-8         	 1000000	      1825 ns/op	 561.06 MB/s
BenchmarkSeal8K-8         	  100000	     10997 ns/op	 744.88 MB/s
BenchmarkOpen8Bytes-8     	 5000000	       327 ns/op	  24.39 MB/s
BenchmarkOpen100Bytes-8   	 2000000	       630 ns/op	 158.49 MB/s
BenchmarkOpen1K-8         	 1000000	      1752 ns/op	 584.21 MB/s
BenchmarkOpen8K-8         	  200000	     10420 ns/op	 786.12 MB/s

Fixes golang/go#20563

Change-Id: Iaacd9715840c1f5c7ee2459759e79c98a4b6f62a
Reviewed-on: https://go-review.googlesource.com/46039
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-18 20:15:51 +00:00
Kevin Burke e7ba826830 nacl/box: Add examples
These largely follow the pattern laid out in the secretbox example
file. Hopefully they should demonstrate the best ways to use the `box`
primitives.

Change-Id: I99be5f886e6ffe5f859268d6caa282e263eeacd0
Reviewed-on: https://go-review.googlesource.com/44736
Reviewed-by: Adam Langley <agl@golang.org>
2017-06-06 16:30:16 +00:00
Kevin Burke 055d4bfb5c nacl/secretbox: add license header and package prefix
Name the example package "secretbox_test" so we use the public
interface for secretbox in examples. This way the code appears the
same way a user would have to type it.

Change-Id: I0487e39927ddae297ea45e09a3fa397779a8e21d
Reviewed-on: https://go-review.googlesource.com/28222
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-31 13:18:26 +00:00
Kevin Burke 88d0005bf4 nacl: use HTTPS for nacl.cr.yp.to links
nacl.cr.yp.to is available over HTTPS and presents a valid certificate, so
seems useful to use it.

Change-Id: I64d86e52cc314641b4169167fe5123d38c2904c0
Reviewed-on: https://go-review.googlesource.com/26812
Reviewed-by: Jonathan Rudenberg <jonathan@titanous.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-19 14:58:26 +00:00
Kevin Burke 1ce41b6ca7 nacl/secretbox: add Seal, Open example
I read the docs and wasn't sure how to use the package - what is
the best way to generate a nonce? Do I need to use the same nonce
for encrypting and decrypting the same message? I read through some
code that used this package, and the tests, found the answers I was
looking for, and used them to generate an example, which hopefully
will be helpful to other users of this package.

Change-Id: I24f9682fecb6632f34b4d8d13fed6eb002993677
Reviewed-on: https://go-review.googlesource.com/26810
Reviewed-by: Adam Langley <agl@golang.org>
2016-08-16 17:48:58 +00:00
David Symonds 1fbbd62cfe crypto: add import comments.
Change-Id: I33240faf1b8620d0cd600de661928d8e422ebdbc
Reviewed-on: https://go-review.googlesource.com/1235
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 23:26:36 +00:00
Andrew Gerrand a73c6bbfc5 go.crypto: use golang.org/x/... import paths
LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/167190043
2014-11-10 08:50:25 +11:00
Adam Langley c2ba5865a8 go.crypto/nacl/secretbox: fix append behaviour.
secretbox is supposed to append to the given slice, like hash.Sum() and
append(). However, I had a complete brain-fart: I've really no idea what
I was thinking of at the time.

R=golang-dev, sfrithjof, rsc
CC=agl, golang-dev
https://golang.org/cl/10099043
2013-06-10 18:03:26 -04:00
Adam Langley f09bfbbb56 go.crypto/nacl: add package
R=golang-dev, dchest, r, rsc
CC=golang-dev
https://golang.org/cl/6497101
2012-09-09 11:18:00 -04:00