[WIP] Security work While on holiday

This commit is contained in:
Alex 2026-08-12 22:45:28 +02:00
commit 7f0231e3f1
Signed by: alex
SSH key fingerprint: SHA256:D1+Ub8o0v4K5y1JNivW8IxEOelqLSvPmUzBbDIoZkRQ
109 changed files with 19694 additions and 5210 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,31 @@
pub mod communication_value;
pub mod data_value;
#[cfg(feature = "crypto")]
pub use communication_value::EncryptedPayload;
pub use communication_value::{CommunicationValue, MAX_WIRE_ID};
pub use data_value::{DataKind, DataValue};
pub use mtp_common::CodecError;
pub mod protected;
#[cfg(feature = "crypto")]
pub mod relay;
pub use communication_value::CommunicationValue;
#[cfg(feature = "crypto")]
pub use data_value::{
ApplicationProtectionPurpose, EncryptedValue, MtpProtectionPurpose, ProtectionError,
ProtectionPolicy, ProtectionPurpose, ProtectionPurposeError, SignaturePolicy, SignedValue,
};
pub use data_value::{DataKind, DataValue, DecodeLimits};
pub use mtp_common::{CodecError, TimeError, unix_time_millis};
#[cfg(feature = "crypto")]
pub use protected::{
CURRENT_PROTECTED_VERSION, InMemoryReplayGuard, ProtectedError, ProtectedMessageBuilder,
ReplayError, ReplayGuard, VerifiedProtectedMessage, open_protected, open_protected_with,
open_protected_with_keys, protected_claimed_signer_id,
};
#[cfg(feature = "crypto")]
pub use relay::{
CURRENT_RELAY_VERSION, RelayError, SealedRelayBuilder, VerifiedRelayContent,
VerifiedRelayMetadata, forward_relay_frame, open_relay_content,
open_relay_content_with_keyrings, open_relay_content_with_keys, open_relay_metadata,
open_relay_metadata_with, open_relay_metadata_with_keys, relay_metadata_claimed_signer_id,
};
pub use mtp_type_map::{
CommunicationType, CommunicationTypeId, DataType, DataTypeId, PROTOCOL_VERSION, TypeMap,
@ -13,7 +33,12 @@ pub use mtp_type_map::{
};
pub(crate) fn rand_u32() -> u32 {
rand::random()
loop {
let value = rand::random();
if value != 0 {
return value;
}
}
}
#[cfg(feature = "registry")]

1186
codec/src/protected.rs Normal file

File diff suppressed because it is too large Load diff

1280
codec/src/relay.rs Normal file

File diff suppressed because it is too large Load diff