mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
crypto: Remove type iv
This commit is contained in:
parent
7b6bd98c9e
commit
63e79539e9
2 changed files with 5 additions and 5 deletions
|
@ -48,7 +48,6 @@ type SigningKey struct {
|
||||||
K [16]byte `json:"k"` // for AES128
|
K [16]byte `json:"k"` // for AES128
|
||||||
R [16]byte `json:"r"` // for Poly1305
|
R [16]byte `json:"r"` // for Poly1305
|
||||||
}
|
}
|
||||||
type iv [ivSize]byte
|
|
||||||
|
|
||||||
// mask for key, (cf. http://cr.yp.to/mac/poly1305-20050329.pdf)
|
// mask for key, (cf. http://cr.yp.to/mac/poly1305-20050329.pdf)
|
||||||
var poly1305KeyMask = [16]byte{
|
var poly1305KeyMask = [16]byte{
|
||||||
|
@ -160,12 +159,13 @@ func NewKey() (k *Key) {
|
||||||
return k
|
return k
|
||||||
}
|
}
|
||||||
|
|
||||||
func newIV() (iv iv) {
|
func newIV() []byte {
|
||||||
n, err := rand.Read(iv[:])
|
iv := make([]byte, ivSize)
|
||||||
|
n, err := rand.Read(iv)
|
||||||
if n != ivSize || err != nil {
|
if n != ivSize || err != nil {
|
||||||
panic("unable to read enough random bytes for iv")
|
panic("unable to read enough random bytes for iv")
|
||||||
}
|
}
|
||||||
return
|
return iv
|
||||||
}
|
}
|
||||||
|
|
||||||
type jsonMACKey struct {
|
type jsonMACKey struct {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type encryptWriter struct {
|
type encryptWriter struct {
|
||||||
iv iv
|
iv []byte
|
||||||
wroteIV bool
|
wroteIV bool
|
||||||
data *bytes.Buffer
|
data *bytes.Buffer
|
||||||
key *Key
|
key *Key
|
||||||
|
|
Loading…
Reference in a new issue