Skip to content

Commit

Permalink
[libc][cgo] refs fibercrypto#105 Correcting memory error to generate …
Browse files Browse the repository at this point in the history
…`pyskycoin`
  • Loading branch information
Maykel Arias Torres committed Sep 25, 2019
1 parent 8832cd8 commit c402645
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/cgo/cipher.encrypt.scrypt_chacha20poly1305.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"reflect"
"unsafe"

encrypt "github.com/skycoin/skycoin/src/cipher/encrypt"
Expand All @@ -16,28 +17,28 @@ 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))
password := *(*[]byte)(unsafe.Pointer(&_password))
__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
}

0 comments on commit c402645

Please sign in to comment.