RSA key import can succeed with an invalid/undefined version #803
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt#803
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In
rsa_import_pkcs1, after handlingversion == 0andversion == 1, there is no fallback case:Affected Code
src/pk/rsa/rsa_import.c:57-78
An unsupported version or a not set version retaining its initial value (
-1) could therefore fall through andreturn CRYPT_OKeven though no key fields were decoded. The key could be uninitialized.Suggested Fix
add this branch:
This ensures that
rsa_import_pkcs1never reports successful key import unless a supported RSA key version was actually decoded.