Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
Fix flaky tests on Ubuntu 22.04
Browse files Browse the repository at this point in the history
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

You can reproduce the bug on Ubuntu 22.04 with tests.
  • Loading branch information
oleg-jukovec committed Jun 30, 2022
1 parent e5e193b commit 805504c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion md4.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 805504c

Please sign in to comment.