diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..a3fc2d3 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,31 @@ +--- +kind: pipeline +name: default + +steps: + - name: Build library + image: gcc:10.2 + environment: + JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64 + commands: + - apt-get update + - apt-get install -y openjdk-11-jdk + - make -j 4 + + - name: publish + image: plugins/github-release + settings: + api_key: + from_secret: kite_bot_key + files: libmpc_crypto.so + checksum: + - md5 + - sha256 + - sha512 + when: + event: [tag] + +trigger: + event: + - push + - tag diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4581ef2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app diff --git a/include/mpc_crypto.h b/include/mpc_crypto.h index 0b9b764..209a7eb 100644 --- a/include/mpc_crypto.h +++ b/include/mpc_crypto.h @@ -43,22 +43,21 @@ typedef struct tag_MPCCryptoKey MPCCryptoShare; typedef struct tag_MPCCryptoContext MPCCryptoContext; typedef struct tag_MPCCryptoMessage MPCCryptoMessage; -enum mpc_crypto_key_e : unsigned +typedef enum { mpc_none = 0, - mpc_eddsa = 2, mpc_ecdsa = 3, mpc_generic_secret = 4, // used for the seed -}; +} mpc_crypto_key_e; -enum mpc_crypto_err_e +typedef enum { MPC_E_BADARG = 0xff010002, // bad argument MPC_E_FORMAT = 0xff010003, // invalid format MPC_E_TOO_SMALL = 0xff010008, // buffer too small MPC_E_CRYPTO = 0xff040001, // crypto error, process is being tampered -}; +} mpc_crypto_err_e; typedef struct tag_mpc_crypto_share_info_t { diff --git a/mpc.yml b/mpc.yml new file mode 100644 index 0000000..c3f0d3e --- /dev/null +++ b/mpc.yml @@ -0,0 +1,22 @@ +--- +GENERATOR: + PackageName: "mpc" + PackageDescription: "Package crypto-mpc provides Go bindings for blockchain-crypto-mpc, library released by Unbound Tech" + PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS." + Includes: ["mpc_crypto.h"] + +PARSER: + IncludePaths: ["/usr/include", "/usr/local/include", "/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include"] + SourcesPaths: ["include/mpc_crypto.h"] + +TRANSLATOR: + ConstRules: + defines: eval + PtrTips: + function: + Rules: + global: + - {transform: lower} + - {action: accept, from: "^MPCCrypto_"} + - {action: replace, from: "^MPCCrypto_", to: "mpc_"} + - {transform: export} diff --git a/mpc/cgo_helpers.go b/mpc/cgo_helpers.go new file mode 100644 index 0000000..e0f9982 --- /dev/null +++ b/mpc/cgo_helpers.go @@ -0,0 +1,444 @@ +// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. + +// WARNING: This file has automatically been generated on Mon, 19 Oct 2020 01:59:52 EEST. +// Code generated by https://git.io/c-for-go. DO NOT EDIT. + +package mpc + +/* +#include "mpc_crypto.h" +#include +#include "cgo_helpers.h" +*/ +import "C" +import ( + "fmt" + "runtime" + "sync" + "unsafe" +) + +// cgoAllocMap stores pointers to C allocated memory for future reference. +type cgoAllocMap struct { + mux sync.RWMutex + m map[unsafe.Pointer]struct{} +} + +var cgoAllocsUnknown = new(cgoAllocMap) + +func (a *cgoAllocMap) Add(ptr unsafe.Pointer) { + a.mux.Lock() + if a.m == nil { + a.m = make(map[unsafe.Pointer]struct{}) + } + a.m[ptr] = struct{}{} + a.mux.Unlock() +} + +func (a *cgoAllocMap) IsEmpty() bool { + a.mux.RLock() + isEmpty := len(a.m) == 0 + a.mux.RUnlock() + return isEmpty +} + +func (a *cgoAllocMap) Borrow(b *cgoAllocMap) { + if b == nil || b.IsEmpty() { + return + } + b.mux.Lock() + a.mux.Lock() + for ptr := range b.m { + if a.m == nil { + a.m = make(map[unsafe.Pointer]struct{}) + } + a.m[ptr] = struct{}{} + delete(b.m, ptr) + } + a.mux.Unlock() + b.mux.Unlock() +} + +func (a *cgoAllocMap) Free() { + a.mux.Lock() + for ptr := range a.m { + C.free(ptr) + delete(a.m, ptr) + } + a.mux.Unlock() +} + +type sliceHeader struct { + Data unsafe.Pointer + Len int + Cap int +} + +// unpackPUint8_tString represents the data from Go string as *C.uint8_t and avoids copying. +func unpackPUint8_tString(str string) (*C.uint8_t, *cgoAllocMap) { + h := (*stringHeader)(unsafe.Pointer(&str)) + return (*C.uint8_t)(h.Data), cgoAllocsUnknown +} + +type stringHeader struct { + Data unsafe.Pointer + Len int +} + +// allocPMpccryptoshareMemory allocates memory for type *C.MPCCryptoShare in C. +// The caller is responsible for freeing the this memory via C.free. +func allocPMpccryptoshareMemory(n int) unsafe.Pointer { + mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPMpccryptoshareValue)) + if mem == nil { + panic(fmt.Sprintln("memory alloc error: ", err)) + } + return mem +} + +const sizeOfPMpccryptoshareValue = unsafe.Sizeof([1]*C.MPCCryptoShare{}) + +const sizeOfPtr = unsafe.Sizeof(&struct{}{}) + +// unpackArgSSMpccryptoshare transforms a sliced Go data structure into plain C format. +func unpackArgSSMpccryptoshare(x [][]Mpccryptoshare) (unpacked **C.MPCCryptoShare, allocs *cgoAllocMap) { + if x == nil { + return nil, nil + } + allocs = new(cgoAllocMap) + defer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) { + go a.Free() + }) + + len0 := len(x) + mem0 := allocPMpccryptoshareMemory(len0) + allocs.Add(mem0) + h0 := &sliceHeader{ + Data: mem0, + Cap: len0, + Len: len0, + } + v0 := *(*[]*C.MPCCryptoShare)(unsafe.Pointer(h0)) + for i0 := range x { + h := (*sliceHeader)(unsafe.Pointer(&x[i0])) + v0[i0] = (*C.MPCCryptoShare)(h.Data) + } + h := (*sliceHeader)(unsafe.Pointer(&v0)) + unpacked = (**C.MPCCryptoShare)(h.Data) + return +} + +// packSSMpccryptoshare reads sliced Go data structure out from plain C format. +func packSSMpccryptoshare(v [][]Mpccryptoshare, ptr0 **C.MPCCryptoShare) { + const m = 0x7fffffff + for i0 := range v { + ptr1 := (*(*[m / sizeOfPtr]*C.MPCCryptoShare)(unsafe.Pointer(ptr0)))[i0] + hxfc4425b := (*sliceHeader)(unsafe.Pointer(&v[i0])) + hxfc4425b.Data = unsafe.Pointer(ptr1) + hxfc4425b.Cap = 0x7fffffff + // hxfc4425b.Len = ? + } +} + +// allocPMpccryptocontextMemory allocates memory for type *C.MPCCryptoContext in C. +// The caller is responsible for freeing the this memory via C.free. +func allocPMpccryptocontextMemory(n int) unsafe.Pointer { + mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPMpccryptocontextValue)) + if mem == nil { + panic(fmt.Sprintln("memory alloc error: ", err)) + } + return mem +} + +const sizeOfPMpccryptocontextValue = unsafe.Sizeof([1]*C.MPCCryptoContext{}) + +// unpackArgSSMpccryptocontext transforms a sliced Go data structure into plain C format. +func unpackArgSSMpccryptocontext(x [][]Mpccryptocontext) (unpacked **C.MPCCryptoContext, allocs *cgoAllocMap) { + if x == nil { + return nil, nil + } + allocs = new(cgoAllocMap) + defer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) { + go a.Free() + }) + + len0 := len(x) + mem0 := allocPMpccryptocontextMemory(len0) + allocs.Add(mem0) + h0 := &sliceHeader{ + Data: mem0, + Cap: len0, + Len: len0, + } + v0 := *(*[]*C.MPCCryptoContext)(unsafe.Pointer(h0)) + for i0 := range x { + h := (*sliceHeader)(unsafe.Pointer(&x[i0])) + v0[i0] = (*C.MPCCryptoContext)(h.Data) + } + h := (*sliceHeader)(unsafe.Pointer(&v0)) + unpacked = (**C.MPCCryptoContext)(h.Data) + return +} + +// packSSMpccryptocontext reads sliced Go data structure out from plain C format. +func packSSMpccryptocontext(v [][]Mpccryptocontext, ptr0 **C.MPCCryptoContext) { + const m = 0x7fffffff + for i0 := range v { + ptr1 := (*(*[m / sizeOfPtr]*C.MPCCryptoContext)(unsafe.Pointer(ptr0)))[i0] + hxf95e7c8 := (*sliceHeader)(unsafe.Pointer(&v[i0])) + hxf95e7c8.Data = unsafe.Pointer(ptr1) + hxf95e7c8.Cap = 0x7fffffff + // hxf95e7c8.Len = ? + } +} + +// allocPMpccryptomessageMemory allocates memory for type *C.MPCCryptoMessage in C. +// The caller is responsible for freeing the this memory via C.free. +func allocPMpccryptomessageMemory(n int) unsafe.Pointer { + mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPMpccryptomessageValue)) + if mem == nil { + panic(fmt.Sprintln("memory alloc error: ", err)) + } + return mem +} + +const sizeOfPMpccryptomessageValue = unsafe.Sizeof([1]*C.MPCCryptoMessage{}) + +// unpackArgSSMpccryptomessage transforms a sliced Go data structure into plain C format. +func unpackArgSSMpccryptomessage(x [][]Mpccryptomessage) (unpacked **C.MPCCryptoMessage, allocs *cgoAllocMap) { + if x == nil { + return nil, nil + } + allocs = new(cgoAllocMap) + defer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) { + go a.Free() + }) + + len0 := len(x) + mem0 := allocPMpccryptomessageMemory(len0) + allocs.Add(mem0) + h0 := &sliceHeader{ + Data: mem0, + Cap: len0, + Len: len0, + } + v0 := *(*[]*C.MPCCryptoMessage)(unsafe.Pointer(h0)) + for i0 := range x { + h := (*sliceHeader)(unsafe.Pointer(&x[i0])) + v0[i0] = (*C.MPCCryptoMessage)(h.Data) + } + h := (*sliceHeader)(unsafe.Pointer(&v0)) + unpacked = (**C.MPCCryptoMessage)(h.Data) + return +} + +// packSSMpccryptomessage reads sliced Go data structure out from plain C format. +func packSSMpccryptomessage(v [][]Mpccryptomessage, ptr0 **C.MPCCryptoMessage) { + const m = 0x7fffffff + for i0 := range v { + ptr1 := (*(*[m / sizeOfPtr]*C.MPCCryptoMessage)(unsafe.Pointer(ptr0)))[i0] + hxff2234b := (*sliceHeader)(unsafe.Pointer(&v[i0])) + hxff2234b.Data = unsafe.Pointer(ptr1) + hxff2234b.Cap = 0x7fffffff + // hxff2234b.Len = ? + } +} + +// allocMpc_crypto_share_info_tMemory allocates memory for type C.mpc_crypto_share_info_t in C. +// The caller is responsible for freeing the this memory via C.free. +func allocMpc_crypto_share_info_tMemory(n int) unsafe.Pointer { + mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfMpc_crypto_share_info_tValue)) + if mem == nil { + panic(fmt.Sprintln("memory alloc error: ", err)) + } + return mem +} + +const sizeOfMpc_crypto_share_info_tValue = unsafe.Sizeof([1]C.mpc_crypto_share_info_t{}) + +// unpackArgSMpc_crypto_share_info_t transforms a sliced Go data structure into plain C format. +func unpackArgSMpc_crypto_share_info_t(x []Mpc_crypto_share_info_t) (unpacked *C.mpc_crypto_share_info_t, allocs *cgoAllocMap) { + if x == nil { + return nil, nil + } + allocs = new(cgoAllocMap) + defer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) { + go a.Free() + }) + + len0 := len(x) + mem0 := allocMpc_crypto_share_info_tMemory(len0) + allocs.Add(mem0) + h0 := &sliceHeader{ + Data: mem0, + Cap: len0, + Len: len0, + } + v0 := *(*[]C.mpc_crypto_share_info_t)(unsafe.Pointer(h0)) + for i0 := range x { + allocs0 := new(cgoAllocMap) + v0[i0], allocs0 = x[i0].PassValue() + allocs.Borrow(allocs0) + } + h := (*sliceHeader)(unsafe.Pointer(&v0)) + unpacked = (*C.mpc_crypto_share_info_t)(h.Data) + return +} + +// packSMpc_crypto_share_info_t reads sliced Go data structure out from plain C format. +func packSMpc_crypto_share_info_t(v []Mpc_crypto_share_info_t, ptr0 *C.mpc_crypto_share_info_t) { + const m = 0x7fffffff + for i0 := range v { + ptr1 := (*(*[m / sizeOfMpc_crypto_share_info_tValue]C.mpc_crypto_share_info_t)(unsafe.Pointer(ptr0)))[i0] + v[i0] = *NewMpc_crypto_share_info_tRef(unsafe.Pointer(&ptr1)) + } +} + +// allocMpc_crypto_context_info_tMemory allocates memory for type C.mpc_crypto_context_info_t in C. +// The caller is responsible for freeing the this memory via C.free. +func allocMpc_crypto_context_info_tMemory(n int) unsafe.Pointer { + mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfMpc_crypto_context_info_tValue)) + if mem == nil { + panic(fmt.Sprintln("memory alloc error: ", err)) + } + return mem +} + +const sizeOfMpc_crypto_context_info_tValue = unsafe.Sizeof([1]C.mpc_crypto_context_info_t{}) + +// unpackArgSMpc_crypto_context_info_t transforms a sliced Go data structure into plain C format. +func unpackArgSMpc_crypto_context_info_t(x []Mpc_crypto_context_info_t) (unpacked *C.mpc_crypto_context_info_t, allocs *cgoAllocMap) { + if x == nil { + return nil, nil + } + allocs = new(cgoAllocMap) + defer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) { + go a.Free() + }) + + len0 := len(x) + mem0 := allocMpc_crypto_context_info_tMemory(len0) + allocs.Add(mem0) + h0 := &sliceHeader{ + Data: mem0, + Cap: len0, + Len: len0, + } + v0 := *(*[]C.mpc_crypto_context_info_t)(unsafe.Pointer(h0)) + for i0 := range x { + allocs0 := new(cgoAllocMap) + v0[i0], allocs0 = x[i0].PassValue() + allocs.Borrow(allocs0) + } + h := (*sliceHeader)(unsafe.Pointer(&v0)) + unpacked = (*C.mpc_crypto_context_info_t)(h.Data) + return +} + +// packSMpc_crypto_context_info_t reads sliced Go data structure out from plain C format. +func packSMpc_crypto_context_info_t(v []Mpc_crypto_context_info_t, ptr0 *C.mpc_crypto_context_info_t) { + const m = 0x7fffffff + for i0 := range v { + ptr1 := (*(*[m / sizeOfMpc_crypto_context_info_tValue]C.mpc_crypto_context_info_t)(unsafe.Pointer(ptr0)))[i0] + v[i0] = *NewMpc_crypto_context_info_tRef(unsafe.Pointer(&ptr1)) + } +} + +// allocMpc_crypto_message_info_tMemory allocates memory for type C.mpc_crypto_message_info_t in C. +// The caller is responsible for freeing the this memory via C.free. +func allocMpc_crypto_message_info_tMemory(n int) unsafe.Pointer { + mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfMpc_crypto_message_info_tValue)) + if mem == nil { + panic(fmt.Sprintln("memory alloc error: ", err)) + } + return mem +} + +const sizeOfMpc_crypto_message_info_tValue = unsafe.Sizeof([1]C.mpc_crypto_message_info_t{}) + +// unpackArgSMpc_crypto_message_info_t transforms a sliced Go data structure into plain C format. +func unpackArgSMpc_crypto_message_info_t(x []Mpc_crypto_message_info_t) (unpacked *C.mpc_crypto_message_info_t, allocs *cgoAllocMap) { + if x == nil { + return nil, nil + } + allocs = new(cgoAllocMap) + defer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) { + go a.Free() + }) + + len0 := len(x) + mem0 := allocMpc_crypto_message_info_tMemory(len0) + allocs.Add(mem0) + h0 := &sliceHeader{ + Data: mem0, + Cap: len0, + Len: len0, + } + v0 := *(*[]C.mpc_crypto_message_info_t)(unsafe.Pointer(h0)) + for i0 := range x { + allocs0 := new(cgoAllocMap) + v0[i0], allocs0 = x[i0].PassValue() + allocs.Borrow(allocs0) + } + h := (*sliceHeader)(unsafe.Pointer(&v0)) + unpacked = (*C.mpc_crypto_message_info_t)(h.Data) + return +} + +// packSMpc_crypto_message_info_t reads sliced Go data structure out from plain C format. +func packSMpc_crypto_message_info_t(v []Mpc_crypto_message_info_t, ptr0 *C.mpc_crypto_message_info_t) { + const m = 0x7fffffff + for i0 := range v { + ptr1 := (*(*[m / sizeOfMpc_crypto_message_info_tValue]C.mpc_crypto_message_info_t)(unsafe.Pointer(ptr0)))[i0] + v[i0] = *NewMpc_crypto_message_info_tRef(unsafe.Pointer(&ptr1)) + } +} + +// allocBip32_info_tMemory allocates memory for type C.bip32_info_t in C. +// The caller is responsible for freeing the this memory via C.free. +func allocBip32_info_tMemory(n int) unsafe.Pointer { + mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfBip32_info_tValue)) + if mem == nil { + panic(fmt.Sprintln("memory alloc error: ", err)) + } + return mem +} + +const sizeOfBip32_info_tValue = unsafe.Sizeof([1]C.bip32_info_t{}) + +// unpackArgSBip32_info_t transforms a sliced Go data structure into plain C format. +func unpackArgSBip32_info_t(x []Bip32_info_t) (unpacked *C.bip32_info_t, allocs *cgoAllocMap) { + if x == nil { + return nil, nil + } + allocs = new(cgoAllocMap) + defer runtime.SetFinalizer(allocs, func(a *cgoAllocMap) { + go a.Free() + }) + + len0 := len(x) + mem0 := allocBip32_info_tMemory(len0) + allocs.Add(mem0) + h0 := &sliceHeader{ + Data: mem0, + Cap: len0, + Len: len0, + } + v0 := *(*[]C.bip32_info_t)(unsafe.Pointer(h0)) + for i0 := range x { + allocs0 := new(cgoAllocMap) + v0[i0], allocs0 = x[i0].PassValue() + allocs.Borrow(allocs0) + } + h := (*sliceHeader)(unsafe.Pointer(&v0)) + unpacked = (*C.bip32_info_t)(h.Data) + return +} + +// packSBip32_info_t reads sliced Go data structure out from plain C format. +func packSBip32_info_t(v []Bip32_info_t, ptr0 *C.bip32_info_t) { + const m = 0x7fffffff + for i0 := range v { + ptr1 := (*(*[m / sizeOfBip32_info_tValue]C.bip32_info_t)(unsafe.Pointer(ptr0)))[i0] + v[i0] = *NewBip32_info_tRef(unsafe.Pointer(&ptr1)) + } +} diff --git a/mpc/cgo_helpers.h b/mpc/cgo_helpers.h new file mode 100644 index 0000000..19c958a --- /dev/null +++ b/mpc/cgo_helpers.h @@ -0,0 +1,11 @@ +// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. + +// WARNING: This file has automatically been generated on Mon, 19 Oct 2020 01:59:52 EEST. +// Code generated by https://git.io/c-for-go. DO NOT EDIT. + +#include "mpc_crypto.h" +#include +#pragma once + +#define __CGOGEN 1 + diff --git a/mpc/const.go b/mpc/const.go new file mode 100644 index 0000000..20e6e44 --- /dev/null +++ b/mpc/const.go @@ -0,0 +1,19 @@ +// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. + +// WARNING: This file has automatically been generated on Mon, 19 Oct 2020 01:59:52 EEST. +// Code generated by https://git.io/c-for-go. DO NOT EDIT. + +package mpc + +/* +#include "mpc_crypto.h" +#include +#include "cgo_helpers.h" +*/ +import "C" + +// Mpc_step_flags_e as declared in include/mpc_crypto.h:93 +type Mpc_step_flags_e int32 + +// Mpc_step_flags_e enumeration from include/mpc_crypto.h:93 +const () diff --git a/mpc/doc.go b/mpc/doc.go new file mode 100644 index 0000000..dc7b36b --- /dev/null +++ b/mpc/doc.go @@ -0,0 +1,9 @@ +// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. + +// WARNING: This file has automatically been generated on Mon, 19 Oct 2020 01:59:52 EEST. +// Code generated by https://git.io/c-for-go. DO NOT EDIT. + +/* +Package crypto-mpc provides Go bindings for blockchain-crypto-mpc, library released by Unbound Tech +*/ +package mpc diff --git a/mpc/mpc.go b/mpc/mpc.go new file mode 100644 index 0000000..635a373 --- /dev/null +++ b/mpc/mpc.go @@ -0,0 +1,568 @@ +// THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS. + +// WARNING: This file has automatically been generated on Mon, 19 Oct 2020 01:59:52 EEST. +// Code generated by https://git.io/c-for-go. DO NOT EDIT. + +package mpc + +/* +#include "mpc_crypto.h" +#include +#include "cgo_helpers.h" +*/ +import "C" +import ( + "runtime" + "unsafe" +) + +// Mpccrypto_freeshare function as declared in include/mpc_crypto.h:100 +func Mpccrypto_freeshare(Share []Mpccryptoshare) { + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + C.MPCCrypto_freeShare(cShare) + runtime.KeepAlive(cShareAllocMap) +} + +// Mpccrypto_freecontext function as declared in include/mpc_crypto.h:101 +func Mpccrypto_freecontext(Context []Mpccryptocontext) { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + C.MPCCrypto_freeContext(cContext) + runtime.KeepAlive(cContextAllocMap) +} + +// Mpccrypto_freemessage function as declared in include/mpc_crypto.h:102 +func Mpccrypto_freemessage(Message []Mpccryptomessage) { + cMessage, cMessageAllocMap := (*C.MPCCryptoMessage)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Message)).Data)), cgoAllocsUnknown + C.MPCCrypto_freeMessage(cMessage) + runtime.KeepAlive(cMessageAllocMap) +} + +// Mpccrypto_sharetobuf function as declared in include/mpc_crypto.h:105 +func Mpccrypto_sharetobuf(Share []Mpccryptoshare, Out []byte, Out_size []int32) int32 { + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cOut, cOutAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out)).Data)), cgoAllocsUnknown + cOut_size, cOut_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_shareToBuf(cShare, cOut, cOut_size) + runtime.KeepAlive(cOut_sizeAllocMap) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cShareAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_contexttobuf function as declared in include/mpc_crypto.h:106 +func Mpccrypto_contexttobuf(Context []Mpccryptocontext, Out []byte, Out_size []int32) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cOut, cOutAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out)).Data)), cgoAllocsUnknown + cOut_size, cOut_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_contextToBuf(cContext, cOut, cOut_size) + runtime.KeepAlive(cOut_sizeAllocMap) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_messagetobuf function as declared in include/mpc_crypto.h:107 +func Mpccrypto_messagetobuf(Message []Mpccryptomessage, Out []byte, Out_size []int32) int32 { + cMessage, cMessageAllocMap := (*C.MPCCryptoMessage)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Message)).Data)), cgoAllocsUnknown + cOut, cOutAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out)).Data)), cgoAllocsUnknown + cOut_size, cOut_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_messageToBuf(cMessage, cOut, cOut_size) + runtime.KeepAlive(cOut_sizeAllocMap) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cMessageAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_sharefrombuf function as declared in include/mpc_crypto.h:110 +func Mpccrypto_sharefrombuf(In string, In_size int32, Share [][]Mpccryptoshare) int32 { + cIn, cInAllocMap := unpackPUint8_tString(In) + cIn_size, cIn_sizeAllocMap := (C.int)(In_size), cgoAllocsUnknown + cShare, cShareAllocMap := unpackArgSSMpccryptoshare(Share) + __ret := C.MPCCrypto_shareFromBuf(cIn, cIn_size, cShare) + packSSMpccryptoshare(Share, cShare) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cIn_sizeAllocMap) + runtime.KeepAlive(cInAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_contextfrombuf function as declared in include/mpc_crypto.h:111 +func Mpccrypto_contextfrombuf(In string, In_size int32, Context [][]Mpccryptocontext) int32 { + cIn, cInAllocMap := unpackPUint8_tString(In) + cIn_size, cIn_sizeAllocMap := (C.int)(In_size), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_contextFromBuf(cIn, cIn_size, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cIn_sizeAllocMap) + runtime.KeepAlive(cInAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_messagefrombuf function as declared in include/mpc_crypto.h:112 +func Mpccrypto_messagefrombuf(In string, In_size int32, Message [][]Mpccryptomessage) int32 { + cIn, cInAllocMap := unpackPUint8_tString(In) + cIn_size, cIn_sizeAllocMap := (C.int)(In_size), cgoAllocsUnknown + cMessage, cMessageAllocMap := unpackArgSSMpccryptomessage(Message) + __ret := C.MPCCrypto_messageFromBuf(cIn, cIn_size, cMessage) + packSSMpccryptomessage(Message, cMessage) + runtime.KeepAlive(cMessageAllocMap) + runtime.KeepAlive(cIn_sizeAllocMap) + runtime.KeepAlive(cInAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_shareinfo function as declared in include/mpc_crypto.h:115 +func Mpccrypto_shareinfo(Share []Mpccryptoshare, Info []Mpc_crypto_share_info_t) int32 { + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cInfo, cInfoAllocMap := unpackArgSMpc_crypto_share_info_t(Info) + __ret := C.MPCCrypto_shareInfo(cShare, cInfo) + packSMpc_crypto_share_info_t(Info, cInfo) + runtime.KeepAlive(cInfoAllocMap) + runtime.KeepAlive(cShareAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_contextinfo function as declared in include/mpc_crypto.h:116 +func Mpccrypto_contextinfo(Context []Mpccryptocontext, Info []Mpc_crypto_context_info_t) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cInfo, cInfoAllocMap := unpackArgSMpc_crypto_context_info_t(Info) + __ret := C.MPCCrypto_contextInfo(cContext, cInfo) + packSMpc_crypto_context_info_t(Info, cInfo) + runtime.KeepAlive(cInfoAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_messageinfo function as declared in include/mpc_crypto.h:117 +func Mpccrypto_messageinfo(Message []Mpccryptomessage, Info []Mpc_crypto_message_info_t) int32 { + cMessage, cMessageAllocMap := (*C.MPCCryptoMessage)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Message)).Data)), cgoAllocsUnknown + cInfo, cInfoAllocMap := unpackArgSMpc_crypto_message_info_t(Info) + __ret := C.MPCCrypto_messageInfo(cMessage, cInfo) + packSMpc_crypto_message_info_t(Info, cInfo) + runtime.KeepAlive(cInfoAllocMap) + runtime.KeepAlive(cMessageAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_step function as declared in include/mpc_crypto.h:120 +func Mpccrypto_step(Context []Mpccryptocontext, In []Mpccryptomessage, Out [][]Mpccryptomessage, Flags []uint32) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cIn, cInAllocMap := (*C.MPCCryptoMessage)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&In)).Data)), cgoAllocsUnknown + cOut, cOutAllocMap := unpackArgSSMpccryptomessage(Out) + cFlags, cFlagsAllocMap := (*C.uint)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Flags)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_step(cContext, cIn, cOut, cFlags) + runtime.KeepAlive(cFlagsAllocMap) + packSSMpccryptomessage(Out, cOut) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cInAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getshare function as declared in include/mpc_crypto.h:123 +func Mpccrypto_getshare(Context []Mpccryptocontext, Share [][]Mpccryptoshare) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cShare, cShareAllocMap := unpackArgSSMpccryptoshare(Share) + __ret := C.MPCCrypto_getShare(cContext, cShare) + packSSMpccryptoshare(Share, cShare) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initrefreshkey function as declared in include/mpc_crypto.h:126 +func Mpccrypto_initrefreshkey(Peer int32, Share []Mpccryptoshare, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initRefreshKey(cPeer, cShare, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initgenerateeddsakey function as declared in include/mpc_crypto.h:129 +func Mpccrypto_initgenerateeddsakey(Peer int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initGenerateEddsaKey(cPeer, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initeddsasign function as declared in include/mpc_crypto.h:130 +func Mpccrypto_initeddsasign(Peer int32, Share []Mpccryptoshare, In string, In_size int32, Refresh int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cIn, cInAllocMap := unpackPUint8_tString(In) + cIn_size, cIn_sizeAllocMap := (C.int)(In_size), cgoAllocsUnknown + cRefresh, cRefreshAllocMap := (C.int)(Refresh), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initEddsaSign(cPeer, cShare, cIn, cIn_size, cRefresh, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cRefreshAllocMap) + runtime.KeepAlive(cIn_sizeAllocMap) + runtime.KeepAlive(cInAllocMap) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getresulteddsasign function as declared in include/mpc_crypto.h:131 +func Mpccrypto_getresulteddsasign(Context []Mpccryptocontext, Signature []byte) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cSignature, cSignatureAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Signature)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_getResultEddsaSign(cContext, cSignature) + runtime.KeepAlive(cSignatureAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_verifyeddsa function as declared in include/mpc_crypto.h:132 +func Mpccrypto_verifyeddsa(Pub_key string, In string, In_size int32, Signature string) int32 { + cPub_key, cPub_keyAllocMap := unpackPUint8_tString(Pub_key) + cIn, cInAllocMap := unpackPUint8_tString(In) + cIn_size, cIn_sizeAllocMap := (C.int)(In_size), cgoAllocsUnknown + cSignature, cSignatureAllocMap := unpackPUint8_tString(Signature) + __ret := C.MPCCrypto_verifyEddsa(cPub_key, cIn, cIn_size, cSignature) + runtime.KeepAlive(cSignatureAllocMap) + runtime.KeepAlive(cIn_sizeAllocMap) + runtime.KeepAlive(cInAllocMap) + runtime.KeepAlive(cPub_keyAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_geteddsapublic function as declared in include/mpc_crypto.h:133 +func Mpccrypto_geteddsapublic(Share []Mpccryptoshare, Pub_key []byte) int32 { + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cPub_key, cPub_keyAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Pub_key)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_getEddsaPublic(cShare, cPub_key) + runtime.KeepAlive(cPub_keyAllocMap) + runtime.KeepAlive(cShareAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initgenerateecdsakey function as declared in include/mpc_crypto.h:136 +func Mpccrypto_initgenerateecdsakey(Peer int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initGenerateEcdsaKey(cPeer, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initecdsasign function as declared in include/mpc_crypto.h:137 +func Mpccrypto_initecdsasign(Peer int32, Share []Mpccryptoshare, In string, In_size int32, Refresh int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cIn, cInAllocMap := unpackPUint8_tString(In) + cIn_size, cIn_sizeAllocMap := (C.int)(In_size), cgoAllocsUnknown + cRefresh, cRefreshAllocMap := (C.int)(Refresh), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initEcdsaSign(cPeer, cShare, cIn, cIn_size, cRefresh, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cRefreshAllocMap) + runtime.KeepAlive(cIn_sizeAllocMap) + runtime.KeepAlive(cInAllocMap) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getresultecdsasign function as declared in include/mpc_crypto.h:138 +func Mpccrypto_getresultecdsasign(Context []Mpccryptocontext, Signature []byte, Out_size []int32) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cSignature, cSignatureAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Signature)).Data)), cgoAllocsUnknown + cOut_size, cOut_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_getResultEcdsaSign(cContext, cSignature, cOut_size) + runtime.KeepAlive(cOut_sizeAllocMap) + runtime.KeepAlive(cSignatureAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_verifyecdsa function as declared in include/mpc_crypto.h:139 +func Mpccrypto_verifyecdsa(Pub_key string, Pub_key_size int32, In string, In_size int32, Signature string, Signature_size int32) int32 { + cPub_key, cPub_keyAllocMap := unpackPUint8_tString(Pub_key) + cPub_key_size, cPub_key_sizeAllocMap := (C.int)(Pub_key_size), cgoAllocsUnknown + cIn, cInAllocMap := unpackPUint8_tString(In) + cIn_size, cIn_sizeAllocMap := (C.int)(In_size), cgoAllocsUnknown + cSignature, cSignatureAllocMap := unpackPUint8_tString(Signature) + cSignature_size, cSignature_sizeAllocMap := (C.int)(Signature_size), cgoAllocsUnknown + __ret := C.MPCCrypto_verifyEcdsa(cPub_key, cPub_key_size, cIn, cIn_size, cSignature, cSignature_size) + runtime.KeepAlive(cSignature_sizeAllocMap) + runtime.KeepAlive(cSignatureAllocMap) + runtime.KeepAlive(cIn_sizeAllocMap) + runtime.KeepAlive(cInAllocMap) + runtime.KeepAlive(cPub_key_sizeAllocMap) + runtime.KeepAlive(cPub_keyAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getecdsapublic function as declared in include/mpc_crypto.h:140 +func Mpccrypto_getecdsapublic(Share []Mpccryptoshare, Pub_key []byte, Pub_key_size []int32) int32 { + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cPub_key, cPub_keyAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Pub_key)).Data)), cgoAllocsUnknown + cPub_key_size, cPub_key_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Pub_key_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_getEcdsaPublic(cShare, cPub_key, cPub_key_size) + runtime.KeepAlive(cPub_key_sizeAllocMap) + runtime.KeepAlive(cPub_keyAllocMap) + runtime.KeepAlive(cShareAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initgenerategenericsecret function as declared in include/mpc_crypto.h:143 +func Mpccrypto_initgenerategenericsecret(Peer int32, Bits int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cBits, cBitsAllocMap := (C.int)(Bits), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initGenerateGenericSecret(cPeer, cBits, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cBitsAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initimportgenericsecret function as declared in include/mpc_crypto.h:144 +func Mpccrypto_initimportgenericsecret(Peer int32, Key string, Size int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cKey, cKeyAllocMap := unpackPUint8_tString(Key) + cSize, cSizeAllocMap := (C.int)(Size), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initImportGenericSecret(cPeer, cKey, cSize, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cSizeAllocMap) + runtime.KeepAlive(cKeyAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initbackupecdsakey function as declared in include/mpc_crypto.h:147 +func Mpccrypto_initbackupecdsakey(Peer int32, Share []Mpccryptoshare, Pub_backup_key string, Pub_backup_key_size int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cPub_backup_key, cPub_backup_keyAllocMap := unpackPUint8_tString(Pub_backup_key) + cPub_backup_key_size, cPub_backup_key_sizeAllocMap := (C.int)(Pub_backup_key_size), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initBackupEcdsaKey(cPeer, cShare, cPub_backup_key, cPub_backup_key_size, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cPub_backup_key_sizeAllocMap) + runtime.KeepAlive(cPub_backup_keyAllocMap) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getresultbackupecdsakey function as declared in include/mpc_crypto.h:148 +func Mpccrypto_getresultbackupecdsakey(Context []Mpccryptocontext, Out []byte, Out_size []int32) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cOut, cOutAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out)).Data)), cgoAllocsUnknown + cOut_size, cOut_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_getResultBackupEcdsaKey(cContext, cOut, cOut_size) + runtime.KeepAlive(cOut_sizeAllocMap) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_verifyecdsabackupkey function as declared in include/mpc_crypto.h:149 +func Mpccrypto_verifyecdsabackupkey(Pub_backup_key string, Pub_backup_key_size int32, Pub_key string, Pub_key_size int32, Backup string, Backup_size int32) int32 { + cPub_backup_key, cPub_backup_keyAllocMap := unpackPUint8_tString(Pub_backup_key) + cPub_backup_key_size, cPub_backup_key_sizeAllocMap := (C.int)(Pub_backup_key_size), cgoAllocsUnknown + cPub_key, cPub_keyAllocMap := unpackPUint8_tString(Pub_key) + cPub_key_size, cPub_key_sizeAllocMap := (C.int)(Pub_key_size), cgoAllocsUnknown + cBackup, cBackupAllocMap := unpackPUint8_tString(Backup) + cBackup_size, cBackup_sizeAllocMap := (C.int)(Backup_size), cgoAllocsUnknown + __ret := C.MPCCrypto_verifyEcdsaBackupKey(cPub_backup_key, cPub_backup_key_size, cPub_key, cPub_key_size, cBackup, cBackup_size) + runtime.KeepAlive(cBackup_sizeAllocMap) + runtime.KeepAlive(cBackupAllocMap) + runtime.KeepAlive(cPub_key_sizeAllocMap) + runtime.KeepAlive(cPub_keyAllocMap) + runtime.KeepAlive(cPub_backup_key_sizeAllocMap) + runtime.KeepAlive(cPub_backup_keyAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_restoreecdsakey function as declared in include/mpc_crypto.h:150 +func Mpccrypto_restoreecdsakey(Prv_backup_key string, Prv_backup_key_size int32, Pub_key string, Pub_key_size int32, Backup string, Backup_size int32, Prv_key []byte, Prv_key_size []int32) int32 { + cPrv_backup_key, cPrv_backup_keyAllocMap := unpackPUint8_tString(Prv_backup_key) + cPrv_backup_key_size, cPrv_backup_key_sizeAllocMap := (C.int)(Prv_backup_key_size), cgoAllocsUnknown + cPub_key, cPub_keyAllocMap := unpackPUint8_tString(Pub_key) + cPub_key_size, cPub_key_sizeAllocMap := (C.int)(Pub_key_size), cgoAllocsUnknown + cBackup, cBackupAllocMap := unpackPUint8_tString(Backup) + cBackup_size, cBackup_sizeAllocMap := (C.int)(Backup_size), cgoAllocsUnknown + cPrv_key, cPrv_keyAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Prv_key)).Data)), cgoAllocsUnknown + cPrv_key_size, cPrv_key_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Prv_key_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_restoreEcdsaKey(cPrv_backup_key, cPrv_backup_key_size, cPub_key, cPub_key_size, cBackup, cBackup_size, cPrv_key, cPrv_key_size) + runtime.KeepAlive(cPrv_key_sizeAllocMap) + runtime.KeepAlive(cPrv_keyAllocMap) + runtime.KeepAlive(cBackup_sizeAllocMap) + runtime.KeepAlive(cBackupAllocMap) + runtime.KeepAlive(cPub_key_sizeAllocMap) + runtime.KeepAlive(cPub_keyAllocMap) + runtime.KeepAlive(cPrv_backup_key_sizeAllocMap) + runtime.KeepAlive(cPrv_backup_keyAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initbackupeddsakey function as declared in include/mpc_crypto.h:153 +func Mpccrypto_initbackupeddsakey(Peer int32, Share []Mpccryptoshare, Pub_backup_key string, Pub_backup_key_size int32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cPub_backup_key, cPub_backup_keyAllocMap := unpackPUint8_tString(Pub_backup_key) + cPub_backup_key_size, cPub_backup_key_sizeAllocMap := (C.int)(Pub_backup_key_size), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initBackupEddsaKey(cPeer, cShare, cPub_backup_key, cPub_backup_key_size, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cPub_backup_key_sizeAllocMap) + runtime.KeepAlive(cPub_backup_keyAllocMap) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getresultbackupeddsakey function as declared in include/mpc_crypto.h:154 +func Mpccrypto_getresultbackupeddsakey(Context []Mpccryptocontext, Out []byte, Out_size []int32) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cOut, cOutAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out)).Data)), cgoAllocsUnknown + cOut_size, cOut_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_getResultBackupEddsaKey(cContext, cOut, cOut_size) + runtime.KeepAlive(cOut_sizeAllocMap) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_verifyeddsabackupkey function as declared in include/mpc_crypto.h:155 +func Mpccrypto_verifyeddsabackupkey(Pub_backup_key string, Pub_backup_key_size int32, Pub_key string, Backup string, Backup_size int32) int32 { + cPub_backup_key, cPub_backup_keyAllocMap := unpackPUint8_tString(Pub_backup_key) + cPub_backup_key_size, cPub_backup_key_sizeAllocMap := (C.int)(Pub_backup_key_size), cgoAllocsUnknown + cPub_key, cPub_keyAllocMap := unpackPUint8_tString(Pub_key) + cBackup, cBackupAllocMap := unpackPUint8_tString(Backup) + cBackup_size, cBackup_sizeAllocMap := (C.int)(Backup_size), cgoAllocsUnknown + __ret := C.MPCCrypto_verifyEddsaBackupKey(cPub_backup_key, cPub_backup_key_size, cPub_key, cBackup, cBackup_size) + runtime.KeepAlive(cBackup_sizeAllocMap) + runtime.KeepAlive(cBackupAllocMap) + runtime.KeepAlive(cPub_keyAllocMap) + runtime.KeepAlive(cPub_backup_key_sizeAllocMap) + runtime.KeepAlive(cPub_backup_keyAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_restoreeddsakey function as declared in include/mpc_crypto.h:156 +func Mpccrypto_restoreeddsakey(Prv_backup_key string, Prv_backup_key_size int32, Pub_key string, Backup string, Backup_size int32, Out []byte) int32 { + cPrv_backup_key, cPrv_backup_keyAllocMap := unpackPUint8_tString(Prv_backup_key) + cPrv_backup_key_size, cPrv_backup_key_sizeAllocMap := (C.int)(Prv_backup_key_size), cgoAllocsUnknown + cPub_key, cPub_keyAllocMap := unpackPUint8_tString(Pub_key) + cBackup, cBackupAllocMap := unpackPUint8_tString(Backup) + cBackup_size, cBackup_sizeAllocMap := (C.int)(Backup_size), cgoAllocsUnknown + cOut, cOutAllocMap := (*C.uint8_t)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_restoreEddsaKey(cPrv_backup_key, cPrv_backup_key_size, cPub_key, cBackup, cBackup_size, cOut) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cBackup_sizeAllocMap) + runtime.KeepAlive(cBackupAllocMap) + runtime.KeepAlive(cPub_keyAllocMap) + runtime.KeepAlive(cPrv_backup_key_sizeAllocMap) + runtime.KeepAlive(cPrv_backup_keyAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_initderivebip32 function as declared in include/mpc_crypto.h:159 +func Mpccrypto_initderivebip32(Peer int32, Share []Mpccryptoshare, Hardened int32, Index uint32, Context [][]Mpccryptocontext) int32 { + cPeer, cPeerAllocMap := (C.int)(Peer), cgoAllocsUnknown + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cHardened, cHardenedAllocMap := (C.int)(Hardened), cgoAllocsUnknown + cIndex, cIndexAllocMap := (C.uint)(Index), cgoAllocsUnknown + cContext, cContextAllocMap := unpackArgSSMpccryptocontext(Context) + __ret := C.MPCCrypto_initDeriveBIP32(cPeer, cShare, cHardened, cIndex, cContext) + packSSMpccryptocontext(Context, cContext) + runtime.KeepAlive(cContextAllocMap) + runtime.KeepAlive(cIndexAllocMap) + runtime.KeepAlive(cHardenedAllocMap) + runtime.KeepAlive(cShareAllocMap) + runtime.KeepAlive(cPeerAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getresultderivebip32 function as declared in include/mpc_crypto.h:160 +func Mpccrypto_getresultderivebip32(Context []Mpccryptocontext, New_share [][]Mpccryptoshare) int32 { + cContext, cContextAllocMap := (*C.MPCCryptoContext)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Context)).Data)), cgoAllocsUnknown + cNew_share, cNew_shareAllocMap := unpackArgSSMpccryptoshare(New_share) + __ret := C.MPCCrypto_getResultDeriveBIP32(cContext, cNew_share) + packSSMpccryptoshare(New_share, cNew_share) + runtime.KeepAlive(cNew_shareAllocMap) + runtime.KeepAlive(cContextAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_getbip32info function as declared in include/mpc_crypto.h:161 +func Mpccrypto_getbip32info(Share []Mpccryptoshare, Bip32_info []Bip32_info_t) int32 { + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cBip32_info, cBip32_infoAllocMap := unpackArgSBip32_info_t(Bip32_info) + __ret := C.MPCCrypto_getBIP32Info(cShare, cBip32_info) + packSBip32_info_t(Bip32_info, cBip32_info) + runtime.KeepAlive(cBip32_infoAllocMap) + runtime.KeepAlive(cShareAllocMap) + __v := (int32)(__ret) + return __v +} + +// Mpccrypto_serializepubbip32 function as declared in include/mpc_crypto.h:162 +func Mpccrypto_serializepubbip32(Share []Mpccryptoshare, Out []byte, Out_size []int32) int32 { + cShare, cShareAllocMap := (*C.MPCCryptoShare)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Share)).Data)), cgoAllocsUnknown + cOut, cOutAllocMap := (*C.char)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out)).Data)), cgoAllocsUnknown + cOut_size, cOut_sizeAllocMap := (*C.int)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&Out_size)).Data)), cgoAllocsUnknown + __ret := C.MPCCrypto_serializePubBIP32(cShare, cOut, cOut_size) + runtime.KeepAlive(cOut_sizeAllocMap) + runtime.KeepAlive(cOutAllocMap) + runtime.KeepAlive(cShareAllocMap) + __v := (int32)(__ret) + return __v +}