const char *p;
const bulkcrypto *bulk;
char *q, *qq;
- dstr d = DSTR_INIT;
+ dstr d = DSTR_INIT, dd = DSTR_INIT;
int rc = -1;
/* --- Hash function --- */
}
}
+ /* --- Block cipher for miscellaneous use --- */
+
+ if (!(a->bulk->prim & BCP_BLKC))
+ a->b = 0;
+ else {
+ if ((p = key_getattr(kf, k, "blkc")) == 0) {
+ dstr_reset(&dd);
+ dstr_puts(&dd, a->c ? a->c->name : "rijndael-");
+ if ((q = strrchr(dd.buf, '-')) != 0) *q = 0;
+ p = dd.buf;
+ }
+ dstr_reset(&d);
+ dstr_putf(&d, "%s-ecb", p);
+ if ((a->b = gcipher_byname(d.buf)) == 0) {
+ a_format(e, "unknown-blkc", "%s", p, A_END);
+ goto done;
+ }
+ }
+
/* --- Message authentication for bulk data --- */
if (!(a->bulk->prim & BCP_MAC)) {
rc = 0;
done:
dstr_destroy(&d);
+ dstr_destroy(&dd);
return (rc);
}
A_END);
return (-1);
}
+ if (a->b && (a->bksz = keysz(a->hashsz, a->b->keysz)) == 0) {
+ a_format(e, "blkc", "%.*s", strlen(a->b->name) - 4, a->b->name,
+ "no-key-size", "%lu", (unsigned long)a->hashsz,
+ A_END);
+ return (-1);
+ }
/* --- Derive the data limit --- */
{
const algswitch *a = &kdx->algs, *aa = &kdy->algs;
- return (group_samep(kdx->g, kdy->g) && a->c == aa->c &&
+ return (group_samep(kdx->g, kdy->g) &&
+ a->c == aa->c && a->b == aa->b &&
a->mgf == aa->mgf && a->h == aa->h &&
a->m == aa->m && a->tagsz == aa->tagsz);
}