1 ------------------------------------------------------------------------------
3 -- GNAT LIBRARY COMPONENTS --
5 -- 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 --
9 -- Copyright (C) 2009, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package provides supporting code for implementation of the following
33 -- secure hash functions described in FIPS PUB 180-3: SHA-224, SHA-256,
34 -- SHA-384, SHA-512. It contains the generic transform operation that is
35 -- common to the above four functions. The complete text of FIPS PUB 180-3
37 -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
39 -- This is an internal unit and should not be used directly in applications.
40 -- Use GNAT.SHA* instead.
42 package GNAT
.Secure_Hashes
.SHA2_Common
is
44 Block_Words
: constant := 16;
45 -- All functions operate on blocks of 16 words
48 with package Hash_State
is new Hash_Function_State
(<>);
51 -- Number of transformation rounds
54 -- Constants used in the transform operation
56 with function Sigma0
(X
: Hash_State
.Word
) return Hash_State
.Word
is <>;
57 with function Sigma1
(X
: Hash_State
.Word
) return Hash_State
.Word
is <>;
58 with function S0
(X
: Hash_State
.Word
) return Hash_State
.Word
is <>;
59 with function S1
(X
: Hash_State
.Word
) return Hash_State
.Word
is <>;
60 -- FIPS PUB 180-3 elementary functions
63 (H_St
: in out Hash_State
.State
;
64 M_St
: in out Message_State
);
66 end GNAT
.Secure_Hashes
.SHA2_Common
;