diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-05-21 19:35:09 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-05-21 19:35:09 +0200 |
commit | 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 (patch) | |
tree | a707602da466c02ff1a54b3263c3a881cd7204a4 /libqpdf/SecureRandomDataProvider.cc | |
parent | 6b077332d38c093de2618d5e1481b42222106065 (diff) | |
download | qpdf-60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2.tar.zst |
Rerun clang-format
Diffstat (limited to 'libqpdf/SecureRandomDataProvider.cc')
-rw-r--r-- | libqpdf/SecureRandomDataProvider.cc | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/libqpdf/SecureRandomDataProvider.cc b/libqpdf/SecureRandomDataProvider.cc index f6ee559f..c47c8707 100644 --- a/libqpdf/SecureRandomDataProvider.cc +++ b/libqpdf/SecureRandomDataProvider.cc @@ -39,13 +39,8 @@ namespace WindowsCryptProvider() { if (!CryptAcquireContextW( - &crypt_prov, - NULL, - NULL, - PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT)) { - throw std::runtime_error( - "unable to acquire crypt context: " + getErrorMessage()); + &crypt_prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { + throw std::runtime_error("unable to acquire crypt context: " + getErrorMessage()); } } ~WindowsCryptProvider() @@ -74,8 +69,7 @@ namespace std::string message(messageBuffer, size); LocalFree(messageBuffer); return ( - "error number " + - QUtil::int_to_string_base(errorMessageID, 16) + ": " + message); + "error number " + QUtil::int_to_string_base(errorMessageID, 16) + ": " + message); } }; } // namespace @@ -89,10 +83,7 @@ SecureRandomDataProvider::provideRandomData(unsigned char* data, size_t len) // Optimization: make the WindowsCryptProvider static as long as // it can be done in a thread-safe fashion. WindowsCryptProvider c; - if (!CryptGenRandom( - c.crypt_prov, - static_cast<DWORD>(len), - reinterpret_cast<BYTE*>(data))) { + if (!CryptGenRandom(c.crypt_prov, static_cast<DWORD>(len), reinterpret_cast<BYTE*>(data))) { throw std::runtime_error("unable to generate secure random data"); } @@ -107,8 +98,7 @@ SecureRandomDataProvider::provideRandomData(unsigned char* data, size_t len) fclose(f); if (fr != len) { throw std::runtime_error( - "unable to read " + std::to_string(len) + " bytes from " + - std::string(RANDOM_DEVICE)); + "unable to read " + std::to_string(len) + " bytes from " + std::string(RANDOM_DEVICE)); } # else |