remove CryptoError
Change-Id: Iad771cbb67932f072f67c07a9df33f19388d49f9
diff --git a/src/protocol-detail/crypto-helper.cpp b/src/protocol-detail/crypto-helper.cpp
index b83d13a..6ff58cc 100644
--- a/src/protocol-detail/crypto-helper.cpp
+++ b/src/protocol-detail/crypto-helper.cpp
@@ -212,7 +212,6 @@
return 0;
}
-// avoid dependency on OpenSSL >= 1.1
int
hkdf(const uint8_t* secret, int secret_len, const uint8_t* salt,
int salt_len, uint8_t* output, int output_len,
@@ -389,7 +388,7 @@
handleErrors(const std::string& errorInfo)
{
NDN_LOG_DEBUG("Error in CRYPTO SUPPORT " << errorInfo);
- NDN_THROW(CryptoError("Error in CRYPTO SUPPORT: " + errorInfo));
+ NDN_THROW(std::runtime_error("Error in CRYPTO SUPPORT: " + errorInfo));
}
} // namespace ndncert
diff --git a/src/protocol-detail/crypto-helper.hpp b/src/protocol-detail/crypto-helper.hpp
index 8df3fa0..5f76ba8 100644
--- a/src/protocol-detail/crypto-helper.hpp
+++ b/src/protocol-detail/crypto-helper.hpp
@@ -30,11 +30,6 @@
static const uint8_t INFO[] = {0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9};
static const int AES_128_KEY_LEN = 16;
-class CryptoError : public std::runtime_error {
-public:
- using std::runtime_error::runtime_error;
-};
-
class ECDHState {
public:
ECDHState();
@@ -106,7 +101,7 @@
* @p ciphertext, output, enough memory must be allocated beforehands
* @p tag, output, 16 bytes tag
* @return the size of ciphertext
- * @throw CryptoError when there is an error in the process of encryption
+ * @throw runtime_error when there is an error in the process of encryption
*/
int
aes_gcm_128_encrypt(const uint8_t* plaintext, size_t plaintext_len, const uint8_t* associated, size_t associated_len,
@@ -123,7 +118,7 @@
* @p iv, input, 12 bytes IV
* @p plaintext, output, enough memory must be allocated beforehands
* @return the size of plaintext or -1 if the verification fails
- * @throw CryptoError when there is an error in the process of encryption
+ * @throw runtime_error when there is an error in the process of encryption
*/
int
aes_gcm_128_decrypt(const uint8_t* ciphertext, size_t ciphertext_len, const uint8_t* associated, size_t associated_len,
diff --git a/tests/unit-tests/crypto-helper.t.cpp b/tests/unit-tests/crypto-helper.t.cpp
index 4df1b02..3312c3d 100644
--- a/tests/unit-tests/crypto-helper.t.cpp
+++ b/tests/unit-tests/crypto-helper.t.cpp
@@ -55,7 +55,7 @@
BOOST_CHECK(alicePub != nullptr);
BOOST_CHECK(aliceState.m_publicKeyLen != 0);
uint8_t fakePub[] = {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b};
- BOOST_CHECK_THROW(aliceState.deriveSecret(fakePub, sizeof(fakePub)), CryptoError);
+ BOOST_CHECK_THROW(aliceState.deriveSecret(fakePub, sizeof(fakePub)), std::runtime_error);
}
BOOST_AUTO_TEST_CASE(EcdhWithBase64Key)