bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
230 stars 121 forks source link

Bug in CMAC with AES256 key #200

Open huckym opened 1 year ago

huckym commented 1 year ago

IV needs to match block size but the key size could be 256bit. CMAC.init works fine if coincidentally AES128 keys are used because the blocksize and key size are same. Breaks for AES256

https://github.com/bcgit/pc-dart/blob/59e06028bff338adc7d25ff9da4063a3b2e28b4c/lib/macs/cmac.dart#L185C5-L185C52

smlu commented 1 month ago

+1 Up voting this issue... The IV size is definitively wrong for block cipher modes. It should match the block size.