示例#1
0
文件: engine.go 项目: 9uuso/openssl
func EngineById(name string) (*Engine, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	e := &Engine{
		e: C.ENGINE_by_id(cname),
	}
	if e.e == nil {
		return nil, fmt.Errorf("engine %s missing", name)
	}
	if C.ENGINE_init(e.e) == 0 {
		C.ENGINE_free(e.e)
		return nil, fmt.Errorf("engine %s not initialized", name)
	}
	runtime.SetFinalizer(e, func(e *Engine) {
		C.ENGINE_finish(e.e)
		C.ENGINE_free(e.e)
	})
	return e, nil
}
示例#2
0
文件: engines.go 项目: postfix/go-ssl
func ById(id string) *ENGINE {
	id_p := C.CString(id)
	defer C.free(unsafe.Pointer(id_p))
	return newEngine(C.ENGINE_by_id(id_p))
}
示例#3
0
文件: engine.go 项目: vbatts/gossl
func NewById(id string) *Engine {
	eid := C.CString(id)
	defer C.free(unsafe.Pointer(eid))
	return New(C.ENGINE_by_id(eid))
}