private void reset() {
        aadBuf = null;
        if (buf == null) {
            bufCount = 0;
            return;
        }
        int bufMemSize = buf.array().length;
        if (bufMemSize > 1024 && bufCount < bufMemSize / 8) {
            // The memory usage of the buffer much larger than what was used.
            // We prefer to release it to avoid keeping too much memory.
            buf = null;
        } else {
            // Keep using the same buffer, to save on memory allocation.
            buf.reset();
        }
        bufCount = 0;
    }
Constant-time array comparison.  Since we are using this to compare keys, we want to
ensure there's no opportunity for a timing attack.
common/src/main/java/org/conscrypt/OpenSSLAeadCipher.java