Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from libp2p/refactor/ed25519-less-special
Browse files Browse the repository at this point in the history
make ed25519 less special
  • Loading branch information
aschmahmann committed Jul 29, 2020
2 parents ab3d2c3 + f4030af commit d9b6402
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d9b6402

Please sign in to comment.