version 1.2, 2001/04/05 10:42:51 |
version 1.2.4.2, 2002/06/22 07:23:17 |
|
|
|
|
struct { |
struct { |
char *name; |
char *name; |
EVP_MD * (*mdfunc)(void); |
const EVP_MD * (*mdfunc)(void); |
int truncatebits; /* truncate digest if != 0 */ |
int truncatebits; /* truncate digest if != 0 */ |
} macs[] = { |
} macs[] = { |
{ "hmac-sha1", EVP_sha1, 0, }, |
{ "hmac-sha1", EVP_sha1, 0, }, |
|
|
if (strcmp(name, macs[i].name) == 0) { |
if (strcmp(name, macs[i].name) == 0) { |
if (mac != NULL) { |
if (mac != NULL) { |
mac->md = (*macs[i].mdfunc)(); |
mac->md = (*macs[i].mdfunc)(); |
mac->key_len = mac->mac_len = mac->md->md_size; |
mac->key_len = mac->mac_len = EVP_MD_size(mac->md); |
if (macs[i].truncatebits != 0) |
if (macs[i].truncatebits != 0) |
mac->mac_len = macs[i].truncatebits/8; |
mac->mac_len = macs[i].truncatebits/8; |
} |
} |
|
|
return (0); |
return (0); |
maclist = cp = xstrdup(names); |
maclist = cp = xstrdup(names); |
for ((p = strsep(&cp, MAC_SEP)); p && *p != '\0'; |
for ((p = strsep(&cp, MAC_SEP)); p && *p != '\0'; |
(p = strsep(&cp, MAC_SEP))) { |
(p = strsep(&cp, MAC_SEP))) { |
if (mac_init(NULL, p) < 0) { |
if (mac_init(NULL, p) < 0) { |
debug("bad mac %s [%s]", p, names); |
debug("bad mac %s [%s]", p, names); |
xfree(maclist); |
xfree(maclist); |