]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Improve documenation about security of PRGNs
authorJohannes Kliemann <kliemann@adacore.com>
Fri, 5 Jul 2024 11:27:44 +0000 (11:27 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 2 Aug 2024 07:08:04 +0000 (09:08 +0200)
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.

gcc/ada/doc/gnat_rm/standard_library_routines.rst
gcc/ada/doc/gnat_rm/the_gnat_library.rst
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/libgnat/a-nudira.ads

index 27659a404630d1a727cfa6d1baca73e27bf7580c..2e7642652b2c90f4ca79e4a098a91ba3cefcd87c 100644 (file)
@@ -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``
index 88204d4cfe7238f7ae270bdc16838b91dab49f8f..ac45b5eb7af82d63a9fc3c1de66258816695a867 100644 (file)
@@ -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)`:
 
index d15d6204cd8f36e485ac1eeaae3a6c81304c5876..d6e2f265ab9c016a1682904685141515aca9a5af 100644 (file)
@@ -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}
index 0e3ee935552d6c26f65c4c14fcd797d7ef7683a6..ea1d2f9d71a8c922b277cef76f20b827105ccb90 100644 (file)
@@ -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
index 1b3eacb897dd68676d65b7eceecacfde02683aed..c6d95731821423d3a0e31e023d42a92778b270d6 100644 (file)
@@ -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;