Proposals for traits for symmetric ciphers#13
Conversation
| SecurityStrength::_256bit, | ||
| ]; | ||
| for ss in security_strengths.iter() { | ||
| key.set_security_strength(ss.clone()).unwrap(); |
There was a problem hiding this comment.
Confused: for security strength tests, the loop mutates key, but calls &mac_key? Failure here may be due to wrong key type rather than weak strength as intending.
| C::aead_encrypt_out(&key, aad, msg, &mut ct).unwrap(); | ||
| let (nonce2, _ct_bytes_written, _tag) = | ||
| C::aead_encrypt_out(&key, aad, msg, &mut ct).unwrap(); | ||
| assert_ne!(nonce1, nonce2); |
There was a problem hiding this comment.
Wouldn't this fail for nonce.len() != 0l which was declared earlier?
| ciphertext: &mut [u8], | ||
| ) -> Result<([u8; INIT_DATA_LEN], usize), SymmetricCipherError>; | ||
| #[cfg(std)] | ||
| /// A one-shot API to decrypt some ciphertext with the given key. |
There was a problem hiding this comment.
Why does decrypt have &self and no init data? It's inconsistent with encrypt, which is static. If we want a one-shot decrypt, shouldn't we also have decrypt as a static?
| SymmetricCipher<KEY_LEN, NONCE_LEN> + Sized | ||
| { | ||
| #[cfg(std)] | ||
| /// A one-shot API to encrypt some plaintext with the given key. |
There was a problem hiding this comment.
For a secure one-shot API, why are we taking in a manual nonce? Shouldn't it be automatic? Or at least manual nonce generation API separated/marked hazardous?
officialfrancismendoza
left a comment
There was a problem hiding this comment.
Wanted to check possible bugs in tests and the AEAD tampering test potentially allowing successful corrupted decrypts.
|
@ounsworth merge conflict in QUALITY_AND_STYLE.md. Also had a few unresolved comments about presumably mismatched key usage (ie: mac_key instead of key and vice versa), permuting over a different key, etc. |
| } | ||
|
|
||
| pub trait Hash : Default { | ||
| /// The basic one-shat encrypt and decrypt that all types of symmetric ciphers must implement. |
No description provided.