Skip to content

Commit

Permalink
Fixed compile errors with newer libsodium versions...
Browse files Browse the repository at this point in the history
  • Loading branch information
redragonx committed Feb 8, 2016
1 parent 4a4a5d4 commit 978177a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 7 additions & 2 deletions cryptoaead/crypto_aead_aes256gcm.go
Expand Up @@ -34,9 +34,11 @@ func CryptoAEADAES256GCMEncrypt(m []byte, ad []byte, nsec []byte, npub []byte, k
support.CheckSize(k, CryptoAEADAES256GCMKeyBytes(), "secret key")
support.CheckSize(npub, CryptoAEADAES256GCMNPubBytes(), "public nonce")
c := make([]byte, len(m)+CryptoAEADAES256GCMABytes())
cLen := len(c)
cLenLongLong := (C.ulonglong(cLen))
exit := int(C.crypto_aead_aes256gcm_encrypt(
(*C.uchar)(&c[0]),
(C.ulonglong)(len(c)),
&cLenLongLong,
(*C.uchar)(&m[0]),
(C.ulonglong)(len(m)),
(*C.uchar)(&ad[0]),
Expand All @@ -52,9 +54,12 @@ func CryptoAEADAES256GCMDecrypt(nsec []byte, c []byte, ad []byte, npub []byte, k
support.CheckSize(k, CryptoAEADAES256GCMKeyBytes(), "secret key")
support.CheckSize(npub, CryptoAEADAES256GCMNPubBytes(), "public nonce")
m := make([]byte, len(c)-CryptoAEADAES256GCMABytes())
mLen := len(m)
mLenLongLong := (C.ulonglong)(mLen)

exit := int(C.crypto_aead_aes256gcm_decrypt(
(*C.uchar)(&m[0]),
(C.ulonglong)(len(m)),
&mLenLongLong,
(*C.uchar)(&nsec[0]),
(*C.uchar)(&c[0]),
(C.ulonglong)(len(c)),
Expand Down
4 changes: 0 additions & 4 deletions sodium/runtime.go
Expand Up @@ -5,10 +5,6 @@ package sodium
// #include <sodium.h>
import "C"

func RuntimeGetCpuFeatures() int {
return int(C.sodium_runtime_get_cpu_features())
}

func RuntimeHasNeon() bool {
return C.sodium_runtime_has_neon() != 0
}
Expand Down

0 comments on commit 978177a

Please sign in to comment.