sprintf(st->path.write_here, SIGKEYID_PR_FMT, SIGKEYID_PR_VAL(id));
const char *path=st->path.buffer;
+ struct hash_if *defhash=st->defhash;
+ struct buffer_if *databuf=&st->databuf;
f = fopen(path,"rb");
if (!f) {
}
setbuf(f,0);
- buffer_init(&st->databuf,0);
- ssize_t got=fread(st->databuf.base,1,st->databuf.alloclen,f);
+ buffer_init(databuf,0);
+ ssize_t got=fread(databuf->base,1,databuf->alloclen,f);
if (ferror(f)) {
slilog(log,M_ERR,"failed to read private-key file %s",
path);
}
if (!feof(f)) {
slilog(log,M_ERR,"private key file %s longer than max %d",
- path, (int)st->databuf.alloclen);
+ path, (int)databuf->alloclen);
goto out;
}
fclose(f); f=0;
goto out;
found:
- st->databuf.start=st->databuf.base;
- st->databuf.size=got;
+ databuf->start=databuf->base;
+ databuf->size=got;
struct cloc loc = { .file=path, .line=0 };
- ok=scheme->loadpriv(scheme, &st->databuf, &sigpriv, log, loc);
+ ok=scheme->loadpriv(scheme, databuf, &sigpriv, log, loc);
if (!ok) goto out; /* loadpriv will have logged */
if (sigpriv->sethash) {
- if (!st->defhash) {
+ if (!defhash) {
slilog(log,M_ERR,
"private key %s requires `hash' config key for privcache to load",
path);
sigpriv=0;
goto out;
}
- sigpriv->sethash(sigpriv->st,st->defhash);
+ sigpriv->sethash(sigpriv->st,defhash);
}
out: