Exemplo n.º 1
0
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
}
Exemplo n.º 2
0
//these methods interrogate the OpenSSL library to getermine what
//operations they are using.
func finishEngine(self *ENGINE) {
	C.ENGINE_finish(self.engine)
	return
}
Exemplo n.º 3
0
func finishEngine(e *Engine) {
	C.ENGINE_finish(e.eng)
}