Handling of algorithms which support variable key sizes
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- cryptography
Direzione di ricerca
Inizia leggendo le definizioni dei trait KeyInit, KeyIvInit e InnerInit e la issue collegata di RustCrypto/block-ciphers. Confronta le due direzioni API proposte, incluso l’impatto sui crate di livello superiore come ocb3. Per considerare il lavoro completato servono un approccio deciso, la documentazione o le implementazioni dei trait aggiornate e la copertura dell’inizializzazione con dimensione della chiave variabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This issue a follow up on https://github.com/RustCrypto/block-ciphers/issues/495
Right now API of the KeyInit/KeyIvInit/InnerInit traits support algorithms with variable key sizes (block ciphers and other algorithms built on top of them) using the new_from_slice(s) methods. For example, Blowfish supports key sizes from 4 to 56 bytes. The idea here is that the KeySize associated type indicates the "default" key size (usually the biggest key size), but if necessary algorithms could be initialized with key sizes which vary at runtime. The important difference between Blowfish and ciphers like AES (where we introduce separate block cipher types for each supported key size) is that for ciphers with variable key size support encryption/decryption does not depend on key size.
As argued by @tarcieri in the discussion, this approach may cause confusion when users want to support several key sizes, but do not know about the fact that we implemented support for them using the new_from_slice(s) methods. There is also a problem with some higher-level crates which do not properly account for variable key sizes. For example, ocb3 implements KeyInit directly without accounting for new_from_slice. Arguably, it should instead implement the InnerInit trait and rely on the blanket impls.
We have two options:
- Keep the current API and intent behind it intact. Improve docs to better explain how to deal with variable key sizes. Fix the higher-level crates.
- Make implementations generic over key sizes with appropriate trait bounds. It would make it clearer for users that the algorithm supports different key sizes. We would lose support for initializing algorithms with key sizes variable at runtime, but it's arguably an anti-pattern and not that important in practice. With this option it also may be reasonable to remove the
new_from_slice(s)methods from our traits.
Personally, I lean towards the first option, but it's not a strong opinion.
- Lingua principale
- Rust
- Stelle
- 756
- Fork
- 256
- Merge medio
- 1h 27m
- PR unite (30g)
- 2
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RustCrypto/traits
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
RustCrypto/traits#2487 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
RustCrypto/traits#2482 · 5 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 32/100
RustCrypto/traits#2478 · 5 commenti ·
-
cipher
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
RustCrypto/traits#2424 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
RustCrypto/traits#2401 ·
Tutte le issue di RustCrypto/traits
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
TheLarkInn/aipm#2413 ·
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
todo:ticket
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
taikoxyz/taiko-mono#22168 · 1 commento ·