summaryrefslogtreecommitdiffstats
path: root/internal/cryptoutil/oae2.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-10-01 20:37:26 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-10-01 20:37:26 -0700
commit8f3927cc91b8f9dcc2bd3e05c2ddd225a92c96dc (patch)
treeb86c45195236428f58ec2883a81c53f317532fe7 /internal/cryptoutil/oae2.go
parentFix the n^2 using a linked list (diff)
downloadroseh.moe-8f3927cc91b8f9dcc2bd3e05c2ddd225a92c96dc.tar.zst
Linked list is cool, but have you heard of array
Diffstat (limited to 'internal/cryptoutil/oae2.go')
-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
}