From 3e384da098d723fea36809c28abe68e4712a5c51 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 28 Oct 2022 10:51:56 +0200 Subject: ignore 1 test with openssl --- 3.patch | 22 ++++ 4.patch | 31 +++++ 5.patch | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6.patch | 24 ++++ php-pecl-rnp.spec | 3 + 5 files changed, 414 insertions(+) create mode 100644 3.patch create mode 100644 4.patch create mode 100644 5.patch create mode 100644 6.patch diff --git a/3.patch b/3.patch new file mode 100644 index 0000000..f5726a8 --- /dev/null +++ b/3.patch @@ -0,0 +1,22 @@ +From 05b5abd244759ad8cd18d0a7d0b17109ace3800f Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 27 Oct 2022 16:10:20 +0200 +Subject: [PATCH] add extension and library version + +--- + rnp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/rnp.c b/rnp.c +index 5b58a0b..3c89a7a 100644 +--- a/rnp.c ++++ b/rnp.c +@@ -2190,6 +2190,8 @@ PHP_MINFO_FUNCTION(rnp) + { + php_info_print_table_start(); + php_info_print_table_header(2, "rnp support", "enabled"); ++ php_info_print_table_row(2, "rnp extension version", PHP_RNP_VERSION); ++ php_info_print_table_row(2, "rnp library version", rnp_version_string()); + php_info_print_table_end(); + } + /* }}} */ diff --git a/4.patch b/4.patch new file mode 100644 index 0000000..1e22a0a --- /dev/null +++ b/4.patch @@ -0,0 +1,31 @@ +From f907913b8cc9c06e7703fdc5093464510a9c9793 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 28 Oct 2022 09:18:27 +0200 +Subject: [PATCH] add backend name/version in info + +--- + rnp.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/rnp.c b/rnp.c +index 3c89a7a..d326f4c 100644 +--- a/rnp.c ++++ b/rnp.c +@@ -2188,11 +2188,17 @@ PHP_RINIT_FUNCTION(rnp) + /* {{{ PHP_MINFO_FUNCTION */ + PHP_MINFO_FUNCTION(rnp) + { ++ char *backend = NULL; ++ + php_info_print_table_start(); + php_info_print_table_header(2, "rnp support", "enabled"); + php_info_print_table_row(2, "rnp extension version", PHP_RNP_VERSION); + php_info_print_table_row(2, "rnp library version", rnp_version_string()); ++ spprintf(&backend, 0, "%s version %s", rnp_backend_string(), rnp_backend_version()); ++ php_info_print_table_row(2, "rnp backend", backend); ++ efree(backend); + php_info_print_table_end(); ++ + } + /* }}} */ + diff --git a/5.patch b/5.patch new file mode 100644 index 0000000..7eb7007 --- /dev/null +++ b/5.patch @@ -0,0 +1,334 @@ +From 83eb9f4b17d112444640e8f470911c22a57a4881 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 28 Oct 2022 09:24:32 +0200 +Subject: [PATCH 1/4] Fix [-Wunused-label] + +--- + rnp.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/rnp.c b/rnp.c +index 3c89a7a..dd2cee7 100644 +--- a/rnp.c ++++ b/rnp.c +@@ -1950,7 +1950,6 @@ PHP_FUNCTION(rnp_import_keys) + rnp_buffer_destroy(results); + } + +-done: + (void) rnp_input_destroy(mem_input); + + if (ret != RNP_SUCCESS) { +@@ -2166,7 +2165,6 @@ PHP_FUNCTION(rnp_import_signatures) + rnp_buffer_destroy(results); + } + +-done: + (void) rnp_input_destroy(mem_input); + + if (ret != RNP_SUCCESS) { + +From 633bfec407711dc8d3d5d14b9f0857400a1f5135 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 28 Oct 2022 09:26:39 +0200 +Subject: [PATCH 2/4] Fix [-Wreturn-type] + +--- + rnp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/rnp.c b/rnp.c +index dd2cee7..78ca158 100644 +--- a/rnp.c ++++ b/rnp.c +@@ -2270,6 +2270,8 @@ PHP_MINIT_FUNCTION(rnp) + REGISTER_LONG_CONSTANT("RNP_KEY_REMOVE_PUBLIC", RNP_KEY_REMOVE_PUBLIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("RNP_KEY_REMOVE_SECRET", RNP_KEY_REMOVE_SECRET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("RNP_KEY_REMOVE_SUBKEYS", RNP_KEY_REMOVE_SUBKEYS, CONST_CS | CONST_PERSISTENT); ++ ++ return SUCCESS; + } + + + +From 83f993cd6030487be35154794303f6df17df69a8 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 28 Oct 2022 09:41:27 +0200 +Subject: [PATCH 3/4] cast to fix [-Wpointer-sign] + +--- + rnp.c | 62 +++++++++++++++++++++++++++++------------------------------ + 1 file changed, 31 insertions(+), 31 deletions(-) + +diff --git a/rnp.c b/rnp.c +index 78ca158..e50e02b 100644 +--- a/rnp.c ++++ b/rnp.c +@@ -178,7 +178,7 @@ PHP_FUNCTION(rnp_load_keys) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(input), ZSTR_LEN(input), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(input), ZSTR_LEN(input), false); + + if (ret != RNP_SUCCESS) { + RETURN_FALSE; +@@ -266,7 +266,7 @@ PHP_FUNCTION(rnp_save_keys) + ret = rnp_output_memory_get_buf(mem_output, &buf, &len, false); + + if (ret == RNP_SUCCESS) { +- ZEND_TRY_ASSIGN_REF_STRINGL(output_ref, buf, len); ++ ZEND_TRY_ASSIGN_REF_STRINGL(output_ref, (char *)buf, len); + } + } + +@@ -330,7 +330,7 @@ PHP_FUNCTION(rnp_dump_packets) + Z_PARAM_LONG(flags) + ZEND_PARSE_PARAMETERS_END(); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(input), ZSTR_LEN(input), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(input), ZSTR_LEN(input), false); + + if (ret != RNP_SUCCESS) { + RETURN_FALSE; +@@ -351,7 +351,7 @@ PHP_FUNCTION(rnp_dump_packets) + ret = rnp_output_memory_get_buf(mem_output, &buf, &len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, buf, len); ++ ZVAL_STRINGL(return_value, (char *)buf, len); + } + } + +@@ -377,7 +377,7 @@ PHP_FUNCTION(rnp_dump_packets_to_json) + Z_PARAM_LONG(flags) + ZEND_PARSE_PARAMETERS_END(); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(input), ZSTR_LEN(input), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(input), ZSTR_LEN(input), false); + + if (ret != RNP_SUCCESS) { + RETURN_FALSE; +@@ -683,7 +683,7 @@ PHP_FUNCTION(rnp_op_sign) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(data), ZSTR_LEN(data), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(data), ZSTR_LEN(data), false); + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + } +@@ -799,7 +799,7 @@ PHP_FUNCTION(rnp_op_sign) + ret = rnp_output_memory_get_buf(mem_output, &sig_buf, &sig_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, sig_buf, sig_len); ++ ZVAL_STRINGL(return_value, (char *)sig_buf, sig_len); + } + + done: +@@ -838,7 +838,7 @@ PHP_FUNCTION(rnp_op_sign_cleartext) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(data), ZSTR_LEN(data), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(data), ZSTR_LEN(data), false); + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + } +@@ -921,7 +921,7 @@ PHP_FUNCTION(rnp_op_sign_cleartext) + ret = rnp_output_memory_get_buf(mem_output, &sig_buf, &sig_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, sig_buf, sig_len); ++ ZVAL_STRINGL(return_value, (char *)sig_buf, sig_len); + } + + done: +@@ -960,7 +960,7 @@ PHP_FUNCTION(rnp_op_sign_detached) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(data), ZSTR_LEN(data), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(data), ZSTR_LEN(data), false); + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + } +@@ -1043,7 +1043,7 @@ PHP_FUNCTION(rnp_op_sign_detached) + ret = rnp_output_memory_get_buf(mem_output, &sig_buf, &sig_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, sig_buf, sig_len); ++ ZVAL_STRINGL(return_value, (char *)sig_buf, sig_len); + } + + done: +@@ -1182,7 +1182,7 @@ PHP_FUNCTION(rnp_op_verify) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(data), ZSTR_LEN(data), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(data), ZSTR_LEN(data), false); + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + } +@@ -1233,12 +1233,12 @@ PHP_FUNCTION(rnp_op_verify_detached) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_data_input, ZSTR_VAL(data), ZSTR_LEN(data), false); ++ ret = rnp_input_from_memory(&mem_data_input, (uint8_t *)ZSTR_VAL(data), ZSTR_LEN(data), false); + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + } + +- ret = rnp_input_from_memory(&mem_sig_input, ZSTR_VAL(signature), ZSTR_LEN(signature), false); ++ ret = rnp_input_from_memory(&mem_sig_input, (uint8_t *)ZSTR_VAL(signature), ZSTR_LEN(signature), false); + if (ret != RNP_SUCCESS) { + goto done; + } +@@ -1289,7 +1289,7 @@ PHP_FUNCTION(rnp_op_encrypt) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(message), ZSTR_LEN(message), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(message), ZSTR_LEN(message), false); + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + } +@@ -1455,7 +1455,7 @@ PHP_FUNCTION(rnp_op_encrypt) + ret = rnp_output_memory_get_buf(mem_output, &encrypted_buf, &encrypted_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, encrypted_buf, encrypted_len); ++ ZVAL_STRINGL(return_value, (char *)encrypted_buf, encrypted_len); + } + + done: +@@ -1488,7 +1488,7 @@ PHP_FUNCTION(rnp_decrypt) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(input), ZSTR_LEN(input), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(input), ZSTR_LEN(input), false); + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + } +@@ -1506,7 +1506,7 @@ PHP_FUNCTION(rnp_decrypt) + ret = rnp_output_memory_get_buf(mem_output, &decrypted_buf, &decrypted_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, decrypted_buf, decrypted_len); ++ ZVAL_STRINGL(return_value, (char *)decrypted_buf, decrypted_len); + } + done: + (void) rnp_input_destroy(mem_input); +@@ -1621,10 +1621,10 @@ PHP_FUNCTION(rnp_key_get_info) + php_rnp_ffi_t *pffi; + rnp_key_handle_t kh = NULL; + bool boolval = false; +- zend_long longval = 0; + char *strval = NULL; + char *fprint = NULL; +- uint32_t bits = 0; ++ uint32_t val32; ++ uint64_t val64; + zval subkeys; + zval uids; + +@@ -1766,21 +1766,21 @@ PHP_FUNCTION(rnp_key_get_info) + add_assoc_bool(return_value, "have_public", boolval); + + #ifdef ZEND_ENABLE_ZVAL_LONG64 +- if ((ret = rnp_key_valid_till64(kh, &longval))) { ++ if ((ret = rnp_key_valid_till64(kh, &val64))) { + goto done; + } +- add_assoc_long(return_value, "valid_till", longval); ++ add_assoc_long(return_value, "valid_till", (zend_long)val64); + #else +- if ((ret = rnp_key_valid_till(kh, &longval))) { ++ if ((ret = rnp_key_valid_till(kh, &val32))) { + goto done; + } +- add_assoc_long(return_value, "valid_till", longval); ++ add_assoc_long(return_value, "valid_till", (zend_long)val32); + #endif + +- if ((ret = rnp_key_get_bits(kh, &bits))) { ++ if ((ret = rnp_key_get_bits(kh, &val32))) { + goto done; + } +- add_assoc_long(return_value, "bits", bits); ++ add_assoc_long(return_value, "bits", (zend_long)val32); + + if ((ret = rnp_key_get_alg(kh, &strval))) { + goto done; +@@ -1836,7 +1836,7 @@ PHP_FUNCTION(rnp_key_export) + ret = rnp_output_memory_get_buf(mem_output, &exported_buf, &exported_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, exported_buf, exported_len); ++ ZVAL_STRINGL(return_value, (char *)exported_buf, exported_len); + } + done: + (void) rnp_key_handle_destroy(kh); +@@ -1906,7 +1906,7 @@ PHP_FUNCTION(rnp_key_export_autocrypt) + ret = rnp_output_memory_get_buf(mem_output, &exported_buf, &exported_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, exported_buf, exported_len); ++ ZVAL_STRINGL(return_value, (char *)exported_buf, exported_len); + } + done: + (void) rnp_key_handle_destroy(kh); +@@ -1937,7 +1937,7 @@ PHP_FUNCTION(rnp_import_keys) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(input), ZSTR_LEN(input), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(input), ZSTR_LEN(input), false); + + if (ret != RNP_SUCCESS) { + RETURN_FALSE; +@@ -2122,7 +2122,7 @@ PHP_FUNCTION(rnp_key_export_revocation) + ret = rnp_output_memory_get_buf(mem_output, &exported_buf, &exported_len, false); + + if (ret == RNP_SUCCESS) { +- ZVAL_STRINGL(return_value, exported_buf, exported_len); ++ ZVAL_STRINGL(return_value, (char *)exported_buf, exported_len); + } + done: + (void) rnp_key_handle_destroy(kh); +@@ -2152,7 +2152,7 @@ PHP_FUNCTION(rnp_import_signatures) + + pffi = Z_FFI_P(zffi); + +- ret = rnp_input_from_memory(&mem_input, ZSTR_VAL(input), ZSTR_LEN(input), false); ++ ret = rnp_input_from_memory(&mem_input, (uint8_t *)ZSTR_VAL(input), ZSTR_LEN(input), false); + + if (ret != RNP_SUCCESS) { + RETURN_FALSE; + +From 3e8e52a1d6364402d74ac6456ca4f4dae31c2229 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 28 Oct 2022 09:42:07 +0200 +Subject: [PATCH 4/4] Fix [-Wunused-variable] + +--- + rnp.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/rnp.c b/rnp.c +index e50e02b..77d54d8 100644 +--- a/rnp.c ++++ b/rnp.c +@@ -1222,8 +1222,6 @@ PHP_FUNCTION(rnp_op_verify_detached) + rnp_input_t mem_data_input = NULL; + rnp_input_t mem_sig_input = NULL; + rnp_op_verify_t verify = NULL; +- size_t sigcount = 0; +- size_t i; + + ZEND_PARSE_PARAMETERS_START(3, 3); + Z_PARAM_OBJECT_OF_CLASS(zffi, rnp_ffi_t_ce) diff --git a/6.patch b/6.patch new file mode 100644 index 0000000..1851702 --- /dev/null +++ b/6.patch @@ -0,0 +1,24 @@ +From 929e63fc6ebbd6156a498c4cde95efc9f2aa9fbf Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 28 Oct 2022 10:47:34 +0200 +Subject: [PATCH] skip test using unavailable algo with OpenSSL + +--- + tests/010.phpt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tests/010.phpt b/tests/010.phpt +index 931bbe3..c60ee1c 100644 +--- a/tests/010.phpt ++++ b/tests/010.phpt +@@ -2,6 +2,10 @@ + encrypt/decrypt test + --EXTENSIONS-- + rnp ++--SKIPIF-- ++ + --CAPTURE_STDIO-- + STDIN STDOUT + --FILE-- diff --git a/php-pecl-rnp.spec b/php-pecl-rnp.spec index 972632e..ea9cde9 100644 --- a/php-pecl-rnp.spec +++ b/php-pecl-rnp.spec @@ -34,6 +34,7 @@ Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upst Patch0: https://patch-diff.githubusercontent.com/raw/rnpgp/php-rnp/pull/3.patch Patch1: https://patch-diff.githubusercontent.com/raw/rnpgp/php-rnp/pull/4.patch Patch2: https://patch-diff.githubusercontent.com/raw/rnpgp/php-rnp/pull/5.patch +Patch3: https://patch-diff.githubusercontent.com/raw/rnpgp/php-rnp/pull/6.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -70,6 +71,7 @@ cd NTS %patch0 -p1 -b .pr3 %patch1 -p1 -b .pr4 %patch2 -p1 -b .pr5 +%patch3 -p1 -b .pr6 # Check version as upstream often forget to update this extver=$(sed -n '/define PHP_RNP_VERSION/{s/.* "//;s/".*$//;p}' php_rnp.h) @@ -197,6 +199,7 @@ fi - open https://github.com/rnpgp/php-rnp/pull/3 extension version - open https://github.com/rnpgp/php-rnp/pull/4 backend name/version - open https://github.com/rnpgp/php-rnp/pull/5 build warnings +- open https://github.com/rnpgp/php-rnp/pull/6 skip test * Thu Oct 27 2022 Remi Collet - 1.2.8-1 - initial package -- cgit