Merge pull request #76 from ivmarkov/main
cargo fmt and clippy; build and test most features; publish actions
This commit is contained in:
commit
2b00a886a7
19 changed files with 200 additions and 77 deletions
25
.github/workflows/build-tlv-tool.yml
vendored
25
.github/workflows/build-tlv-tool.yml
vendored
|
@ -1,25 +0,0 @@
|
||||||
name: Build-TLV-Tool
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build
|
|
||||||
run: cd tools/tlv; cargo build
|
|
||||||
- name: Archive artifacts
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: tlv
|
|
||||||
path: tools/tlv/target/debug/tlv
|
|
39
.github/workflows/ci-tlv-tool.yml
vendored
Normal file
39
.github/workflows/ci-tlv-tool.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
name: CITLVTool
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
schedule:
|
||||||
|
- cron: "20 7 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_tlv_tool:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Fmt
|
||||||
|
run: cargo fmt -- --check
|
||||||
|
working-directory: tools/tlv
|
||||||
|
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo clippy --no-deps -- -Dwarnings
|
||||||
|
working-directory: tools/tlv
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build
|
||||||
|
working-directory: tools/tlv
|
||||||
|
|
||||||
|
- name: Archive artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: tlv
|
||||||
|
path: tools/tlv/target/debug/tlv
|
48
.github/workflows/ci.yml
vendored
Normal file
48
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
schedule:
|
||||||
|
- cron: "50 6 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUST_TOOLCHAIN: nightly-2023-07-01
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_and_test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
crypto-backend: ['rustcrypto', 'mbedtls', 'openssl']
|
||||||
|
features: ['', 'alloc', 'os']
|
||||||
|
toolchain: ['stable', 'nightly']
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Rust
|
||||||
|
if: matrix.toolchain == 'nightly'
|
||||||
|
uses: dtolnay/rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
||||||
|
components: rustfmt, clippy, rust-src
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Fmt
|
||||||
|
run: cargo +${{ matrix.toolchain == 'nightly' && env.RUST_TOOLCHAIN || 'stable'}} fmt -- --check
|
||||||
|
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo +${{ matrix.toolchain == 'nightly' && env.RUST_TOOLCHAIN || 'stable'}} clippy --no-deps --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},${{ matrix.toolchain == 'nightly' && 'nightly' || ''}} -- -Dwarnings
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo +${{ matrix.toolchain == 'nightly' && env.RUST_TOOLCHAIN || 'stable'}} build --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},${{ matrix.toolchain == 'nightly' && 'nightly' || ''}}
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
if: matrix.features == 'os'
|
||||||
|
run: cargo +${{ matrix.toolchain == 'nightly' && env.RUST_TOOLCHAIN || 'stable'}} test --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},${{ matrix.toolchain == 'nightly' && 'nightly' || ''}} -- --test-threads=1
|
17
.github/workflows/publish-dry-run.yml
vendored
Normal file
17
.github/workflows/publish-dry-run.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: PublishDryRun
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
env:
|
||||||
|
CRATE_NAME: rs-matter
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish_dry_run:
|
||||||
|
name: PublishDryRun
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: PublishDryRun
|
||||||
|
run: cargo publish -p rs-matter --dry-run
|
14
.github/workflows/publish-macros-dry-run.yml
vendored
Normal file
14
.github/workflows/publish-macros-dry-run.yml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
name: PublishMacrosDryRun
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish_macros_dry_run:
|
||||||
|
name: PublishMacrosDryRun
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: PublishDryRun-Macros
|
||||||
|
run: cargo publish -p rs-matter-macros --dry-run
|
17
.github/workflows/publish-macros.yml
vendored
Normal file
17
.github/workflows/publish-macros.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: PublishMacros
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish_macros:
|
||||||
|
name: PublishMacros
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Login
|
||||||
|
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
|
||||||
|
|
||||||
|
- name: Publish-Macros
|
||||||
|
run: cargo publish -p rs-matter-macros
|
32
.github/workflows/publish.yml
vendored
Normal file
32
.github/workflows/publish.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
name: Publish
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
env:
|
||||||
|
CRATE_NAME: rs-matter
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Login
|
||||||
|
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
|
||||||
|
|
||||||
|
- name: Publish
|
||||||
|
run: cargo publish -p rs-matter
|
||||||
|
|
||||||
|
- name: Get the crate version from cargo
|
||||||
|
run: |
|
||||||
|
version=$(cd rs-matter; cargo metadata --format-version=1 --no-deps | jq -r ".packages[] | select(.name == \"${{env.CRATE_NAME}}\") | .version")
|
||||||
|
echo "crate_version=$version" >> $GITHUB_ENV
|
||||||
|
echo "${{env.CRATE_NAME}} version: $version"
|
||||||
|
|
||||||
|
- name: Tag the new release
|
||||||
|
uses: rickstaa/action-create-tag@v1
|
||||||
|
with:
|
||||||
|
tag: v${{env.crate_version}}
|
||||||
|
message: "Release v${{env.crate_version}}"
|
25
.github/workflows/test-linux.yml
vendored
25
.github/workflows/test-linux.yml
vendored
|
@ -1,25 +0,0 @@
|
||||||
name: Test-Linux
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_and_test:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
crypto-backend: ['rustcrypto', 'mbedtls', 'openssl']
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build
|
|
||||||
run: cd rs-matter; cargo build --no-default-features --features ${{matrix.crypto-backend}}
|
|
||||||
- name: Run tests
|
|
||||||
run: cd rs-matter; cargo test --no-default-features --features os,${{matrix.crypto-backend}} -- --test-threads=1
|
|
10
README.md
10
README.md
|
@ -1,9 +1,11 @@
|
||||||
# rs-matter: The Rust Implementation of Matter
|
# rs-matter: The Rust Implementation of Matter
|
||||||
|
|
||||||
 [](https://raw.githubusercontent.com/project-chip/matter-rs/main/LICENSE)
|

|
||||||
|
[](https://raw.githubusercontent.com/project-chip/matter-rs/main/LICENSE)
|
||||||
[](https://github.com/project-chip/matter-rs/actions/workflows/test-linux-openssl.yml)
|
[](https://github.com/project-chip/matter-rs/actions/workflows/ci.yml)
|
||||||
[](https://github.com/project-chip/matter-rs/actions/workflows/test-linux-mbedtls.yml)
|
[](https://github.com/project-chip/matter-rs/actions/workflows/ci-tlv-tool.yml)
|
||||||
|
[](https://crates.io/crates/rs-matter)
|
||||||
|
[](https://matrix.to/#/#matter-rs:matrix.org)
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ fn run() -> Result<(), Error> {
|
||||||
let mut mdns_runner = pin!(mdns.run(&stack, &mut mdns_buffers));
|
let mut mdns_runner = pin!(mdns.run(&stack, &mut mdns_buffers));
|
||||||
|
|
||||||
let mut buffers = RunBuffers::new();
|
let mut buffers = RunBuffers::new();
|
||||||
let mut runner = matter.run(
|
let runner = matter.run(
|
||||||
&stack,
|
&stack,
|
||||||
&mut buffers,
|
&mut buffers,
|
||||||
CommissioningData {
|
CommissioningData {
|
||||||
|
@ -157,10 +157,10 @@ fn run() -> Result<(), Error> {
|
||||||
#[cfg(not(all(feature = "std", not(target_os = "espidf"))))]
|
#[cfg(not(all(feature = "std", not(target_os = "espidf"))))]
|
||||||
let mut psm_runner = pin!(core::future::pending());
|
let mut psm_runner = pin!(core::future::pending());
|
||||||
|
|
||||||
let mut runner = select3(&mut runner, &mut mdns_runner, &mut psm_runner);
|
let runner = select3(&mut runner, &mut mdns_runner, &mut psm_runner);
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
async_io::block_on(&mut runner).unwrap()?;
|
async_io::block_on(runner).unwrap()?;
|
||||||
|
|
||||||
// NOTE (no_std): For no_std, replace with your own more efficient no_std executor,
|
// NOTE (no_std): For no_std, replace with your own more efficient no_std executor,
|
||||||
// because the executor used below is a simple busy-loop poller
|
// because the executor used below is a simple busy-loop poller
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
name = "rs-matter-macros"
|
name = "rs-matter-macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
authors = ["Kedar Sovani <kedars@gmail.com>"]
|
||||||
|
description = "Native Rust implementation of the Matter (Smart-Home) ecosystem - Proc-macros"
|
||||||
|
repository = "https://github.com/project-chip/matter-rs"
|
||||||
|
readme = "README.md"
|
||||||
|
keywords = ["matter", "smart", "smart-home", "IoT", "ESP32"]
|
||||||
|
categories = ["embedded", "network-programming"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# rs-matter-macros
|
# rs-matter-macros: The Rust Implementation of Matter Library - Proc-macros
|
||||||
|
|
||||||
Proc-macros for implementing the `ToTLV` and `FromTLV` traits.
|
Proc-macros for implementing the `ToTLV` and `FromTLV` traits.
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,13 @@ name = "rs-matter"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Kedar Sovani <kedars@gmail.com>"]
|
authors = ["Kedar Sovani <kedars@gmail.com>"]
|
||||||
description = "Native RUST implementation of the Matter (Smart-Home) ecosystem"
|
description = "Native Rust implementation of the Matter (Smart-Home) ecosystem"
|
||||||
repository = "https://github.com/kedars/matter-rs"
|
repository = "https://github.com/project-chip/matter-rs"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["matter", "smart", "smart-home", "IoT", "ESP32"]
|
keywords = ["matter", "smart", "smart-home", "IoT", "ESP32"]
|
||||||
categories = ["embedded", "network-programming"]
|
categories = ["embedded", "network-programming"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "rs_matter"
|
|
||||||
path = "src/lib.rs"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["os", "mbedtls"]
|
default = ["os", "mbedtls"]
|
||||||
os = ["std", "backtrace", "env_logger", "nix", "critical-section/std", "embassy-sync/std", "embassy-time/std"]
|
os = ["std", "backtrace", "env_logger", "nix", "critical-section/std", "embassy-sync/std", "embassy-time/std"]
|
||||||
|
@ -28,7 +24,7 @@ rustcrypto = ["alloc", "sha2", "hmac", "pbkdf2", "hkdf", "aes", "ccm", "p256", "
|
||||||
embassy-net = ["dep:embassy-net", "dep:embassy-net-driver", "smoltcp"]
|
embassy-net = ["dep:embassy-net", "dep:embassy-net-driver", "smoltcp"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rs-matter-macros = { path = "../rs-matter-macros" }
|
rs-matter-macros = { version = "0.1", path = "../rs-matter-macros" }
|
||||||
bitflags = { version = "1.3", default-features = false }
|
bitflags = { version = "1.3", default-features = false }
|
||||||
byteorder = { version = "1.4.3", default-features = false }
|
byteorder = { version = "1.4.3", default-features = false }
|
||||||
heapless = "0.7.16"
|
heapless = "0.7.16"
|
||||||
|
|
|
@ -59,7 +59,8 @@ impl HmacSha256 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&mut self, data: &[u8]) -> Result<(), Error> {
|
pub fn update(&mut self, data: &[u8]) -> Result<(), Error> {
|
||||||
Ok(self.ctx.update(data))
|
self.ctx.update(data);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn finish(self, out: &mut [u8]) -> Result<(), Error> {
|
pub fn finish(self, out: &mut [u8]) -> Result<(), Error> {
|
||||||
|
@ -118,7 +119,7 @@ impl KeyPair {
|
||||||
fn private_key(&self) -> Result<&EcKey<Private>, Error> {
|
fn private_key(&self) -> Result<&EcKey<Private>, Error> {
|
||||||
match &self.key {
|
match &self.key {
|
||||||
KeyType::Public(_) => Err(ErrorCode::Invalid.into()),
|
KeyType::Public(_) => Err(ErrorCode::Invalid.into()),
|
||||||
KeyType::Private(k) => Ok(&k),
|
KeyType::Private(k) => Ok(k),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +228,7 @@ impl KeyPair {
|
||||||
}
|
}
|
||||||
|
|
||||||
const P256_KEY_LEN: usize = 256 / 8;
|
const P256_KEY_LEN: usize = 256 / 8;
|
||||||
pub fn pubkey_from_der<'a>(der: &'a [u8], out_key: &mut [u8]) -> Result<(), Error> {
|
pub fn pubkey_from_der(der: &[u8], out_key: &mut [u8]) -> Result<(), Error> {
|
||||||
if out_key.len() != P256_KEY_LEN {
|
if out_key.len() != P256_KEY_LEN {
|
||||||
error!("Insufficient length");
|
error!("Insufficient length");
|
||||||
Err(ErrorCode::NoSpace.into())
|
Err(ErrorCode::NoSpace.into())
|
||||||
|
@ -286,7 +287,7 @@ pub fn decrypt_in_place(
|
||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
let tag_start = data.len() - super::AEAD_MIC_LEN_BYTES;
|
let tag_start = data.len() - super::AEAD_MIC_LEN_BYTES;
|
||||||
let (data, tag) = data.split_at_mut(tag_start);
|
let (data, tag) = data.split_at_mut(tag_start);
|
||||||
let result = lowlevel_decrypt_aead(key, Some(nonce), ad, data, &tag)?;
|
let result = lowlevel_decrypt_aead(key, Some(nonce), ad, data, tag)?;
|
||||||
data[..result.len()].copy_from_slice(result.as_slice());
|
data[..result.len()].copy_from_slice(result.as_slice());
|
||||||
Ok(result.len())
|
Ok(result.len())
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
#![allow(clippy::bad_bit_mask)]
|
||||||
|
|
||||||
use crate::data_model::objects::GlobalElements;
|
use crate::data_model::objects::GlobalElements;
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ impl<'a, 'b, 'c> AttrDataEncoder<'a, 'b, 'c> {
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
{
|
{
|
||||||
handler.read(&attr, encoder).await
|
handler.read(attr, encoder).await
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,9 +181,7 @@ impl<'a, 'b, 'c> AttrDataEncoder<'a, 'b, 'c> {
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
{
|
{
|
||||||
handler
|
handler.write(attr, AttrData::new(attr.dataver, data)).await
|
||||||
.write(&attr, AttrData::new(attr.dataver, &data))
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -357,7 +355,7 @@ impl<'a, 'b, 'c> CmdDataEncoder<'a, 'b, 'c> {
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
{
|
{
|
||||||
handler.invoke(exchange, &cmd, &data, encoder).await
|
handler.invoke(exchange, cmd, data, encoder).await
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -632,7 +632,7 @@ impl<'a, 'r, 'p> Interaction<'a, 'r, 'p> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn new<S>(
|
pub fn new<S>(
|
||||||
exchange: &'r mut Exchange<'a>,
|
exchange: &'r mut Exchange<'a>,
|
||||||
rx: &'r mut Packet<'p>,
|
rx: &'r Packet<'p>,
|
||||||
tx: &'r mut Packet<'p>,
|
tx: &'r mut Packet<'p>,
|
||||||
rx_status: &'r mut Packet<'p>,
|
rx_status: &'r mut Packet<'p>,
|
||||||
subscription_id: S,
|
subscription_id: S,
|
||||||
|
|
|
@ -485,7 +485,7 @@ impl<'a> Case<'a> {
|
||||||
fn get_sigma2_key(
|
fn get_sigma2_key(
|
||||||
ipk: &[u8],
|
ipk: &[u8],
|
||||||
our_random: &[u8],
|
our_random: &[u8],
|
||||||
case_session: &mut CaseSession,
|
case_session: &CaseSession,
|
||||||
key: &mut [u8],
|
key: &mut [u8],
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
const S2K_INFO: [u8; 6] = [0x53, 0x69, 0x67, 0x6d, 0x61, 0x32];
|
const S2K_INFO: [u8; 6] = [0x53, 0x69, 0x67, 0x6d, 0x61, 0x32];
|
||||||
|
|
|
@ -235,7 +235,7 @@ impl CryptoSpake2 {
|
||||||
let mut len_buf: [u8; 8] = [0; 8];
|
let mut len_buf: [u8; 8] = [0; 8];
|
||||||
LittleEndian::write_u64(&mut len_buf, buf.len() as u64);
|
LittleEndian::write_u64(&mut len_buf, buf.len() as u64);
|
||||||
tt.update(&len_buf)?;
|
tt.update(&len_buf)?;
|
||||||
if buf.len() > 0 {
|
if !buf.is_empty() {
|
||||||
tt.update(buf)?;
|
tt.update(buf)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -263,6 +263,7 @@ impl CryptoSpake2 {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn get_ZV_as_prover(
|
fn get_ZV_as_prover(
|
||||||
w0: &BigNum,
|
w0: &BigNum,
|
||||||
w1: &BigNum,
|
w1: &BigNum,
|
||||||
|
@ -298,6 +299,7 @@ impl CryptoSpake2 {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn get_ZV_as_verifier(
|
fn get_ZV_as_verifier(
|
||||||
w0: &BigNum,
|
w0: &BigNum,
|
||||||
L: &EcPoint,
|
L: &EcPoint,
|
||||||
|
|
Loading…
Add table
Reference in a new issue