-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aes: add GCM-TLS checks and improve performance #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed doc, mostly small suggestions. Agree with the Resolution
part, for sure seems like the most reasonable way to go!
openssl/aes_test.go
Outdated
t.Fatal(err) | ||
} | ||
nonce := []byte{0x91, 0xc7, 0xa7, 0x54, 0, 0, 0, 0, 0, 0, 0, 0} | ||
nonce1 := []byte{0x91, 0xc7, 0xa7, 0x54, 0, 0, 0, 0, 0, 0, 0, 1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any tests to make sure bad nonces are properly caught in the Go standard library test suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no explicit tests that verifies IVs construction follows the 800-38D 8.3 spec.
Still, Go's IV generation currently follows that spec, and there are some tests in crypto/tls
(the ones starting with TestHandshake*) that compare TLS flows against prerecorded golden flows, so if there is an unintentional change in the IV generation algorithm, all those tests will fail.
I'll try to submit a test upstream that directly covers the IV generation so our expectations don't rely on a catch-all regression test nor in dev.boringcrypto tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to submit a test upstream that directly covers the IV generation so our expectations don't rely on a catch-all regression test nor in dev.boringcrypto tests.
Here it is: https://go-review.googlesource.com/c/go/+/391495
b7eaf17
to
c99845a
Compare
Co-authored-by: Davis Goodin <[email protected]>
c99845a
to
0b886f0
Compare
Co-authored-by: Chris Sienkiewicz <[email protected]>
This PR can be reviewed commit by commit.
There are two main changes:
This I what I did:
aesGCM
lifetime, which reduces cgo calls and helps reusing OpenSSL cipher context backing memory buffers.And the results speak by themselves: