[WIP] Security work While on holiday
This commit is contained in:
parent
a81ac4efca
commit
7f0231e3f1
109 changed files with 19694 additions and 5210 deletions
|
|
@ -10,6 +10,7 @@ mtp-crypto = { version = "0.2.0", path = "../crypto", optional = true }
|
|||
base64 = "0.22"
|
||||
byteorder = "1.5"
|
||||
rand = { version = "0.10.1", features = ["std", "std_rng"] }
|
||||
thiserror = "2.0.18"
|
||||
|
||||
[features]
|
||||
registry = ["mtp-type-map/registry"]
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -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
1186
codec/src/protected.rs
Normal file
File diff suppressed because it is too large
Load diff
1280
codec/src/relay.rs
Normal file
1280
codec/src/relay.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue