+ return st;
+
+error_out:
+ if (st) rsapriv_dispose(st);
+ st=0;
+ goto out;
+}
+
+static void verror_cfgfatal(struct rsapriv_load_ctx *l,
+ FILE *maybe_f, bool_t unsup,
+ const char *message, va_list args)
+{
+ vcfgfatal_maybefile(maybe_f,l->u.apply.loc,"rsa-private",message,args);
+}
+
+static list_t *rsapriv_apply(closure_t *self, struct cloc loc, dict_t *context,
+ list_t *args)
+{
+ struct rsapriv *st;
+ item_t *i;
+ cstring_t filename;
+ FILE *f;
+ struct rsapriv_load_ctx l[1];
+
+ l->verror=verror_cfgfatal;
+ l->u.apply.loc=loc;
+
+ /* Argument is filename pointing to SSH1 private key file */
+ i=list_elem(args,0);
+ if (i) {
+ if (i->type!=t_string) {
+ cfgfatal(i->loc,"rsa-private","first argument must be a string\n");
+ }
+ filename=i->data.string;
+ } else {
+ filename=NULL; /* Make compiler happy */
+ cfgfatal(i->loc,"rsa-private","you must provide a filename\n");
+ }
+
+ f=fopen(filename,"rb");
+ if (!f) {
+ if (just_check_config) {
+ Message(M_WARNING,"rsa-private (%s:%d): cannot open keyfile "
+ "\"%s\"; assuming it's valid while we check the "
+ "rest of the configuration\n",loc.file,loc.line,filename);
+ } else {
+ fatal_perror("rsa-private (%s:%d): cannot open file \"%s\"",
+ loc.file,loc.line,filename);
+ }
+ }
+
+ bool_t do_validity_check=True;
+ i=list_elem(args,1);
+ if (i && i->type==t_bool && i->data.bool==False) {
+ Message(M_INFO,"rsa-private (%s:%d): skipping RSA key validity "
+ "check\n",loc.file,loc.line);
+ do_validity_check=False;
+ }
+
+ st=rsa_loadpriv_core(l,f,loc,do_validity_check,filename);
+ fclose(f);