Skip to content

Commit ca6c6eb

Browse files
committed
slh-dsa: bump zerocopy to v0.8
The `AsBytes` trait is gone, and now found on the `IntoBytes` trait. It needs a new `Immutable` marker trait which says: > Types which are free from interior mutability. ...so it seems safe to add to the types that previously used `AsBytes` which are simple data structs.
1 parent 78b0133 commit ca6c6eb

File tree

3 files changed

+15
-40
lines changed

3 files changed

+15
-40
lines changed

Cargo.lock

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

slh-dsa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exclude = ["tests"]
1919
hybrid-array = { version = "0.4", features = ["extra-sizes"] }
2020
typenum = { version = "1.17", features = ["const-generics"] }
2121
sha3 = { version = "0.11.0-rc.0", default-features = false }
22-
zerocopy = { version = "0.7", features = ["derive"] }
22+
zerocopy = { version = "0.8", features = ["derive"] }
2323
rand_core = { version = "0.9" }
2424
signature = { version = "3.0.0-rc.4", features = ["rand_core"] }
2525
hmac = "0.13.0-rc.1"

slh-dsa/src/address.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
use hybrid_array::Array;
1919
use typenum::U22;
2020

21-
use zerocopy::AsBytes;
22-
use zerocopy::byteorder::big_endian::{U32, U64};
21+
use zerocopy::{
22+
Immutable, IntoBytes,
23+
byteorder::big_endian::{U32, U64},
24+
};
2325

2426
/// `Address` represents a hash address as defined by FIPS-205 section 4.2
2527
pub trait Address: AsRef<[u8]> {
@@ -39,7 +41,7 @@ pub trait Address: AsRef<[u8]> {
3941
}
4042
}
4143

42-
#[derive(Clone, AsBytes)]
44+
#[derive(Clone, IntoBytes, Immutable)]
4345
#[repr(C)]
4446
pub struct WotsHash {
4547
pub layer_adrs: U32,
@@ -51,7 +53,7 @@ pub struct WotsHash {
5153
pub hash_adrs: U32,
5254
}
5355

54-
#[derive(Clone, AsBytes)]
56+
#[derive(Clone, IntoBytes, Immutable)]
5557
#[repr(C)]
5658
pub struct WotsPk {
5759
pub layer_adrs: U32,
@@ -62,7 +64,7 @@ pub struct WotsPk {
6264
padding: U64, // 0
6365
}
6466

65-
#[derive(Clone, AsBytes)]
67+
#[derive(Clone, IntoBytes, Immutable)]
6668
#[repr(C)]
6769
pub struct HashTree {
6870
pub layer_adrs: U32,
@@ -74,7 +76,7 @@ pub struct HashTree {
7476
pub tree_index: U32,
7577
}
7678

77-
#[derive(Clone, AsBytes)]
79+
#[derive(Clone, IntoBytes, Immutable)]
7880
#[repr(C)]
7981
pub struct ForsTree {
8082
layer_adrs: U32, // 0
@@ -86,7 +88,7 @@ pub struct ForsTree {
8688
pub tree_index: U32,
8789
}
8890

89-
#[derive(Clone, AsBytes)]
91+
#[derive(Clone, IntoBytes, Immutable)]
9092
#[repr(C)]
9193
pub struct ForsRoots {
9294
layer_adrs: U32, // 0
@@ -97,7 +99,7 @@ pub struct ForsRoots {
9799
padding: U64, // 0
98100
}
99101

100-
#[derive(Clone, AsBytes)]
102+
#[derive(Clone, IntoBytes, Immutable)]
101103
#[repr(C)]
102104
pub struct WotsPrf {
103105
pub layer_adrs: U32,
@@ -109,7 +111,7 @@ pub struct WotsPrf {
109111
hash_adrs: U32, // 0
110112
}
111113

112-
#[derive(Clone, AsBytes)]
114+
#[derive(Clone, IntoBytes, Immutable)]
113115
#[repr(C)]
114116
pub struct ForsPrf {
115117
layer_adrs: U32, // 0

0 commit comments

Comments
 (0)