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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC