/*
+ * Copyright notice from original mutt:
* Copyright (C) 1997-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later
- * version.
- *
- * This program 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 General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111, USA.
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
*/
/* Generally useful, pgp-related functions. */
const char *pgp_pkalgbytype (unsigned char type)
{
- switch (type)
- {
+ switch (type) {
case 1:
return "RSA";
case 2:
static const char *hashalgbytype (unsigned char type)
{
- switch (type)
- {
+ switch (type) {
case 1:
return "MD5";
case 2:
short pgp_canencrypt (unsigned char type)
{
- switch (type)
- {
+ switch (type) {
case 1:
case 2:
case 16:
short pgp_cansign (unsigned char type)
{
- switch (type)
- {
+ switch (type) {
case 1:
case 3:
case 17:
return (pgp_canencrypt (type) << 1) | pgp_cansign (type);
}
-void pgp_free_sig (pgp_sig_t **sigp)
+void pgp_free_sig (pgp_sig_t ** sigp)
{
pgp_sig_t *sp, *q;
-
+
if (!sigp || !*sigp)
return;
-
- for (sp = *sigp; sp; sp = q)
- {
+
+ for (sp = *sigp; sp; sp = q) {
q = sp->next;
FREE (&sp);
}
-
+
*sigp = NULL;
}
if (!upp || !*upp)
return;
- for (up = *upp; up; up = q)
- {
+ for (up = *upp; up; up = q) {
q = up->next;
pgp_free_sig (&up->sigs);
FREE (&up->addr);
*upp = NULL;
}
-pgp_uid_t *pgp_copy_uids (pgp_uid_t *up, pgp_key_t parent)
+pgp_uid_t *pgp_copy_uids (pgp_uid_t * up, pgp_key_t parent)
{
pgp_uid_t *l = NULL;
pgp_uid_t **lp = &l;
- for (; up; up = up->next)
- {
+ for (; up; up = up->next) {
*lp = safe_calloc (1, sizeof (pgp_uid_t));
- (*lp)->trust = up->trust;
- (*lp)->flags = up->flags;
- (*lp)->addr = safe_strdup (up->addr);
+ (*lp)->trust = up->trust;
+ (*lp)->flags = up->flags;
+ (*lp)->addr = safe_strdup (up->addr);
(*lp)->parent = parent;
lp = &(*lp)->next;
}
return l;
}
-static void _pgp_free_key (pgp_key_t *kpp)
+static void _pgp_free_key (pgp_key_t * kpp)
{
pgp_key_t kp;
FREE (kpp);
}
-pgp_key_t pgp_remove_key (pgp_key_t *klist, pgp_key_t key)
+pgp_key_t pgp_remove_key (pgp_key_t * klist, pgp_key_t key)
{
pgp_key_t *last;
pgp_key_t p, q, r;
return q;
}
-void pgp_free_key (pgp_key_t *kpp)
+void pgp_free_key (pgp_key_t * kpp)
{
pgp_key_t p, q, r;
if ((*kpp)->parent && (*kpp)->parent != *kpp)
*kpp = (*kpp)->parent;
-
+
/* Order is important here:
*
* - First free all children.
* - free ourselves.
*/
- for (p = *kpp; p; p = q)
- {
- for (q = p->next; q && q->parent == p; q = r)
- {
+ for (p = *kpp; p; p = q) {
+ for (q = p->next; q && q->parent == p; q = r) {
r = q->next;
_pgp_free_key (&q);
}
*kpp = NULL;
}
-