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
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@

[package]
name = "uprotocol"
version = "0.1.0"
version = "0.1.1"
edition = { workspace = true }

[lib]
crate-type = ["cdylib"]

[dependencies]
backon = { version = "1.5", default-features = false, features = ["tokio-sleep"] }
backon = { version = "1.6.0", default-features = false, features = ["tokio-sleep"] }
symphony = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { version = "1.45" }
tokio = { version = "1.52.3" }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
up-rust = { version = "0.7.1", default-features = false, features = ["communication", "util"] }
up-transport-mqtt5 = { version = "0.3" }
up-transport-zenoh = { version = "0.8" }
up-rust = { version = "0.9.0", default-features = false, features = ["communication", "util"] }
up-transport-mqtt5 = { version = "0.4.0" }
up-transport-zenoh = { version = "0.9.0" }

[dev-dependencies]
async-trait = { version = "0.1.88" }
test-case = { version = "3.3" }
test-log = { version = "0.2", features = ["trace"] }
up-rust = { version = "0.7.1", default-features = false, features = ["communication", "util", "test-util"] }
test-case = { version = "3.3.1" }
test-log = { version = "0.2.20", features = ["trace"] }
up-rust = { version = "0.9.0", default-features = false, features = ["communication", "util", "test-util"] }
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[package]
name = "symphony"
version = "0.1.4"
version = "0.1.5"
edition = { workspace = true }
license = "MIT"
description = "Eclipse Symphony Target Provider Rust binding"
Expand All @@ -15,9 +15,9 @@ keywords = ["orchestration"]
crate-type = ["cdylib", "staticlib", "rlib"]

[dependencies]
libloading = { version = "0.8" }
libloading = { version = "0.9" }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
sha2 = { version = "0.10", default-features = false, features = ["std"]}
sha2 = { version = "0.11" }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
21 changes: 15 additions & 6 deletions api/pkg/apis/v1alpha1/providers/target/rust/symphony/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,34 @@
*/

use core::ffi::c_char;
use libloading::Library;
use sha2::{Digest, Sha256};
use std::collections::HashMap;
use std::ffi::{CStr, CString};
use std::fs::File;
use std::io;
use std::io::Read;
use std::ptr;

use libloading::Library;
use sha2::{Digest, Sha256};
use tracing::{debug, error, warn};

pub mod models;
use crate::models::*;

/// Computes the SHA-256 hash of a file.
fn compute_sha256_hash(file_path: &str) -> Result<String, io::Error> {
fn compute_sha256_hash(file_path: &str) -> Result<String, std::io::Error> {
let mut file = File::open(file_path)?;
let mut hasher = Sha256::new();
io::copy(&mut file, &mut hasher)?;
let mut buffer = [0u8; 8192];
loop {
let n = file.read(&mut buffer)?;
if n == 0 {
break;
}
hasher.update(&buffer[..n]);
}
let hash = hasher.finalize();
Ok(format!("{:x}", hash))
let hex_string: String = hash.iter().map(|b| format!("{b:02x}")).collect();
Ok(hex_string)
}

/// Validates the computed hash against the expected hash value.
Expand Down
Loading