コード例 #1
0
ファイル: pkcs11.go プロジェクト: useidel/notary
// New creates a new context and initializes the module/library for use.
func New(module string) *Ctx {
	c := new(Ctx)
	mod := C.CString(module)
	defer C.free(unsafe.Pointer(mod))
	c.ctx = C.New(mod)
	if c.ctx == nil {
		return nil
	}
	return c
}
コード例 #2
0
ファイル: pkcs11.go プロジェクト: jfrazelle/boulder
// New creates a new context and initializes the module/library for use.
func New(module string) *Ctx {
	// libtool-ltdl will return an assertion error if passed an empty string, so
	// we check for it explicitly.
	if module == "" {
		return nil
	}
	c := new(Ctx)
	mod := C.CString(module)
	defer C.free(unsafe.Pointer(mod))
	c.ctx = C.New(mod)
	if c.ctx == nil {
		return nil
	}
	return c
}