aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/sexputil.c16
-rw-r--r--common/util.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/common/sexputil.c b/common/sexputil.c
index 66cd9f60e..7a67f2b7c 100644
--- a/common/sexputil.c
+++ b/common/sexputil.c
@@ -698,3 +698,19 @@ hash_algo_to_string (int algo)
return hashnames[i].name;
return "?";
}
+
+
+/* Map cipher modes to a string. */
+const char *
+cipher_mode_to_string (int mode)
+{
+ switch (mode)
+ {
+ case GCRY_CIPHER_MODE_CFB: return "CFB";
+ case GCRY_CIPHER_MODE_CBC: return "CBC";
+ case GCRY_CIPHER_MODE_GCM: return "GCM";
+ case GCRY_CIPHER_MODE_OCB: return "OCB";
+ case 14: return "EAX"; /* Only in gcrypt 1.9 */
+ default: return "[?]";
+ }
+}
diff --git a/common/util.h b/common/util.h
index f2b4306c3..b5bdd0385 100644
--- a/common/util.h
+++ b/common/util.h
@@ -204,6 +204,7 @@ int get_pk_algo_from_canon_sexp (const unsigned char *keydata,
char *pubkey_algo_string (gcry_sexp_t s_pkey, enum gcry_pk_algos *r_algoid);
const char *pubkey_algo_to_string (int algo);
const char *hash_algo_to_string (int algo);
+const char *cipher_mode_to_string (int mode);
/*-- convert.c --*/
int hex2bin (const char *string, void *buffer, size_t length);