28 #ifndef __CASYMCIPHERGCM__
29 #define __CASYMCIPHERGCM__
65 #ifndef ONLY_LOCAL_PROXY
74 #ifndef USE_OPENSSL_GCM
98 #ifndef USE_OPENSSL_GCM
104 AES_set_encrypt_key(m_iv1, 128, m_keyAES1);
105 m_pGCMCtxEnc = CRYPTO_gcm128_new(m_keyAES1, (block128_f)AES_encrypt);
106 m_pGCMCtxDec = CRYPTO_gcm128_new(m_keyAES1, (block128_f)AES_encrypt);
111 #ifndef USE_OPENSSL_GCM
122 AES_set_encrypt_key(keyRecv, 128, m_keyAES1);
123 AES_set_encrypt_key(keySend, 128, m_keyAES2);
126 m_pGCMCtxEnc = CRYPTO_gcm128_new(m_keyAES2, (block128_f)AES_encrypt);
127 m_pGCMCtxDec = CRYPTO_gcm128_new(m_keyAES1, (block128_f)AES_encrypt);
139 memmove(out, in, inlen);
146 #ifndef USE_OPENSSL_GCM
159 memmove(out, in, inlen);
169 #ifndef USE_OPENSSL_GCM
173 CRYPTO_gcm128_decrypt(
m_pGCMCtxDec, in, out, inlen - 16);
174 ret = CRYPTO_gcm128_finish(
m_pGCMCtxDec, in + inlen - 16, 16);
179 #ifndef USE_OPENSSL_GCM
183 ret = CRYPTO_gcm128_decrypt(
m_pGCMCtxDec, in, out, inlen);
187 #ifndef USE_OPENSSL_GCM
201 #ifndef USE_OPENSSL_GCM
#define INCLUDE_MIDDLE_MIX
From this class other classes could be derived, which need some kind from "locking" in memory.
SINT32 waitForDestroy()
If called checks if the reference counter equals zero.
This class could be used for encryption/decryption of data (streams) with AES using 128bit GCM mode.
void setGCMKeys(UINT8 *keyRecv, UINT8 *keySend)
gcm_ctx_64k * m_pGCMCtxDec
gcm_ctx_64k * m_pGCMCtxEnc
SINT32 encryptMessage(const UINT8 *in, UINT32 inlen, UINT8 *out)
SINT32 decryptMessage(const UINT8 *in, UINT32 inlen, UINT8 *out, bool integrityCheck)