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