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