chiark / gitweb /
priv-cache etc.: private key algorithm is specified in key id
[secnet.git] / privcache.c
index 0c10197d8fc0fc2694e002ae2ce0a40330240c62..b8dc2adee323ce23b2625ac6fe9a313901d0b388 100644 (file)
@@ -76,9 +76,13 @@ static struct sigprivkey_if *uncached_get(struct privcache *st,
     for (const struct sigscheme_info *scheme=sigschemes;
         scheme->name;
         scheme++) {
+       if (scheme->algid != id->b[GRPIDSZ])
+           continue;
+
        st->databuf.start=st->databuf.base;
        st->databuf.size=got;
-       ok=scheme->loadpriv(scheme, &st->databuf, &sigpriv, log);
+       struct cloc loc = { .file=st->path.buffer, .line=0 };
+       ok=scheme->loadpriv(scheme, &st->databuf, &sigpriv, log, loc);
        if (ok) {
            if (sigpriv->sethash) {
                if (!st->defhash) {
@@ -93,9 +97,11 @@ static struct sigprivkey_if *uncached_get(struct privcache *st,
            }
            goto out;
        }
+       /* loadpriv will have logged */
+       goto out;
     }
 
-    slilog(log,M_ERR,"private key file %s not loaded (not recognised?)",
+    slilog(log,M_ERR,"private key file %s not loaded (unknown algid)",
           st->path.buffer);
 
   out: