patch-ext_standard_password_c 740 B

12345678910111213141516171819202122
  1. $OpenBSD: patch-ext_standard_password_c,v 1.1 2016/02/06 23:30:25 sthen Exp $
  2. --- ext/standard/password.c.orig.port Mon Feb 1 23:04:02 2016
  3. +++ ext/standard/password.c Mon Feb 1 23:51:51 2016
  4. @@ -124,6 +124,9 @@ static int php_password_make_salt(size_t length, char
  5. buffer = (char *) safe_emalloc(raw_length, 1, 1);
  6. +#if defined(__OpenBSD__)
  7. + arc4random_buf(buffer, raw_length);
  8. +#else
  9. #if PHP_WIN32
  10. {
  11. BYTE *iv_b = (BYTE *) buffer;
  12. @@ -156,6 +159,7 @@ static int php_password_make_salt(size_t length, char
  13. buffer[i] ^= (char) (255.0 * php_rand(TSRMLS_C) / RAND_MAX);
  14. }
  15. }
  16. +#endif /* openbsd */
  17. result = safe_emalloc(length, 1, 1);
  18. if (php_password_salt_to64(buffer, raw_length, length, result) == FAILURE) {