xref: /PHP-8.2/ext/openssl/tests/bug74402.phpt (revision 74859783)
1--TEST--
2Bug #74402 (segfault on random_bytes, bin3hex, openssl_seal)
3--EXTENSIONS--
4openssl
5--SKIPIF--
6<?php
7if (!in_array('AES256', openssl_get_cipher_methods(true))) print "skip";
8?>
9--FILE--
10<?php
11$data = "23153b1cf683cb16f8d71190a7c42f38fecda27c29a7bc8991c9f6a2a63602bf";
12$key = array("-----BEGIN PUBLIC KEY-----
13MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqvjCLfpS0MyilIjR+IsH
14HPH8TqFUCw4kTAVmTy9SDZV9hHYY2EPgrlTd7gvMP/DWipvBD6Y5w2bPdAQoXr5D
15qEKAGkE+1El4hS8XyuOdYXSYTDH1HPSlFiGdgsnlkFcbh/fJyzIKBaGLnWxsjhiS
16deiI7KuEkI9zt+X2r4KqFt/dhnXz0kcB1M7qyhQ6Rvijgjy/A1LsN4ZAREFLCEjb
171AP9nk0QAUHWcG5MvbgsE20Pn4R5wFsMFBTvNmb34jHFREgR9j4DYcV5FFR3tKb8
183XtjE9/kjfK29BSpiyXZs8PSqDhO00vh6txUB4VfkVUD2Bi93rxDeyALnCW7My+l
19YwIDAQAB
20-----END PUBLIC KEY-----");
21$iv = '';
22var_dump(strlen($data));
23var_dump(openssl_seal($data, $sealed_data, $env_keys, $key, 'AES256', $iv));
24?>
25--EXPECT--
26int(64)
27int(80)
28