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

fix: CCM mode cbc-mac iv initialized to block-size #185

Closed
wants to merge 4 commits into from
Closed

fix: CCM mode cbc-mac iv initialized to block-size #185

wants to merge 4 commits into from

Conversation

huckym
Copy link

@huckym huckym commented Feb 4, 2023

@AKushWarrior

AES-CCM mode is broken for 192bit and 256bit keys
According to spec(NIST 800-38C section 5.2), the cbc-mac is initialized with a zero IV. The cbc-mac init, however, is falling back to using key.length as the length of iv, so for aes key sizes of 192 and 256, cmac fails.

CBC-MAC init referenced below:

void init(CipherParameters params) {
    if (params is ParametersWithIV) {
      _params = params;
    } else if (params is KeyParameter) {
      final zeroIV = Uint8List(params.key.length);
      _params = ParametersWithIV(params, zeroIV);
    }

    reset();

    _cipher.init(true, _params);
  }

@Ephenodrom
Copy link
Contributor

Done via direct commit

@Ephenodrom Ephenodrom closed this Mar 8, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants