/* -*-c-*-
*
- * $Id: key-flags.c,v 1.4 2004/04/02 01:03:49 mdw Exp $
+ * $Id$
*
* Reading and writing key flag strings
*
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: key-flags.c,v $
- * Revision 1.4 2004/04/02 01:03:49 mdw
- * Miscellaneous constification.
- *
- * Revision 1.3 2004/03/28 01:58:47 mdw
- * Generate, store and retreive elliptic curve keys.
- *
- * Revision 1.2 2000/02/12 18:21:02 mdw
- * Overhaul of key management (again).
- *
- * Revision 1.1 1999/12/22 15:47:48 mdw
- * Major key-management revision.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <stdlib.h>
/* --- Look up the string in the flags table --- */
+ if (sz == 4 && strncmp(p, "none", 4) == 0)
+ goto next;
for (e = flagtab; e->name; e++) {
if (strncmp(e->name, p, sz) == 0) {
if (e->name[sz] == 0) {
return (KERR_BADFLAGS);
m |= ee->m;
f |= ee->f;
+ next:
p += sz;
if (*p == 0 || *p == ':')
break;
int key_match(key_data *k, const key_filter *kf)
{
- sym_iter i;
- key_struct *ks;
+ key_subkeyiter i;
+ const char *tag;
+ key_data *kd;
if (!kf)
return (1);
if ((k->e & KF_ENCMASK) != KENC_STRUCT)
return ((k->e & kf->m) == kf->f);
- for (sym_mkiter(&i, &k->u.s); (ks = sym_next(&i)) != 0; ) {
- if (key_match(&ks->k, kf))
+ for (key_mksubkeyiter(&i, k); key_nextsubkey(&i, &tag, &kd); ) {
+ if (key_match(kd, kf))
return (1);
}
return (0);