summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2017-03-23 11:54:43 +0100
committerYves Orton <demerphq@gmail.com>2017-04-23 11:44:18 +0200
commitdd1b95f812312c85390f487887cdd55282fcd6ce (patch)
treee1dc4cde23d1a15369a39f1d268d5c31ead0ff90
parent259e968485f855f70472c8be9267efceca42b0fb (diff)
downloadperl-dd1b95f812312c85390f487887cdd55282fcd6ce.tar.gz
get rid of USE_HASH_SEED_EXPLICIT
I think this has been outright broken for a long time, and it doesnt make any sense to since mandatory randomization anyway, so simply remove it.
-rw-r--r--hv_func.h5
-rw-r--r--perl.c13
-rw-r--r--perl.h12
-rw-r--r--util.c4
4 files changed, 13 insertions, 21 deletions
diff --git a/hv_func.h b/hv_func.h
index ce2d50b577..e091c86b0f 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) || defined(USE_HASH_SEED_EXPLICIT)
+# if defined(USE_HASH_SEED)
# define PERL_HASH_SEED PL_hash_seed
# else
/* this is a 512 bit seed, which should be more than enough for the
@@ -270,9 +270,6 @@ PERL_SIPHASH_FNC(
#endif /* defined(CAN64BITHASH) */
-
-
-
#endif /*compile once*/
/*
diff --git a/perl.c b/perl.c
index 125afaed51..d7b0866dd0 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) || defined(USE_HASH_SEED_EXPLICIT)
+#if defined(USE_HASH_SEED)
/* get the hash seed from the environment or from an RNG */
Perl_get_hash_seed(aTHX_ PL_hash_seed);
-#else /*if !(defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)) */
+#else
/* they want a hard coded seed, check that it is long enough */
assert( strlen(PERL_HASH_SEED) >= PERL_HASH_SEED_BYTES );
-#endif /* #if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT) */
+#endif
/* 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_EXPLICIT) || defined(USE_HASH_SEED_DEBUG)) && !defined(NO_PERL_HASH_SEED_DEBUG)
+#if (defined(USE_HASH_SEED) || 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) || defined(USE_HASH_SEED_EXPLICIT) ... */
+#endif /* #if (defined(USE_HASH_SEED) ... */
#ifdef __amigaos4__
{
@@ -1869,9 +1869,6 @@ 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 70e12bd722..ea6b79f549 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 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)
+ * 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)
# define USE_HASH_SEED
#endif
diff --git a/util.c b/util.c
index b324af43ed..5bb0dfcffc 100644
--- a/util.c
+++ b/util.c
@@ -4632,7 +4632,6 @@ 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))
@@ -4667,8 +4666,7 @@ Perl_get_hash_seed(pTHX_ unsigned char * const seed_buffer)
/* should we warn about insufficient hex? */
}
else
-# endif
-#endif
+#endif /* NO_PERL_HASH_ENV */
{
(void)seedDrand01((Rand_seed_t)seed());