101e04c3fSmrgThis local copy of a SHA1 implementation based on the sources below. 201e04c3fSmrg 301e04c3fSmrgWhy: 401e04c3fSmrg - Some libraries suffer from race condition and other issues. For example see 501e04c3fSmrgcommit ade3108bb5b0 ("util: Fix race condition on libgcrypt initialization"). 601e04c3fSmrg 701e04c3fSmrg - Fold the handling and detection of _eight_ implementations at configure 801e04c3fSmrgstage and _seven_ different codepaths. 901e04c3fSmrg 1001e04c3fSmrg - Have a single, uniform, code used by developers, testers and users. 1101e04c3fSmrg 1201e04c3fSmrg - Avoid conflicts when using software which ships with it's own SHA1 library. 1301e04c3fSmrgThe latter of which conflicting with the one mesa is build against. 1401e04c3fSmrg 1501e04c3fSmrg 1601e04c3fSmrg 1701e04c3fSmrgSource: 1801e04c3fSmrgThe SHA1 implementation is copied verbatim from the following links. 1901e04c3fSmrgAt the time of checkout HEAD is 1.25 and 1.24 respectively. 2001e04c3fSmrg 2101e04c3fSmrghttp://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/hash/sha1.c?rev=HEAD 2201e04c3fSmrghttp://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/include/sha1.h?rev=HEAD 2301e04c3fSmrg 2401e04c3fSmrg 2501e04c3fSmrgNotes: 2601e04c3fSmrg - The files should not have any local changes. If there are any they should be 2701e04c3fSmrgclearly documented below and one should aim to upstream them where possible. 2801e04c3fSmrg 2901e04c3fSmrg - Files will be periodically syncronised with the respective upstream sources. 3001e04c3fSmrgUpdates will be made regularly, but since the code is _not_ aimed as a 3101e04c3fSmrgcryptography solution any issues found should not be considered security ones. 3201e04c3fSmrg 3301e04c3fSmrg 3401e04c3fSmrgLocal changes: 3501e04c3fSmrg - Removed __bounded__ attribute qualifiers. Unavailable on platforms targeted 3601e04c3fSmrgby Mesa. Upstream status: TBD (N/A ?) 3701e04c3fSmrg 3801e04c3fSmrg - Pick the sha1.h header from the current folder, by using "" over <> in the 3901e04c3fSmrginclude directive. Upstream status: TBD 4001e04c3fSmrg 4101e04c3fSmrg - Remove unused function prototypes - SHA1End, SHA1File, SHA1FileChunk and 4201e04c3fSmrgSHA1Data. Upstream status: TBD 4301e04c3fSmrg 4401e04c3fSmrg - Use stdint.h integer types - u_int{8,16,32}_t -> uint{8,16,32}_t and 4501e04c3fSmrgu_int -> uint32_t, change header include. Upstream status: TBD 4601e04c3fSmrg 4701e04c3fSmrg - Revert sha1.c rev 1.26 change (introduce DEF_WEAK). 4801e04c3fSmrgUpstream status: TBD (N/A ?) 4901e04c3fSmrg 5001e04c3fSmrg - Add stdint.h include in sha1.h for uint*_t types. Upstream status: TBD 5101e04c3fSmrg 5201e04c3fSmrg - Add stddef.h include in sha1.h for size_t type. Upstream status: TBD 5301e04c3fSmrg 5401e04c3fSmrg - Use memset over explicit_bzero, since memset_s once isn't widely available. 5501e04c3fSmrgUpstream status: TBD (N/A ?) 5601e04c3fSmrg 5701e04c3fSmrg - Manually expand __BEGIN_DECLS/__END_DECLS and make sure that they include 5801e04c3fSmrgthe struct declaration. 5901e04c3fSmrgUpstream status: TBD 6001e04c3fSmrg 6101e04c3fSmrg - Add non-typedef struct name. 6201e04c3fSmrgUpstream status: TBD 63