From a7563638308878ddee235376f1f682116269dd74 Mon Sep 17 00:00:00 2001 From: Eric Devolder Date: Thu, 29 Aug 2024 21:51:01 +0200 Subject: [PATCH] Combined fixes from #218 Signed-off-by: Eric Devolder --- cryptoki/src/mechanism/ekdf.rs | 2 +- cryptoki/src/mechanism/elliptic_curve.rs | 14 +++++++------- cryptoki/src/session/random.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cryptoki/src/mechanism/ekdf.rs b/cryptoki/src/mechanism/ekdf.rs index e8a3e05..7494bb4 100644 --- a/cryptoki/src/mechanism/ekdf.rs +++ b/cryptoki/src/mechanism/ekdf.rs @@ -28,7 +28,7 @@ impl<'a> AesCbcDeriveParams<'a> { /// * `iv` - The initialization vector /// /// * `data` - Data that will be encryption with the base key to obtain - /// the new key from the resulted cypher. + /// the new key from the resulted cypher. pub fn new(iv: [u8; 16], data: &'a [u8]) -> Self { Self { inner: cryptoki_sys::CK_AES_CBC_ENCRYPT_DATA_PARAMS { diff --git a/cryptoki/src/mechanism/elliptic_curve.rs b/cryptoki/src/mechanism/elliptic_curve.rs index 21f55e0..9c36287 100644 --- a/cryptoki/src/mechanism/elliptic_curve.rs +++ b/cryptoki/src/mechanism/elliptic_curve.rs @@ -42,13 +42,13 @@ impl<'a> Ecdh1DeriveParams<'a> { /// * `kdf` - The key derivation function to use. /// /// * `public_data` - The other party's public key. A token MUST be able - /// to accept this value encoded as a raw octet string (as per section - /// A.5.2 of ANSI X9.62). A token MAY, in addition, support accepting - /// this value as a DER-encoded `ECPoint` (as per section E.6 of ANSI - /// X9.62) i.e. the same as a `CKA_EC_POINT` encoding. The calling - /// application is responsible for converting the offered public key to the - /// compressed or uncompressed forms of these encodings if the token does - /// not support the offered form. + /// to accept this value encoded as a raw octet string (as per section + /// A.5.2 of ANSI X9.62). A token MAY, in addition, support accepting + /// this value as a DER-encoded `ECPoint` (as per section E.6 of ANSI + /// X9.62) i.e. the same as a `CKA_EC_POINT` encoding. The calling + /// application is responsible for converting the offered public key to the + /// compressed or uncompressed forms of these encodings if the token does + /// not support the offered form. pub fn new(kdf: EcKdf<'a>, public_data: &'a [u8]) -> Self { Self { kdf: kdf.kdf_type, diff --git a/cryptoki/src/session/random.rs b/cryptoki/src/session/random.rs index 409a4e4..4926933 100644 --- a/cryptoki/src/session/random.rs +++ b/cryptoki/src/session/random.rs @@ -13,7 +13,7 @@ impl Session { /// # Arguments /// /// * `random_slice` - The slice to stick the random data into. The length of the slice represents - /// the number of bytes to obtain from the RBG + /// the number of bytes to obtain from the RBG pub fn generate_random_slice(&self, random_data: &mut [u8]) -> Result<()> { unsafe { Rv::from(get_pkcs11!(self.client(), C_GenerateRandom)(