summaryrefslogtreecommitdiffstats
path: root/internal/cryptoutil
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cryptoutil')
-rw-r--r--internal/cryptoutil/oae2.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/cryptoutil/oae2.go b/internal/cryptoutil/oae2.go
index 4e667b7..8eb18fb 100644
--- a/internal/cryptoutil/oae2.go
+++ b/internal/cryptoutil/oae2.go
@@ -35,7 +35,7 @@ type oae2 struct {
additionalData []byte
aead cipher.AEAD
- i uint64
+ i int64
noncePrefix [noncePrefixSize]byte
}
@@ -56,10 +56,10 @@ func (o *oae2) initialize(header []byte) error {
func (o *oae2) nonce(nonce []byte, lastBlock bool) error {
copy(nonce, o.noncePrefix[:])
- if o.i == 0 {
+ if o.i < 0 {
return errors.New("counter overflowed (64 bits??)")
}
- binary.BigEndian.PutUint64(nonce[noncePrefixSize:], o.i)
+ binary.BigEndian.PutUint64(nonce[noncePrefixSize:], uint64(o.i))
if lastBlock {
nonce[gcmNonceSize-1] = 1
}