1 |
Replace the informational hash name section with a formal specification |
2 |
of allowed hash algorithms. The original reasoning for leaving them |
3 |
implementation-defined was poor. After all, not a single new hash |
4 |
was added since the initial version of the GLEP. At the same time, |
5 |
ensuring consistent support for at least a minimal set of hash |
6 |
algorithms is crucial to interoperability. Given that the effort needed |
7 |
to update the GLEP is relatively small, it is better to require all |
8 |
algorithms to be formally listed than to have to track all |
9 |
implementations for new hashes and hope for consistency. |
10 |
|
11 |
Signed-off-by: Michał Górny <mgorny@g.o> |
12 |
--- |
13 |
glep-0074.rst | 125 +++++++++++++++++++++++++++++++------------------- |
14 |
1 file changed, 77 insertions(+), 48 deletions(-) |
15 |
|
16 |
diff --git a/glep-0074.rst b/glep-0074.rst |
17 |
index 8cec618..33f6f80 100644 |
18 |
--- a/glep-0074.rst |
19 |
+++ b/glep-0074.rst |
20 |
@@ -6,7 +6,7 @@ Author: Michał Górny <mgorny@g.o>, |
21 |
Ulrich Müller <ulm@g.o> |
22 |
Type: Standards Track |
23 |
Status: Final |
24 |
-Version: 1.2 |
25 |
+Version: 1.3 |
26 |
Created: 2017-10-21 |
27 |
Last-Modified: 2022-09-11 |
28 |
Post-History: 2017-10-26, 2017-11-16, 2018-02-08, 2022-09-08, 2022-09-11 |
29 |
@@ -26,6 +26,9 @@ efficient and provide means of backwards compatibility. |
30 |
Changes |
31 |
======= |
32 |
|
33 |
+v1.3 |
34 |
+ Formally specified the current set of hash algorithms supported. |
35 |
+ |
36 |
v1.2 |
37 |
Specified the newline convention used for Manifests. |
38 |
|
39 |
@@ -364,27 +367,50 @@ up to and including the *original* directory. Note that those |
40 |
sub-Manifests can use different filenames than ``Manifest``. |
41 |
|
42 |
|
43 |
-Checksum algorithms (informational) |
44 |
------------------------------------ |
45 |
- |
46 |
-This section is informational only. Specifying the exact set |
47 |
-of supported algorithms is outside the scope of this specification. |
48 |
- |
49 |
-The algorithm names reserved at the time of writing are: |
50 |
- |
51 |
-- ``MD5`` [#MD5]_, |
52 |
-- ``RMD160`` -- RIPEMD-160 [#RIPEMD160]_, |
53 |
-- ``SHA1`` [#SHS]_, |
54 |
-- ``SHA256`` and ``SHA512`` -- SHA-2 family of hashes [#SHS]_, |
55 |
-- ``WHIRLPOOL`` [#WHIRLPOOL]_, |
56 |
-- ``BLAKE2B`` and ``BLAKE2S`` -- BLAKE2 family of hashes [#BLAKE2]_, |
57 |
-- ``SHA3_256`` and ``SHA3_512`` -- SHA-3 family of hashes [#SHA3]_, |
58 |
-- ``STREEBOG256`` and ``STREEBOG512`` -- Streebog family of hashes |
59 |
- [#STREEBOG]_. |
60 |
- |
61 |
-The method of introducing new hashes is defined by GLEP 59 [#GLEP59]_. |
62 |
-It is recommended that any new hashes are named after the Python |
63 |
-``hashlib`` module algorithm names, transformed into uppercase. |
64 |
+Checksum algorithms |
65 |
+------------------- |
66 |
+ |
67 |
+.. table:: Table 1. Defined hash algorithms |
68 |
+ :widths: auto |
69 |
+ :class: table table-bordered table-striped |
70 |
+ |
71 |
+ =============== ======================= ==== ==== =========== |
72 |
+ Name Specification Bits Enc. Notes |
73 |
+ =============== ======================= ==== ==== =========== |
74 |
+ ``BLAKE2B`` RFC 7693 [#RFC7693]_ 512 Hex Recommended |
75 |
+ ``BLAKE2S`` ditto 256 Hex |
76 |
+ ``MD5`` RFC 1321 [#RFC1321]_ 128 Hex Deprecated |
77 |
+ ``RMD160`` RIPEMD-160 [#RMD160]_ 160 Hex Deprecated |
78 |
+ ``SHA1`` FIPS 180-4 [#SHS]_ 160 Hex Deprecated |
79 |
+ ``SHA256`` ditto 256 Hex |
80 |
+ ``SHA512`` ditto 512 Hex Recommended |
81 |
+ ``SHA3_256`` FIPS 202 [#SHA3]_ 256 Hex |
82 |
+ ``SHA3_512`` ditto 512 Hex |
83 |
+ ``STREEBOG256`` RFC 6986 [#RFC6986]_ 256 Hex |
84 |
+ ``STREEBOG512`` ditto 512 Hex |
85 |
+ ``WHIRLPOOL`` Whirlpool [#WHIRLPOOL]_ 512 Hex |
86 |
+ =============== ======================= ==== ==== =========== |
87 |
+ |
88 |
+Any new hashes must be added to this specification prior to being used |
89 |
+in Manifest files. Adding a new hash is considered |
90 |
+a backwards-compatible change to the GLEP. It is recommended that new |
91 |
+hashes are named after the Python ``hashlib`` module algorithm names, |
92 |
+transformed into uppercase, with dashes replaced by underscores. |
93 |
+ |
94 |
+An implementation can implement an arbitrary subset of the listed |
95 |
+hashes. For best interoperability, it should implement at least |
96 |
+recommended hashes. If deprecated hashes are implemented, it is |
97 |
+preferable to disallow their use by default. |
98 |
+ |
99 |
+If an entry specifies multiple hashes using different algorithms, |
100 |
+an implementation may choose to verify an arbitrary subset of them. |
101 |
+However, should any tested hash yield a mismatch, the verification must |
102 |
+fail. |
103 |
+ |
104 |
+If a particular hash is either unsupported or unknown, |
105 |
+the implementation can either ignore it or report a failure. However, |
106 |
+at least one algorithm specified for a particular entry must be |
107 |
+supported for the verification to succeed. |
108 |
|
109 |
|
110 |
Manifest compression |
111 |
@@ -913,23 +939,25 @@ tool working with this Manifest format. |
112 |
Hash algorithms |
113 |
--------------- |
114 |
|
115 |
-While maintaining a consistent supported hash set is important |
116 |
-for interoperability, it is not a good fit for the generic layout |
117 |
-of this GLEP. Furthermore, it would require updating the GLEP |
118 |
-in the future every time the used algorithms change. |
119 |
+Originally, this GLEP did not formally specify the complete set of hash |
120 |
+algorithms. Instead, it only listed (informationally) the names already |
121 |
+used at the time of writing. Since enforcing consistent use of algorithm |
122 |
+names is important for interoperability, this was changed in version |
123 |
+1.3. |
124 |
|
125 |
-Instead, the specification focuses on listing the currently used |
126 |
-algorithm names for interoperability, and sets a recommendation |
127 |
-for consistent naming of algorithms in the future. The Python |
128 |
-``hashlib`` module is used as a reference since it is used |
129 |
-as the provider of hash functions for most of the Python software, |
130 |
-including Portage and PkgCore. |
131 |
+Since the effort needed to update the GLEP is small compared to the time |
132 |
+needed for a new hash algorithm to be well-deployed, the GLEP needs |
133 |
+to be updated prior to adding a new hash method. |
134 |
|
135 |
-The basic rules for changing hash algorithms are defined in GLEP 59 |
136 |
-[#GLEP59]_. The implementations can focus only on those algorithms |
137 |
-that are actually used or planned on being used. It may be feasible |
138 |
-to devise a new GLEP that specifies the currently used hashes (or update |
139 |
-GLEP 59 accordingly). |
140 |
+The recommended naming is based off Python ``hashlib`` module, |
141 |
+as most of the Gentoo tooling is written in Python. The names |
142 |
+are transformed to match the historical naming used for hash functions |
143 |
+in Manifests. |
144 |
+ |
145 |
+Implementations are allowed to support and use only a subset of hashes |
146 |
+listed in Manifest files. This could be used both to avoid the overhead |
147 |
+of computing multiple hashes on non-performant systems, and to handle |
148 |
+transition to new hashes gracefully. |
149 |
|
150 |
|
151 |
Manifest compression |
152 |
@@ -1072,27 +1100,28 @@ References |
153 |
.. [#FILE-NAMING-RULES] Ebuild File Format -- Gentoo Development Guide |
154 |
(https://devmanual.gentoo.org/ebuild-writing/file-format/#file-naming-rules) |
155 |
|
156 |
-.. [#MD5] RFC1321: The MD5 Message-Digest Algorithm |
157 |
- (https://www.ietf.org/rfc/rfc1321.txt) |
158 |
+.. [#RFC7693] RFC 7693: The BLAKE2 Cryptographic Hash and Message Authentication |
159 |
+ Code (MAC) |
160 |
+ (https://www.rfc-editor.org/rfc/rfc7693) |
161 |
+ |
162 |
+.. [#RFC1321] RFC 1321: The MD5 Message-Digest Algorithm |
163 |
+ (https://www.rfc-editor.org/rfc/rfc1321) |
164 |
|
165 |
-.. [#RIPEMD160] The hash function RIPEMD-160 |
166 |
+.. [#RMD160] The hash function RIPEMD-160 |
167 |
(https://homes.esat.kuleuven.be/~bosselae/ripemd160.html) |
168 |
|
169 |
.. [#SHS] FIPS PUB 180-4: Secure Hash Standard (SHS) |
170 |
(http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) |
171 |
|
172 |
-.. [#WHIRLPOOL] The WHIRLPOOL Hash Function |
173 |
- (http://www.larc.usp.br/~pbarreto/WhirlpoolPage.html) |
174 |
- |
175 |
-.. [#BLAKE2] BLAKE2 -- fast secure hashing |
176 |
- (https://blake2.net/) |
177 |
- |
178 |
.. [#SHA3] FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash |
179 |
and Extendable-Output Functions |
180 |
(http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) |
181 |
|
182 |
-.. [#STREEBOG] GOST R 34.11-2012: Streebog Hash Function |
183 |
- (https://www.streebog.net/) |
184 |
+.. [#RFC6986] RFC 6986: GOST R 34.11-2012: Hash Function |
185 |
+ (https://www.rfc-editor.org/rfc/rfc6986) |
186 |
+ |
187 |
+.. [#WHIRLPOOL] The WHIRLPOOL Hash Function (archived at 2017-11-29) |
188 |
+ (https://web.archive.org/web/20171129084214/http://www.larc.usp.br/~pbarreto/WhirlpoolPage.html) |
189 |
|
190 |
.. [#C08] Cappos, J et al. (2008). "Attacks on Package Managers" |
191 |
(https://www2.cs.arizona.edu/stork/packagemanagersecurity/attacks-on-package-managers.html) |
192 |
-- |
193 |
2.37.3 |