<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Oops, you are correct.  I was under the mistaken impression that ossl_assert compiled to nothing outside of debug mode.<div class=""><br class=""><div class=""><br class=""></div><div class="">Pauli<br class=""><div class="">
<div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">-- <br class="">Dr Paul Dale | Distinguished Architect | Cryptographic Foundations <br class="">Phone +61 7 3031 7217<br class="">Oracle Australia</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class=""></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline">
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On 29 Nov 2019, at 7:22 pm, Matt Caswell <<a href="mailto:matt@openssl.org" class="">matt@openssl.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><br class="">On 29/11/2019 08:38, Dr Paul Dale wrote:<br class=""><blockquote type="cite" class="">I’d prefer option 1 or the middle ground.  I’ve lost count of the<br class="">number of times I’ve seen programs crashing in the crypto library<br class="">which required mammoth debugging efforts to irrefutably demonstrate<br class="">that the caller is at fault rather than the crypto library :(<br class=""><br class="">Option 1 would be preferable from this point of view but it can cause<br class="">a performance hit — most of the time it wouldn’t matter but when it<br class="">does it would be a big deal.  The middle ground doesn’t entail any<br class="">performance loss in production code (it does in debug but that<br class="">shouldn’t be relevant).<br class=""></blockquote><br class=""><br class="">I think you misunderstand the middle ground option:<br class=""><br class="">    if (!ossl_assert(ptr != NULL)) {<br class="">        ERR_raise(ERR_LIB_WHATEVER, ERR_R_PASSED_NULL_PARAMETER);<br class="">        return 0;<br class="">    }<br class=""><br class="">In debug code this will crash if ptr is NULL. In production code this<br class="">acts exactly like option 1 - so has exactly the same performance hit.<br class=""><br class="">For the record my preference is the middle ground option as being the<br class="">norm for new code and where we make a significant refactor of old code.<br class="">If something truly is performance critical then we can choose not to do<br class="">it in those cases.<br class=""><br class="">Matt<br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>