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
|
Adapted for 1.0.6 from upstream:
From ecbf0f15206d6898b26fc4c12a5c03a2e1609995 Mon Sep 17 00:00:00 2001
From: Frank Denis <github@pureftpd.org>
Date: Fri, 18 Aug 2017 19:21:08 +0200
Subject: [PATCH] If sodium_init() returns 1, this is fine.
We actually want to do this so that multiple extensions using libsodium
can be loaded simultaneously.
---
libsodium.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsodium.c b/libsodium.c
index 6eb2234..9089a31 100644
--- a/libsodium.c
+++ b/libsodium.c
@@ -257,7 +257,7 @@ ZEND_GET_MODULE(libsodium)
PHP_MINIT_FUNCTION(libsodium)
{
- if (sodium_init() != 0) {
+ if (sodium_init() < 0) {
zend_error(E_ERROR, "sodium_init()");
}
From e529d49b4ab0a875333eff867722207de97bcb76 Mon Sep 17 00:00:00 2001
From: Frank Denis <github@pureftpd.org>
Date: Sun, 1 Oct 2017 15:59:13 +0200
Subject: [PATCH] Fix pwhash_argon2i test
---
tests/pwhash_argon2i.phpt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/pwhash_argon2i.phpt b/tests/pwhash_argon2i.phpt
index e84dbf0..aee90bd 100644
--- a/tests/pwhash_argon2i.phpt
+++ b/tests/pwhash_argon2i.phpt
@@ -10,14 +10,14 @@ $passwd = 'password';
$hash = \Sodium\crypto_pwhash_str
($passwd, \Sodium\CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
\Sodium\CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE);
-var_dump(substr($hash, 0, 9) ===
+var_dump(substr($hash, 0, strlen(\Sodium\CRYPTO_PWHASH_STRPREFIX)) ===
\Sodium\CRYPTO_PWHASH_STRPREFIX);
$testHash = '$argon2i$v=19$m=4096,t=3,p=1$MzE4ODFiZWFlMjAzOWUAAA$FWUV6tsyJ32qThiLi1cCsLIbf3dIOG/RwXcTzt536KY';
$c = \Sodium\crypto_pwhash_str_verify($testHash, $passwd);
var_dump($c);
-$testHash = '$argon2i$v=19$m=4096,t=2,p=1$c29tZXNhbHQAAAAAAAAAAA$JTBozgKQiCn5yKAm3Hz0vUSX/XgfqhZloNCxDWmeDr0';
+$testHash = '$argon2i$v=19$m=4096,t=0,p=1$c29tZXNhbHQAAAAAAAAAAA$JTBozgKQiCn5yKAm3Hz0vUSX/XgfqhZloNCxDWmeDr0';
$c = \Sodium\crypto_pwhash_str_verify($testHash, $passwd);
var_dump($c);
|