Add CRYPTO_gcm128_tag() function to retrieve the tag.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 7 Feb 2011 18:05:27 +0000 (18:05 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 7 Feb 2011 18:05:27 +0000 (18:05 +0000)
crypto/modes/gcm128.c
crypto/modes/modes.h

index 2de858c28236838e4156884f785f7a04c31df06b..a9e9a34d3f9cd1fd1eb30898f919243a24d4b960 100644 (file)
@@ -1337,6 +1337,12 @@ int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag,
                return -1;
 }
 
+void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
+{
+       CRYPTO_gcm128_finish(ctx, NULL, 0);
+       memcpy(tag, ctx->Xi.c, len);
+}
+
 GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block)
 {
        GCM128_CONTEXT *ret;
index f4aac299386634a78e16fdab09c6b613ef4f8d4e..1af06efbfbb048345679ebd657f49f03028947d2 100644 (file)
@@ -102,4 +102,5 @@ void CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
                        size_t len, ctr128_f stream);
 int  CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag,
                        size_t len);
+void  CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
 void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx);