5 Commits

Author SHA1 Message Date
dc596d7601 Merge pull request #37 from acw/warning-clean
Clean some warnings and add some basic CI.
2025-01-12 13:47:19 -08:00
05507c2199 Add some CI. 2025-01-12 13:43:06 -08:00
6043fc6d6a Clean up some new warnings re parentheses. 2025-01-12 13:41:37 -08:00
a453128181 Merge pull request #36 from muturgan/master
bump a thiserror version
2025-01-12 13:39:20 -08:00
Сахаров Андрей Александрович
d7b31d67d3 bump a thiserror version 2025-01-11 16:53:28 +03:00
3 changed files with 44 additions and 11 deletions

33
.github/workflows/rust.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Rust
on:
push:
branches: [ "develop", "ci" ]
pull_request:
branches: [ "develop" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
default: true
override: true
- name: Format Check
run: cargo fmt --check
- name: Build
run: cargo build
- name: Run tests
run: cargo test

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "simple_asn1" name = "simple_asn1"
version = "0.6.2" version = "0.6.3"
authors = ["Adam Wick <awick@uhsure.com>"] authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library." description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"] categories = ["encoding"]
@@ -12,7 +12,7 @@ edition = "2018"
[dependencies] [dependencies]
num-bigint = { default-features = false, version = "0.4" } num-bigint = { default-features = false, version = "0.4" }
num-traits = { default-features = false, version = "0.2" } num-traits = { default-features = false, version = "0.2" }
thiserror = { default-features = false, version = "1" } thiserror = { default-features = false, version = "2" }
time = { default-features = false, version = "0.3", features = ["formatting", "macros", "parsing"] } time = { default-features = false, version = "0.3", features = ["formatting", "macros", "parsing"] }
[dev-dependencies] [dev-dependencies]

View File

@@ -152,34 +152,34 @@ impl ASN1Block {
impl PartialEq for ASN1Block { impl PartialEq for ASN1Block {
fn eq(&self, other: &ASN1Block) -> bool { fn eq(&self, other: &ASN1Block) -> bool {
match (self, other) { match (self, other) {
(&ASN1Block::Boolean(_, a1), &ASN1Block::Boolean(_, a2)) => (a1 == a2), (&ASN1Block::Boolean(_, a1), &ASN1Block::Boolean(_, a2)) => a1 == a2,
(&ASN1Block::Integer(_, ref a1), &ASN1Block::Integer(_, ref a2)) => (a1 == a2), (&ASN1Block::Integer(_, ref a1), &ASN1Block::Integer(_, ref a2)) => a1 == a2,
(&ASN1Block::BitString(_, a1, ref b1), &ASN1Block::BitString(_, a2, ref b2)) => { (&ASN1Block::BitString(_, a1, ref b1), &ASN1Block::BitString(_, a2, ref b2)) => {
(a1 == a2) && (b1 == b2) (a1 == a2) && (b1 == b2)
} }
(&ASN1Block::OctetString(_, ref a1), &ASN1Block::OctetString(_, ref a2)) => (a1 == a2), (&ASN1Block::OctetString(_, ref a1), &ASN1Block::OctetString(_, ref a2)) => a1 == a2,
(&ASN1Block::Null(_), &ASN1Block::Null(_)) => true, (&ASN1Block::Null(_), &ASN1Block::Null(_)) => true,
(&ASN1Block::ObjectIdentifier(_, ref a1), &ASN1Block::ObjectIdentifier(_, ref a2)) => { (&ASN1Block::ObjectIdentifier(_, ref a1), &ASN1Block::ObjectIdentifier(_, ref a2)) => {
a1 == a2 a1 == a2
} }
(&ASN1Block::UTF8String(_, ref a1), &ASN1Block::UTF8String(_, ref a2)) => (a1 == a2), (&ASN1Block::UTF8String(_, ref a1), &ASN1Block::UTF8String(_, ref a2)) => a1 == a2,
(&ASN1Block::PrintableString(_, ref a1), &ASN1Block::PrintableString(_, ref a2)) => { (&ASN1Block::PrintableString(_, ref a1), &ASN1Block::PrintableString(_, ref a2)) => {
a1 == a2 a1 == a2
} }
(&ASN1Block::TeletexString(_, ref a1), &ASN1Block::TeletexString(_, ref a2)) => { (&ASN1Block::TeletexString(_, ref a1), &ASN1Block::TeletexString(_, ref a2)) => {
a1 == a2 a1 == a2
} }
(&ASN1Block::IA5String(_, ref a1), &ASN1Block::IA5String(_, ref a2)) => (a1 == a2), (&ASN1Block::IA5String(_, ref a1), &ASN1Block::IA5String(_, ref a2)) => a1 == a2,
(&ASN1Block::UTCTime(_, ref a1), &ASN1Block::UTCTime(_, ref a2)) => (a1 == a2), (&ASN1Block::UTCTime(_, ref a1), &ASN1Block::UTCTime(_, ref a2)) => a1 == a2,
(&ASN1Block::GeneralizedTime(_, ref a1), &ASN1Block::GeneralizedTime(_, ref a2)) => { (&ASN1Block::GeneralizedTime(_, ref a1), &ASN1Block::GeneralizedTime(_, ref a2)) => {
a1 == a2 a1 == a2
} }
(&ASN1Block::UniversalString(_, ref a1), &ASN1Block::UniversalString(_, ref a2)) => { (&ASN1Block::UniversalString(_, ref a1), &ASN1Block::UniversalString(_, ref a2)) => {
a1 == a2 a1 == a2
} }
(&ASN1Block::BMPString(_, ref a1), &ASN1Block::BMPString(_, ref a2)) => (a1 == a2), (&ASN1Block::BMPString(_, ref a1), &ASN1Block::BMPString(_, ref a2)) => a1 == a2,
(&ASN1Block::Sequence(_, ref a1), &ASN1Block::Sequence(_, ref a2)) => (a1 == a2), (&ASN1Block::Sequence(_, ref a1), &ASN1Block::Sequence(_, ref a2)) => a1 == a2,
(&ASN1Block::Set(_, ref a1), &ASN1Block::Set(_, ref a2)) => (a1 == a2), (&ASN1Block::Set(_, ref a1), &ASN1Block::Set(_, ref a2)) => a1 == a2,
( (
&ASN1Block::Explicit(a1, _, ref b1, ref c1), &ASN1Block::Explicit(a1, _, ref b1, ref c1),
&ASN1Block::Explicit(a2, _, ref b2, ref c2), &ASN1Block::Explicit(a2, _, ref b2, ref c2),