ssl/crypto/crypto.pony says constructing a Digest cannot fail:
Constructing a Digest cannot fail; a context OpenSSL would not give you surfaces at the first append or final.
It can. Every Digest constructor is partial and raises when OpenSSL cannot allocate the context. In ssl/crypto/digest.pony:
new md5() ? =>
_variable_length = false
_digest_size = 16
_ctx = _EVPContext(@EVP_md5())?
_EVPContext.apply raises when EVP_MD_CTX_new returns null or EVP_DigestInit_ex fails.
Two statements in ssl/crypto/crypto.pony are wrong:
- The "cannot fail" sentence above.
- The list of partial functions omits the constructors: "
Digest.append, Digest.final, HmacSha256, Pbkdf2Sha256 and RandBytes are partial." Constructing a Digest is partial too.
.release-notes/next-release.md also contradicts itself. One note says construction now raises. Another says "one that could not be created reports it at the first append or final rather than crashing," which is the pre-change behavior.
The Digest class docstring in ssl/crypto/digest.pony is already correct. The package docstring and the second release note were not updated when the constructors were made partial.
ssl/crypto/crypto.ponysays constructing aDigestcannot fail:It can. Every
Digestconstructor is partial and raises when OpenSSL cannot allocate the context. Inssl/crypto/digest.pony:_EVPContext.applyraises whenEVP_MD_CTX_newreturns null orEVP_DigestInit_exfails.Two statements in
ssl/crypto/crypto.ponyare wrong:Digest.append,Digest.final,HmacSha256,Pbkdf2Sha256andRandBytesare partial." Constructing aDigestis partial too..release-notes/next-release.mdalso contradicts itself. One note says construction now raises. Another says "one that could not be created reports it at the firstappendorfinalrather than crashing," which is the pre-change behavior.The
Digestclass docstring inssl/crypto/digest.ponyis already correct. The package docstring and the second release note were not updated when the constructors were made partial.