php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47728 openssl_pkcs7_sign ignores new openssl flags
Submitted: 2009-03-20 10:06 UTC Modified: 2010-12-20 14:26 UTC
From: josef dot andrysek at icewarp dot com Assigned: pajoye
Status: Assigned Package: OpenSSL related
PHP Version: 5.2.9 OS: *
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-03-20 10:06 UTC] josef dot andrysek at icewarp dot com
Description:
------------
openssl_pkcs7_sign supports several new flags:
e.g. PKCS7_CRLFEOL,PKCS7_NOSMIMECAP...

1. openssl extension should define these constants
2. openssl extension should check the PKCS7_CRLFEOL and use appropriate line delimiter in call to BIO_printf()



Reproduce code:
---------------
look at ext\openssl\openssl.c



Expected result:
----------------
1) also new constants should be registered here
REGISTER_LONG_CONSTANT("PKCS7_NOSMIMECAP", PKCS7_NOSMIMECAP, CONST_CS|CONST_PERSISTENT);
	REGISTER_LONG_CONSTANT("PKCS7_NOOLDMIMETYPE", PKCS7_NOOLDMIMETYPE, CONST_CS|CONST_PERSISTENT);
	REGISTER_LONG_CONSTANT("PKCS7_CRLFEOL", PKCS7_CRLFEOL, CONST_CS|CONST_PERSISTENT);
	REGISTER_LONG_CONSTANT("PKCS7_STREAM", PKCS7_STREAM, CONST_CS|CONST_PERSISTENT);
	REGISTER_LONG_CONSTANT("PKCS7_NOCRL", PKCS7_NOCRL, CONST_CS|CONST_PERSISTENT);

2) newline symbol should depend on PKCS7_CRLFEOL flag
   (this style of coding is taken from openssl project itself)
	if (flags & PKCS7_CRLFEOL)
		mime_eol = "\r\n";
	else
		mime_eol = "\n"; 


if (strindex) {
				BIO_printf(outfile, "%s: %s%s", strindex, Z_STRVAL_PP(hval),mime_eol);
			} else {
				BIO_printf(outfile, "%s%s", Z_STRVAL_PP(hval),mime_eol);
			}


Actual result:
--------------
look at ext\openssl\openssl.c


1)
Line 701:
/* flags for S/MIME */
-  only old flags are defined here	


2)
if (strindex) {
				BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(hval));
			} else {
				BIO_printf(outfile, "%s\n", Z_STRVAL_PP(hval));
			}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-20 11:23 UTC] pajoye@php.net
Right, and need one a couple of small changes+tests as well.
 [2010-12-20 14:26 UTC] jani@php.net
-Package: Feature/Change Request +Package: OpenSSL related
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC