Improve types and documentation
This commit is contained in:
+6
-6
@@ -122,24 +122,24 @@ pub(crate) struct OpenedInnerEnvelope<D: Hash> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
type SealRaw<CS> = (
|
type SealRawResult<CS> = (
|
||||||
Envelope<CS>,
|
Envelope<CS>,
|
||||||
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
||||||
);
|
);
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
type SealRaw<CS> = (
|
type SealRawResult<CS> = (
|
||||||
Envelope<CS>,
|
Envelope<CS>,
|
||||||
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
||||||
Vec<u8>,
|
Vec<u8>,
|
||||||
);
|
);
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
type Seal<CS> = (
|
type SealResult<CS> = (
|
||||||
Envelope<CS>,
|
Envelope<CS>,
|
||||||
PublicKey<<CS as CipherSuite>::Group>,
|
PublicKey<<CS as CipherSuite>::Group>,
|
||||||
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
||||||
);
|
);
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
type Seal<CS> = (
|
type SealResult<CS> = (
|
||||||
Envelope<CS>,
|
Envelope<CS>,
|
||||||
PublicKey<<CS as CipherSuite>::Group>,
|
PublicKey<<CS as CipherSuite>::Group>,
|
||||||
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
GenericArray<u8, <<CS as CipherSuite>::Hash as Digest>::OutputSize>,
|
||||||
@@ -207,7 +207,7 @@ impl<CS: CipherSuite> Envelope<CS> {
|
|||||||
key: &[u8],
|
key: &[u8],
|
||||||
server_s_pk: &[u8],
|
server_s_pk: &[u8],
|
||||||
optional_ids: Option<Identifiers>,
|
optional_ids: Option<Identifiers>,
|
||||||
) -> Result<Seal<CS>, ProtocolError> {
|
) -> Result<SealResult<CS>, ProtocolError> {
|
||||||
let mut nonce = vec![0u8; NONCE_LEN];
|
let mut nonce = vec![0u8; NONCE_LEN];
|
||||||
rng.fill_bytes(&mut nonce);
|
rng.fill_bytes(&mut nonce);
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ impl<CS: CipherSuite> Envelope<CS> {
|
|||||||
nonce: &[u8],
|
nonce: &[u8],
|
||||||
aad: &[u8],
|
aad: &[u8],
|
||||||
mode: InnerEnvelopeMode,
|
mode: InnerEnvelopeMode,
|
||||||
) -> Result<SealRaw<CS>, InternalPakeError> {
|
) -> Result<SealRawResult<CS>, InternalPakeError> {
|
||||||
let h = Hkdf::<CS::Hash>::new(None, key);
|
let h = Hkdf::<CS::Hash>::new(None, key);
|
||||||
let mut hmac_key = vec![0u8; Self::hmac_key_size()];
|
let mut hmac_key = vec![0u8; Self::hmac_key_size()];
|
||||||
let mut export_key = vec![0u8; Self::export_key_size()];
|
let mut export_key = vec![0u8; Self::export_key_size()];
|
||||||
|
|||||||
+3
-2
@@ -573,7 +573,7 @@ pub struct ClientLoginFinishResult<CS: CipherSuite> {
|
|||||||
/// Instance of the ClientLogin, only used in tests for checking zeroize
|
/// Instance of the ClientLogin, only used in tests for checking zeroize
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub state: ClientLogin<CS>,
|
pub state: ClientLogin<CS>,
|
||||||
/// Handshake secret, only used tests
|
/// Handshake secret, only used in tests
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub handshake_secret: Vec<u8>,
|
pub handshake_secret: Vec<u8>,
|
||||||
/// Client MAC key, only used in tests
|
/// Client MAC key, only used in tests
|
||||||
@@ -752,9 +752,10 @@ pub struct ServerLoginStartResult<CS: CipherSuite> {
|
|||||||
pub message: CredentialResponse<CS>,
|
pub message: CredentialResponse<CS>,
|
||||||
/// The state that the server must keep in order to finish the protocl
|
/// The state that the server must keep in order to finish the protocl
|
||||||
pub state: ServerLogin<CS>,
|
pub state: ServerLogin<CS>,
|
||||||
/// Handshake secret, only used tests
|
/// Handshake secret, only used in tests
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub handshake_secret: Vec<u8>,
|
pub handshake_secret: Vec<u8>,
|
||||||
|
/// Server MAC key, only used in tests
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub server_mac_key: GenericArray<u8, <CS::Hash as Digest>::OutputSize>,
|
pub server_mac_key: GenericArray<u8, <CS::Hash as Digest>::OutputSize>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user