feat: add new ipc call
This commit is contained in:
14
src/lib.rs
14
src/lib.rs
@@ -52,13 +52,25 @@ pub fn x25519_keygen<'a>() -> (X25519PrivKey<'a>, X25519PubKey<'a>) {
|
|||||||
(sk, pk)
|
(sk, pk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn x22519_pubkey<'a>(sk: &X25519PrivKey) -> X25519PubKey<'a> {
|
||||||
|
let pk = X25519PubKey(SharedPtr::<32>::new().unwrap());
|
||||||
|
|
||||||
|
let mut agent = AGENT.lock().unwrap();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
agent.perform_ipc_call(1, &[sk.0.get_offset(), pk.0.get_offset()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
pk
|
||||||
|
}
|
||||||
|
|
||||||
pub fn x25519<'a>(sk: &X25519PrivKey, pk: &X25519PubKey) -> X25519SharedKey<'a> {
|
pub fn x25519<'a>(sk: &X25519PrivKey, pk: &X25519PubKey) -> X25519SharedKey<'a> {
|
||||||
let out = X25519SharedKey(SharedPtr::<32>::new().unwrap());
|
let out = X25519SharedKey(SharedPtr::<32>::new().unwrap());
|
||||||
|
|
||||||
let mut agent = AGENT.lock().unwrap();
|
let mut agent = AGENT.lock().unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
agent.perform_ipc_call(1, &[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()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
out
|
out
|
||||||
|
|||||||
Reference in New Issue
Block a user