aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crypto.go8
-rw-r--r--network.go2
m---------salticidae0
3 files changed, 7 insertions, 3 deletions
diff --git a/crypto.go b/crypto.go
index 528be5c..c0012d7 100644
--- a/crypto.go
+++ b/crypto.go
@@ -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() })
}
diff --git a/network.go b/network.go
index cdc882a..71e0ffa 100644
--- a/network.go
+++ b/network.go
@@ -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