static void pgpring_dump_keyblock(struct PgpKeyInfo *p)
{
- struct PgpUid *uid = NULL;
- bool first;
- struct tm *tp = NULL;
- time_t t;
-
- for (; p; p = p->next)
+ for (struct tm *tp = NULL; p; p = p->next)
{
- first = true;
+ bool first = true;
if (p->flags & KEYFLAG_SECRET)
{
if (p->flags & KEYFLAG_DISABLED)
putchar('d');
- for (uid = p->address; uid; uid = uid->next, first = false)
+ for (struct PgpUid *uid = p->address; uid; uid = uid->next, first = false)
{
if (!first)
{
else
putchar(gnupg_trustletter(uid->trust));
- t = p->gen_time;
+ const time_t t = p->gen_time;
tp = gmtime(&t);
printf(":%d:%d:%s:%04d-%02d-%02d::::", p->keylen, p->numalg, p->keyid,
static void skip_bignum(unsigned char *buf, size_t l, size_t j, size_t *toff, size_t n)
{
- size_t len;
-
do
{
- len = (buf[j] << 8) + buf[j + 1];
+ const size_t len = (buf[j] << 8) + buf[j + 1];
j += (len + 7) / 8 + 2;
} while (j <= l && --n > 0);
static int pgp_parse_pgp3_sig(unsigned char *buf, size_t l,
struct PgpKeyInfo *p, struct PgpSignature *s)
{
- unsigned char sigtype;
- unsigned char skt;
time_t sig_gen_time = -1;
long validity = -1;
long key_validity = -1;
unsigned long signerid1 = 0;
unsigned long signerid2 = 0;
- size_t ml;
size_t j;
short have_critical_spks = 0;
j = 2;
- sigtype = buf[j++];
+ const unsigned char sigtype = buf[j++];
j += 2; /* pkalg, hashalg */
for (short ii = 0; ii < 2; ii++)
{
- size_t skl;
- size_t nextone;
-
- ml = (buf[j] << 8) + buf[j + 1];
+ size_t ml = (buf[j] << 8) + buf[j + 1];
j += 2;
if (j + ml > l)
break;
- nextone = j;
+ size_t nextone = j;
while (ml)
{
j = nextone;
- skl = buf[j++];
+ size_t skl = buf[j++];
if (!--ml)
break;
ml -= skl;
nextone = j + skl;
- skt = buf[j++];
+ const unsigned char skt = buf[j++];
switch (skt & 0x7f)
{
{
unsigned char *buf = NULL;
unsigned char pt = 0;
- unsigned char last_pt;
size_t l = 0;
short err = 0;
while (!err && (buf = pgp_read_packet(fp, &l)) != NULL)
{
- last_pt = pt;
+ unsigned char last_pt = pt;
pt = buf[0] & 0x3f;
/* check if we have read the complete key block. */
static void pgpring_find_candidates(char *ringfile, const char *hints[], int nhints)
{
- FILE *rfp = NULL;
fpos_t pos, keypos;
unsigned char *buf = NULL;
- unsigned char pt = 0;
size_t l = 0;
short err = 0;
- rfp = fopen(ringfile, "r");
+ FILE *rfp = fopen(ringfile, "r");
if (!rfp)
{
char *error_buf = NULL;
while (!err && (buf = pgp_read_packet(rfp, &l)) != NULL)
{
- pt = buf[0] & 0x3f;
+ const unsigned char pt = buf[0] & 0x3f;
if (l < 1)
continue;
short secring = 0;
const char *tmp_kring = NULL;
- const char *env_pgppath = NULL;
- const char *env_home = NULL;
-
- char pgppath[_POSIX_PATH_MAX];
char kring[_POSIX_PATH_MAX];
while ((c = getopt(argc, argv, "f25sk:S")) != EOF)
mutt_str_strfcpy(kring, tmp_kring, sizeof(kring));
else
{
- env_pgppath = mutt_str_getenv("PGPPATH");
+ const char *env_home = NULL;
+ char pgppath[_POSIX_PATH_MAX];
+ const char *env_pgppath = mutt_str_getenv("PGPPATH");
if (env_pgppath)
mutt_str_strfcpy(pgppath, env_pgppath, sizeof(pgppath));
else if ((env_home = mutt_str_getenv("HOME")))