From 94e531f2d29f62612636af257e2ce0ca0aff5ef9 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 3 Oct 2022 00:47:43 +0800 Subject: [PATCH] fix visibility issues in API API now has to be shared with the crate that implements the API, so they are now all public structures. Not exactly great, but, probably also not exactly harmful because all the source is open and anyone looking to inject messages can just find the source code and construct them manually. Mostly we just have to be careful to not abuse the API by reaching around the lib calls and passing raw xous messages based on what could be changing data structures. --- api/xous-names/Cargo.toml | 2 +- api/xous-names/src/api.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/xous-names/Cargo.toml b/api/xous-names/Cargo.toml index c2b2700cb..409268abe 100644 --- a/api/xous-names/Cargo.toml +++ b/api/xous-names/Cargo.toml @@ -3,7 +3,7 @@ authors = ["bunnie "] description = "Xous microkernel OS inter-process name resolution server" edition = "2018" name = "xous-api-names" -version = "0.9.0" +version = "0.9.1" license = "MIT OR Apache-2.0" repository = "https://github.com/betrusted-io/xous-core/" homepage = "https://betrusted.io/" diff --git a/api/xous-names/src/api.rs b/api/xous-names/src/api.rs index 5acff89da..d7fa06b23 100644 --- a/api/xous-names/src/api.rs +++ b/api/xous-names/src/api.rs @@ -4,7 +4,7 @@ pub const AUTHENTICATE_TIMEOUT: u32 = 10_000; // time in ms that a process has t #[derive(num_derive::FromPrimitive, num_derive::ToPrimitive)] #[non_exhaustive] #[repr(C)] -pub(crate) enum Opcode { +pub enum Opcode { /// Create a new server with the given name and return its SID. Register = 0, @@ -55,7 +55,7 @@ pub(crate) enum Opcode { #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] #[non_exhaustive] #[repr(C)] -pub(crate) enum Return { +pub enum Return { /// The caller must perform an AuthenticatedLookup using this challenge AuthenticateRequest(AuthenticateRequest), @@ -73,19 +73,19 @@ pub(crate) enum Return { } #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] -pub(crate) struct Registration { +pub struct Registration { pub name: xous_ipc::String<64>, pub conn_limit: Option, } #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] -pub(crate) struct Disconnect { +pub struct Disconnect { pub name: xous_ipc::String<64>, pub token: [u32; 4], } #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] -pub(crate) struct AuthenticatedLookup { +pub struct AuthenticatedLookup { pub name: xous_ipc::String<64>, pub pubkey_id: [u8; 20], // 160-bit pubkey ID encoded in network order (big endian) pub response: [u32; 8], @@ -93,7 +93,7 @@ pub(crate) struct AuthenticatedLookup { #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] #[repr(C)] -pub(crate) struct AuthenticateRequest { +pub struct AuthenticateRequest { pub name: xous_ipc::String<64>, // a copy of the originally requested lookup pub pubkey_id: [u8; 20], // 160-bit pubkey ID encoded in network order (big endian) pub challenge: [u32; 4],