diff options
author | Johannes Kliemann <kliemann@adacore.com> | 2024-07-05 11:27:44 +0000 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-08-02 09:08:04 +0200 |
commit | dc72d4dca9e6ee5af2ea2af0353a994a7a109db3 (patch) | |
tree | 32d99800063c2ba7b6d861924540ebc9f4983104 /gcc/ada | |
parent | b1dc668b71bf64046b65b508f43157fcaa095ea9 (diff) | |
download | gcc-dc72d4dca9e6ee5af2ea2af0353a994a7a109db3.zip gcc-dc72d4dca9e6ee5af2ea2af0353a994a7a109db3.tar.gz gcc-dc72d4dca9e6ee5af2ea2af0353a994a7a109db3.tar.bz2 |
ada: Improve documenation about security of PRGNs
The pseudo random number generators used in GNAT are not
suitable for applications that require cryptographic
security. While this was mentioned in some places others
did not have a corresponding note, leading to these
generators being used in a non-suitable context.
gcc/ada/
* doc/gnat_rm/standard_library_routines.rst: Add note to section
of Ada.Numerics.Discrete_Random and Ada.Numerics.Float_Random.
* doc/gnat_rm/the_gnat_library.rst: Add note to section about
GNAT.Random_Numbers.
* libgnat/a-nudira.ads: Add note about cryptographic properties.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/doc/gnat_rm/standard_library_routines.rst | 6 | ||||
-rw-r--r-- | gcc/ada/doc/gnat_rm/the_gnat_library.rst | 4 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 10 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 2 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-nudira.ads | 2 |
5 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ada/doc/gnat_rm/standard_library_routines.rst b/gcc/ada/doc/gnat_rm/standard_library_routines.rst index 27659a4..2e76426 100644 --- a/gcc/ada/doc/gnat_rm/standard_library_routines.rst +++ b/gcc/ada/doc/gnat_rm/standard_library_routines.rst @@ -302,12 +302,14 @@ the unit is not implemented. ``Ada.Numerics.Discrete_Random`` This generic package provides a random number generator suitable for generating - uniformly distributed values of a specified discrete subtype. + uniformly distributed values of a specified discrete subtype. It should not be + used as a cryptographic pseudo-random source. ``Ada.Numerics.Float_Random`` This package provides a random number generator suitable for generating - uniformly distributed floating point values in the unit interval. + uniformly distributed floating point values in the unit interval. It should not + be used as a cryptographic pseudo-random source. ``Ada.Numerics.Generic_Complex_Elementary_Functions`` diff --git a/gcc/ada/doc/gnat_rm/the_gnat_library.rst b/gcc/ada/doc/gnat_rm/the_gnat_library.rst index 88204d4..ac45b5e 100644 --- a/gcc/ada/doc/gnat_rm/the_gnat_library.rst +++ b/gcc/ada/doc/gnat_rm/the_gnat_library.rst @@ -1329,7 +1329,9 @@ convenient for use with realtime applications. .. index:: Random number generation Provides random number capabilities which extend those available in the -standard Ada library and are more convenient to use. +standard Ada library and are more convenient to use. This package is +however NOT suitable for situations requiring cryptographically secure +randomness. .. _`GNAT.Regexp_(g-regexp.ads)`: diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index d15d620..d6e2f26 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -21142,12 +21142,14 @@ build the type @code{Complex} and @code{Imaginary}. @item @code{Ada.Numerics.Discrete_Random} This generic package provides a random number generator suitable for generating -uniformly distributed values of a specified discrete subtype. +uniformly distributed values of a specified discrete subtype. It should not be +used as a cryptographic pseudo-random source. @item @code{Ada.Numerics.Float_Random} This package provides a random number generator suitable for generating -uniformly distributed floating point values in the unit interval. +uniformly distributed floating point values in the unit interval. It should not +be used as a cryptographic pseudo-random source. @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions} @@ -24688,7 +24690,9 @@ convenient for use with realtime applications. @geindex Random number generation Provides random number capabilities which extend those available in the -standard Ada library and are more convenient to use. +standard Ada library and are more convenient to use. This package is +however NOT suitable for situations requiring cryptographically secure +randomness. @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{270}@anchor{gnat_rm/the_gnat_library id90}@anchor{39b} diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 0e3ee93..ea1d2f9 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -29670,8 +29670,8 @@ to permit their use in free software. @printindex ge -@anchor{d1}@w{ } @anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ } +@anchor{d1}@w{ } @c %**end of body @bye diff --git a/gcc/ada/libgnat/a-nudira.ads b/gcc/ada/libgnat/a-nudira.ads index 1b3eacb..c6d9573 100644 --- a/gcc/ada/libgnat/a-nudira.ads +++ b/gcc/ada/libgnat/a-nudira.ads @@ -35,6 +35,8 @@ -- Note: the implementation used in this package is a version of the -- Mersenne Twister. See s-rannum.adb for details and references. +-- It is suitable for simulations, but should not be used as a cryptographic +-- pseudo-random source. with System.Random_Numbers; |