hardcode path

This commit is contained in:
2025-10-27 13:53:16 +01:00
parent 6b60e04513
commit af0d286549

View File

@@ -2,13 +2,17 @@ pub use shared_memory_heap::sharedptr::SharedPtr;
use crate::agent::Agent;
use std::{
ops::Deref, path::Path, sync::{LazyLock, Mutex}
ops::Deref,
path::Path,
sync::{LazyLock, Mutex},
};
static X25519AGENT: LazyLock<Mutex<Agent>> = LazyLock::new(|| {
let agent_path = std::env::var("X25519_AGENT_PATH").expect("X25519_AGENT_PATH environment variable missing");
let keyfile_path = std::env::var("X25519_KEYFILE").expect("X25519_KEYFILE environment variable missing");
let agent = unsafe { Agent::new(Path::new(&agent_path), Path::new(&keyfile_path)).expect("Agent failed to start") };
let agent_path = "agent_harness";
let keyfile_path = "/etc/x25519-agent/keyfile";
let agent = unsafe {
Agent::new(Path::new(&agent_path), Path::new(&keyfile_path)).expect("Agent failed to start")
};
Mutex::new(agent)
});
@@ -61,7 +65,7 @@ impl Deref for X25519SharedKey {
pub fn x25519_keygen() -> (X25519PrivKey, X25519PubKey) {
let sk = X25519PrivKey(SharedPtr::new(8).unwrap());
let pk = X25519PubKey(SharedPtr::new(32).unwrap());
let pk = X25519PubKey(SharedPtr::new(32).unwrap());
let mut agent = X25519AGENT.lock().unwrap();
@@ -94,7 +98,10 @@ pub fn x25519(sk: &X25519PrivKey, pk: &X25519PubKey) -> X25519SharedKey {
let mut agent = X25519AGENT.lock().unwrap();
unsafe {
agent.perform_ipc_call(2, &[out.0.get_offset(), sk.0.get_offset(), pk.0.get_offset()]);
agent.perform_ipc_call(
2,
&[out.0.get_offset(), sk.0.get_offset(), pk.0.get_offset()],
);
}
drop(agent);