+2009-11-30 Thomas Quinot <quinot@adacore.com>
+
+ * s-sechas.adb, s-sechas.ads, s-shshco.adb, s-shshco.ads, s-shsh64.adb,
+ s-shsh64.ads, s-sehamd.adb, s-sehamd.ads, s-shsh32.adb, s-shsh32.ads,
+ s-sehash.adb, s-sehash.ads, g-sechas.adb, g-sechas.ads, g-shshco.adb,
+ g-shshco.ads, g-md5.ads, g-sha256.ads, g-shsh64.adb, g-shsh64.ads,
+ g-sehamd.adb, g-sehamd.ads, g-sha512.ads, g-sha1.ads, Makefile.rtl,
+ g-sha224.ads, g-shsh32.adb, g-shsh32.ads, g-sha384.ads, g-sehash.adb,
+ g-sehash.ads: Rename System.Secure_Hashes to GNAT.Secure_Hashes.
+
2009-11-30 Robert Dewar <dewar@adacore.com>
* osint.ads: Minor comment update.
g-rannum$(objext) \
g-regexp$(objext) \
g-regpat$(objext) \
+ g-sechas$(objext) \
+ g-sehamd$(objext) \
+ g-sehash$(objext) \
g-sercom$(objext) \
g-sestin$(objext) \
g-sha1$(objext) \
g-sha256$(objext) \
g-sha384$(objext) \
g-sha512$(objext) \
+ g-shsh32$(objext) \
+ g-shsh64$(objext) \
+ g-shshco$(objext) \
g-souinf$(objext) \
g-spchge$(objext) \
g-speche$(objext) \
s-rident$(objext) \
s-rpc$(objext) \
s-scaval$(objext) \
- s-sechas$(objext) \
s-secsta$(objext) \
- s-sehamd$(objext) \
- s-sehash$(objext) \
s-sequio$(objext) \
s-shasto$(objext) \
- s-shsh32$(objext) \
- s-shsh64$(objext) \
- s-shshco$(objext) \
s-soflin$(objext) \
s-stache$(objext) \
s-stalib$(objext) \
-- 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
+-- See the declaration of GNAT.Secure_Hashes.H in g-sechas.ads for complete
-- documentation.
-with System.Secure_Hashes.MD5;
+with GNAT.Secure_Hashes.MD5;
+with System;
-package GNAT.MD5 is new System.Secure_Hashes.H
- (Block_Words => System.Secure_Hashes.MD5.Block_Words,
+package GNAT.MD5 is new GNAT.Secure_Hashes.H
+ (Block_Words => GNAT.Secure_Hashes.MD5.Block_Words,
State_Words => 4,
Hash_Words => 4,
Hash_Bit_Order => System.Low_Order_First,
- Hash_State => System.Secure_Hashes.MD5.Hash_State,
- Initial_State => System.Secure_Hashes.MD5.Initial_State,
- Transform => System.Secure_Hashes.MD5.Transform);
+ Hash_State => GNAT.Secure_Hashes.MD5.Hash_State,
+ Initial_State => GNAT.Secure_Hashes.MD5.Initial_State,
+ Transform => GNAT.Secure_Hashes.MD5.Transform);
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S --
+-- G N A T . S E C U R E _ H A S H E S --
-- --
-- B o d y --
-- --
with System; use System;
with Interfaces; use Interfaces;
-package body System.Secure_Hashes is
+package body GNAT.Secure_Hashes is
use Ada.Streams;
end Hash_Function_State;
-end System.Secure_Hashes;
+end GNAT.Secure_Hashes;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S --
+-- G N A T . S E C U R E _ H A S H E S --
-- --
-- S p e c --
-- --
-- hash functions (including MD5 and the FIPS PUB 180-3 functions SHA-1,
-- SHA-224, SHA-256, SHA-384 and SHA-512).
+-- This is an internal unit and should be not used directly in applications.
+-- Use GNAT.MD5 and GNAT.SHA* instead.
+
with Ada.Streams;
with Interfaces;
+with System;
-package System.Secure_Hashes is
+package GNAT.Secure_Hashes is
type Buffer_Type is new String;
for Buffer_Type'Alignment use 8;
package H is
+ -- The visible part of H is the interface to secure hashing functions
+ -- that is exposed to user applications, and is intended to remain
+ -- a stable interface.
+
pragma Assert (Hash_Words <= State_Words);
type Context is private;
end H;
-end System.Secure_Hashes;
+end GNAT.Secure_Hashes;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . M D 5 --
+-- G N A T . S E C U R E _ H A S H E S . M D 5 --
-- --
-- B o d y --
-- --
with GNAT.Byte_Swapping; use GNAT.Byte_Swapping;
-package body System.Secure_Hashes.MD5 is
+package body GNAT.Secure_Hashes.MD5 is
use Interfaces;
(H : in out Hash_State.State;
M : in out Message_State)
is
+ use System;
+
X : array (0 .. 15) of Interfaces.Unsigned_32;
for X'Address use M.Buffer'Address;
pragma Import (Ada, X);
DD : Unsigned_32 := H (3);
begin
- if System.Default_Bit_Order /= Low_Order_First then
+ if Default_Bit_Order /= Low_Order_First then
for J in X'Range loop
Swap4 (X (J)'Address);
end loop;
end Transform;
-end System.Secure_Hashes.MD5;
+end GNAT.Secure_Hashes.MD5;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . M D 5 --
+-- G N A T . S E C U R E _ H A S H E S . M D 5 --
-- --
-- S p e c --
-- --
-- RFC 1321 can be found at:
-- http://www.ietf.org/rfc/rfc1321.txt
+-- This is an internal unit and should not be used directly in applications.
+-- Use GNAT.MD5 instead.
+
with GNAT.Byte_Swapping;
with Interfaces;
-package System.Secure_Hashes.MD5 is
+package GNAT.Secure_Hashes.MD5 is
package Hash_State is
- new System.Secure_Hashes.Hash_Function_State
+ new GNAT.Secure_Hashes.Hash_Function_State
(Word => Interfaces.Unsigned_32,
Swap => GNAT.Byte_Swapping.Swap4,
Hash_Bit_Order => System.Low_Order_First);
(Initial_A, Initial_B, Initial_C, Initial_D);
-- Initialization vector from RFC 1321
-end System.Secure_Hashes.MD5;
+end GNAT.Secure_Hashes.MD5;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 1 --
+-- G N A T . S E C U R E _ H A S H E S . S H A 1 --
-- --
-- B o d y --
-- --
-- --
------------------------------------------------------------------------------
-package body System.Secure_Hashes.SHA1 is
+package body GNAT.Secure_Hashes.SHA1 is
use Interfaces;
use GNAT.Byte_Swapping;
(H : in out Hash_State.State;
M : in out Message_State)
is
+ use System;
+
type Words is array (Natural range <>) of Interfaces.Unsigned_32;
X : Words (0 .. 15);
A, B, C, D, E, Temp : Interfaces.Unsigned_32;
begin
- if System.Default_Bit_Order /= High_Order_First then
+ if Default_Bit_Order /= High_Order_First then
for J in X'Range loop
Swap4 (X (J)'Address);
end loop;
H (4) := H (4) + E;
end Transform;
-end System.Secure_Hashes.SHA1;
+end GNAT.Secure_Hashes.SHA1;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 1 --
+-- G N A T . S E C U R E _ H A S H E S . S H A 1 --
-- --
-- S p e c --
-- --
-- of FIPS PUB 180-3 can be found at:
-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
+-- This is an internal unit and should not be used directly in applications.
+-- Use GNAT.SHA1 instead.
+
with GNAT.Byte_Swapping;
with Interfaces;
-package System.Secure_Hashes.SHA1 is
+package GNAT.Secure_Hashes.SHA1 is
package Hash_State is new Hash_Function_State
(Word => Interfaces.Unsigned_32,
4 => 16#C3D2E1F0#);
-- Initialization vector from FIPS PUB 180-3
-end System.Secure_Hashes.SHA1;
+end GNAT.Secure_Hashes.SHA1;
-- 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
+-- See the declaration of GNAT.Secure_Hashes.H in g-sechas.ads for complete
-- documentation.
-with System.Secure_Hashes.SHA1;
+with GNAT.Secure_Hashes.SHA1;
+with System;
-package GNAT.SHA1 is new System.Secure_Hashes.H
- (Block_Words => System.Secure_Hashes.SHA1.Block_Words,
+package GNAT.SHA1 is new GNAT.Secure_Hashes.H
+ (Block_Words => GNAT.Secure_Hashes.SHA1.Block_Words,
State_Words => 5,
Hash_Words => 5,
Hash_Bit_Order => System.High_Order_First,
- Hash_State => System.Secure_Hashes.SHA1.Hash_State,
- Initial_State => System.Secure_Hashes.SHA1.Initial_State,
- Transform => System.Secure_Hashes.SHA1.Transform);
+ Hash_State => GNAT.Secure_Hashes.SHA1.Hash_State,
+ Initial_State => GNAT.Secure_Hashes.SHA1.Initial_State,
+ Transform => GNAT.Secure_Hashes.SHA1.Transform);
-- 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
+-- See the declaration of GNAT.Secure_Hashes.H in g-sechas.ads for complete
-- documentation.
-with System.Secure_Hashes.SHA2_Common;
-with System.Secure_Hashes.SHA2_32;
+with GNAT.Secure_Hashes.SHA2_Common;
+with GNAT.Secure_Hashes.SHA2_32;
+with System;
-package GNAT.SHA224 is new System.Secure_Hashes.H
- (Block_Words => System.Secure_Hashes.SHA2_Common.Block_Words,
+package GNAT.SHA224 is new GNAT.Secure_Hashes.H
+ (Block_Words => GNAT.Secure_Hashes.SHA2_Common.Block_Words,
State_Words => 8,
Hash_Words => 7,
Hash_Bit_Order => System.High_Order_First,
- Hash_State => System.Secure_Hashes.SHA2_32.Hash_State,
- Initial_State => System.Secure_Hashes.SHA2_32.SHA224_Init_State,
- Transform => System.Secure_Hashes.SHA2_32.Transform);
+ Hash_State => GNAT.Secure_Hashes.SHA2_32.Hash_State,
+ Initial_State => GNAT.Secure_Hashes.SHA2_32.SHA224_Init_State,
+ Transform => GNAT.Secure_Hashes.SHA2_32.Transform);
-- 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
+-- See the declaration of GNAT.Secure_Hashes.H in g-sechas.ads for complete
-- documentation.
-with System.Secure_Hashes.SHA2_Common;
-with System.Secure_Hashes.SHA2_32;
+with GNAT.Secure_Hashes.SHA2_Common;
+with GNAT.Secure_Hashes.SHA2_32;
+with System;
-package GNAT.SHA256 is new System.Secure_Hashes.H
- (Block_Words => System.Secure_Hashes.SHA2_Common.Block_Words,
+package GNAT.SHA256 is new GNAT.Secure_Hashes.H
+ (Block_Words => GNAT.Secure_Hashes.SHA2_Common.Block_Words,
State_Words => 8,
Hash_Words => 8,
Hash_Bit_Order => System.High_Order_First,
- Hash_State => System.Secure_Hashes.SHA2_32.Hash_State,
- Initial_State => System.Secure_Hashes.SHA2_32.SHA256_Init_State,
- Transform => System.Secure_Hashes.SHA2_32.Transform);
+ Hash_State => GNAT.Secure_Hashes.SHA2_32.Hash_State,
+ Initial_State => GNAT.Secure_Hashes.SHA2_32.SHA256_Init_State,
+ Transform => GNAT.Secure_Hashes.SHA2_32.Transform);
-- 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
+-- See the declaration of GNAT.Secure_Hashes.H in g-sechas.ads for complete
-- documentation.
-with System.Secure_Hashes.SHA2_Common;
-with System.Secure_Hashes.SHA2_64;
+with GNAT.Secure_Hashes.SHA2_Common;
+with GNAT.Secure_Hashes.SHA2_64;
+with System;
-package GNAT.SHA384 is new System.Secure_Hashes.H
- (Block_Words => System.Secure_Hashes.SHA2_Common.Block_Words,
+package GNAT.SHA384 is new GNAT.Secure_Hashes.H
+ (Block_Words => GNAT.Secure_Hashes.SHA2_Common.Block_Words,
State_Words => 8,
Hash_Words => 6,
Hash_Bit_Order => System.High_Order_First,
- Hash_State => System.Secure_Hashes.SHA2_64.Hash_State,
- Initial_State => System.Secure_Hashes.SHA2_64.SHA384_Init_State,
- Transform => System.Secure_Hashes.SHA2_64.Transform);
+ Hash_State => GNAT.Secure_Hashes.SHA2_64.Hash_State,
+ Initial_State => GNAT.Secure_Hashes.SHA2_64.SHA384_Init_State,
+ Transform => GNAT.Secure_Hashes.SHA2_64.Transform);
-- 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
+-- See the declaration of GNAT.Secure_Hashes.H in g-sechas.ads for complete
-- documentation.
-with System.Secure_Hashes.SHA2_Common;
-with System.Secure_Hashes.SHA2_64;
+with GNAT.Secure_Hashes.SHA2_Common;
+with GNAT.Secure_Hashes.SHA2_64;
+with System;
-package GNAT.SHA512 is new System.Secure_Hashes.H
- (Block_Words => System.Secure_Hashes.SHA2_Common.Block_Words,
+package GNAT.SHA512 is new GNAT.Secure_Hashes.H
+ (Block_Words => GNAT.Secure_Hashes.SHA2_Common.Block_Words,
State_Words => 8,
Hash_Words => 8,
Hash_Bit_Order => System.High_Order_First,
- Hash_State => System.Secure_Hashes.SHA2_64.Hash_State,
- Initial_State => System.Secure_Hashes.SHA2_64.SHA512_Init_State,
- Transform => System.Secure_Hashes.SHA2_64.Transform);
+ Hash_State => GNAT.Secure_Hashes.SHA2_64.Hash_State,
+ Initial_State => GNAT.Secure_Hashes.SHA2_64.SHA512_Init_State,
+ Transform => GNAT.Secure_Hashes.SHA2_64.Transform);
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 2 _ 3 2 --
+-- G N A T . S E C U R E _ H A S H E S . S H A 2 _ 3 2 --
-- --
-- B o d y --
-- --
-- --
------------------------------------------------------------------------------
-package body System.Secure_Hashes.SHA2_32 is
+package body GNAT.Secure_Hashes.SHA2_32 is
use Interfaces;
xor Shift_Right (X, 10);
end S1;
-end System.Secure_Hashes.SHA2_32;
+end GNAT.Secure_Hashes.SHA2_32;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 2 _ 3 2 --
+-- G N A T . S E C U R E _ H A S H E S . S H A 2 _ 3 2 --
-- --
-- S p e c --
-- --
------------------------------------------------------------------------------
-- This pacakge provides support for the 32-bit FIPS PUB 180-3 functions
--- SHA-256 and SHA-224.
+-- SHA-224 and SHA-256.
+
+-- This is an internal unit and should not be used directly in applications.
+-- Use GNAT.SHA224 and GNAT.SHA256 instead.
with Interfaces;
with GNAT.Byte_Swapping;
-with System.Secure_Hashes.SHA2_Common;
+with GNAT.Secure_Hashes.SHA2_Common;
-package System.Secure_Hashes.SHA2_32 is
+package GNAT.Secure_Hashes.SHA2_32 is
subtype Word is Interfaces.Unsigned_32;
7 => 16#5be0cd19#);
-- Initialization vectors from FIPS PUB 180-3
-end System.Secure_Hashes.SHA2_32;
+end GNAT.Secure_Hashes.SHA2_32;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 2 _ 6 4 --
+-- G N A T . S E C U R E _ H A S H E S . S H A 2 _ 6 4 --
-- --
-- B o d y --
-- --
-- --
------------------------------------------------------------------------------
-package body System.Secure_Hashes.SHA2_64 is
+package body GNAT.Secure_Hashes.SHA2_64 is
use Interfaces;
xor Shift_Right (X, 6);
end S1;
-end System.Secure_Hashes.SHA2_64;
+end GNAT.Secure_Hashes.SHA2_64;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 2 _ 6 4 --
+-- G N A T . S E C U R E _ H A S H E S . S H A 2 _ 6 4 --
-- --
-- S p e c --
-- --
------------------------------------------------------------------------------
-- This pacakge provides support for the 64-bit FIPS PUB 180-3 functions
--- (SHA-384 and SHA-512).
+-- SHA-384 and SHA-512.
+
+-- This is an internal unit and should not be used directly in applications.
+-- Use GNAT.SHA384 and GNAT.SHA512 instead.
with Interfaces;
with GNAT.Byte_Swapping;
-with System.Secure_Hashes.SHA2_Common;
+with GNAT.Secure_Hashes.SHA2_Common;
-package System.Secure_Hashes.SHA2_64 is
+package GNAT.Secure_Hashes.SHA2_64 is
subtype Word is Interfaces.Unsigned_64;
package Hash_State is new Hash_Function_State
7 => 16#5be0cd19137e2179#);
-- Initialization vectors from FIPS PUB 180-3
-end System.Secure_Hashes.SHA2_64;
+end GNAT.Secure_Hashes.SHA2_64;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 2 _ C O M M O N --
+-- G N A T . S E C U R E _ H A S H E S . S H A 2 _ C O M M O N --
-- --
-- B o d y --
-- --
-- --
------------------------------------------------------------------------------
-package body System.Secure_Hashes.SHA2_Common is
+package body GNAT.Secure_Hashes.SHA2_Common is
---------------
-- Transform --
(H_St : in out Hash_State.State;
M_St : in out Message_State)
is
+ use System;
+
subtype Word is Hash_State.Word;
use type Hash_State.Word;
-- Start of processing for Transform
begin
- if System.Default_Bit_Order /= High_Order_First then
+ if Default_Bit_Order /= High_Order_First then
for J in X'Range loop
Hash_State.Swap (X (J)'Address);
end loop;
H_St (7) := H + H_St (7);
end Transform;
-end System.Secure_Hashes.SHA2_Common;
+end GNAT.Secure_Hashes.SHA2_Common;
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- S Y S T E M . S E C U R E _ H A S H E S . S H A 2 _ C O M M O N --
+-- G N A T . S E C U R E _ H A S H E S . S H A 2 _ C O M M O N --
-- --
-- S p e c --
-- --
-- can be found at:
-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
-package System.Secure_Hashes.SHA2_Common is
+-- This is an internal unit and should not be used directly in applications.
+-- Use GNAT.SHA* instead.
+
+package GNAT.Secure_Hashes.SHA2_Common is
Block_Words : constant := 16;
-- All functions operate on blocks of 16 words
(H_St : in out Hash_State.State;
M_St : in out Message_State);
-end System.Secure_Hashes.SHA2_Common;
+end GNAT.Secure_Hashes.SHA2_Common;