Skip to content
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

NewGCM(..) operates in strict mode even if flag isn't set #166

Open
Radisovik opened this issue Feb 7, 2024 · 0 comments
Open

NewGCM(..) operates in strict mode even if flag isn't set #166

Radisovik opened this issue Feb 7, 2024 · 0 comments

Comments

@Radisovik
Copy link

This behavior was un-expected, and I think is a bug. However maybe I don't fully understand the intent.

func (c *aesCipher) NewGCM(nonceSize, tagSize int) (cipher.AEAD, error) {
	if !ExecutingTest() || IsStrictFips() {
		if nonceSize != gcmStandardNonceSize {
			return nil, errors.New("crypto/aes: GCM nonce size can't be non-standard")
		}
		if tagSize != gcmTagSize {
			return nil, errors.New("crypto/aes: GCM tag size can't be non-standard")
		}

I believe the || should be an &&. As this stands now, anytime we're not running _test code, we're enforcing strict checking of the default nonce size..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant