Skip to content

Commit 25910fe

Browse files
authored
Added SHA-3 OIDs. (RustCrypto#1000)
1 parent 98957ae commit 25910fe

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

const-oid/oiddbgen/fips202.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Object Identifiers (OID) for SHA-3
2+
----------------------------------
3+
This document lists the OIDs for
4+
- SHA3-224,
5+
- SHA3-256,
6+
- SHA3-384,
7+
- SHA3-512,
8+
- SHAKE128, and
9+
- SHAKE256.
10+
11+
This file was manually created, as there exists no offical document that is easily parsable.
12+
The SHA-3 standard is specified in [FIPS 202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf).
13+
It references [Computer Security Objects Register (CSOR)]
14+
(https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration),
15+
which publishes the following SHA-3 OIDs:
16+
17+
nistAlgorithms OBJECT IDENTIFIER ::= { joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) }
18+
19+
hashAlgs OBJECT IDENTIFIER ::= { nistAlgorithms 2 }
20+
21+
id-sha3-224 OBJECT IDENTIFIER ::= { hashAlgs 7 }
22+
23+
id-sha3-256 OBJECT IDENTIFIER ::= { hashAlgs 8 }
24+
25+
id-sha3-384 OBJECT IDENTIFIER ::= { hashAlgs 9 }
26+
27+
id-sha3-512 OBJECT IDENTIFIER ::= { hashAlgs 10 }
28+
29+
id-shake128 OBJECT IDENTIFIER ::= { hashAlgs 11 }
30+
31+
id-shake256 OBJECT IDENTIFIER ::= { hashAlgs 12 }

const-oid/oiddbgen/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ const RFCS: &[(&str, &str)] = &[
1717
("rfc8410", include_str!("../rfc8410.txt")),
1818
];
1919

20+
// Created from:
21+
// https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration
22+
const FIPS202: &str = include_str!("../fips202.md");
23+
2024
// Bases defined in other places.
2125
const BASES: &[(&str, &str)] = &[("id-ad-ocsp", "1.3.6.1.5.5.7.48.1")];
26+
const NO_BASES: &[(&str, &str)] = &[("","")];
2227

2328
fn main() {
2429
let mut root = Root::default();
@@ -33,5 +38,9 @@ fn main() {
3338
}
3439
}
3540

41+
for (name, obid) in Asn1Parser::new(FIPS202, NO_BASES).iter() {
42+
root.add("fips202", &name, &obid);
43+
}
44+
3645
println!("{}", root.module());
3746
}

const-oid/src/db/gen.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
#![doc = "!! DO NOT EDIT !!: This file is auto-generated by oiddbgen."]
2+
pub mod fips202 {
3+
pub const NIST_ALGORITHMS: crate::ObjectIdentifier =
4+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4");
5+
pub const HASH_ALGS: crate::ObjectIdentifier =
6+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2");
7+
pub const ID_SHA_3_512: crate::ObjectIdentifier =
8+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2.10");
9+
pub const ID_SHAKE_128: crate::ObjectIdentifier =
10+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2.11");
11+
pub const ID_SHAKE_256: crate::ObjectIdentifier =
12+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2.12");
13+
pub const ID_SHA_3_224: crate::ObjectIdentifier =
14+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2.7");
15+
pub const ID_SHA_3_256: crate::ObjectIdentifier =
16+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2.8");
17+
pub const ID_SHA_3_384: crate::ObjectIdentifier =
18+
crate::ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2.9");
19+
}
220
pub mod rfc1274 {
321
pub const TEXT_ENCODED_OR_ADDRESS: crate::ObjectIdentifier =
422
crate::ObjectIdentifier::new_unwrap("0.9.2342.19200300.100.1.2");
@@ -2258,6 +2276,14 @@ pub mod rfc8410 {
22582276
crate::ObjectIdentifier::new_unwrap("1.3.101.113");
22592277
}
22602278
pub const DB: super::Database<'static> = super::Database(&[
2279+
(&fips202::NIST_ALGORITHMS, "nistAlgorithms"),
2280+
(&fips202::HASH_ALGS, "hashAlgs"),
2281+
(&fips202::ID_SHA_3_512, "id-sha3-512"),
2282+
(&fips202::ID_SHAKE_128, "id-shake128"),
2283+
(&fips202::ID_SHAKE_256, "id-shake256"),
2284+
(&fips202::ID_SHA_3_224, "id-sha3-224"),
2285+
(&fips202::ID_SHA_3_256, "id-sha3-256"),
2286+
(&fips202::ID_SHA_3_384, "id-sha3-384"),
22612287
(&rfc1274::TEXT_ENCODED_OR_ADDRESS, "textEncodedORAddress"),
22622288
(&rfc1274::OTHER_MAILBOX, "otherMailbox"),
22632289
(&rfc1274::LAST_MODIFIED_TIME, "lastModifiedTime"),

0 commit comments

Comments
 (0)