Source File
aes128gcmrekey.go
Belonging Package
google.golang.org/grpc/credentials/alts/internal/conn
package conn
import (
core
)
overflowLenAES128GCMRekey = 8
nonceLen = 12
aeadKeyLen = 16
kdfKeyLen = 32
kdfCounterOffset = 2
kdfCounterLen = 6
sizeUint64 = 8
)
func ( core.Side, []byte) (ALTSRecordCrypto, error) {
:= NewInCounter(, overflowLenAES128GCMRekey)
:= NewOutCounter(, overflowLenAES128GCMRekey)
, := newRekeyAEAD()
if != nil {
return nil,
}
, := newRekeyAEAD()
if != nil {
return nil,
}
return &aes128gcmRekey{
,
,
,
,
}, nil
}
:= len()
, := SliceForAppend(, len()+GcmTagSize)
, := .outCounter.Value()
if != nil {
return nil,
}
:= [:len()]
copy(, ) // data may alias plaintext
= .outAEAD.Seal([:], , , nil)
.outCounter.Inc()
return , nil
}
func ( *aes128gcmRekey) () int {
return GcmTagSize
}
func ( *aes128gcmRekey) (, []byte) ([]byte, error) {
, := .inCounter.Value()
if != nil {
return nil,
}
, := .inAEAD.Open(, , , nil)
if != nil {
return nil, ErrAuth
}
.inCounter.Inc()
return , nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |