diff options
author | Stephan Mueller <smueller@chronox.de> | 2016-12-01 17:11:42 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-12-08 08:43:07 +0100 |
commit | 227099f179df9dcf083d0ef6be9883c775df0874 (patch) | |
tree | ec2431c4ae4454f6ddf138a5c161fa0bfc6f0c54 /cipher/cipher.c | |
parent | df8634d8e2b595430dc1e6575a7452c242cffca1 (diff) | |
download | libgcrypt-227099f179df9dcf083d0ef6be9883c775df0874.tar.gz |
cipher: New function for reading the counter in CTR mode
* cipher/cipher.c (gcry_cipher_getctr): New.
--
The API call allows reading the current counter of the CTR mode. The API
remains internal to libgcrypt and is not exported to external callers.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
ChangeLog entry above added by -wk
Diffstat (limited to 'cipher/cipher.c')
-rw-r--r-- | cipher/cipher.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cipher/cipher.c b/cipher/cipher.c index ff3340f7..55853da9 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -1117,6 +1117,16 @@ _gcry_cipher_setctr (gcry_cipher_hd_t hd, const void *ctr, size_t ctrlen) return 0; } +gpg_err_code_t +_gcry_cipher_getctr (gcry_cipher_hd_t hd, void *ctr, size_t ctrlen) +{ + if (ctr && ctrlen == hd->spec->blocksize) + memcpy (ctr, hd->u_ctr.ctr, hd->spec->blocksize); + else + return GPG_ERR_INV_ARG; + + return 0; +} gcry_err_code_t _gcry_cipher_authenticate (gcry_cipher_hd_t hd, const void *abuf, |