37 #ifndef VIRGIL_CRYPTO_MBEDTLS_EXCEPTION_H
38 #define VIRGIL_CRYPTO_MBEDTLS_EXCEPTION_H
40 #include <virgil/crypto/VirgilCryptoException.h>
42 #define MBEDTLS_ERROR_HANDLER(invocation) MBEDTLS_ERROR_HANDLER_DISPOSE(invocation, {})
44 #define MBEDTLS_ERROR_HANDLER_DISPOSE(invocation, dispose) \
46 int errCode__ = invocation; \
47 if (errCode__ < 0) { \
48 do { dispose; } while (0); \
49 throw PolarsslException(errCode__); \
53 #define MBEDTLS_ERROR_HANDLER_CLEANUP(errCode, invocation) \
54 do { errCode = invocation; if (errCode < 0) { goto cleanup; } } while (0)
56 #define MBEDTLS_ERROR_MESSAGE_CLEANUP(messageVariable, message) \
57 do { messageVariable = message; goto cleanup; } while (0)
59 #define MBEDTLS_ERROR_MESSAGE_HANDLER(messageVariable) \
60 do { if (messageVariable) throw VirgilCryptoException(messageVariable); } while (0)
63 namespace virgil {
namespace crypto {
namespace foundation {
Definition: VirgilAsn1Compatible.h:46
Encapsulates logic errors of module 'crypto'.
Definition: VirgilCryptoException.h:48