Expand description
§GREASE Support for MLS
This module implements GREASE (Generate Random Extensions And Sustain Extensibility) as defined in RFC 9420 Section 13.5.
GREASE values are used to ensure that implementations properly handle
unknown values and maintain extensibility. The GREASE values follow a
specific pattern where both bytes are of the form 0x_A (e.g., 0x0A0A,
0x1A1A, 0x2A2A, etc.).
§Purpose
GREASE helps prevent extensibility failures by:
- Ensuring implementations don’t reject unknown values
- Testing that parsers properly handle unexpected values
- Maintaining forward compatibility
§Usage in OpenMLS
OpenMLS provides tools for working with GREASE values:
-
Recognition: GREASE values are automatically recognized during deserialization and stored in dedicated
Greasevariants (e.g.,ProposalType::Grease,ExtensionType::Grease). -
Validation: During capability validation, GREASE values are treated the same as unknown values and filtered out appropriately.
-
Injection: Library users can inject random GREASE values into capabilities using the
Capabilities::with_greasemethod or by manually addingGreasevariants.
§Example
use openmls::prelude::*;
use openmls_rust_crypto::OpenMlsRustCrypto;
let provider = OpenMlsRustCrypto::default();
// Inject random GREASE values into capabilities
let capabilities = Capabilities::builder()
.with_grease(provider.rand())
.build();
// Capabilities now contain random GREASE values
assert!(capabilities.ciphersuites().iter().any(|cs| cs.is_grease()));Constants§
- GREASE_
VALUES - All valid GREASE values as defined in RFC 9420. These follow the pattern 0x_A_A where _ is 0-E.
Functions§
- is_
grease_ value - Checks if a given u16 value is a valid GREASE value.
- random_
grease_ value - Returns a random GREASE value from the set of valid GREASE values.