1b8e80941SmrgThis local copy of a SHA1 implementation based on the sources below.
2b8e80941Smrg
3b8e80941SmrgWhy:
4b8e80941Smrg - Some libraries suffer from race condition and other issues. For example see
5b8e80941Smrgcommit ade3108bb5b0 ("util: Fix race condition on libgcrypt initialization").
6b8e80941Smrg
7b8e80941Smrg - Fold the handling and detection of _eight_ implementations at configure
8b8e80941Smrgstage and _seven_ different codepaths.
9b8e80941Smrg
10b8e80941Smrg - Have a single, uniform, code used by developers, testers and users.
11b8e80941Smrg
12b8e80941Smrg - Avoid conflicts when using software which ships with it's own SHA1 library.
13b8e80941SmrgThe latter of which conflicting with the one mesa is build against.
14b8e80941Smrg
15b8e80941Smrg
16b8e80941Smrg
17b8e80941SmrgSource:
18b8e80941SmrgThe SHA1 implementation is copied verbatim from the following links.
19b8e80941SmrgAt the time of checkout HEAD is 1.25 and 1.24 respectively.
20b8e80941Smrg
21b8e80941Smrghttp://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/hash/sha1.c?rev=HEAD
22b8e80941Smrghttp://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/include/sha1.h?rev=HEAD
23b8e80941Smrg
24b8e80941Smrg
25b8e80941SmrgNotes:
26b8e80941Smrg - The files should not have any local changes. If there are any they should be
27b8e80941Smrgclearly documented below and one should aim to upstream them where possible.
28b8e80941Smrg 
29b8e80941Smrg - Files will be periodically syncronised with the respective upstream sources.
30b8e80941SmrgUpdates will be made regularly, but since the code is _not_ aimed as a
31b8e80941Smrgcryptography solution any issues found should not be considered security ones.
32b8e80941Smrg
33b8e80941Smrg
34b8e80941SmrgLocal changes:
35b8e80941Smrg - Removed __bounded__ attribute qualifiers. Unavailable on platforms targeted
36b8e80941Smrgby Mesa. Upstream status: TBD (N/A ?)
37b8e80941Smrg
38b8e80941Smrg - Pick the sha1.h header from the current folder, by using "" over <> in the
39b8e80941Smrginclude directive. Upstream status: TBD
40b8e80941Smrg
41b8e80941Smrg - Remove unused function prototypes - SHA1End, SHA1File, SHA1FileChunk and
42b8e80941SmrgSHA1Data. Upstream status: TBD
43b8e80941Smrg
44b8e80941Smrg - Use stdint.h integer types - u_int{8,16,32}_t -> uint{8,16,32}_t and
45b8e80941Smrgu_int -> uint32_t, change header include. Upstream status: TBD
46b8e80941Smrg
47b8e80941Smrg - Revert sha1.c rev 1.26 change (introduce DEF_WEAK).
48b8e80941SmrgUpstream status: TBD (N/A ?)
49b8e80941Smrg
50b8e80941Smrg - Add stdint.h include in sha1.h for uint*_t types. Upstream status: TBD
51b8e80941Smrg
52b8e80941Smrg - Add stddef.h include in sha1.h for size_t type. Upstream status: TBD
53b8e80941Smrg
54b8e80941Smrg - Use memset over explicit_bzero, since memset_s once isn't widely available.
55b8e80941SmrgUpstream status: TBD (N/A ?)
56b8e80941Smrg
57b8e80941Smrg - Manually expand __BEGIN_DECLS/__END_DECLS and make sure that they include
58b8e80941Smrgthe struct declaration.
59b8e80941SmrgUpstream status: TBD
60b8e80941Smrg
61b8e80941Smrg - Add non-typedef struct name.
62b8e80941SmrgUpstream status: TBD
63