1
0
mirror of https://github.com/libp2p/go-openssl.git synced 2025-04-14 16:40:23 +08:00

Fix flaky tests on Ubuntu 22.04

It is necessary to handle OpenSSL errors very carefully. Otherwise,
errors may appear in unexpected places. For example, we didn't catch
an error from EVP_DigestInit_ex() and it appears sometimes in conn.go:

func (c *Conn) getErrorHandler(rv C.int, errno error) func() error {
	errcode := C.SSL_get_error(c.ssl, rv) // <- here
This commit is contained in:
Oleg Jukovec 2022-06-30 16:38:07 +03:00
parent e5e193b4dc
commit b87b660e7b

5
md4.go
View File

@ -51,8 +51,11 @@ func (s *MD4Hash) Close() {
}
func (s *MD4Hash) Reset() error {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
if C.X_EVP_DigestInit_ex(s.ctx, C.X_EVP_md4(), engineRef(s.engine)) != 1 {
return errors.New("openssl: md4: cannot init digest ctx")
return errors.New("openssl: md4: cannot init digest ctx: " +
errorFromErrorQueue().Error())
}
return nil
}