summaryrefslogtreecommitdiff
path: root/lib/crypto/CipherContext.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2012-04-28 18:13:19 +0000
committerChris Wilson <chris+github@qwirx.com>2012-04-28 18:13:19 +0000
commit26c898448b0c88c9a9b1cd7609847d0df9ab52bf (patch)
treeeafa7290f1d1c7e6074173e19a351650cbe3e69b /lib/crypto/CipherContext.h
parent3c60fe12ad2b8cb476991a3a7c7822782ce80953 (diff)
Allow ciphers to identify themselves for debugging.
Diffstat (limited to 'lib/crypto/CipherContext.h')
-rw-r--r--lib/crypto/CipherContext.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/crypto/CipherContext.h b/lib/crypto/CipherContext.h
index 64ce52d8..93c889d6 100644
--- a/lib/crypto/CipherContext.h
+++ b/lib/crypto/CipherContext.h
@@ -35,12 +35,15 @@ public:
private:
CipherContext(const CipherContext &); // no copying
CipherContext &operator=(const CipherContext &); // no assignment
+protected:
+ std::string LogError(const std::string& operation);
public:
typedef enum
{
- Decrypt = 0,
- Encrypt = 1
+ None = 0,
+ Decrypt,
+ Encrypt
} CipherFunction;
void Init(CipherContext::CipherFunction Function, const CipherDescription &rDescription);
@@ -61,6 +64,10 @@ public:
const void *SetRandomIV(int &rLengthOut);
void UsePadding(bool Padding = true);
+ const char* GetFunction() const
+ {
+ return (mFunction == Encrypt) ? "encrypt" : "decrypt";
+ }
#ifdef HAVE_OLD_SSL
void OldOpenSSLFinal(unsigned char *Buffer, int &rOutLengthOut);
@@ -72,8 +79,9 @@ private:
bool mWithinTransform;
bool mPaddingOn;
uint8_t mGeneratedIV[CIPHERCONTEXT_MAX_GENERATED_IV_LENGTH];
-#ifdef HAVE_OLD_SSL
CipherFunction mFunction;
+ std::string mCipherName;
+#ifdef HAVE_OLD_SSL
CipherDescription *mpDescription;
#endif
};