diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dbb8057d971..86e754b003c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2009-11-30 Robert Dewar + + * osint.ads: Minor comment update. + +2009-11-30 Thomas Quinot + + * s-sechas.adb: Fix swapping error in previous checkin. + * g-md5.ads, g-sha256.ads, g-sha512.ads, g-sha1.ads, g-sha224.ads, + g-sha384.ads: Add missing documentation. + 2009-11-30 Robert Dewar * g-sha256.ads, s-sehamd.ads, s-sehamd.adb, g-sha512.ads, g-sha224.ads, diff --git a/gcc/ada/g-md5.ads b/gcc/ada/g-md5.ads index ec37642ba17..0f2d2834091 100644 --- a/gcc/ada/g-md5.ads +++ b/gcc/ada/g-md5.ads @@ -31,9 +31,15 @@ -- -- ------------------------------------------------------------------------------ --- Why is this package undocumented ??? +-- This package implements the MD5 Message-Digest Algorithm as described in +-- RFC 1321. The complete text of RFC 1321 can be found at: +-- http://www.ietf.org/rfc/rfc1321.txt + +-- See the declaration of System.Secure_Hashes.H in s-sechas.ads for complete +-- documentation. with System.Secure_Hashes.MD5; + package GNAT.MD5 is new System.Secure_Hashes.H (Block_Words => System.Secure_Hashes.MD5.Block_Words, State_Words => 4, diff --git a/gcc/ada/g-sha1.ads b/gcc/ada/g-sha1.ads index a7d8e4cbd68..8570923b109 100644 --- a/gcc/ada/g-sha1.ads +++ b/gcc/ada/g-sha1.ads @@ -31,9 +31,15 @@ -- -- ------------------------------------------------------------------------------ --- Why no documentation ??? +-- This package implaments the SHA-1 secure hash function as decsribed in +-- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: +-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf + +-- See the declaration of System.Secure_Hashes.H in s-sechas.ads for complete +-- documentation. with System.Secure_Hashes.SHA1; + package GNAT.SHA1 is new System.Secure_Hashes.H (Block_Words => System.Secure_Hashes.SHA1.Block_Words, State_Words => 5, diff --git a/gcc/ada/g-sha224.ads b/gcc/ada/g-sha224.ads index 9b93a19e4e0..c79f87fb8c5 100644 --- a/gcc/ada/g-sha224.ads +++ b/gcc/ada/g-sha224.ads @@ -29,6 +29,13 @@ -- -- ------------------------------------------------------------------------------ +-- This package implaments the SHA-224 secure hash function as decsribed in +-- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: +-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf + +-- See the declaration of System.Secure_Hashes.H in s-sechas.ads for complete +-- documentation. + with System.Secure_Hashes.SHA2_Common; with System.Secure_Hashes.SHA2_32; diff --git a/gcc/ada/g-sha256.ads b/gcc/ada/g-sha256.ads index ee8177fa2eb..a45e057f8c2 100644 --- a/gcc/ada/g-sha256.ads +++ b/gcc/ada/g-sha256.ads @@ -29,6 +29,13 @@ -- -- ------------------------------------------------------------------------------ +-- This package implaments the SHA-256 secure hash function as decsribed in +-- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: +-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf + +-- See the declaration of System.Secure_Hashes.H in s-sechas.ads for complete +-- documentation. + with System.Secure_Hashes.SHA2_Common; with System.Secure_Hashes.SHA2_32; diff --git a/gcc/ada/g-sha384.ads b/gcc/ada/g-sha384.ads index 4c1b8b5a326..262fb92a75c 100644 --- a/gcc/ada/g-sha384.ads +++ b/gcc/ada/g-sha384.ads @@ -29,6 +29,13 @@ -- -- ------------------------------------------------------------------------------ +-- This package implaments the SHA-384 secure hash function as decsribed in +-- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: +-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf + +-- See the declaration of System.Secure_Hashes.H in s-sechas.ads for complete +-- documentation. + with System.Secure_Hashes.SHA2_Common; with System.Secure_Hashes.SHA2_64; diff --git a/gcc/ada/g-sha512.ads b/gcc/ada/g-sha512.ads index c8ebd32f969..dad8079a8f5 100644 --- a/gcc/ada/g-sha512.ads +++ b/gcc/ada/g-sha512.ads @@ -29,6 +29,13 @@ -- -- ------------------------------------------------------------------------------ +-- This package implaments the SHA-512 secure hash function as decsribed in +-- FIPS PUB 180-3. The complete text of FIPS PUB 180-3 can be found at: +-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf + +-- See the declaration of System.Secure_Hashes.H in s-sechas.ads for complete +-- documentation. + with System.Secure_Hashes.SHA2_Common; with System.Secure_Hashes.SHA2_64; diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads index eeba80148ae..ae827ba286b 100644 --- a/gcc/ada/osint.ads +++ b/gcc/ada/osint.ads @@ -737,9 +737,11 @@ private File_Attributes_Size : constant Natural := 24; -- This should be big enough to fit a "struct file_attributes" on any - -- system. It doesn't matter if it is too big (which avoids the need for - -- either mapping the struct exactly or importing the sizeof from C, which - -- would result in dynamic code) + -- system. It doesn't cause any malfunction if it is too big (which avoids + -- the need for either mapping the struct exactly or importing the sizeof + -- from C, which would result in dynamic code). However, it does waste + -- space (e.g. when a component of this type appears in a record, if it is + -- unnecessarily large. type File_Attributes is array (1 .. File_Attributes_Size) diff --git a/gcc/ada/s-sechas.adb b/gcc/ada/s-sechas.adb index 0b1fab39807..d34f0499ff4 100644 --- a/gcc/ada/s-sechas.adb +++ b/gcc/ada/s-sechas.adb @@ -46,8 +46,9 @@ package body System.Secure_Hashes is S : String; First : Natural; Last : out Natural); - -- A procedure to transfer data from S into M's block buffer until either - -- the block buffer is full or all data from S has been consumed. + -- A procedure to transfer data from S, starting at First, into M's block + -- buffer until either the block buffer is full or all data from S has been + -- consumed. procedure Fill_Buffer_Copy (M : in out Message_State; @@ -61,7 +62,12 @@ package body System.Secure_Hashes is S : String; First : Natural; Last : out Natural); - -- Transfer procedure which swaps bytes from S when copying into M + -- Transfer procedure which swaps bytes from S when copying into M. S must + -- have even length. Note that the swapping is performed considering pairs + -- starting at S'First, even if S'First /= First (that is, if + -- First = S'First then the first copied byte is always S (S'First + 1), + -- and if First = S'First + 1 then the first copied byte is always + -- S (S'First). procedure To_String (SEA : Stream_Element_Array; S : out String); -- Return the hexadecimal representation of SEA @@ -102,13 +108,16 @@ package body System.Secure_Hashes is First : Natural; Last : out Natural) is + pragma Assert (S'Length mod 2 = 0); Length : constant Natural := Natural'Min (M.Block_Length - M.Last, S'Last - First + 1); begin Last := First; while Last - First < Length loop M.Buffer (M.Last + 1 + Last - First) := - (if (Last - First) mod 2 = 0 then S (Last + 1) else S (Last - 1)); + (if (Last - S'First) mod 2 = 0 + then S (Last + 1) + else S (Last - 1)); Last := Last + 1; end loop; M.Last := M.Last + Length;