Use pointers to 64-bit atomics to enforce alignment in AES-GCM Barrier (#11211)

* Align atomics in barrier

* Use the pointer solution
This commit is contained in:
Scott Miller 2021-03-26 14:51:56 -05:00 committed by GitHub
parent 9097ee0bed
commit c44f18e3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -82,10 +82,10 @@ type AESGCMBarrier struct {
initialized atomic.Bool
UnaccountedEncryptions atomic.Int64
UnaccountedEncryptions *atomic.Int64
// Used only for testing
RemoteEncryptions atomic.Int64
totalLocalEncryptions atomic.Int64
RemoteEncryptions *atomic.Int64
totalLocalEncryptions *atomic.Int64
}
func (b *AESGCMBarrier) RotationConfig() (kc KeyRotationConfig, err error) {
@ -115,6 +115,9 @@ func NewAESGCMBarrier(physical physical.Backend) (*AESGCMBarrier, error) {
sealed: true,
cache: make(map[uint32]cipher.AEAD),
currentAESGCMVersionByte: byte(AESGCMVersion2),
UnaccountedEncryptions: atomic.NewInt64(0),
RemoteEncryptions: atomic.NewInt64(0),
totalLocalEncryptions: atomic.NewInt64(0),
}
return b, nil
}