MCPcopy Create free account
hub / github.com/USBGuard/usbguard / LibraryInit

Method LibraryInit

src/Library/Init.cpp:41–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 {
40 public:
41 LibraryInit()
42 {
43 std::setlocale(LC_NUMERIC, "C");
44 /*
45 * FIXME: Provide a mechanism to disable the crypto library
46 * initialization as it might interfere with initialization
47 * done by third-party applications.
48 *
49 * gcrypt: whether initialization was performed or not can
50 * be queried using:
51 * gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P, 0);
52 */
53#if defined(USBGUARD_USE_LIBSODIUM)
54
55 if (sodium_init() == -1) {
56 throw std::runtime_error("Cannot initialize the sodium library");
57 }
58
59#endif
60#if defined(USBGUARD_USE_LIBGCRYPT)
61
62 if (!gcry_check_version(GCRYPT_VERSION)) {
63 throw std::runtime_error("Cannot initialize the gcrypt library");
64 }
65
66 gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
67#endif
68 }
69
70 ~LibraryInit()
71 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected