1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
From 83eb9f4b17d112444640e8f470911c22a57a4881 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
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 <remi@remirepo.net>
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 <remi@remirepo.net>
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 <remi@remirepo.net>
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)
|