diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-02-07 18:05:27 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-02-07 18:05:27 +0000 |
commit | fd3dbc1dbf416995089ff9eb1ac99b5cf0beffd7 (patch) | |
tree | f7014381377762857b2b484a028de85f5aefc9a9 /crypto | |
parent | d45087c672bd24467e6aea4ef05dbe6a5c420d5a (diff) |
Add CRYPTO_gcm128_tag() function to retrieve the tag.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/modes/gcm128.c | 6 | ||||
-rw-r--r-- | crypto/modes/modes.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/crypto/modes/gcm128.c b/crypto/modes/gcm128.c index 2de858c282..a9e9a34d3f 100644 --- a/crypto/modes/gcm128.c +++ b/crypto/modes/gcm128.c @@ -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; diff --git a/crypto/modes/modes.h b/crypto/modes/modes.h index f4aac29938..1af06efbfb 100644 --- a/crypto/modes/modes.h +++ b/crypto/modes/modes.h @@ -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); |