[Cryptography] GOTO Considered Harmful

Viktor Dukhovni cryptography at dukhovni.org
Fri Feb 28 23:20:56 EST 2014


On Fri, Feb 28, 2014 at 08:19:25PM -0500, Jerry Leichter wrote:

> BTW, I got curious and had a look at the latest (1.0.0l) sources.

With OpenSSL, the latest released code is 1.0.1f.  At the tip of
each of the OpenSSL 0.9.8, 1.0.0, 1.0.1, 1.0.2 (in beta) and "master"
branches a crude goto count (including dead code, test code, ...) shows:

    OpenSSL_0_9_7-stable 4483
    OpenSSL_0_9_8-stable 6166
    OpenSSL_1_0_0-stable 6441
    OpenSSL_1_0_1-stable 6884
    OpenSSL_1_0_2-stable 7264
    master               7759

So the trend in OpenSSL is to continue to use goto for error cleanup
in new code.  For what it is worth, the corresponding trend for
Postfix is:

    postfix-20010228     0
    postfix-1.1          0
    postfix-2.0          0
    postfix-2.1          0
    postfix-2.2          0
    postfix-2.3          0
    postfix-2.4          0
    postfix-2.5          0
    postfix-2.6          0
    postfix-2.7          0
    postfix-2.8          0
    postfix-2.9          0
    postfix-2.10         0
    postfix-2.11         0
    master               0

Both projects show long-term consistency in the coding style.

-- 
	Viktor.


More information about the cryptography mailing list