Handling of algorithms which support variable key sizes
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- rust
- Área
- cryptography
Línea de trabajo
Empieza leyendo las definiciones de los traits KeyInit, KeyIvInit e InnerInit y el issue enlazado de RustCrypto/block-ciphers. Compara las dos direcciones de API propuestas, incluido el impacto en crates de nivel superior como ocb3. Para darlo por terminado se requiere un enfoque decidido, documentación o implementaciones actualizadas de los traits y cobertura para la inicialización con tamaños de clave variables.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 760
- Forks
- 258
- Merge medio
- 2 h 53 min
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de RustCrypto/traits
-
try_sign_digest() is confusing.Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
RustCrypto/traits#2487 · 2 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
RustCrypto/traits#2482 · 5 comentarios ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 32/100
RustCrypto/traits#2478 · 5 comentarios ·
-
cipher: tracking issue for v0.6Abiertocipher
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
RustCrypto/traits#2424 ·
-
`signature` v4 tracking issueAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
RustCrypto/traits#2401 ·
Todos los issues de RustCrypto/traits
Issues similares
-
Four problem loader browser tests fail on WindowsPosiblemente ocupada @Patriciaath999 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Claude Code guards in .claude/settings.json never block: they read unset variables and exit 1Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
starkware-libs/sequencer#15229 ·
Los mantenedores suelen responder en 1 día
-
`fnox set` ignores piped stdin when `--description` is given, saving the secret without a valueAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
ActivityWatch/aw-notify-rs#47 · 1 comentario ·