refactor(python): use ML-DSA-44 OID from cryptography
What changed, and why it matters
This is a minor code cleanup in the Python Trezor library. It replaces a hard-coded identifier for the ML-DSA-44 signature algorithm with the official constant provided by the cryptography library. There is no security bug being fixed and no change in behavior for users.
No action required. This is a routine dependency-driven refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes a local ObjectIdentifier constant (2.16.840.1.101.3.4.3.17) for ML-DSA-44 and uses cryptography’s SignatureAlgorithmOID.ML_DSA_44 instead. The OID value is identical; only the source of the constant changes. This is a pure refactor with no functional or security impact.
Changed components
python/src/trezorlib/authentication.pyInspect captured patch +2 / −4
### python/src/trezorlib/authentication.py
@@ -69,8 +69,6 @@ def get_challenge_message(challenge: bytes) -> bytes:
NameOID.DN_QUALIFIER: "DNQ",
}
-MLDSA44_SIGNATURE_ALG_OID = ObjectIdentifier("2.16.840.1.101.3.4.3.17")
-
class DeviceNotAuthentic(Exception):
pass
@@ -104,7 +102,7 @@ def from_bytes_and_oid(data: bytes, oid: ObjectIdentifier) -> PublicKey:
return EcdsaPublicKey.from_bytes(data, ec.SECP256R1())
elif oid == SignatureAlgorithmOID.ED25519:
return Ed25519PublicKey.from_bytes(data)
- elif oid == MLDSA44_SIGNATURE_ALG_OID:
+ elif oid == SignatureAlgorithmOID.ML_DSA_44:
return Mldsa44PublicKey.from_bytes(data)
else:
raise ValueError("Unsupported key type.")
@@ -285,7 +283,7 @@ def pubkey_for_oid(self, oid: ObjectIdentifier) -> PublicKey:
if self.ed25519_pubkey is None:
raise ValueError("ED25519 public key not set.")
return self.ed25519_pubkey
- elif oid == MLDSA44_SIGNATURE_ALG_OID:
+ elif oid == SignatureAlgorithmOID.ML_DSA_44:
if self.mldsa44_pubkey is None:
raise ValueError("ML-DSA-44 public key not set.")
return self.mldsa44_pubkeyWhy this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.