GCM: set default tag size to 12 bytes

According to RFC 5084, the default value of the GCM tag should be 12
octets (bytes). Change the default tag length from 0 to 12 to honor
this.

Bug: 22855843
Change-Id: I1ed16df24d0cfa9fff2593a3402c97faf913e05e
diff --git a/src/main/java/org/conscrypt/OpenSSLCipher.java b/src/main/java/org/conscrypt/OpenSSLCipher.java
index 858193c..1d5e2c6 100644
--- a/src/main/java/org/conscrypt/OpenSSLCipher.java
+++ b/src/main/java/org/conscrypt/OpenSSLCipher.java
@@ -846,6 +846,11 @@
 
     public static abstract class EVP_AEAD extends OpenSSLCipher {
         /**
+         * The default tag size when one is not specified.
+         */
+        private static final int DEFAULT_TAG_SIZE_BITS = 12 * 8;
+
+        /**
          * Keeps track of the last used block size.
          */
         private static int lastGlobalMessageSize = 32;
@@ -911,7 +916,7 @@
             final int tagLenBits;
             if (params == null) {
                 iv = null;
-                tagLenBits = 0;
+                tagLenBits = DEFAULT_TAG_SIZE_BITS;
             } else {
                 GCMParameters gcmParams = Platform.fromGCMParameterSpec(params);
                 if (gcmParams != null) {
@@ -920,10 +925,10 @@
                 } else if (params instanceof IvParameterSpec) {
                     IvParameterSpec ivParams = (IvParameterSpec) params;
                     iv = ivParams.getIV();
-                    tagLenBits = 0;
+                    tagLenBits = DEFAULT_TAG_SIZE_BITS;
                 } else {
                     iv = null;
-                    tagLenBits = 0;
+                    tagLenBits = DEFAULT_TAG_SIZE_BITS;
                 }
             }