2014-11-18 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / ada / g-sehash.ads
blobc3bbce1edb4de24d3cb3c04f2db535f4c01ab4e5
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- G N A T . S E C U R E _ H A S H E S . S H A 1 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2002-2011, Free Software Foundation, Inc. --
10 -- --
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. --
17 -- --
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. --
21 -- --
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/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This package provides supporting code for implementation of the SHA-1
33 -- secure hash function as described in FIPS PUB 180-3. The complete text
34 -- of FIPS PUB 180-3 can be found at:
35 -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
37 -- This is an internal unit and should not be used directly in applications.
38 -- Use GNAT.SHA1 instead.
40 with GNAT.Byte_Swapping;
41 with Interfaces;
43 package GNAT.Secure_Hashes.SHA1 is
45 package Hash_State is new Hash_Function_State
46 (Word => Interfaces.Unsigned_32,
47 Swap => GNAT.Byte_Swapping.Swap4,
48 Hash_Bit_Order => System.High_Order_First);
49 -- SHA-1 operates on 32-bit big endian words
51 Block_Words : constant := 16;
52 -- Messages are processed in chunks of 16 words
54 procedure Transform
55 (H : in out Hash_State.State;
56 M : in out Message_State);
57 -- Transformation function applied for each block
59 Initial_State : constant Hash_State.State;
60 -- Initialization vector
62 private
64 Initial_State : constant Hash_State.State :=
65 (0 => 16#67452301#,
66 1 => 16#EFCDAB89#,
67 2 => 16#98BADCFE#,
68 3 => 16#10325476#,
69 4 => 16#C3D2E1F0#);
70 -- Initialization vector from FIPS PUB 180-3
72 end GNAT.Secure_Hashes.SHA1;