Don't prefix function names with "pgp_" if the functions are static.
This commit is contained in:
parent
4f977752ce
commit
e2c60ad188
|
@ -54,7 +54,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: crypto.c,v 1.32 2010/11/07 08:39:59 agc Exp $");
|
||||
__RCSID("$NetBSD: crypto.c,v 1.33 2010/11/15 08:50:32 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -316,7 +316,7 @@ write_parsed_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
|
|||
case PGP_PTAG_CT_SE_DATA_BODY:
|
||||
case PGP_PTAG_CT_SE_DATA_HEADER:
|
||||
/* Ignore these packets */
|
||||
/* They're handled in pgp_parse_packet() */
|
||||
/* They're handled in parse_packet() */
|
||||
/* and nothing else needs to be done */
|
||||
break;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: keyring.c,v 1.48 2010/11/07 08:39:59 agc Exp $");
|
||||
__RCSID("$NetBSD: keyring.c,v 1.49 2010/11/15 08:50:32 agc Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
|
@ -398,7 +398,7 @@ pgp_is_key_supported(const pgp_key_t *key)
|
|||
\note If dst already has a userid, it will be freed.
|
||||
*/
|
||||
static uint8_t *
|
||||
pgp_copy_userid(uint8_t **dst, const uint8_t *src)
|
||||
copy_userid(uint8_t **dst, const uint8_t *src)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
|
@ -407,7 +407,7 @@ pgp_copy_userid(uint8_t **dst, const uint8_t *src)
|
|||
free(*dst);
|
||||
}
|
||||
if ((*dst = calloc(1, len + 1)) == NULL) {
|
||||
(void) fprintf(stderr, "pgp_copy_userid: bad alloc\n");
|
||||
(void) fprintf(stderr, "copy_userid: bad alloc\n");
|
||||
} else {
|
||||
(void) memcpy(*dst, src, len);
|
||||
}
|
||||
|
@ -423,13 +423,13 @@ pgp_copy_userid(uint8_t **dst, const uint8_t *src)
|
|||
\note If dst already has a packet, it will be freed.
|
||||
*/
|
||||
static pgp_subpacket_t *
|
||||
pgp_copy_packet(pgp_subpacket_t *dst, const pgp_subpacket_t *src)
|
||||
copy_packet(pgp_subpacket_t *dst, const pgp_subpacket_t *src)
|
||||
{
|
||||
if (dst->raw) {
|
||||
free(dst->raw);
|
||||
}
|
||||
if ((dst->raw = calloc(1, src->length)) == NULL) {
|
||||
(void) fprintf(stderr, "pgp_copy_packet: bad alloc\n");
|
||||
(void) fprintf(stderr, "copy_packet: bad alloc\n");
|
||||
} else {
|
||||
dst->length = src->length;
|
||||
(void) memcpy(dst->raw, src->raw, src->length);
|
||||
|
@ -454,7 +454,7 @@ pgp_add_userid(pgp_key_t *key, const uint8_t *userid)
|
|||
uidp = &key->uids[key->uidc++];
|
||||
*uidp = NULL;
|
||||
/* now copy it */
|
||||
return pgp_copy_userid(uidp, userid);
|
||||
return copy_userid(uidp, userid);
|
||||
}
|
||||
|
||||
void print_packet_hex(const pgp_subpacket_t *pkt);
|
||||
|
@ -477,7 +477,7 @@ pgp_add_subpacket(pgp_key_t *keydata, const pgp_subpacket_t *packet)
|
|||
subpktp->length = 0;
|
||||
subpktp->raw = NULL;
|
||||
/* now copy it */
|
||||
return pgp_copy_packet(subpktp, packet);
|
||||
return copy_packet(subpktp, packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: packet-parse.c,v 1.48 2010/11/15 08:03:40 agc Exp $");
|
||||
__RCSID("$NetBSD: packet-parse.c,v 1.49 2010/11/15 08:50:32 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -871,7 +871,7 @@ pgp_subpacket_free(pgp_subpacket_t *packet)
|
|||
\brief Free allocated memory
|
||||
*/
|
||||
static void
|
||||
pgp_headers_free(pgp_headers_t *headers)
|
||||
headers_free(pgp_headers_t *headers)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
|
@ -899,7 +899,7 @@ cleartext_trailer_free(struct _ops_hash_t **trailer)
|
|||
\brief Free allocated memory
|
||||
*/
|
||||
static void
|
||||
pgp_cmd_get_passphrase_free(pgp_seckey_passphrase_t *skp)
|
||||
cmd_get_passphrase_free(pgp_seckey_passphrase_t *skp)
|
||||
{
|
||||
if (skp->passphrase && *skp->passphrase) {
|
||||
free(*skp->passphrase);
|
||||
|
@ -995,11 +995,11 @@ pgp_parser_content_free(pgp_packet_t *c)
|
|||
break;
|
||||
|
||||
case PGP_PTAG_CT_SIGNED_CLEARTEXT_HEADER:
|
||||
pgp_headers_free(&c->u.cleartext_head);
|
||||
headers_free(&c->u.cleartext_head);
|
||||
break;
|
||||
|
||||
case PGP_PTAG_CT_ARMOUR_HEADER:
|
||||
pgp_headers_free(&c->u.armour_header.headers);
|
||||
headers_free(&c->u.armour_header.headers);
|
||||
break;
|
||||
|
||||
case PGP_PTAG_CT_SIGNED_CLEARTEXT_TRAILER:
|
||||
|
@ -1118,7 +1118,7 @@ pgp_parser_content_free(pgp_packet_t *c)
|
|||
break;
|
||||
|
||||
case PGP_GET_PASSPHRASE:
|
||||
pgp_cmd_get_passphrase_free(&c->u.skey_passphrase);
|
||||
cmd_get_passphrase_free(&c->u.skey_passphrase);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2868,7 +2868,7 @@ parse_pk_sesskey(pgp_region_t *region,
|
|||
}
|
||||
|
||||
static int
|
||||
pgp_decrypt_se_data(pgp_content_enum tag, pgp_region_t *region,
|
||||
decrypt_se_data(pgp_content_enum tag, pgp_region_t *region,
|
||||
pgp_stream_t *stream)
|
||||
{
|
||||
pgp_crypt_t *decrypt;
|
||||
|
@ -2928,7 +2928,7 @@ pgp_decrypt_se_data(pgp_content_enum tag, pgp_region_t *region,
|
|||
}
|
||||
|
||||
static int
|
||||
pgp_decrypt_se_ip_data(pgp_content_enum tag, pgp_region_t *region,
|
||||
decrypt_se_ip_data(pgp_content_enum tag, pgp_region_t *region,
|
||||
pgp_stream_t *stream)
|
||||
{
|
||||
pgp_crypt_t *decrypt;
|
||||
|
@ -2938,7 +2938,7 @@ pgp_decrypt_se_ip_data(pgp_content_enum tag, pgp_region_t *region,
|
|||
decrypt = pgp_get_decrypt(stream);
|
||||
if (decrypt) {
|
||||
if (pgp_get_debug_level(__FILE__)) {
|
||||
(void) fprintf(stderr, "pgp_decrypt_se_ip_data: decrypt\n");
|
||||
(void) fprintf(stderr, "decrypt_se_ip_data: decrypt\n");
|
||||
}
|
||||
pgp_reader_push_decrypt(stream, decrypt, region);
|
||||
pgp_reader_push_se_ip_data(stream, decrypt, region);
|
||||
|
@ -2951,7 +2951,7 @@ pgp_decrypt_se_ip_data(pgp_content_enum tag, pgp_region_t *region,
|
|||
pgp_packet_t pkt;
|
||||
|
||||
if (pgp_get_debug_level(__FILE__)) {
|
||||
(void) fprintf(stderr, "pgp_decrypt_se_ip_data: no decrypt\n");
|
||||
(void) fprintf(stderr, "decrypt_se_ip_data: no decrypt\n");
|
||||
}
|
||||
while (region->readc < region->length) {
|
||||
unsigned len;
|
||||
|
@ -2991,7 +2991,7 @@ parse_se_data(pgp_region_t *region, pgp_stream_t *stream)
|
|||
* The content of an encrypted data packet is more OpenPGP packets
|
||||
* once decrypted, so recursively handle them
|
||||
*/
|
||||
return pgp_decrypt_se_data(PGP_PTAG_CT_SE_DATA_BODY, region, stream);
|
||||
return decrypt_se_data(PGP_PTAG_CT_SE_DATA_BODY, region, stream);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3025,8 +3025,7 @@ parse_se_ip_data(pgp_region_t *region, pgp_stream_t *stream)
|
|||
* The content of an encrypted data packet is more OpenPGP packets
|
||||
* once decrypted, so recursively handle them
|
||||
*/
|
||||
return pgp_decrypt_se_ip_data(PGP_PTAG_CT_SE_IP_DATA_BODY, region,
|
||||
stream);
|
||||
return decrypt_se_ip_data(PGP_PTAG_CT_SE_IP_DATA_BODY, region, stream);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3063,7 +3062,7 @@ parse_mdc(pgp_region_t *region, pgp_stream_t *stream)
|
|||
* \param *pktlen On return, will contain number of bytes in packet
|
||||
* \return 1 on success, 0 on error, -1 on EOF */
|
||||
static int
|
||||
pgp_parse_packet(pgp_stream_t *stream, uint32_t *pktlen)
|
||||
parse_packet(pgp_stream_t *stream, uint32_t *pktlen)
|
||||
{
|
||||
pgp_packet_t pkt;
|
||||
pgp_region_t region;
|
||||
|
@ -3077,7 +3076,7 @@ pgp_parse_packet(pgp_stream_t *stream, uint32_t *pktlen)
|
|||
|
||||
if (pgp_get_debug_level(__FILE__)) {
|
||||
(void) fprintf(stderr,
|
||||
"pgp_parse_packet: base_read returned %d, ptag %d\n",
|
||||
"parse_packet: base_read returned %d, ptag %d\n",
|
||||
ret, ptag);
|
||||
}
|
||||
|
||||
|
@ -3138,7 +3137,7 @@ pgp_parse_packet(pgp_stream_t *stream, uint32_t *pktlen)
|
|||
region.length = pkt.u.ptag.length;
|
||||
region.indeterminate = indeterminate;
|
||||
if (pgp_get_debug_level(__FILE__)) {
|
||||
(void) fprintf(stderr, "pgp_parse_packet: type %u\n",
|
||||
(void) fprintf(stderr, "parse_packet: type %u\n",
|
||||
pkt.u.ptag.type);
|
||||
}
|
||||
switch (pkt.u.ptag.type) {
|
||||
|
@ -3276,7 +3275,7 @@ pgp_parse(pgp_stream_t *stream, const int perrors)
|
|||
int r;
|
||||
|
||||
do {
|
||||
r = pgp_parse_packet(stream, &pktlen);
|
||||
r = parse_packet(stream, &pktlen);
|
||||
} while (r != -1);
|
||||
if (perrors) {
|
||||
pgp_print_errors(stream->errors);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: packet-print.c,v 1.39 2010/11/07 08:39:59 agc Exp $");
|
||||
__RCSID("$NetBSD: packet-print.c,v 1.40 2010/11/15 08:50:32 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
@ -732,7 +732,7 @@ pgp_sprint_pubkey(const pgp_key_t *key, char *out, size_t outsize)
|
|||
\param seckey
|
||||
*/
|
||||
static void
|
||||
pgp_print_seckey_verbose(const pgp_content_enum type,
|
||||
print_seckey_verbose(const pgp_content_enum type,
|
||||
const pgp_seckey_t *seckey)
|
||||
{
|
||||
printf("------- SECRET KEY or ENCRYPTED SECRET KEY ------\n");
|
||||
|
@ -774,7 +774,7 @@ pgp_print_seckey_verbose(const pgp_content_enum type,
|
|||
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
"pgp_print_seckey_verbose: unusual algorithm\n");
|
||||
"print_seckey_verbose: unusual algorithm\n");
|
||||
}
|
||||
if (seckey->s2k_usage == PGP_S2KU_ENCRYPTED_AND_HASHED) {
|
||||
print_hexdump(0, "Checkhash", seckey->checkhash,
|
||||
|
@ -792,7 +792,7 @@ pgp_print_seckey_verbose(const pgp_content_enum type,
|
|||
\param key
|
||||
*/
|
||||
static void
|
||||
pgp_print_pk_sesskey(pgp_content_enum tag,
|
||||
print_pk_sesskey(pgp_content_enum tag,
|
||||
const pgp_pk_sesskey_t * key)
|
||||
{
|
||||
print_tagname(0, (tag == PGP_PTAG_CT_PK_SESSION_KEY) ?
|
||||
|
@ -814,7 +814,7 @@ pgp_print_pk_sesskey(pgp_content_enum tag,
|
|||
|
||||
default:
|
||||
(void) fprintf(stderr,
|
||||
"pgp_print_pk_sesskey: unusual algorithm\n");
|
||||
"print_pk_sesskey: unusual algorithm\n");
|
||||
}
|
||||
if (tag == PGP_PTAG_CT_PK_SESSION_KEY) {
|
||||
printf("Symmetric algorithm: %d (%s)\n", key->symm_alg,
|
||||
|
@ -1345,12 +1345,12 @@ pgp_print_packet(pgp_printstate_t *print, const pgp_packet_t *pkt)
|
|||
|
||||
case PGP_PTAG_CT_SECRET_KEY:
|
||||
print_tagname(print->indent, "PGP_PTAG_CT_SECRET_KEY");
|
||||
pgp_print_seckey_verbose(pkt->tag, &content->seckey);
|
||||
print_seckey_verbose(pkt->tag, &content->seckey);
|
||||
break;
|
||||
|
||||
case PGP_PTAG_CT_ENCRYPTED_SECRET_KEY:
|
||||
print_tagname(print->indent, "PGP_PTAG_CT_ENCRYPTED_SECRET_KEY");
|
||||
pgp_print_seckey_verbose(pkt->tag, &content->seckey);
|
||||
print_seckey_verbose(pkt->tag, &content->seckey);
|
||||
break;
|
||||
|
||||
case PGP_PTAG_CT_ARMOUR_HEADER:
|
||||
|
@ -1394,11 +1394,11 @@ pgp_print_packet(pgp_printstate_t *print, const pgp_packet_t *pkt)
|
|||
|
||||
case PGP_PTAG_CT_PK_SESSION_KEY:
|
||||
case PGP_PTAG_CT_ENCRYPTED_PK_SESSION_KEY:
|
||||
pgp_print_pk_sesskey(pkt->tag, &content->pk_sesskey);
|
||||
print_pk_sesskey(pkt->tag, &content->pk_sesskey);
|
||||
break;
|
||||
|
||||
case PGP_GET_SECKEY:
|
||||
pgp_print_pk_sesskey(PGP_PTAG_CT_ENCRYPTED_PK_SESSION_KEY,
|
||||
print_pk_sesskey(PGP_PTAG_CT_ENCRYPTED_PK_SESSION_KEY,
|
||||
content->get_seckey.pk_sesskey);
|
||||
break;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: packet-show.c,v 1.19 2010/11/07 08:39:59 agc Exp $");
|
||||
__RCSID("$NetBSD: packet-show.c,v 1.20 2010/11/15 08:50:32 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -743,7 +743,7 @@ pgp_showall_ss_skapref(const pgp_data_t *ss_skapref)
|
|||
* \return string or "Unknown"
|
||||
*/
|
||||
static const char *
|
||||
pgp_show_ss_feature(uint8_t octet, unsigned offset)
|
||||
show_ss_feature(uint8_t octet, unsigned offset)
|
||||
{
|
||||
if (offset >= PGP_ARRAY_SIZE(ss_feature_map)) {
|
||||
return "Unknown";
|
||||
|
@ -780,7 +780,7 @@ pgp_showall_ss_features(pgp_data_t ss_features)
|
|||
for (j = 0; j < 8; j++, mask = (unsigned)mask >> 1) {
|
||||
bit = ss_features.contents[i] & mask;
|
||||
if (bit) {
|
||||
str = pgp_show_ss_feature(bit, i);
|
||||
str = show_ss_feature(bit, i);
|
||||
if (!add_bitmap_entry(text, str, bit)) {
|
||||
pgp_text_free(text);
|
||||
return NULL;
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: reader.c,v 1.45 2010/11/11 00:58:04 agc Exp $");
|
||||
__RCSID("$NetBSD: reader.c,v 1.46 2010/11/15 08:50:32 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -537,7 +537,7 @@ unarmoured_read_char(pgp_stream_t *stream, dearmour_t *dearmour,
|
|||
* \return header value if found, otherwise NULL
|
||||
*/
|
||||
static const char *
|
||||
pgp_find_header(pgp_headers_t *headers, const char *key)
|
||||
find_header(pgp_headers_t *headers, const char *key)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
|
@ -554,12 +554,12 @@ pgp_find_header(pgp_headers_t *headers, const char *key)
|
|||
* \param src
|
||||
*/
|
||||
static void
|
||||
pgp_dup_headers(pgp_headers_t *dest, const pgp_headers_t *src)
|
||||
dup_headers(pgp_headers_t *dest, const pgp_headers_t *src)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
if ((dest->headers = calloc(src->headerc, sizeof(*dest->headers))) == NULL) {
|
||||
(void) fprintf(stderr, "pgp_dup_headers: bad alloc\n");
|
||||
(void) fprintf(stderr, "dup_headers: bad alloc\n");
|
||||
} else {
|
||||
dest->headerc = src->headerc;
|
||||
for (n = 0; n < src->headerc; ++n) {
|
||||
|
@ -592,7 +592,7 @@ process_dash_escaped(pgp_stream_t *stream, dearmour_t *dearmour,
|
|||
"process_dash_escaped: bad alloc");
|
||||
return -1;
|
||||
}
|
||||
hashstr = pgp_find_header(&dearmour->headers, "Hash");
|
||||
hashstr = find_header(&dearmour->headers, "Hash");
|
||||
if (hashstr) {
|
||||
pgp_hash_alg_t alg;
|
||||
|
||||
|
@ -1169,8 +1169,7 @@ got_minus:
|
|||
}
|
||||
|
||||
if (strcmp(buf, "BEGIN PGP SIGNED MESSAGE") == 0) {
|
||||
pgp_dup_headers(
|
||||
&content.u.cleartext_head,
|
||||
dup_headers(&content.u.cleartext_head,
|
||||
&dearmour->headers);
|
||||
CALLBACK(PGP_PTAG_CT_SIGNED_CLEARTEXT_HEADER,
|
||||
cbinfo,
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: writer.c,v 1.31 2010/11/15 08:03:40 agc Exp $");
|
||||
__RCSID("$NetBSD: writer.c,v 1.32 2010/11/15 08:50:32 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1470,13 +1470,13 @@ pgp_push_stream_enc_se_ip(pgp_output_t *output, const pgp_key_t *pubkey, const c
|
|||
|
||||
/* calculate the partial data length */
|
||||
static unsigned
|
||||
pgp_partial_data_len(unsigned len)
|
||||
partial_data_len(unsigned len)
|
||||
{
|
||||
unsigned mask;
|
||||
int i;
|
||||
|
||||
if (len == 0) {
|
||||
(void) fprintf(stderr, "pgp_partial_data_len: 0 len\n");
|
||||
(void) fprintf(stderr, "partial_data_len: 0 len\n");
|
||||
return 0;
|
||||
}
|
||||
if (len > MAX_PARTIAL_DATA_LENGTH) {
|
||||
|
@ -1516,7 +1516,7 @@ stream_write_litdata(pgp_output_t *output,
|
|||
size_t pdlen;
|
||||
|
||||
while (len > 0) {
|
||||
pdlen = pgp_partial_data_len(len);
|
||||
pdlen = partial_data_len(len);
|
||||
write_partial_len(output, (unsigned)pdlen);
|
||||
pgp_write(output, data, (unsigned)pdlen);
|
||||
data += pdlen;
|
||||
|
@ -1539,7 +1539,7 @@ stream_write_litdata_first(pgp_output_t *output,
|
|||
size_t sz_pd;
|
||||
|
||||
sz_towrite = 1 + 1 + 4 + len;
|
||||
sz_pd = (size_t)pgp_partial_data_len(sz_towrite);
|
||||
sz_pd = (size_t)partial_data_len(sz_towrite);
|
||||
if (sz_pd < 512) {
|
||||
(void) fprintf(stderr,
|
||||
"stream_write_litdata_first: bad sz_pd\n");
|
||||
|
@ -1576,7 +1576,7 @@ stream_write_se_ip(pgp_output_t *output,
|
|||
size_t pdlen;
|
||||
|
||||
while (len > 0) {
|
||||
pdlen = pgp_partial_data_len(len);
|
||||
pdlen = partial_data_len(len);
|
||||
write_partial_len(output, (unsigned)pdlen);
|
||||
|
||||
pgp_push_enc_crypt(output, se_ip->crypt);
|
||||
|
@ -1611,7 +1611,7 @@ stream_write_se_ip_first(pgp_output_t *output,
|
|||
"stream_write_se_ip_first: bad alloc\n");
|
||||
return 0;
|
||||
}
|
||||
sz_pd = (size_t)pgp_partial_data_len((unsigned)sz_towrite);
|
||||
sz_pd = (size_t)partial_data_len((unsigned)sz_towrite);
|
||||
if (sz_pd < 512) {
|
||||
free(preamble);
|
||||
(void) fprintf(stderr,
|
||||
|
|
Loading…
Reference in New Issue