Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sphincsplus cgo bindings be compatible on all platforms #110

Merged
merged 2 commits into from Dec 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions sphincsplus/ref/binding.go
Expand Up @@ -64,9 +64,9 @@ func (p *PublicKey) Reset() {
// Verify checks whether the given signature is valid.
func (p *PublicKey) Verify(signature, message []byte) bool {
ret := C.crypto_sign_verify((*C.uchar)(unsafe.Pointer(&signature[0])),
C.ulong(len(signature)),
C.size_t(len(signature)),
(*C.uchar)(unsafe.Pointer(&message[0])),
C.ulong(len(message)),
C.size_t(len(message)),
(*C.uchar)(unsafe.Pointer(&p.publicKey[0])))
if ret == 0 {
return true
Expand Down Expand Up @@ -117,11 +117,11 @@ func (p *PrivateKey) Reset() {
// Sign signs the given message and returns the signature.
func (p *PrivateKey) Sign(message []byte) []byte {
signature := make([]byte, C.CRYPTO_BYTES)
sigLen := C.ulong(C.CRYPTO_BYTES)
sigLen := C.size_t(C.CRYPTO_BYTES)
C.crypto_sign_signature((*C.uchar)(unsafe.Pointer(&signature[0])),
&sigLen,
(*C.uchar)(unsafe.Pointer(&message[0])),
(C.ulong)(len(message)),
(C.size_t)(len(message)),
(*C.uchar)(unsafe.Pointer(&p.privateKey[0])))
return signature
}
Expand Down