Commit baefa68d authored by Ian Jackson's avatar Ian Jackson 💬
Browse files

Merge branch 'nd-features-hsdesc-inner-docs' into 'main'

tor-netdoc: stabilise/abolish cargo feature "hsdesc-inner-docs"

See merge request !3927
parents ad2eaf56 31c115c7
Loading
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ experimental = [
    "dangerous-expose-struct-fields",
    "experimental-api",
    "incomplete",
    "hsdesc-inner-docs",
    "hs-dir",
    "hs-pow-full",
    "ns-vote",
@@ -59,7 +58,7 @@ incomplete = ["encode", "ns-vote", "parse2", "__is_experimental"]
routerdesc = ["plain-consensus", "encode"]

# Expose interfaces useful for testing
testing = ["hex-literal", "hsdesc-inner-docs", "visibility"]
testing = ["hex-literal", "visibility"]

# Enable the "ns consensus" document type, which some relays cache and serve.
plain-consensus = ["routerdesc", "encode"]
@@ -82,10 +81,6 @@ hs-client = ["hs-common"]
hs-service = ["hs-common", "encode"]
hs-common = ["tor-hscrypto", "tor-linkspec", "tor-units"]
# Testing only : expose code to parse inner layers of onion service descriptors.
hsdesc-inner-docs = [
    "visibility",
    "__is_experimental",
] # TODO maybe fold this feature into `testing`

# Onion service proof of work schemes
hs-pow-full = ["tor-hscrypto/hs-pow-full", "__is_experimental"]
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ libfuzzer-sys = "0.4"

[dependencies.tor-netdoc]
path = ".."
features = ["routerdesc", "plain-consensus", "hsdesc-inner-docs", "hs-service"]
features = ["routerdesc", "plain-consensus", "hs-service"]

# Prevent this from interfering with workspaces
[workspace]
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ use smallvec::SmallVec;
use std::result::Result as StdResult;
use std::time::SystemTime;

#[cfg(feature = "hsdesc-inner-docs")]
pub use {inner::HsDescInner, middle::HsDescMiddle, outer::HsDescOuter};

#[cfg(feature = "hs-service")]
+2 −4
Original line number Diff line number Diff line
@@ -23,8 +23,7 @@ use tor_llcrypto::pk::{ValidatableSignature, curve25519, ed25519};

/// The contents of the inner document of an onion service descriptor.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "hsdesc-inner-docs", visibility::make(pub))]
pub(crate) struct HsDescInner {
pub struct HsDescInner {
    /// The authentication types that this onion service accepts when
    /// connecting.
    //
@@ -192,8 +191,7 @@ impl HsDescInner {
    ///
    /// On success, return the signing key that was used for every certificate in the
    /// inner document, and the inner document itself.
    #[cfg_attr(feature = "hsdesc-inner-docs", visibility::make(pub))]
    pub(super) fn parse(s: &str) -> Result<(Option<Ed25519Identity>, UncheckedHsDescInner)> {
    pub fn parse(s: &str) -> Result<(Option<Ed25519Identity>, UncheckedHsDescInner)> {
        let mut reader = NetDocReader::new(s)?;
        let result = Self::take_from_reader(&mut reader).map_err(|e| e.within(s))?;
        Ok(result)
+3 −6
Original line number Diff line number Diff line
@@ -26,8 +26,7 @@ pub(super) const HS_DESC_AUTH_TYPE: &str = "x25519";
/// A more-or-less verbatim representation of the middle document of an onion
/// service descriptor.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "hsdesc-inner-docs", visibility::make(pub))]
pub(super) struct HsDescMiddle {
pub struct HsDescMiddle {
    /// A public key used by authorized clients to decrypt the key used to
    /// decrypt the encryption layer and decode the inner document.  This is
    /// ignored if restricted discovery is not in use.
@@ -54,8 +53,7 @@ impl HsDescMiddle {
    ///
    /// A failure may mean either that the encryption was corrupted, or that we
    /// didn't have the right key.
    #[cfg_attr(feature = "hsdesc-inner-docs", visibility::make(pub))]
    pub(super) fn decrypt_inner(
    pub fn decrypt_inner(
        &self,
        blinded_id: &HsBlindId,
        revision: RevisionCounter,
@@ -193,8 +191,7 @@ static HS_MIDDLE_RULES: LazyLock<SectionRules<HsMiddleKwd>> = LazyLock::new(|| {
impl HsDescMiddle {
    /// Try to parse the middle document of an onion service descriptor from a provided
    /// string.
    #[cfg_attr(feature = "hsdesc-inner-docs", visibility::make(pub))]
    pub(super) fn parse(s: &str) -> Result<HsDescMiddle> {
    pub fn parse(s: &str) -> Result<HsDescMiddle> {
        let mut reader = NetDocReader::new(s)?;
        let result = HsDescMiddle::take_from_reader(&mut reader).map_err(|e| e.within(s))?;
        Ok(result)
Loading