Skip to content

Commit c6acc9b

Browse files
committed
cbor, cose: support null and bool; fix cose detached null payload
1 parent 2a77ec1 commit c6acc9b

File tree

6 files changed

+332
-43
lines changed

6 files changed

+332
-43
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This repository is parameter selection and lightweight wrapper around a number o
2525
- **Argon2 ([RFC-9106](https://datatracker.ietf.org/doc/html/rfc9106))**: `id` variant
2626
- **HKDF ([RFC-5869](https://datatracker.ietf.org/doc/html/rfc5869))**: `SHA256`
2727
- Serialization
28-
- **CBOR ([RFC-8949](https://datatracker.ietf.org/doc/html/rfc8949))**: restricted to `integer`, `text`, `bytes`, `array`, `map[int]`
28+
- **CBOR ([RFC-8949](https://datatracker.ietf.org/doc/html/rfc8949))**: restricted to `bool`,`null`, `integer`, `text`, `bytes`, `array`, `map[int]`, `option`
2929
- **COSE ([RFC-8152](https://datatracker.ietf.org/doc/html/rfc8152))**: `COSE_Sign1`, `COSE_Encrypt0`, `dark-bio-v1:` domain prefix
3030

3131
All functionality is WASM ready.

fuzz/Cargo.lock

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

fuzz/fuzz_targets/cbor.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#![no_main]
88

9-
use darkbio_crypto::cbor::{decode, encode, Cbor, Raw};
9+
use darkbio_crypto::cbor::{decode, encode, Cbor, Null, Raw};
1010
use libfuzzer_sys::fuzz_target;
1111

1212
#[derive(Debug, PartialEq, Cbor)]
@@ -55,30 +55,46 @@ macro_rules! roundtrip {
5555
fuzz_target!(|data: &[u8]| {
5656
roundtrip!(
5757
data,
58+
bool,
5859
String,
5960
u64,
6061
i64,
6162
Vec<u8>,
63+
Null,
64+
Option<u64>,
65+
Option<i64>,
66+
Option<String>,
67+
Option<Vec<u8>>,
68+
Option<bool>,
6269
(),
6370
(String,),
6471
(u64,),
6572
(i64,),
73+
(bool,),
6674
(String, u64),
6775
(String, i64),
76+
(String, bool),
6877
(u64, String),
6978
(i64, String),
79+
(bool, String),
7080
(String, String),
7181
(u64, i64),
7282
(i64, u64),
83+
(bool, u64),
84+
(u64, bool),
7385
[u8; 1],
7486
[u8; 2],
7587
[u8; 4],
7688
[u8; 8],
7789
((u64, [u8; 4]), (String, u64)),
7890
((i64, [u8; 4]), (String, i64)),
91+
((bool, [u8; 4]), (String, bool)),
7992
Raw,
8093
(String, Raw),
8194
(Raw, u64),
95+
(Raw, bool),
96+
(Option<String>, u64),
97+
(u64, Option<String>),
8298
MapSimple,
8399
MapNested,
84100
ArraySimple,

0 commit comments

Comments
 (0)