php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80337 win7
Submitted: 2020-11-08 16:01 UTC Modified: 2020-11-08 16:13 UTC
From: malacca42 at gmail dot com Assigned: nikic (profile)
Status: Closed Package: OpenSSL related
PHP Version: 7.4.12 OS: windows
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: malacca42 at gmail dot com
New email:
PHP Version: OS:

 

 [2020-11-08 16:01 UTC] malacca42 at gmail dot com
Description:
------------
openssl cipher methods  aes-128-ocb / aes-192-ocb / aes-256-ocb not working

Test script:
---------------
--TEST--
Test aes-128-ocb / aes-192-ocb / aes-256-ocb
--FILE--
<?php

function testDecrypt($method)
{
    $str = 'foo';
    $key = 'key';
    $len = openssl_cipher_iv_length($method);
    $iv = openssl_random_pseudo_bytes($len);
    $encode = openssl_encrypt($str, $method, $key, 0, $iv);
    $decode = openssl_decrypt($encode, $method, $key, 0, $iv);
    var_dump($decode === $key);
}

testDecrypt('aes-128-ocb');
testDecrypt('aes-192-ocb');
testDecrypt('aes-256-ocb');

?>
--EXPECTF--
bool(true)
bool(true)
bool(true)

Expected result:
----------------
bool(true)
bool(true)
bool(true)

Actual result:
--------------
bool(false)
bool(false)
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-08 16:05 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-11-08 16:05 UTC] nikic@php.net
OCB support has been added in PHP 7.4.13.
 [2020-11-08 16:13 UTC] cmb@php.net
Also, the script needs to use the $tag parameters, and should not
assume that the $key matches the $str.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 18:01:32 2025 UTC