refactor: make Ed25519 keys less special cased

This commit is contained in:
Adin Schmahmann 2020-07-29 16:32:44 -04:00
parent ab3d2c3342
commit f4030af720

8
key.go
View File

@ -183,11 +183,15 @@ func (key *pKey) VerifyPKCS1v15(method Method, data, sig []byte) error {
ctx := C.X_EVP_MD_CTX_new()
defer C.X_EVP_MD_CTX_free(ctx)
if len(sig) == 0 {
return errors.New("verifypkcs1v15: 0-length sig")
}
if key.KeyType() == KeyTypeED25519 {
// do ED specific one-shot sign
if method != nil || len(data) == 0 || len(sig) == 0 {
return errors.New("verifypkcs1v15: 0-length data or sig or non-null digest")
if method != nil || len(data) == 0 {
return errors.New("verifypkcs1v15: 0-length data or non-null digest")
}
if 1 != C.X_EVP_DigestVerifyInit(ctx, nil, nil, nil, key.key) {