Quick glance didn't show glaring errors. Though the perl stuff makes
me wonder if it's interfacing with OpenSSL at EVP_*() level, which
/might/ make a difference here as your C code uses bare metal AES
crypto calls -- haven't checked this, just a wild guess.
Next is probably a stupid remark you
few nitpicks on the code:
int
bin2hex (unsigned char *pcIbuf, unsigned char *pszObuf, unsigned int ilen)
{
unsigned int i; // loop iteration counter
unsigned int j = (ilen * 2) + 1; // output buffer length
unsigned char *p;
p = pszObuf; // point to