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