Skip to content

Commit af4b780

Browse files
f remove deprecated blinded path auth stuff
1 parent 70576cb commit af4b780

File tree

3 files changed

+2
-55
lines changed

3 files changed

+2
-55
lines changed

lightning/src/blinded_path/message.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -451,19 +451,6 @@ pub enum AsyncPaymentsContext {
451451
///
452452
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
453453
static_invoice_absolute_expiry: core::time::Duration,
454-
/// A nonce used for authenticating that a [`StaticInvoicePersisted`] message is valid for a
455-
/// preceding [`ServeStaticInvoice`] message.
456-
///
457-
/// [`StaticInvoicePersisted`]: crate::onion_message::async_payments::StaticInvoicePersisted
458-
/// [`ServeStaticInvoice`]: crate::onion_message::async_payments::ServeStaticInvoice
459-
nonce: Nonce,
460-
/// Authentication code for the [`StaticInvoicePersisted`] message.
461-
///
462-
/// Prevents nodes from creating their own blinded path to us and causing us to cache an
463-
/// unintended async receive offer.
464-
///
465-
/// [`StaticInvoicePersisted`]: crate::onion_message::async_payments::StaticInvoicePersisted
466-
hmac: Hmac<Sha256>,
467454
/// The time as duration since the Unix epoch at which this path expires and messages sent over
468455
/// it should be ignored.
469456
///
@@ -562,9 +549,7 @@ impl_writeable_tlv_based_enum!(AsyncPaymentsContext,
562549
(4, offer_created_at, required),
563550
(6, update_static_invoice_path, required),
564551
(8, static_invoice_absolute_expiry, required),
565-
(10, nonce, required),
566-
(12, hmac, required),
567-
(14, path_absolute_expiry, required),
552+
(10, path_absolute_expiry, required),
568553
},
569554
);
570555

lightning/src/offers/flow.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,14 +1206,9 @@ where
12061206
ES::Target: EntropySource,
12071207
R::Target: Router,
12081208
{
1209-
let expanded_key = &self.inbound_payment_key;
12101209
let duration_since_epoch = self.duration_since_epoch();
1211-
12121210
match context {
1213-
AsyncPaymentsContext::OfferPaths { nonce, hmac, path_absolute_expiry } => {
1214-
if let Err(()) = signer::verify_offer_paths_context(nonce, hmac, expanded_key) {
1215-
return None;
1216-
}
1211+
AsyncPaymentsContext::OfferPaths { path_absolute_expiry } => {
12171212
if duration_since_epoch > path_absolute_expiry {
12181213
return None;
12191214
}
@@ -1325,8 +1320,6 @@ where
13251320
.and_then(|paths| paths.into_iter().next().ok_or(()))?;
13261321

13271322
let reply_path_context = {
1328-
let nonce = Nonce::from_entropy_source(entropy);
1329-
let hmac = signer::hmac_for_static_invoice_persisted_context(nonce, expanded_key);
13301323
let static_invoice_absolute_expiry =
13311324
invoice.created_at().saturating_add(invoice.relative_expiry());
13321325
let path_absolute_expiry =
@@ -1337,8 +1330,6 @@ where
13371330
offer_created_at,
13381331
update_static_invoice_path,
13391332
static_invoice_absolute_expiry,
1340-
nonce,
1341-
hmac,
13421333
path_absolute_expiry,
13431334
}
13441335
};

lightning/src/offers/signer.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ const PAYMENT_TLVS_HMAC_INPUT: &[u8; 16] = &[8; 16];
5555
#[cfg(async_payments)]
5656
const ASYNC_PAYMENTS_HELD_HTLC_HMAC_INPUT: &[u8; 16] = &[9; 16];
5757

58-
// HMAC input used in `AsyncPaymentsContext::StaticInvoicePersisted` to authenticate inbound
59-
// static_invoice_persisted onion messages.
60-
#[cfg(async_payments)]
61-
const ASYNC_PAYMENTS_STATIC_INV_PERSISTED_INPUT: &[u8; 16] = &[11; 16];
62-
6358
/// Message metadata which possibly is derived from [`MetadataMaterial`] such that it can be
6459
/// verified.
6560
#[derive(Clone)]
@@ -575,27 +570,3 @@ pub(crate) fn verify_held_htlc_available_context(
575570
Err(())
576571
}
577572
}
578-
579-
#[cfg(async_payments)]
580-
pub(crate) fn verify_offer_paths_context(
581-
nonce: Nonce, hmac: Hmac<Sha256>, expanded_key: &ExpandedKey,
582-
) -> Result<(), ()> {
583-
if hmac_for_offer_paths_context(nonce, expanded_key) == hmac {
584-
Ok(())
585-
} else {
586-
Err(())
587-
}
588-
}
589-
590-
#[cfg(async_payments)]
591-
pub(crate) fn hmac_for_static_invoice_persisted_context(
592-
nonce: Nonce, expanded_key: &ExpandedKey,
593-
) -> Hmac<Sha256> {
594-
const IV_BYTES: &[u8; IV_LEN] = b"LDK InvPersisted";
595-
let mut hmac = expanded_key.hmac_for_offer();
596-
hmac.input(IV_BYTES);
597-
hmac.input(&nonce.0);
598-
hmac.input(ASYNC_PAYMENTS_STATIC_INV_PERSISTED_INPUT);
599-
600-
Hmac::from_engine(hmac)
601-
}

0 commit comments

Comments
 (0)