Skip to content

Commit 1731ced

Browse files
authored
Add OID support (#405)
1 parent cc52373 commit 1731ced

File tree

18 files changed

+226
-37
lines changed

18 files changed

+226
-37
lines changed

.github/workflows/sha1.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
set-msrv:
2222
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
2323
with:
24-
msrv: 1.41.0
24+
# Crate supports MSRV 1.41 without `oid` feature. We test true MSRV
25+
# in the `test-msrv` job.
26+
msrv: 1.57.0
2527

2628
# Builds for no_std platforms
2729
build:
@@ -171,3 +173,17 @@ jobs:
171173
package: ${{ github.workflow }}
172174
target: ${{ matrix.target }}
173175
features: ${{ matrix.features }}
176+
177+
# TODO: remove on MSRV bump to 1.57 or higher
178+
test-msrv:
179+
runs-on: ubuntu-latest
180+
steps:
181+
- uses: actions/checkout@v2
182+
- uses: RustCrypto/actions/cargo-cache@master
183+
- uses: actions-rs/toolchain@v1
184+
with:
185+
profile: minimal
186+
toolchain: 1.41.0
187+
override: true
188+
- run: cargo test --no-default-features
189+
- run: cargo test

.github/workflows/sha2.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
set-msrv:
2222
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
2323
with:
24-
msrv: 1.41.0
24+
# Crate supports MSRV 1.41 without `oid` feature. We test true MSRV
25+
# in the `test-msrv` job.
26+
msrv: 1.57.0
2527

2628
# Builds for no_std platforms
2729
build:
@@ -166,3 +168,17 @@ jobs:
166168
package: ${{ github.workflow }}
167169
target: ${{ matrix.target }}
168170
features: ${{ matrix.features }}
171+
172+
# TODO: remove on MSRV bump to 1.57 or higher
173+
test-msrv:
174+
runs-on: ubuntu-latest
175+
steps:
176+
- uses: actions/checkout@v2
177+
- uses: RustCrypto/actions/cargo-cache@master
178+
- uses: actions-rs/toolchain@v1
179+
with:
180+
profile: minimal
181+
toolchain: 1.41.0
182+
override: true
183+
- run: cargo test --no-default-features
184+
- run: cargo test

.github/workflows/sha3.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
set-msrv:
2222
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
2323
with:
24-
msrv: 1.41.0
24+
# Crate supports MSRV 1.41 without `oid` feature. We test true MSRV
25+
# in the `test-msrv` job.
26+
msrv: 1.57.0
2527

2628
build:
2729
needs: set-msrv
@@ -97,3 +99,17 @@ jobs:
9799
package: ${{ github.workflow }}
98100
target: ${{ matrix.target }}
99101
features: ${{ matrix.features }}
102+
103+
# TODO: remove on MSRV bump to 1.57 or higher
104+
test-msrv:
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v2
108+
- uses: RustCrypto/actions/cargo-cache@master
109+
- uses: actions-rs/toolchain@v1
110+
with:
111+
profile: minimal
112+
toolchain: 1.41.0
113+
override: true
114+
- run: cargo test --no-default-features
115+
- run: cargo test

.github/workflows/streebog.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
strategy:
5050
matrix:
5151
rust:
52-
- 1.41.0 # MSRV
52+
#- 1.41.0 # MSRV
5353
- stable
5454
steps:
5555
- uses: actions/checkout@v2
@@ -63,3 +63,17 @@ jobs:
6363
- run: cargo test --no-default-features
6464
- run: cargo test
6565
- run: cargo test --all-features
66+
67+
# `oid` feature bumps MSRV to 1.57, so we temporarily split this job.
68+
test-msrv:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v2
72+
- uses: RustCrypto/actions/cargo-cache@master
73+
- uses: actions-rs/toolchain@v1
74+
with:
75+
profile: minimal
76+
toolchain: 1.41.0
77+
override: true
78+
- run: cargo test --no-default-features
79+
- run: cargo test

Cargo.lock

Lines changed: 15 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sha1/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.10.5 (2022-09-16)
9+
### Added
10+
- Feature-gated OID support ([#405])
11+
12+
[#405]: https://github.com/RustCrypto/hashes/pull/405
13+
814
## 0.10.4 (2022-09-02)
915
### Fixed
1016
- MSRV issue which was not resolved by v0.10.3 ([#401])

sha1/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sha1"
3-
version = "0.10.4"
3+
version = "0.10.5"
44
description = "SHA-1 hash function"
55
authors = ["RustCrypto Developers"]
66
license = "MIT OR Apache-2.0"
@@ -12,20 +12,21 @@ keywords = ["crypto", "sha1", "hash", "digest"]
1212
categories = ["cryptography", "no-std"]
1313

1414
[dependencies]
15-
digest = "0.10.3"
15+
digest = "0.10.4"
1616
cfg-if = "1.0"
1717

1818
[target.'cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))'.dependencies]
1919
cpufeatures = "0.2"
2020
sha1-asm = { version = "0.5", optional = true }
2121

2222
[dev-dependencies]
23-
digest = { version = "0.10.3", features = ["dev"] }
23+
digest = { version = "0.10.4", features = ["dev"] }
2424
hex-literal = "0.2.2"
2525

2626
[features]
2727
default = ["std"]
2828
std = ["digest/std"]
29+
oid = ["digest/oid"] # Enable OID support. WARNING: Bumps MSRV to 1.57
2930
asm = ["sha1-asm"] # WARNING: this feature SHOULD NOT be enabled by library crates
3031
compress = [] # Expose compress function
3132
force-soft = [] # Force software implementation

sha1/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
pub use digest::{self, Digest};
5252

5353
use core::{fmt, slice::from_ref};
54+
#[cfg(feature = "oid")]
55+
use digest::const_oid::{AssociatedOid, ObjectIdentifier};
5456
use digest::{
5557
block_buffer::Eager,
5658
core_api::{
@@ -142,5 +144,11 @@ impl fmt::Debug for Sha1Core {
142144
}
143145
}
144146

147+
#[cfg(feature = "oid")]
148+
#[cfg_attr(docsrs, doc(cfg(feature = "oid")))]
149+
impl AssociatedOid for Sha1Core {
150+
const OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.3.14.3.2.26");
151+
}
152+
145153
/// SHA-1 hasher state.
146154
pub type Sha1 = CoreWrapper<Sha1Core>;

sha2/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.10.6 (2022-09-16)
9+
### Added
10+
- Feature-gated OID support ([#405])
11+
12+
[#405]: https://github.com/RustCrypto/hashes/pull/405
13+
814
## 0.10.5 (2022-09-02)
915
### Fixed
1016
- MSRV issue which was not resolved by v0.10.4 ([#401])

sha2/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sha2"
3-
version = "0.10.5"
3+
version = "0.10.6"
44
description = """
55
Pure Rust implementation of the SHA-2 hash function family
66
including SHA-224, SHA-256, SHA-384, and SHA-512.
@@ -15,20 +15,21 @@ keywords = ["crypto", "sha2", "hash", "digest"]
1515
categories = ["cryptography", "no-std"]
1616

1717
[dependencies]
18-
digest = "0.10.3"
18+
digest = "0.10.4"
1919
cfg-if = "1.0"
2020

2121
[target.'cfg(any(target_arch = "aarch64", target_arch = "x86_64", target_arch = "x86"))'.dependencies]
2222
cpufeatures = "0.2"
2323
sha2-asm = { version = "0.6.1", optional = true }
2424

2525
[dev-dependencies]
26-
digest = { version = "0.10.3", features = ["dev"] }
26+
digest = { version = "0.10.4", features = ["dev"] }
2727
hex-literal = "0.2.2"
2828

2929
[features]
3030
default = ["std"]
3131
std = ["digest/std"]
32+
oid = ["digest/oid"] # Enable OID support. WARNING: Bumps MSRV to 1.57
3233
asm = ["sha2-asm"] # WARNING: this feature SHOULD NOT be enabled by library crates
3334
compress = [] # Expose compress functions
3435
force-soft = [] # Force software implementation

0 commit comments

Comments
 (0)