Use a XOR cipher instead of byte shuffling to protect against bad seeds.
authorJanne Blomqvist <jb@gcc.gnu.org>
Fri, 19 Aug 2016 14:19:51 +0000 (17:19 +0300)
committerJanne Blomqvist <jb@gcc.gnu.org>
Fri, 19 Aug 2016 14:19:51 +0000 (17:19 +0300)
commit09309e09ecfa663cb22c8a210521704df0f18a5d
tree90867836565b9d525c6d273b63d2397a7a3ebed6
parent91151a7334543817f1f790310a1bfc4589889cad
Use a XOR cipher instead of byte shuffling to protect against bad seeds.

libgfortran:
2016-08-19  Janne Blomqvist  <jb@gcc.gnu.org>

        * intrinsics/random.c (xor_keys): New array with "secret" keys.
        (scramble_seed): XOR given seed with xor_keys array rather than
        shuffling bytes.
        (unscramble_seed): Remove function.
        (random_seed_i4): Use new scramble_seed.
        (random_seed_i8): Likewise.

frontend:
2016-08-19  Janne Blomqvist  <jb@gcc.gnu.org>

        * intrinsics.texi (RANDOM_NUMBER): Remove reference to
        init_random_seed in example.
        (RANDOM_SEED): Remove warning to not set all seed values to 0.

From-SVN: r239613
gcc/fortran/ChangeLog
gcc/fortran/intrinsic.texi
libgfortran/ChangeLog
libgfortran/intrinsics/random.c