ossl_cipher_get_auth_tag(int argc, VALUE *argv, VALUE self)
{
    VALUE vtag_len;
    EVP_CIPHER_CTX *ctx;
    int nid, tag_len;

    if (rb_scan_args(argc, argv, "01", &vtag_len) == 0) {
	tag_len = 16;
    } else {
	tag_len = NUM2INT(vtag_len);
    }

    GetCipher(self, ctx);
    nid = EVP_CIPHER_CTX_nid(ctx);

    if (ossl_is_gcm(nid)) {
	return ossl_get_gcm_auth_tag(ctx, tag_len);
    } else {
	ossl_raise(eCipherError, "authentication tag not supported by this cipher");
	return Qnil; /* dummy */
    }
}
ossl_cipher_get_auth_tag(int argc, VALUE *argv, VALUE self)
{
    VALUE vtag_len;
    EVP_CIPHER_CTX *ctx;
    int nid, tag_len;

    if (rb_scan_args(argc, argv, "01", &vtag_len) == 0) {
	tag_len = 16;
    } else {
	tag_len = NUM2INT(vtag_len);
    }

    GetCipher(self, ctx);
    nid = EVP_CIPHER_CTX_nid(ctx);

    if (ossl_is_gcm(nid)) {
	return ossl_get_gcm_auth_tag(ctx, tag_len);
    } else {
	ossl_raise(eCipherError, "authentication tag not supported by this cipher");
	return Qnil;  
    }
}