[openssl-project] Style guide update -- summary so far

Matt Caswell matt at openssl.org
Mon Feb 5 19:05:57 UTC 2018



On 05/02/18 18:13, Salz, Rich wrote:

> Use ossl_assert, not assert.  Do not forget to handle the error
> condition as asserts are not compiled into production code.

It's slightly more nuanced than that. There are occasions where assert
is ok, e.g.

switch(my_expression)
{
case 1:
	/* do something */
	break;
case 2:
	/* do something else */
	break;
default:
	assert("Shouldn't get here" == NULL);
	return -1;
}

In general we should prefer ossl_assert over assert. Never use
OPENSSL_assert() in libcrypto or libssl.

Matt


More information about the openssl-project mailing list