diff options
author | Determinant <[email protected]> | 2019-06-28 17:37:18 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-28 17:37:18 -0400 |
commit | c725d4a2fc05eade8d06cb1e92796c3f1099f9d1 (patch) | |
tree | 5c5e48ef51e564355e7c77183812ecf27be95a1e | |
parent | 6d1be18d58a2e6874cddc59e0f01a14e153d1938 (diff) |
...
-rw-r--r-- | crypto.go | 8 | ||||
-rw-r--r-- | network.go | 2 | ||||
m--------- | salticidae | 0 |
3 files changed, 7 insertions, 3 deletions
@@ -11,13 +11,17 @@ type x509 struct { inner CX509 } // The handle for a X509 certificate. type X509 = *x509 +func X509FromC(ptr CX509) X509 { + return &x509{ inner: ptr } +} + func NewX509FromPemFile(fname string, passwd *string, err *Error) X509 { fname_c_str := C.CString(fname) passwd_c_str := (*C.char)(nil) if passwd != nil { passwd_c_str = C.CString(*passwd) } - res := &x509{ inner: C.x509_new_from_pem_file(fname_c_str, passwd_c_str, err) } + res := X509FromC(C.x509_new_from_pem_file(fname_c_str, passwd_c_str, err)) if res != nil { runtime.SetFinalizer(res, func(self X509) { self.free() }) } @@ -29,7 +33,7 @@ func NewX509FromPemFile(fname string, passwd *string, err *Error) X509 { } func NewX509FromDer(der ByteArray, err *Error) X509 { - res := &x509{ inner: C.x509_new_from_der(der.inner, err) } + res := X509FromC(C.x509_new_from_der(der.inner, err)) if res != nil { runtime.SetFinalizer(res, func(self X509) { self.free() }) } @@ -425,7 +425,7 @@ func (self PeerNetwork) RegPeerHandler(callback PeerNetworkPeerCallback, userdat C.peernetwork_reg_peer_handler(self.inner, callback, userdata) } -// The C function pointer type which takes netaddr_t* and void* (passing in the +// The C function pointer type which takes netaddr_t*, x509_t* and void* (passing in the // custom user data allocated by C.malloc) as parameters. type PeerNetworkUnknownPeerCallback = C.peernetwork_unknown_peer_callback_t diff --git a/salticidae b/salticidae -Subproject fedfeaced48150e27907628244e95ca54dbe7c0 +Subproject b8bdd8237ca51439995e1990bbc4f39f8a96fbf |