Skip to content

Commit

Permalink
Add: 32bit OS compile/usage (need int64) support.
Browse files Browse the repository at this point in the history
part II (casting)
  • Loading branch information
paepckehh committed Dec 23, 2022
1 parent 91bc491 commit 841cd74
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gcmsiv.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@ func (ctx *GCMSIV) Seal(dst, nonce, plaintext, additionalData []byte) []byte {
log("Nonce", nonce)
}

if len(plaintext) > maxPlaintextLen {
if int64(len(plaintext)) > maxPlaintextLen {
panic("gcmsiv: plaintext too large")
}

if len(additionalData) > maxADLen {
if int64(len(additionalData)) > maxADLen {
panic("gcmsiv: additional data too large")
}

Expand All @@ -472,11 +472,11 @@ func (ctx *GCMSIV) Seal(dst, nonce, plaintext, additionalData []byte) []byte {
}

func (ctx GCMSIV) Open(dst, nonce, ciphertext, additionalData []byte) (out []byte, err error) {
if len(additionalData) > maxADLen {
if int64(len(additionalData)) > maxADLen {
return nil, errors.New("gcmsiv: bad ciphertext length")
}

if len(ciphertext) < 16 || len(ciphertext) > maxCiphertextLen {
if int64(len(ciphertext)) < 16 || int64(len(ciphertext)) > maxCiphertextLen {
return nil, errors.New("gcmsiv: bad ciphertext length")
}

Expand Down

0 comments on commit 841cd74

Please sign in to comment.