crypto/cipher: add package
cipher is intended to replace crypto/block over time. This
change only adds basic parts: CBC and CTR mode and doesn't add
the package to the top-level Makefile.
Mailing this out for an early review of the design. As opposed to the old ...
14 years, 4 months ago
(2010-11-12 18:36:22 UTC)
#1
Mailing this out for an early review of the design.
As opposed to the old 'block' package, 'cipher' exposes the cipher modes without
wrapping them in an io.Reader/Writer. This serves the more common case of
wishing to deal with small blocks of memory (i.e. TLS or SSH packets).
The streaming interface can be built on top of a BlockMode (i.e. as has been
done with the StreamReader/StreamWriter). In the end, 'cipher' should have a
BlockWriter which wraps a BlockMode and handles padding etc.
On Fri, Nov 12, 2010 at 2:15 PM, <r@golang.org> wrote: > i'm going to leave ...
14 years, 4 months ago
(2010-11-19 15:55:07 UTC)
#3
On Fri, Nov 12, 2010 at 2:15 PM, <r@golang.org> wrote:
> i'm going to leave this for rsc, who's back in a couple of days, because
> i'm not sure about the tradeoffs.
[+cc: rsc]
seems like a good start to me http://codereview.appspot.com/3069041/diff/6001/src/pkg/crypto/cipher/cbc.go File src/pkg/crypto/cipher/cbc.go (right): http://codereview.appspot.com/3069041/diff/6001/src/pkg/crypto/cipher/cbc.go#newcode30 src/pkg/crypto/cipher/cbc.go:30: type CBCEncrypter ...
14 years, 4 months ago
(2010-11-19 16:26:47 UTC)
#4
http://codereview.appspot.com/3069041/diff/25001/src/pkg/crypto/cipher/io.go File src/pkg/crypto/cipher/io.go (right): http://codereview.appspot.com/3069041/diff/25001/src/pkg/crypto/cipher/io.go#newcode34 src/pkg/crypto/cipher/io.go:34: Desynced os.Error I was thinking this could expose the ...
14 years, 4 months ago
(2010-11-19 17:31:22 UTC)
#6
http://codereview.appspot.com/3069041/diff/25001/src/pkg/crypto/cipher/io.go
File src/pkg/crypto/cipher/io.go (right):
http://codereview.appspot.com/3069041/diff/25001/src/pkg/crypto/cipher/io.go#...
src/pkg/crypto/cipher/io.go:34: Desynced os.Error
I was thinking this could expose the actual
error instead of the desynced error.
// If any Write call returns an error, then the
// StreamWriter is out of sync and must be discarded.
and then in Write
if w.Err != nil {
return 0, w.Err
}
...
n, err = w.W.Write(c)
if err == nil && n != len(c) { // should not happen
err = io.ErrShortWrite
}
if err != nil {
w.Err = err
}
return
*** Submitted as http://code.google.com/p/go/source/detail?r=6b04915a1cf6 *** crypto/cipher: add package cipher is intended to replace crypto/block over ...
14 years, 4 months ago
(2010-11-19 19:12:27 UTC)
#10
Issue 3069041: code review 3069041: crypto/cipher: add package
(Closed)
Created 14 years, 4 months ago by agl1
Modified 14 years, 4 months ago
Reviewers:
Base URL:
Comments: 10