diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index bd866799..269ec4b5 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -450,6 +450,13 @@ openvpn_decrypt_aead (struct buffer *buf, struct buffer work, tag_ptr = BPTR(buf); ASSERT (buf_advance (buf, tag_size)); dmsg (D_PACKET_CONTENT, "DECRYPT MAC: %s", format_hex (tag_ptr, tag_size, 0, &gc)); +#if defined(ENABLE_CRYPTO_OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10001040L + /* OpenSSL <= 1.0.1c bug requires set tag before processing ciphertext */ + if (!EVP_CIPHER_CTX_ctrl (ctx->cipher, EVP_CTRL_GCM_SET_TAG, tag_size, tag_ptr)) + { + CRYPT_ERROR ("setting tag failed"); + } +#endif if (buf->len < 1) {