summaryrefslogtreecommitdiff
path: root/cipher/cipher-internal.h
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2020-02-02 19:52:08 +0200
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2020-02-02 19:52:08 +0200
commit5beadf201312d0c649971b0c1d4c3827b434a0b5 (patch)
tree67d3b937afdc6d3e44e50daa5538d4380888a398 /cipher/cipher-internal.h
parente0898d0628789414da23e0526c87df1885c8b3ae (diff)
downloadlibgcrypt-5beadf201312d0c649971b0c1d4c3827b434a0b5.tar.gz
Add gcry_cipher_ctl command to allow weak keys in testing use-cases
* cipher/cipher-internal.h (gcry_cipher_handle): Add 'marks.allow_weak_key' flag. * cipher/cipher.c (cipher_setkey): Do not handle weak key as error when weak keys are allowed. (cipher_reset): Preserve 'marks.allow_weak_key' flag on object reset. (_gcry_cipher_ctl): Add handling for GCRYCTL_SET_ALLOW_WEAK_KEY. * src/gcrypt.h.in (gcry_ctl_cmds): Add GCRYCTL_SET_ALLOW_WEAK_KEY. * tests/basic.c (check_ecb_cipher): Add tests for weak key errors and for GCRYCTL_SET_ALLOW_WEAK_KEY. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/cipher-internal.h')
-rw-r--r--cipher/cipher-internal.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/cipher/cipher-internal.h b/cipher/cipher-internal.h
index 47b7b6f9..262ca902 100644
--- a/cipher/cipher-internal.h
+++ b/cipher/cipher-internal.h
@@ -207,6 +207,7 @@ struct gcry_cipher_handle
unsigned int iv:1; /* Set to 1 if a IV has been set. */
unsigned int tag:1; /* Set to 1 if a tag is finalized. */
unsigned int finalize:1; /* Next encrypt/decrypt has the final data. */
+ unsigned int allow_weak_key:1; /* Set to 1 if weak keys are allowed. */
} marks;
/* The initialization vector. For best performance we make sure