1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
Description: remove embedded pkcs11*.h code and use libnss instead
Forwarded: no
Author: Tianon Gravi <tianon@debian.org>
--- a/pkcs11go.h
+++ b/pkcs11go.h
@@ -6,20 +6,16 @@
#define CK_PTR *
#ifndef NULL_PTR
#define NULL_PTR 0
#endif
-#define CK_DEFINE_FUNCTION(returnType, name) returnType name
-#define CK_DECLARE_FUNCTION(returnType, name) returnType name
-#define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType (* name)
-#define CK_CALLBACK_FUNCTION(returnType, name) returnType (* name)
#include <unistd.h>
#ifdef PACKED_STRUCTURES
# pragma pack(push, 1)
-# include "pkcs11.h"
+# include <pkcs11.h>
# pragma pack(pop)
#else
-# include "pkcs11.h"
+# include <pkcs11.h>
#endif
// Copy of CK_INFO but with default alignment (not packed). Go hides unaligned
// struct fields so copying to an aligned struct is necessary to read CK_INFO
--- a/params.go
+++ b/params.go
@@ -4,8 +4,9 @@
package pkcs11
/*
+#cgo pkg-config: nss
#include <stdlib.h>
#include <string.h>
#include "pkcs11go.h"
--- a/types.go
+++ b/types.go
@@ -4,8 +4,9 @@
package pkcs11
/*
+#cgo pkg-config: nss
#include <stdlib.h>
#include <string.h>
#include "pkcs11go.h"
--- a/pkcs11.go
+++ b/pkcs11.go
@@ -10,8 +10,9 @@ package pkcs11
// * Go's uint size == PKCS11's CK_ULONG size
// * CK_ULONG never overflows an Go int
/*
+#cgo pkg-config: nss
#cgo windows CFLAGS: -DPACKED_STRUCTURES
#cgo linux LDFLAGS: -ldl
#cgo darwin LDFLAGS: -ldl
#cgo openbsd LDFLAGS: -ldl
|