Reduce file scope C++ statics

8 views
Skip to first unread message

Jeffrey Walton

unread,
Nov 12, 2017, 11:47:45 AM11/12/17
to Crypto++ Users
Hi Everyone,

Ethereum uses Crypto++ and they have been having some trouble with global C++ objects in their test suite. The issue does not appear to be related to Crypto++, but the bug report caused us to revisit our gear.

We have about 6 objects that are subject to C++ static initialization order fiasco problems. With some reworking we can eliminate them. The retooled code moves some of the C++ objects into headers (DEFAULT_CHANNEL, AAD_CHANNEL, g_nullNameValuePairs). And for others (Integer::Zero(), Integer::One(), Integer::Two()) it uses C++ dynamic intialization or the old Singleton pattern that causes the memory leak.

The reworked code is being tested now on the testing clone. It took a couple commits to get it right because the FIPS DLL was giving us some trouble. Here's the diff: https://github.com/weidai11/cryptopp/compare/master...noloader:master .

I plan on checking it in later today. This will break ABI again, so please clean and rebuild the library when you pull from Master.

Jeff

Jeffrey Walton

unread,
Nov 12, 2017, 12:38:53 PM11/12/17
to Crypto++ Users
Reply all
Reply to author
Forward
0 new messages