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

Fix pointer to AEAD context #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
go build ./...
setlocal
set CC=clang
go build ./...
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
exec go build ./...
export CC=clang
exec go build ./...
8 changes: 4 additions & 4 deletions cryptoaead/crypto_aead_aes256gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func CryptoAEADAES256GCMEncryptAfterNM(m, ad, npub, ctx []byte) ([]byte, int) {
(C.ulonglong)(len(ad)),
(*C.uchar)(nil),
(*C.uchar)(&npub[0]),
(*[512]C.uchar)(unsafe.Pointer(&ctx[0]))))
(*C.crypto_aead_aes256gcm_state)(unsafe.Pointer(&ctx[0]))))

return c, exit
}
Expand All @@ -171,7 +171,7 @@ func CryptoAEADAES256GCMDecryptAfterNM(c, ad, npub, ctx []byte) ([]byte, int) {
(*C.uchar)(support.BytePointer(ad)),
(C.ulonglong)(len(ad)),
(*C.uchar)(&npub[0]),
(*[512]C.uchar)(unsafe.Pointer(&ctx[0]))))
(*C.crypto_aead_aes256gcm_state)(unsafe.Pointer(&ctx[0]))))

return m, exit
}
Expand All @@ -194,7 +194,7 @@ func CryptoAEADAES256GCMEncryptDetachedAfterNM(m, ad, npub, ctx []byte) ([]byte,
(C.ulonglong)(len(ad)),
(*C.uchar)(nil),
(*C.uchar)(&npub[0]),
(*[512]C.uchar)(unsafe.Pointer(&ctx[0]))))
(*C.crypto_aead_aes256gcm_state)(unsafe.Pointer(&ctx[0]))))

return c, mac, exit
}
Expand All @@ -215,7 +215,7 @@ func CryptoAEADAES256GCMDecryptDetachedAfterNM(c, mac, ad, npub, ctx []byte) ([]
(*C.uchar)(support.BytePointer(ad)),
(C.ulonglong)(len(ad)),
(*C.uchar)(&npub[0]),
(*[512]C.uchar)(unsafe.Pointer(&ctx[0]))))
(*C.crypto_aead_aes256gcm_state)(unsafe.Pointer(&ctx[0]))))

return m, exit
}
Expand Down