gitpan/Crypt-CCM — pull request #1 by nlitsme (2013-06-25 19:28:08+00:00)
Title: fixing rt.cpan bugs 44560 and 44561:

# 44560
Specifying an alternate cipher with the '-cipher' option is broken,
the issue is with this line in sub new

$args{'-cipher'} |= 'Crypt::Rijndael';

This should be:

$args{'-cipher'} ||= 'Crypt::Rijndael';

# 44561
When one don't specify alternate data ( which is probably the most common
case )

The encryption result is incorrect.

The problem is in the function _format_associated_data:

It says now:

if ($a_len == 0) {
$payload = '';
}

And then goes on encoding the payload anyway as 16 NUL bytes.

While what should happen is this:

if ($a_len == 0) {
return '';
}

See rfc3610, where it says:

> If l(a)>0 (as indicated by the Adata field), then one or more blocks
> of authentication data are added.

( and not >=0, as the current code does )