diff options
Diffstat (limited to '')
-rw-r--r-- | g10/misc.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/g10/misc.c b/g10/misc.c index 61f104a01..fb9d62f1f 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -31,6 +31,7 @@ #include <sys/time.h> #include <sys/resource.h> #endif +#include <gcrypt.h> #include "util.h" #include "main.h" #include "options.h" @@ -265,3 +266,32 @@ map_gcry_rc( int rc ) } } + +/**************** + * Wrapper around the libgcrypt function with addional checks on + * openPGP contrainst for the algo ID. + */ +int +openpgp_cipher_test_algo( int algo ) +{ + if( algo < 0 || algo > 110 ) + return GCRYERR_INV_ALGO; + return gcry_cipher_test_algo(algo); +} + +int +openpgp_pk_test_algo( int algo ) +{ + if( algo < 0 || algo > 110 ) + return GCRYERR_INV_ALGO; + return gcry_pk_test_algo(algo); +} + +int +openpgp_md_test_algo( int algo ) +{ + if( algo < 0 || algo > 110 ) + return GCRYERR_INV_ALGO; + return gcry_md_test_algo(algo); +} + |