pkttype = *plain & 0x40 ? (*plain & 0x3f) : ((*plain >> 2) & 0xf);
if (pkttype == CDK_PKT_COMPRESSED && r_zipalgo)
{
- _cdk_log_debug ("armor compressed (algo=%d)\n", *(plain + 1));
+ _gnutls_buffers_log ("armor compressed (algo=%d)\n", *(plain + 1));
*r_zipalgo = *(plain + 1);
}
break;
return CDK_Inv_Value;
}
- _cdk_log_debug ("armor filter: encode\n");
+ _gnutls_buffers_log ("armor filter: encode\n");
memset (crcbuf, 0, sizeof (crcbuf));
return CDK_Inv_Value;
}
- _cdk_log_debug ("armor filter: decode\n");
+ _gnutls_buffers_log ("armor filter: decode\n");
fseek (in, 0, SEEK_SET);
/* Search the begin of the message */
afx->crc_okay = (afx->crc == crc2) ? 1 : 0;
if (!afx->crc_okay && !rc)
{
- _cdk_log_debug ("file crc=%08X afx_crc=%08X\n", (unsigned int) crc2,
+ _gnutls_buffers_log ("file crc=%08X afx_crc=%08X\n", (unsigned int) crc2,
(unsigned int) afx->crc);
rc = CDK_Armor_CRC_Error;
}
armor_filter_t *afx = data;
if (afx)
{
- _cdk_log_debug ("free armor filter\n");
+ _gnutls_buffers_log ("free armor filter\n");
afx->idx = afx->idx2 = 0;
afx->crc = afx->crc_okay = 0;
return 0;
if (nbits > MAX_MPI_BITS || nbits == 0)
{
- _cdk_log_debug ("read_mpi: too large %d bits\n", (int) nbits);
+ _gnutls_write_log ("read_mpi: too large %d bits\n", (int) nbits);
return CDK_MPI_Error; /* Sanity check */
}
rc = stream_read (inp, buf + 2, nread, &nread);
if (!rc && nread != ((nbits + 7) / 8))
{
- _cdk_log_debug ("read_mpi: too short %d < %d\n", (int) nread,
+ _gnutls_write_log ("read_mpi: too short %d < %d\n", (int) nread,
(int) ((nbits + 7) / 8));
return CDK_MPI_Error;
}
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_pubkey_enc: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_pubkey_enc: %d octets\n", (int) pktlen);
if (pktlen < 12)
return CDK_Inv_Packet;
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_mdc:\n");
+ _gnutls_write_log ("read_mdc:\n");
rc = stream_read (inp, mdc->hash, DIM (mdc->hash), &n);
if (rc)
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_compressed: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_compressed: %d octets\n", (int) pktlen);
c->algorithm = cdk_stream_getc (inp);
if (c->algorithm > 3)
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_public_key: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_public_key: %d octets\n", (int) pktlen);
pk->is_invalid = 1; /* default to detect missing self signatures */
pk->is_revoked = 0;
if (!npkey)
{
gnutls_assert ();
- _cdk_log_debug ("invalid public key algorithm %d\n", pk->pubkey_algo);
+ _gnutls_write_log ("invalid public key algorithm %d\n", pk->pubkey_algo);
return CDK_Inv_Algo;
}
for (i = 0; i < npkey; i++)
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_secret_key: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_secret_key: %d octets\n", (int) pktlen);
p1 = cdk_stream_tell (inp);
rc = read_public_key (inp, pktlen, sk->pk);
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_attribute: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_attribute: %d octets\n", (int) pktlen);
strcpy (attr->name, "[attribute]");
attr->len = strlen (attr->name);
return CDK_Inv_Packet;
if (DEBUG_PKT)
- _cdk_log_debug ("read_user_id: %lu octets\n", pktlen);
+ _gnutls_write_log ("read_user_id: %lu octets\n", pktlen);
user_id->len = pktlen;
rc = stream_read (inp, user_id->name, pktlen, &nread);
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_subpkt:\n");
+ _gnutls_write_log ("read_subpkt:\n");
n = 0;
*r_nbytes = 0;
node->size = size;
node->type = cdk_stream_getc (inp);
if (DEBUG_PKT)
- _cdk_log_debug (" %d octets %d type\n", node->size, node->type);
+ _gnutls_write_log (" %d octets %d type\n", node->size, node->type);
n++;
node->size--;
rc = stream_read (inp, node->d, node->size, &nread);
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_onepass_sig: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_onepass_sig: %d octets\n", (int) pktlen);
if (pktlen != 13)
return CDK_Inv_Packet;
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_signature: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_signature: %d octets\n", (int) pktlen);
if (pktlen < 16)
return CDK_Inv_Packet;
return CDK_Inv_Value;
if (DEBUG_PKT)
- _cdk_log_debug ("read_literal: %d octets\n", (int) pktlen);
+ _gnutls_write_log ("read_literal: %d octets\n", (int) pktlen);
pt->mode = cdk_stream_getc (inp);
if (pt->mode != 0x62 && pt->mode != 0x74 && pt->mode != 0x75)
return CDK_Inv_Value;
}
- _cdk_log_debug ("open stream `%s'\n", file);
+ _gnutls_read_log ("open stream `%s'\n", file);
*ret_s = NULL;
s = cdk_calloc (1, sizeof *s);
if (!s)
gnutls_assert ();
return CDK_File_Error;
}
- _cdk_log_debug ("open stream fd=%d\n", fileno (s->fp));
+ _gnutls_read_log ("open stream fd=%d\n", fileno (s->fp));
s->flags.write = 0;
*ret_s = s;
return 0;
return CDK_Inv_Value;
}
- _cdk_log_debug ("new stream `%s'\n", file ? file : "[temp]");
+ _gnutls_read_log ("new stream `%s'\n", file ? file : "[temp]");
*ret_s = NULL;
s = cdk_calloc (1, sizeof *s);
if (!s)
gnutls_assert ();
return CDK_File_Error;
}
- _cdk_log_debug ("new stream fd=%d\n", fileno (s->fp));
+ _gnutls_read_log ("new stream fd=%d\n", fileno (s->fp));
*ret_s = s;
return 0;
}
return CDK_Inv_Value;
}
- _cdk_log_debug ("create stream `%s'\n", file);
+ _gnutls_read_log ("create stream `%s'\n", file);
*ret_s = NULL;
s = cdk_calloc (1, sizeof *s);
if (!s)
gnutls_assert ();
return CDK_File_Error;
}
- _cdk_log_debug ("stream create fd=%d\n", fileno (s->fp));
+ _gnutls_read_log ("stream create fd=%d\n", fileno (s->fp));
*ret_s = s;
return 0;
}
return CDK_Out_Of_Core;
}
- _cdk_log_debug ("stream ref fd=%d\n", fileno (fp));
+ _gnutls_read_log ("stream ref fd=%d\n", fileno (fp));
s->fp = fp;
s->fp_ref = 1;
s->flags.filtrated = 1;
return CDK_Inv_Value;
}
- _cdk_log_debug ("close stream ref=%d `%s'\n",
+ _gnutls_read_log ("close stream ref=%d `%s'\n",
s->fp_ref, s->fname ? s->fname : "[temp]");
/* In the user callback mode, we call the release cb if possible
{
int err;
- _cdk_log_debug ("close stream fd=%d\n", fileno (s->fp));
+ _gnutls_read_log ("close stream fd=%d\n", fileno (s->fp));
err = fclose (s->fp);
s->fp = NULL;
if (err)
assert (s);
- _cdk_log_debug ("replace stream fd=%d with fd=%d\n",
+ _gnutls_read_log ("replace stream fd=%d with fd=%d\n",
fileno (s->fp), fileno (*tmp));
rc = fclose (s->fp);
if (rc)
if (!f->flags.enabled)
continue;
/* if there is no next filter, create the final output file */
- _cdk_log_debug ("filter [write]: last filter=%d fname=%s\n",
+ _gnutls_read_log ("filter [write]: last filter=%d fname=%s\n",
f->next ? 1 : 0, s->fname);
if (!f->next && s->fname)
f->tmp = fopen (s->fname, "w+b");
break;
}
rc = f->fnct (f->opaque, f->ctl, s->fp, f->tmp);
- _cdk_log_debug ("filter [write]: type=%d rc=%d\n", f->type, rc);
+ _gnutls_read_log ("filter [write]: type=%d rc=%d\n", f->type, rc);
if (!rc)
rc = stream_fp_replace (s, &f->tmp);
if (!rc)
rc = cdk_stream_seek (s, 0);
if (rc)
{
- _cdk_log_debug ("filter [close]: fd=%d\n", fileno (f->tmp));
+ _gnutls_read_log ("filter [close]: fd=%d\n", fileno (f->tmp));
fclose (f->tmp);
break;
}
continue;
if (f->flags.error)
{
- _cdk_log_debug ("filter %s [read]: has the error flag; skipped\n",
+ _gnutls_read_log ("filter %s [read]: has the error flag; skipped\n",
s->fname ? s->fname : "[temp]");
continue;
}
break;
}
rc = f->fnct (f->opaque, f->ctl, s->fp, f->tmp);
- _cdk_log_debug ("filter %s [read]: type=%d rc=%d\n",
+ _gnutls_read_log ("filter %s [read]: type=%d rc=%d\n",
s->fname ? s->fname : "[temp]", f->type, rc);
if (rc)
{
s->cache.alloced += (count + STREAM_BUFSIZE);
memcpy (s->cache.buf, old, s->cache.size);
cdk_free (old);
- _cdk_log_debug ("stream: enlarge cache to %d octets\n",
+ _gnutls_read_log ("stream: enlarge cache to %d octets\n",
(int) s->cache.alloced);
}
memcpy (s->cache.buf + s->cache.size, buf, count);
struct stream_filter_s *f;
const char *orig_fname;
- _cdk_log_debug ("stream: enable literal mode.\n");
+ _gnutls_read_log ("stream: enable literal mode.\n");
if (!s)
{
{
s->cache.buf = cdk_calloc (1, STREAM_BUFSIZE);
s->cache.alloced = STREAM_BUFSIZE;
- _cdk_log_debug ("stream: allocate cache of %d octets\n",
+ _gnutls_read_log ("stream: allocate cache of %d octets\n",
STREAM_BUFSIZE);
}
return 0;
/* Memory mapping is not supported on custom I/O objects. */
if (s->cbs_hd)
{
- _cdk_log_debug ("cdk_stream_mmap_part: not supported on callbacks\n");
+ _gnutls_read_log ("cdk_stream_mmap_part: not supported on callbacks\n");
gnutls_assert ();
return CDK_Inv_Mode;
}
len = cdk_stream_get_length (s);
if (!len)
{
- _cdk_log_debug ("cdk_stream_mmap_part: invalid file size %lu\n", len);
+ _gnutls_read_log ("cdk_stream_mmap_part: invalid file size %lu\n", len);
gnutls_assert ();
return s->error;
}
{
assert (s);
- _cdk_log_debug ("stream: activate block mode with blocksize %d\n",
+ _gnutls_read_log ("stream: activate block mode with blocksize %d\n",
(int) nbytes);
s->blkmode = nbytes;
return 0;
return CDK_Inv_Algo;
if (DEBUG_PKT)
- _cdk_log_debug ("write_pubkey_enc:\n");
+ _gnutls_write_log ("write_pubkey_enc:\n");
nenc = cdk_pk_get_nenc (pke->pubkey_algo);
size = 10 + calc_mpisize (pke->mpi, nenc);
assert (out);
if (DEBUG_PKT)
- _cdk_log_debug ("write_mdc:\n");
+ _gnutls_write_log ("write_mdc:\n");
/* This packet requires a fixed header encoding */
rc = stream_putc (out, 0xD3); /* packet ID and 1 byte length */
return CDK_Inv_Packet;
if (DEBUG_PKT)
- _cdk_log_debug ("write_signature:\n");
+ _gnutls_write_log ("write_signature:\n");
nsig = cdk_pk_get_nsig (sig->pubkey_algo);
if (!nsig)
return CDK_Inv_Packet;
if (DEBUG_PKT)
- _cdk_log_debug ("write_public_key: subkey=%d\n", is_subkey);
+ _gnutls_write_log ("write_public_key: subkey=%d\n", is_subkey);
pkttype = is_subkey ? CDK_PKT_PUBLIC_SUBKEY : CDK_PKT_PUBLIC_KEY;
npkey = cdk_pk_get_npkey (pk->pubkey_algo);
return CDK_Inv_Packet;
if (DEBUG_PKT)
- _cdk_log_debug ("write_secret_key:\n");
+ _gnutls_write_log ("write_secret_key:\n");
npkey = cdk_pk_get_npkey (pk->pubkey_algo);
nskey = cdk_pk_get_nskey (pk->pubkey_algo);
assert (cd);
if (DEBUG_PKT)
- _cdk_log_debug ("packet: write_compressed\n");
+ _gnutls_write_log ("packet: write_compressed\n");
/* Use an old (RFC1991) header for this packet. */
rc = pkt_write_head (out, 1, 0, CDK_PKT_COMPRESSED);
return CDK_Inv_Packet;
if (DEBUG_PKT)
- _cdk_log_debug ("write_literal:\n");
+ _gnutls_write_log ("write_literal:\n");
size = 6 + pt->namelen + pt->len;
rc = pkt_write_head (out, old_ctb, size, CDK_PKT_LITERAL);
return CDK_Inv_Packet;
if (DEBUG_PKT)
- _cdk_log_debug ("write_onepass_sig:\n");
+ _gnutls_write_log ("write_onepass_sig:\n");
rc = pkt_write_head (out, 0, 13, CDK_PKT_ONEPASS_SIG);
if (!rc)
if (!out || !pkt)
return CDK_Inv_Value;
- _cdk_log_debug ("write packet pkttype=%d\n", pkt->pkttype);
+ _gnutls_write_log ("write packet pkttype=%d\n", pkt->pkttype);
switch (pkt->pkttype)
{
case CDK_PKT_LITERAL:
}
if (DEBUG_PKT)
- _cdk_log_debug ("write_packet rc=%d pkttype=%d\n", rc, pkt->pkttype);
+ _gnutls_write_log ("write_packet rc=%d pkttype=%d\n", rc, pkt->pkttype);
return rc;
}