diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-09-02 22:58:35 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-11-06 21:06:27 +0100 |
commit | 1d9b2f9984fefbc050c8e3295397ffd280e41788 (patch) | |
tree | c6fa8a4f5e0e6fbc0e165c2bd80b2c81a48bf6bc /common/rfb/CSecurityDH.cxx | |
parent | 5c3588c464520a4757bfc20974090e21af220cdc (diff) | |
download | tigervnc-1d9b2f9984fefbc050c8e3295397ffd280e41788.tar.gz tigervnc-1d9b2f9984fefbc050c8e3295397ffd280e41788.zip |
Use standard exception classes
Use the more specific already included exception classes for common
errors to keep things more understandable.
Diffstat (limited to 'common/rfb/CSecurityDH.cxx')
-rw-r--r-- | common/rfb/CSecurityDH.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/rfb/CSecurityDH.cxx b/common/rfb/CSecurityDH.cxx index 6eafbd9c..e37a3a33 100644 --- a/common/rfb/CSecurityDH.cxx +++ b/common/rfb/CSecurityDH.cxx @@ -112,7 +112,7 @@ void CSecurityDH::writeCredentials() std::vector<uint8_t> bBytes(keyLength); if (!rs.hasData(keyLength)) - throw Exception("failed to generate DH private key"); + throw std::runtime_error("failed to generate DH private key"); rs.readBytes(bBytes.data(), bBytes.size()); nettle_mpz_set_str_256_u(b, bBytes.size(), bBytes.data()); mpz_powm(k, A, b, p); @@ -132,13 +132,13 @@ void CSecurityDH::writeCredentials() uint8_t buf[128]; if (!rs.hasData(128)) - throw Exception("failed to generate random padding"); + throw std::runtime_error("failed to generate random padding"); rs.readBytes(buf, 128); if (username.size() >= 64) - throw Exception("username is too long"); + throw std::out_of_range("username is too long"); memcpy(buf, username.c_str(), username.size() + 1); if (password.size() >= 64) - throw Exception("password is too long"); + throw std::out_of_range("password is too long"); memcpy(buf + 64, password.c_str(), password.size() + 1); aes128_encrypt(&aesCtx, 128, buf, buf); |