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