X-Git-Url: http://www.average.org/gitweb/?p=pam_pcsc_cr.git;a=blobdiff_plain;f=crypto.c;fp=crypto.c;h=b524f8ad24d3631f02fe8b980d625afe9dcb0c64;hp=282a713d494517afef007f57212df40691b264ca;hb=8c8a47cd542e60381773fe23f2075aa5b896be4f;hpb=3d841899fe8859b2ce6af8fdfd8fa961c7651425 diff --git a/crypto.c b/crypto.c index 282a713..b524f8a 100644 --- a/crypto.c +++ b/crypto.c @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include #include "crypto.h" #include "crypto_if.h" @@ -25,6 +28,12 @@ int select_crypto_if(int ifno) return 0; } +const char *if_name(int ifno) +{ + if (ifno < 0 || ifno > MAX_IF) return "invalid index"; + return ifs[ifno]->name; +} + static unsigned char iv[16] = {0}; unsigned long encrypt(void *key, int keylen, void *pt, void *ct, int tlen) @@ -47,7 +56,6 @@ unsigned long hash(void *pt, int tlen, void *tag, int *taglen) unsigned long hmac(void *key, int keylen, void *pt, int tlen, void *tag, int *taglen) { - assert(keylen == 20); assert(*taglen == 20); return ifs[which]->hmac(key, keylen, pt, tlen, tag, taglen); }