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