summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2017-04-23 11:47:04 +0200
committerYves Orton <demerphq@gmail.com>2017-04-23 11:47:04 +0200
commiteba287cb48b881ee252ec418246375010c97a85b (patch)
tree292e87a8de014d3789629a1ab55480a352a1a86e
parent9627bf7af087e000c169b623f1a4536976a0f6c1 (diff)
downloadperl-eba287cb48b881ee252ec418246375010c97a85b.tar.gz
Revert "get rid of USE_HASH_SEED_EXPLICIT"
This reverts commit dd1b95f812312c85390f487887cdd55282fcd6ce. Accidentally pushed work pending unfreeze.
-rw-r--r--hv_func.h5
-rw-r--r--perl.c13
-rw-r--r--perl.h12
-rw-r--r--util.c4
4 files changed, 21 insertions, 13 deletions
diff --git a/hv_func.h b/hv_func.h
index e091c86b0f..ce2d50b577 100644
--- a/hv_func.h
+++ b/hv_func.h
@@ -133,7 +133,7 @@ U32 S_perl_hash_with_seed(const U8 * const seed, const U8 * const str, const STR
* initialze whatever state it might need later in hashing. */
#ifndef PERL_HASH_SEED
-# if defined(USE_HASH_SEED)
+# if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)
# define PERL_HASH_SEED PL_hash_seed
# else
/* this is a 512 bit seed, which should be more than enough for the
@@ -270,6 +270,9 @@ PERL_SIPHASH_FNC(
#endif /* defined(CAN64BITHASH) */
+
+
+
#endif /*compile once*/
/*
diff --git a/perl.c b/perl.c
index d7b0866dd0..125afaed51 100644
--- a/perl.c
+++ b/perl.c
@@ -317,13 +317,13 @@ perl_construct(pTHXx)
* a suitable seed yourself and define PERL_HASH_SEED to a well chosen
* string. See hv_func.h for details.
*/
-#if defined(USE_HASH_SEED)
+#if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)
/* get the hash seed from the environment or from an RNG */
Perl_get_hash_seed(aTHX_ PL_hash_seed);
-#else
+#else /*if !(defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)) */
/* they want a hard coded seed, check that it is long enough */
assert( strlen(PERL_HASH_SEED) >= PERL_HASH_SEED_BYTES );
-#endif
+#endif /* #if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT) */
/* now we use the chosen seed to initialize the state -
* in some configurations this may be a relatively speaking
@@ -1564,7 +1564,7 @@ perl_parse(pTHXx_ XSINIT_t xsinit, int argc, char **argv, char **env)
#ifndef MULTIPLICITY
PERL_UNUSED_ARG(my_perl);
#endif
-#if (defined(USE_HASH_SEED) || defined(USE_HASH_SEED_DEBUG)) && !defined(NO_PERL_HASH_SEED_DEBUG)
+#if (defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT) || defined(USE_HASH_SEED_DEBUG)) && !defined(NO_PERL_HASH_SEED_DEBUG)
{
const char * const s = PerlEnv_getenv("PERL_HASH_SEED_DEBUG");
@@ -1583,7 +1583,7 @@ perl_parse(pTHXx_ XSINIT_t xsinit, int argc, char **argv, char **env)
PerlIO_printf(Perl_debug_log, "\n");
}
}
-#endif /* #if (defined(USE_HASH_SEED) ... */
+#endif /* #if (defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT) ... */
#ifdef __amigaos4__
{
@@ -1869,6 +1869,9 @@ S_Internals_V(pTHX_ CV *cv)
# ifdef USE_FAST_STDIO
" USE_FAST_STDIO"
# endif
+# ifdef USE_HASH_SEED_EXPLICIT
+ " USE_HASH_SEED_EXPLICIT"
+# endif
# ifdef USE_LOCALE
" USE_LOCALE"
# endif
diff --git a/perl.h b/perl.h
index ea6b79f549..70e12bd722 100644
--- a/perl.h
+++ b/perl.h
@@ -3887,12 +3887,12 @@ typedef struct crypt_data { /* straight from /usr/include/crypt.h */
#endif
/* [perl #22371] Algorimic Complexity Attack on Perl 5.6.1, 5.8.0.
- * Note that the USE_HASH_SEED and similar defines are *NOT* defined by
- * Configure, despite their names being similar to other defines like
- * USE_ITHREADS. Configure in fact knows nothing about the randomised
- * hashes. Therefore to enable/disable the hash randomisation defines
- * use the Configure -Accflags=... instead. */
-#if !defined(NO_HASH_SEED) && !defined(USE_HASH_SEED)
+ * Note that the USE_HASH_SEED and USE_HASH_SEED_EXPLICIT are *NOT*
+ * defined by Configure, despite their names being similar to the
+ * other defines like USE_ITHREADS. Configure in fact knows nothing
+ * about the randomised hashes. Therefore to enable/disable the hash
+ * randomisation defines use the Configure -Accflags=... instead. */
+#if !defined(NO_HASH_SEED) && !defined(USE_HASH_SEED) && !defined(USE_HASH_SEED_EXPLICIT)
# define USE_HASH_SEED
#endif
diff --git a/util.c b/util.c
index 5bb0dfcffc..b324af43ed 100644
--- a/util.c
+++ b/util.c
@@ -4632,6 +4632,7 @@ Perl_get_hash_seed(pTHX_ unsigned char * const seed_buffer)
env_pv= PerlEnv_getenv("PERL_HASH_SEED");
if ( env_pv )
+# ifndef USE_HASH_SEED_EXPLICIT
{
/* ignore leading spaces */
while (isSPACE(*env_pv))
@@ -4666,7 +4667,8 @@ Perl_get_hash_seed(pTHX_ unsigned char * const seed_buffer)
/* should we warn about insufficient hex? */
}
else
-#endif /* NO_PERL_HASH_ENV */
+# endif
+#endif
{
(void)seedDrand01((Rand_seed_t)seed());