aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-11-30 16:16:49 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2009-11-30 16:16:49 +0100
commiteaf180889e63584942ec0d8da8707b964de8fe35 (patch)
tree28d08bd6fb236b572e801263248cecf3bd323e7b /gcc
parent40513dd30b587ccb7967b565822f473f96d73544 (diff)
downloadgcc-eaf180889e63584942ec0d8da8707b964de8fe35.zip
gcc-eaf180889e63584942ec0d8da8707b964de8fe35.tar.gz
gcc-eaf180889e63584942ec0d8da8707b964de8fe35.tar.bz2
[multiple changes]
2009-11-30 Robert Dewar <dewar@adacore.com> * osint.ads: Minor comment update. 2009-11-30 Thomas Quinot <quinot@adacore.com> * 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. From-SVN: r154819
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/g-md5.ads8
-rw-r--r--gcc/ada/g-sha1.ads8
-rw-r--r--gcc/ada/g-sha224.ads7
-rw-r--r--gcc/ada/g-sha256.ads7
-rw-r--r--gcc/ada/g-sha384.ads7
-rw-r--r--gcc/ada/g-sha512.ads7
-rw-r--r--gcc/ada/osint.ads8
-rw-r--r--gcc/ada/s-sechas.adb17
9 files changed, 70 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index dbb8057d..86e754b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,15 @@
2009-11-30 Robert Dewar <dewar@adacore.com>
+ * osint.ads: Minor comment update.
+
+2009-11-30 Thomas Quinot <quinot@adacore.com>
+
+ * 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 <dewar@adacore.com>
+
* g-sha256.ads, s-sehamd.ads, s-sehamd.adb, g-sha512.ads, g-sha224.ads,
g-sha384.ads: Minor reformatting
diff --git a/gcc/ada/g-md5.ads b/gcc/ada/g-md5.ads
index ec37642..0f2d283 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 a7d8e4c..8570923 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 9b93a19..c79f87f 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 ee8177f..a45e057 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 4c1b8b5..262fb92 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 c8ebd32..dad8079 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 eeba801..ae827ba 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 0b1fab3..d34f049 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;