EVP_AEAD: change constant to work with non-BoringSSL

If the version of OpenSSL we're compiling against has the EVP_AEAD
interface ported, then we can use it. So check for one of its
definitions in addition to checking for BoringSSL. To be more precise,
rename the constant that is generated to directly reflect what it's
being used for.

Change-Id: Ic47eecff4a3968c56b32dc30867fc29cd89fdb6a
diff --git a/src/gen/native/generate_constants.cc b/src/gen/native/generate_constants.cc
index 480260d..0d6073c 100644
--- a/src/gen/native/generate_constants.cc
+++ b/src/gen/native/generate_constants.cc
@@ -21,6 +21,10 @@
 #include <openssl/rsa.h>
 #include <openssl/ssl.h>
 #include <openssl/x509v3.h>
+#include <openssl/evp.h>
+#if defined(OPENSSL_IS_BORINGSSL)
+#include <openssl/aead.h>
+#endif
 
 static const char kCopyright[] =
     "/* Copyright (C) 2015 The Android Open Source Project\n"
@@ -44,8 +48,8 @@
   printf("package org.conscrypt;\n\n");
   printf("public final class NativeConstants {\n");
 
-  printf("    public static final boolean IS_BORINGSSL = %s;\n",
-#if defined(OPENSSL_IS_BORINGSSL)
+  printf("    public static final boolean HAS_EVP_AEAD = %s;\n",
+#if defined(EVP_AEAD_DEFAULT_TAG_LENGTH)
          "true"
 #else
          "false"
diff --git a/src/main/java/org/conscrypt/OpenSSLProvider.java b/src/main/java/org/conscrypt/OpenSSLProvider.java
index c9dd54f..831e644 100644
--- a/src/main/java/org/conscrypt/OpenSSLProvider.java
+++ b/src/main/java/org/conscrypt/OpenSSLProvider.java
@@ -228,8 +228,7 @@
 
         putSymmetricCipherImplClass("ARC4", "OpenSSLCipher$EVP_CIPHER$ARC4");
 
-        if (NativeConstants.IS_BORINGSSL) {
-            /* EVP_AEAD is only supported in BoringSSL right now. */
+        if (NativeConstants.HAS_EVP_AEAD) {
             putSymmetricCipherImplClass("AES/GCM/NoPadding", "OpenSSLCipher$EVP_AEAD$AES$GCM");
             put("Alg.Alias.Cipher.GCM", "AES/GCM/NoPadding");
         }