Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/der.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ jobs:
override: true
- run: cargo build --target ${{ matrix.target }} --release
- run: cargo build --target ${{ matrix.target }} --release --features alloc
- run: cargo build --target ${{ matrix.target }} --release --features bigint
- run: cargo build --target ${{ matrix.target }} --release --features derive
- run: cargo build --target ${{ matrix.target }} --release --features oid
- run: cargo build --target ${{ matrix.target }} --release --features pem
- run: cargo build --target ${{ matrix.target }} --release --features time
- run: cargo build --target ${{ matrix.target }} --release --features alloc,bigint,derive,oid,pem,time
- run: cargo build --target ${{ matrix.target }} --release --features alloc,derive,oid,pem,time

test:
strategy:
Expand Down Expand Up @@ -85,7 +84,6 @@ jobs:
override: true
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }} --release
- run: cargo test --target ${{ matrix.target }} --release --features bigint
- run: cargo test --target ${{ matrix.target }} --release --features oid
- run: cargo test --target ${{ matrix.target }} --release --features pem
- run: cargo test --target ${{ matrix.target }} --release --all-features
Expand Down
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ members = [
"tls_codec/derive",
"x509"
]

[patch.crates-io]
crypto-bigint = { git = "https://github.com/RustCrypto/crypto-bigint.git" }
2 changes: 0 additions & 2 deletions der/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ rust-version = "1.57"

[dependencies]
const-oid = { version = "0.8", optional = true, path = "../const-oid" }
crypto-bigint = { version = "=0.4.0-pre", optional = true, default-features = false, features = ["generic-array"] }
der_derive = { version = "0.5", optional = true, path = "derive" }
pem-rfc7468 = { version = "0.3", optional = true, path = "../pem-rfc7468" }
time = { version = "0.3", optional = true, default-features = false }
Expand All @@ -29,7 +28,6 @@ proptest = "1"
[features]
alloc = []
derive = ["der_derive"]
bigint = ["crypto-bigint"]
oid = ["const-oid"]
pem = ["alloc", "pem-rfc7468/alloc"]
std = ["alloc"]
Expand Down
59 changes: 0 additions & 59 deletions der/src/asn1/integer/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ use crate::{
Length, Result, Tag,
};

#[cfg(feature = "bigint")]
use crypto_bigint::{generic_array::GenericArray, ArrayEncoding, UInt};

/// "Big" unsigned ASN.1 `INTEGER` type.
///
/// Provides direct access to the underlying big endian bytes which comprise an
Expand Down Expand Up @@ -95,62 +92,6 @@ impl<'a> FixedTag for UIntBytes<'a> {
const TAG: Tag = Tag::Integer;
}

#[cfg(feature = "bigint")]
#[cfg_attr(docsrs, doc(cfg(feature = "bigint")))]
impl<'a, const LIMBS: usize> TryFrom<Any<'a>> for UInt<LIMBS>
where
UInt<LIMBS>: ArrayEncoding,
{
type Error = Error;

fn try_from(any: Any<'a>) -> Result<UInt<LIMBS>> {
UIntBytes::try_from(any)?.try_into()
}
}

#[cfg(feature = "bigint")]
#[cfg_attr(docsrs, doc(cfg(feature = "bigint")))]
impl<'a, const LIMBS: usize> TryFrom<UIntBytes<'a>> for UInt<LIMBS>
where
UInt<LIMBS>: ArrayEncoding,
{
type Error = Error;

fn try_from(bytes: UIntBytes<'a>) -> Result<UInt<LIMBS>> {
let mut array = GenericArray::default();
let offset = array.len().saturating_sub(bytes.len().try_into()?);
array[offset..].copy_from_slice(bytes.as_bytes());
Ok(UInt::from_be_byte_array(array))
}
}

#[cfg(feature = "bigint")]
#[cfg_attr(docsrs, doc(cfg(feature = "bigint")))]
impl<const LIMBS: usize> EncodeValue for UInt<LIMBS>
where
UInt<LIMBS>: ArrayEncoding,
{
fn value_len(&self) -> Result<Length> {
// TODO(tarcieri): more efficient length calculation
let array = self.to_be_byte_array();
UIntBytes::new(&array)?.value_len()
}

fn encode_value(&self, encoder: &mut Encoder<'_>) -> Result<()> {
let array = self.to_be_byte_array();
UIntBytes::new(&array)?.encode_value(encoder)
}
}

#[cfg(feature = "bigint")]
#[cfg_attr(docsrs, doc(cfg(feature = "bigint")))]
impl<const LIMBS: usize> FixedTag for UInt<LIMBS>
where
UInt<LIMBS>: ArrayEncoding,
{
const TAG: Tag = Tag::Integer;
}

#[cfg(test)]
mod tests {
use super::UIntBytes;
Expand Down
2 changes: 1 addition & 1 deletion pkcs1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ edition = "2021"
rust-version = "1.57"

[dependencies]
der = { version = "=0.6.0-pre", features = ["bigint", "oid"], path = "../der" }
der = { version = "=0.6.0-pre", features = ["oid"], path = "../der" }

# optional dependencies
pkcs8 = { version = "=0.9.0-pre", optional = true, default-features = false, path = "../pkcs8" }
Expand Down