+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <assert.h>
#include "crypto.h"
#include "crypto_if.h"
return 0;
}
-static unsigned char iv[16] = {0};
+const char *crypto_init(int ifno)
+{
+ if (ifno < 0 || ifno > MAX_IF) return (const char *)0;
+ return ifs[ifno]->init();
+}
+
+#define INITIV {0}
unsigned long encrypt(void *key, int keylen, void *pt, void *ct, int tlen)
{
+ unsigned char iv[16] = INITIV;
+
assert(keylen == 16);
return ifs[which]->encrypt(key, keylen, iv, pt, ct, tlen);
}
unsigned long decrypt(void *key, int keylen, void *ct, void *pt, int tlen)
{
+ unsigned char iv[16] = INITIV;
+
assert(keylen == 16);
return ifs[which]->decrypt(key, keylen, iv, ct, pt, tlen);
}
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);
}