php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73808 iv length warning too restrictive for aes-128-ccm
Submitted: 2016-12-23 19:23 UTC Modified: 2017-04-30 18:37 UTC
From: anthon dot pang at gmail dot com Assigned: bukka (profile)
Status: Closed Package: OpenSSL related
PHP Version: 7.1.0 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: anthon dot pang at gmail dot com
New email:
PHP Version: OS:

 

 [2016-12-23 19:23 UTC] anthon dot pang at gmail dot com
Description:
------------
openssl_decrypt with a cipher of 'aes-128-ccm' currently enforces an iv length of 12 octets or 96 bits. According to various RFCs, the iv length has an allowable range of 7 to 13 octets.

https://tools.ietf.org/html/rfc3610
https://tools.ietf.org/html/rfc5084

"aes-nonce         OCTET STRING (SIZE(7..13)),"



Expected result:
----------------
In php_openssl_validate_iv(), when mode->is_aead, treat iv_required_len as a recommendation; do a range check instead.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-28 12:00 UTC] anthon dot pang at gmail dot com
Just for comparison, sjcl appears to silently truncate iv when length > 13.
 [2017-04-30 18:37 UTC] bukka@php.net
-Summary: iv length check too restrictive for aes-128-ccm +Summary: iv length warning too restrictive for aes-128-ccm -Status: Open +Status: Assigned -Assigned To: +Assigned To: bukka
 [2017-04-30 18:37 UTC] bukka@php.net
IV length can be set. You can try

var_dump(openssl_encrypt('data', 'aes-256-ccm', 'password', 0, '1234567', $tag));

or just see https://3v4l.org/5Vdo3

The only thing that is wrong is a warning that specifies default length which doesn't make much sense because it can be a range so the message should be definitely stripped. I'll fix it as part of this bug (that's why I renamed it...)
 [2017-04-30 18:46 UTC] bukka@php.net
Automatic comment on behalf of bukka
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6028fe511efd7e7f8444af9e53c4bbd7368233b1
Log: Fix bug #73808 (iv length warning too restrictive for aes-128-ccm)
 [2017-04-30 18:46 UTC] bukka@php.net
-Status: Assigned +Status: Closed
 [2017-04-30 18:47 UTC] bukka@php.net
Automatic comment on behalf of bukka
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6028fe511efd7e7f8444af9e53c4bbd7368233b1
Log: Fix bug #73808 (iv length warning too restrictive for aes-128-ccm)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC