Skip to main content

NonMalleable

Trait NonMalleable 

Source
pub trait NonMalleable: SafeParser {
    // Required method
    proof fn lemma_parse_non_malleable(&self, buf1: Seq<u8>, buf2: Seq<u8>);

    // Provided method
    open spec fn nonmal_inv(&self) -> bool { ... }
}
Expand description

Parser non-malleability.

If two buffers parse to equal values, their consumed bytes are identical—i.e., each semantic value has a unique byte-level representation.

Required Methods§

Source

proof fn lemma_parse_non_malleable(&self, buf1: Seq<u8>, buf2: Seq<u8>)

requires
self.safe_inv(),
self.nonmal_inv(),
ensures
self
    .spec_parse(
        buf1,
    ) matches Some(
    (n1, v1),
) ==> self
    .spec_parse(
        buf2,
    ) matches Some((n2, v2)) ==> v1 == v2 ==> buf1.take(n1) == buf2.take(n2),

Provided Methods§

Source

open spec fn nonmal_inv(&self) -> bool

{ true }

Optional invariant (used by spec-function combinators; struct-based combinators typically leave this as true)

Implementors§

Source§

impl NonMalleable for Integer8Fmt

Source§

impl NonMalleable for Integer16Fmt

Source§

impl NonMalleable for AnyFmt<true>

Source§

impl NonMalleable for BmpStringFmt

Source§

impl NonMalleable for BoolFmt<true>

Source§

impl NonMalleable for EnumeratedFmt

Source§

impl NonMalleable for GeneralizedTimeFmt<true>

Source§

impl NonMalleable for Ia5StringFmt

Source§

impl NonMalleable for IntegerFmt

Source§

impl NonMalleable for LengthFmt<true>

Source§

impl NonMalleable for NatLengthFmt<true>

Source§

impl NonMalleable for ObjectIdentifierFmt

Source§

impl NonMalleable for PrintableStringFmt

Source§

impl NonMalleable for TagFmt

Source§

impl NonMalleable for TeletexStringFmt

Source§

impl NonMalleable for UniversalStringFmt

Source§

impl NonMalleable for UtcTimeFmt<true>

Source§

impl NonMalleable for Utf8StringFmt

Source§

impl NonMalleable for CborHeadFmt<true>

Source§

impl NonMalleable for CborInitialFmt

Source§

impl NonMalleable for Empty

Source§

impl NonMalleable for Void

Source§

impl NonMalleable for I8

Source§

impl NonMalleable for I16Be

Source§

impl NonMalleable for I16Le

Source§

impl NonMalleable for I32Be

Source§

impl NonMalleable for I32Le

Source§

impl NonMalleable for I64Be

Source§

impl NonMalleable for I64Le

Source§

impl NonMalleable for Eof

Source§

impl NonMalleable for Tail

Source§

impl NonMalleable for U8

Source§

impl NonMalleable for U16Be

Source§

impl NonMalleable for U16Le

Source§

impl NonMalleable for U24Be

Source§

impl NonMalleable for U24Le

Source§

impl NonMalleable for U32Be

Source§

impl NonMalleable for U32Le

Source§

impl NonMalleable for U64Be

Source§

impl NonMalleable for U64Le

Source§

impl NonMalleable for Base128Fmt<true>

Source§

impl NonMalleable for VarInt<true>

Source§

impl<A, B> NonMalleable for Preceded<A, A::PVal, B, false>

Source§

impl<A, B> NonMalleable for Preceded<A, A::PVal, B, true>

Source§

impl<A, B> NonMalleable for PairRev<A, B>
where A: NonMalleable, B: StaticByteLen + NonMalleable<PVal = B::T>,

Source§

impl<A, B> NonMalleable for Terminated<A, B, B::PVal, false>

Source§

impl<A, B> NonMalleable for Terminated<A, B, B::PVal, true>

Source§

impl<A, B> NonMalleable for Bind<A, B>
where A: NonMalleable, B: SpecMap<Input = A::PVal>, B::Output: NonMalleable,

Source§

impl<A, Then> NonMalleable for AndThen<A, Then>

Source§

impl<A: NonMalleable + SafeParser> NonMalleable for Star<A>

Source§

impl<A: NonMalleable> NonMalleable for Opt<A>

Source§

impl<A: NonMalleable, B: NonMalleable> NonMalleable for Sum<A, B>

Source§

impl<A: NonMalleable, B: NonMalleable> NonMalleable for Choice<A, B>

Source§

impl<A: NonMalleable, B: NonMalleable> NonMalleable for Optional<A, B>

Source§

impl<A: NonMalleable, B: NonMalleable> NonMalleable for Repeat<A, B>

Source§

impl<A: NonMalleable, B: NonMalleable> NonMalleable for Pair<A, B>

Source§

impl<A: NonMalleable, Pred: SpecPred<A::PVal>> NonMalleable for Refined<A, Pred>

Source§

impl<C: NonMalleable + SafeParser> NonMalleable for OptionalEnd<C>

Source§

impl<C: NonMalleable + SafeParser> NonMalleable for RepeatTillEnd<C>

Source§

impl<C: NonMalleable + SafeParser, N: AsLen> NonMalleable for RepeatN<C, N>

Source§

impl<C: NonMalleable> NonMalleable for SetOfFmt<C>

Source§

impl<Content: SpecCombinator + SoundParser + NonMalleable> NonMalleable for ASN1Fmt<Content, true>

Source§

impl<F> NonMalleable for ImplicitlyTaggedFmt<F>

Source§

impl<Field, Rest, const DER: bool> NonMalleable for DefaultedFmt<Field, Field::PVal, Rest, DER>

Source§

impl<Head, Tail> NonMalleable for Implicit<Head, Tail>
where Head: SoundParser + NonMalleable, Tail: DepCombinator<Key = Head::T>, Tail::Body: SoundParser<T = Tail::Val> + NonMalleable,

Source§

impl<Inner, M> NonMalleable for Mapped<Inner, M>
where Inner: SoundParser + NonMalleable, M: LosslessMapper<In = Inner::PVal>,

Source§

impl<Inner, M> NonMalleable for TryMap<Inner, M>
where Inner: SoundParser + NonMalleable, M: LosslessMapper<In = Inner::PVal>,

Source§

impl<Inner, M, MRev> NonMalleable for Mapped<Inner, BiMap<M, MRev>>
where Inner: SoundParser + NonMalleable, M: SpecMap<Input = Inner::PVal>, MRev: SpecMap<Input = M::Output, Output = M::Input>,

Source§

impl<Inner, Out> NonMalleable for Mapped<Inner, FnSpecMapper<Inner::PVal, Out>>
where Inner: SoundParser + NonMalleable,

Source§

impl<Inner: NonMalleable> NonMalleable for Cond<Inner>

Source§

impl<Inner: NonMalleable> NonMalleable for Named<Inner>

Source§

impl<Inner: NonMalleable> NonMalleable for Ref<Inner>

Source§

impl<Inner: NonMalleable> NonMalleable for Const<Inner, Inner::PVal>

Source§

impl<Inner: NonMalleable, Len: AsLen> NonMalleable for ExactLen<Inner, Len>

Source§

impl<Len: AsLen> NonMalleable for Varied<Len>

Source§

impl<Of, Tg> NonMalleable for SuffixTagged<Of, Tg, Tg::T>

Source§

impl<Repr, Tuple, Nominal> NonMalleable for Bits<Repr, Tuple, Nominal>
where Repr: SpecByteLen + SoundParser + NonMalleable<PVal = Repr::T>,

Source§

impl<SpecP, Cnstcy, Blen> NonMalleable for ParserSpecs<SpecP, Cnstcy, Blen>
where Blen: SpecByteLen, SpecP: SpecParser<PVal = Blen::T>, Cnstcy: Consistency<Val = Blen::T>,

Source§

impl<T> NonMalleable for BundledSpecs<T>

Source§

impl<T, C: NonMalleable, const N: usize> NonMalleable for Dispatch<T, C, N>

Source§

impl<Tg, Of> NonMalleable for PrefixTagged<Tg, Tg::T, Of>

Source§

impl<const DER: bool> NonMalleable for BitStringFmt<DER>

Source§

impl<const DER: bool> NonMalleable for RealFmt<DER>

Source§

impl<const LIMIT: usize> NonMalleable for CborFmt<true, LIMIT>

Source§

impl<const LIMIT: usize, Body, Param> NonMalleable for FixWith<LIMIT, Body, Param>
where Body: NonMalleableRecBody, Body::Body: NonMalleable + SafeParser + SoundParser, Param: DeepView<V = Body::Param>,

Source§

impl<const N: usize> NonMalleable for Fixed<N>

Source§

impl<const N: usize> NonMalleable for Const<Fixed<N>, [u8; N]>

Source§

impl<const N: usize> NonMalleable for ULeb128<true, N>

Source§

impl<const N: usize, C: NonMalleable> NonMalleable for Array<N, C>

Source§

impl<const NONDETERMINISTIC: bool, A, B> NonMalleable for Alt<A, B, NONDETERMINISTIC>