Skip to content

Commit 3edbb1c

Browse files
committed
Merged DomBlack#4 into Master.
Conflict; crypto/crypto_scrypt-sse.c
2 parents 81588b2 + 73acbc5 commit 3edbb1c

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ mkinstalldirs
2424
run-tests.php
2525
modules
2626

27+
#
28+
# Test Output
29+
#
30+
tests/*.diff
31+
tests/*.exp
32+
tests/*.log
33+
tests/*.out
34+
tests/*.php
35+
tests/*.sh
36+
2737
#
2838
# Visual Studio
2939
#
@@ -46,4 +56,4 @@ obj/
4656
Thumbs.db
4757

4858
# OSX store fiels
49-
.DS_Store
59+
.DS_Store

VS2008/VS2008.vcproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
Name="crypto"
176176
>
177177
<File
178-
RelativePath="..\crypto\crypto_scrypt.c"
178+
RelativePath="..\crypto\crypto_scrypt-nosse.c"
179179
>
180180
</File>
181181
<File

crypto/crypto_scrypt-sse.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
* This file was originally written by Colin Percival as part of the Tarsnap
2727
* online backup system.
2828
*/
29+
#include "php.h"
30+
#ifdef PHP_WIN32
31+
#include "zend_config.w32.h"
32+
#endif
33+
2934
#include <sys/types.h>
3035
#include <sys/mman.h>
3136

@@ -270,23 +275,27 @@ crypto_scrypt(const uint8_t * passwd, size_t passwdlen,
270275
/* Sanity-check parameters. */
271276
#if SIZE_MAX > UINT32_MAX
272277
if (buflen > (((uint64_t)(1) << 32) - 1) * 32) {
278+
php_error(1, "Invalid Parameters: $keyLength too big");
273279
errno = EFBIG;
274280
goto err0;
275281
}
276282
#endif
277283
if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) {
278284
errno = EFBIG;
285+
php_error(1, "Invalid Parameters; $r * $p is >= 2^30");
279286
goto err0;
280287
}
281288
if (((N & (N - 1)) != 0) || (N == 0)) {
282289
errno = EINVAL;
290+
php_error(1, "Invalid Parameters; $N is not a power of two greater than 1");
283291
goto err0;
284292
}
285293
if ((r > SIZE_MAX / 128 / p) ||
286294
#if SIZE_MAX / 256 <= UINT32_MAX
287295
(r > (SIZE_MAX - 64) / 256) ||
288296
#endif
289297
(N > SIZE_MAX / 128 / r)) {
298+
php_error(1, "Invalid Parameters");
290299
errno = ENOMEM;
291300
goto err0;
292301
}

php-scrypt.sublime-project

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
"Makefile*",
2323
"missing",
2424
"mkinstalldirs",
25-
"run-tests.php"
25+
"run-tests.php",
26+
"tests/*.diff",
27+
"tests/*.exp",
28+
"tests/*.log",
29+
"tests/*.out"
2630
],
2731
"folder_exclude_patterns":
2832
[

0 commit comments

Comments
 (0)