From c402645e6c29c7637fb4827ea87280008e4a7d26 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Tue, 24 Sep 2019 23:41:27 -0400 Subject: [PATCH] [libc][cgo] refs #105 Correcting memory error to generate `pyskycoin` --- lib/cgo/cipher.encrypt.scrypt_chacha20poly1305.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cgo/cipher.encrypt.scrypt_chacha20poly1305.go b/lib/cgo/cipher.encrypt.scrypt_chacha20poly1305.go index 4798dc0b8..6141b8401 100644 --- a/lib/cgo/cipher.encrypt.scrypt_chacha20poly1305.go +++ b/lib/cgo/cipher.encrypt.scrypt_chacha20poly1305.go @@ -1,6 +1,7 @@ package main import ( + "reflect" "unsafe" encrypt "github.com/skycoin/skycoin/src/cipher/encrypt" @@ -16,7 +17,7 @@ import ( import "C" //export SKY_encrypt_ScryptChacha20poly1305_Encrypt -func SKY_encrypt_ScryptChacha20poly1305_Encrypt(_s *C.encrypt__ScryptChacha20poly1305, _data []byte, _password []byte, _arg1 *[]byte) (____error_code uint32) { +func SKY_encrypt_ScryptChacha20poly1305_Encrypt(_s *C.encrypt__ScryptChacha20poly1305, _data []byte, _password []byte, _arg1 *C.GoSlice_) (____error_code uint32) { s := *(*encrypt.ScryptChacha20poly1305)(unsafe.Pointer(_s)) data := *(*[]byte)(unsafe.Pointer(&_data)) @@ -24,20 +25,20 @@ func SKY_encrypt_ScryptChacha20poly1305_Encrypt(_s *C.encrypt__ScryptChacha20pol __arg1, ____return_err := s.Encrypt(data, password) ____error_code = libErrorCode(____return_err) if ____return_err == nil { - *_arg1 = __arg1 + copyToGoSlice(reflect.ValueOf(__arg1), _arg1) } return } //export SKY_encrypt_ScryptChacha20poly1305_Decrypt -func SKY_encrypt_ScryptChacha20poly1305_Decrypt(_s *C.encrypt__ScryptChacha20poly1305, _data []byte, _password []byte, _arg1 *[]byte) (____error_code uint32) { +func SKY_encrypt_ScryptChacha20poly1305_Decrypt(_s *C.encrypt__ScryptChacha20poly1305, _data []byte, _password []byte, _arg1 *C.GoSlice_) (____error_code uint32) { s := *(*encrypt.ScryptChacha20poly1305)(unsafe.Pointer(_s)) data := *(*[]byte)(unsafe.Pointer(&_data)) password := *(*[]byte)(unsafe.Pointer(&_password)) __arg1, ____return_err := s.Decrypt(data, password) ____error_code = libErrorCode(____return_err) if ____return_err == nil { - *_arg1 = __arg1 + copyToGoSlice(reflect.ValueOf(__arg1), _arg1) } return }