Skip to content

Commit

Permalink
Merge pull request #2 from ChandraNarreddy/development
Browse files Browse the repository at this point in the history
Added support for go module
  • Loading branch information
ChandraNarreddy authored Jan 9, 2022
2 parents 546b0f8 + cb5fdb1 commit 67a1020
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aes_siv.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ var (
ErrSivUnWrapSizeUnsupportedCiphertext = errors.New("Siv Unwrap error: ciphertext size is longer than supported")
//ErrSivUnWrapUnsupportedAdditionalData indicates that the additionalData elements supplied exceed the maximum number supported
ErrSivUnWrapUnsupportedAdditionalData = errors.New("Siv Unwrap error: additionalData elements more than than supported")
//ErrSivUnWrapShortCipherLength indicates that the cipher text is too short
ErrSivUnWrapShortCipherLength = errors.New("Siv Unwrap error: ciphertext is too short")
)

const (
Expand Down Expand Up @@ -68,6 +70,9 @@ func (c *aesSiv) Unwrap(ciphertext []byte, additionalData ...[]byte) ([]byte, er
if len(ciphertext)-ctrBlockSize > (1 << (strconv.IntSize - 3)) {
return nil, ErrSivUnWrapSizeUnsupportedCiphertext
}
if len(ciphertext) < cmacBlockSize {
return nil, ErrSivUnWrapShortCipherLength
}
if len(additionalData) > (cmacBlockSize*8)-2 {
return nil, ErrSivUnWrapUnsupportedAdditionalData
}
Expand Down
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/ChandraNarreddy/siv

go 1.16

require github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1 h1:+JkXLHME8vLJafGhOH4aoV2Iu8bR55nU6iKMVfYVLjY=
github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1/go.mod h1:nuudZmJhzWtx2212z+pkuy7B6nkBqa+xwNXZHL1j8cg=

0 comments on commit 67a1020

Please sign in to comment.