uint8_t *hashbuf;
};
+#define FREE(b) ({ free((b)); (b)=0; })
+
struct load_ctx {
void (*verror)(struct load_ctx *l,
FILE *maybe_f, bool_t unsup,
const char *message, va_list args);
bool_t (*postreadcheck)(struct load_ctx *l, FILE *f);
+ const char *what;
struct cloc *loc;
union {
struct {
const char *message, va_list args)
{
int class=unsup ? M_DEBUG : M_ERR;
- slilog_part(l->u.tryload.log,class,"rsa1priv load: ");
+ slilog_part(l->u.tryload.log,class,"%s: ",l->what);
vslilog(l->u.tryload.log,class,message,args);
}
FILE *maybe_f, bool_t unsup,
const char *message, va_list args)
{
- vcfgfatal_maybefile(maybe_f,*l->loc,"rsa-private",message,args);
+ vcfgfatal_maybefile(maybe_f,*l->loc,l->what,message,args);
}
struct rsapriv {
#define LDUNSUP(...) ({ load_error(l,0,1,__VA_ARGS__); goto error_out; })
#define LDFATAL_FILE(...) ({ load_error(l,f,0,__VA_ARGS__); goto error_out; })
#define LDUNSUP_FILE(...) ({ load_error(l,f,1,__VA_ARGS__); goto error_out; })
-#define FREE(b) ({ free((b)); (b)=0; })
#define KEYFILE_GET(is) ({ \
uint##is##_t keyfile_get_tmp=keyfile_get_##is(l,f); \
if (!l->postreadcheck(l,f)) goto error_out; \
bool_t rsa1_loadpriv(const struct sigscheme_info *algo,
struct buffer_if *privkeydata,
struct sigprivkey_if **sigpriv_r,
- struct log_if *log)
+ struct log_if *log, struct cloc loc)
{
FILE *f=0;
struct rsapriv *st=0;
goto error_out;
}
- struct cloc loc;
- loc.file="dynamically loaded";
- loc.line=0;
-
struct load_ctx l[1];
+ l->what="rsa1priv load";
l->verror=verror_tryload;
l->postreadcheck=postreadcheck_tryload;
l->loc=&loc;
FILE *f;
struct load_ctx l[1];
+ l->what="rsa-private";
l->verror=verror_cfgfatal;
l->postreadcheck=postreadcheck_apply;
l->loc=&loc;