-
Notifications
You must be signed in to change notification settings - Fork 116
bug: hash algorithm defaults to SHA256 for most algorithms #628
Copy link
Copy link
Closed
Description
I am using tuf-on-ci and running into issues when the key scheme is ecdsa-sha2-nistp384 (worth noting that these tests aren't failing when using the python tuf client)
I've root caused the issue to the hash algorithm basically hardcoded to use SHA256 here:
Lines 312 to 316 in 48216cf
| // use corresponding hash function for key type | |
| hash := crypto.Hash(0) | |
| if key.Type != KeyTypeEd25519 { | |
| hash = crypto.SHA256 | |
| } |
It looks like mainly the 256-bit curves are supported here but with a slight change this would also support ECDSA P384.
I've modified this code to the following locally and clear the error using ecdsa-sha2-nistp384 as the key scheme:
// use corresponding hash function for key type
hash := crypto.Hash(0)
if key.Type != KeyTypeEd25519 {
switch key.Scheme {
case KeySchemeECDSA_SHA2_P256:
hash = crypto.SHA256
case KeySchemeECDSA_SHA2_P384:
hash = crypto.SHA384
default:
hash = crypto.SHA256
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels