mirror of
https://github.com/libp2p/go-openssl.git
synced 2025-03-29 14:10:07 +08:00
PA-267: modify sign check values
This commit is contained in:
parent
6253032ea7
commit
33c6d8f445
6
key.go
6
key.go
@ -192,17 +192,17 @@ func (key *pKey) Sign(method Method, data []byte) ([]byte, error) {
|
||||
return nil, fmt.Errorf("EVP_DigestSignInit")
|
||||
}
|
||||
|
||||
if C.X_EVP_DigestSignUpdate(ctx, unsafe.Pointer(&data[0]), C.size_t(len(data))) <= 0 {
|
||||
if C.X_EVP_DigestSignUpdate(ctx, unsafe.Pointer(&data[0]), C.size_t(len(data))) != 1 {
|
||||
return nil, fmt.Errorf("EVP_DigestSignUpdate")
|
||||
}
|
||||
|
||||
var msgLenEnc C.size_t
|
||||
if (C.X_EVP_DigestSignFinal(ctx, nil, &msgLenEnc)) <= 0 {
|
||||
if (C.X_EVP_DigestSignFinal(ctx, nil, &msgLenEnc)) != 1 {
|
||||
return nil, fmt.Errorf("EVP_DigestSignFinal get length")
|
||||
}
|
||||
|
||||
sig := make([]byte, msgLenEnc)
|
||||
if (C.X_EVP_DigestSignFinal(ctx, (*C.uchar)(unsafe.Pointer(&sig[0])), &msgLenEnc)) <= 0 {
|
||||
if (C.X_EVP_DigestSignFinal(ctx, (*C.uchar)(unsafe.Pointer(&sig[0])), &msgLenEnc)) != 1 {
|
||||
return nil, fmt.Errorf("EVP_DigestSignFinal")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user