aboutsummaryrefslogtreecommitdiffstats
path: root/g10/packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'g10/packet.h')
-rw-r--r--g10/packet.h61
1 files changed, 30 insertions, 31 deletions
diff --git a/g10/packet.h b/g10/packet.h
index f3181332f..54eeda1a9 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -1,4 +1,4 @@
-/* packet.h - packet definitions
+/* packet.h - OpenPGP packet definitions
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006 Free Software Foundation, Inc.
*
@@ -24,11 +24,10 @@
#define G10_PACKET_H
#include "types.h"
-#include "iobuf.h"
-#include "mpi.h"
+#include "../common/iobuf.h"
+#include "../jnlib/strlist.h"
#include "cipher.h"
#include "filter.h"
-#include "global.h"
#define DEBUG_PARSE_PACKET 1
@@ -97,7 +96,7 @@ typedef struct {
byte version;
byte pubkey_algo; /* algorithm used for public key scheme */
byte throw_keyid;
- MPI data[PUBKEY_MAX_NENC];
+ gcry_mpi_t data[PUBKEY_MAX_NENC];
} PKT_pubkey_enc;
@@ -171,7 +170,7 @@ typedef struct
subpktarea_t *hashed; /* All subpackets with hashed data (v4 only). */
subpktarea_t *unhashed; /* Ditto for unhashed data. */
byte digest_start[2]; /* First 2 bytes of the digest. */
- MPI data[PUBKEY_MAX_NSIG];
+ gcry_mpi_t data[PUBKEY_MAX_NSIG];
} PKT_signature;
#define ATTRIB_IMAGE 1
@@ -262,7 +261,7 @@ typedef struct {
byte trust_depth;
byte trust_value;
const byte *trust_regexp;
- MPI pkey[PUBKEY_MAX_NPKEY];
+ gcry_mpi_t pkey[PUBKEY_MAX_NPKEY];
} PKT_public_key;
/* Evaluates as true if the pk is disabled, and false if it isn't. If
@@ -296,7 +295,7 @@ typedef struct {
byte ivlen; /* used length of the iv */
byte iv[16]; /* initialization vector for CFB mode */
} protect;
- MPI skey[PUBKEY_MAX_NSKEY];
+ gcry_mpi_t skey[PUBKEY_MAX_NSKEY];
u16 csum; /* checksum */
} PKT_secret_key;
@@ -310,7 +309,7 @@ typedef struct {
u32 len; /* reserved */
byte new_ctb;
byte algorithm;
- IOBUF buf; /* IOBUF reference */
+ iobuf_t buf; /* IOBUF reference */
} PKT_compressed;
typedef struct {
@@ -319,7 +318,7 @@ typedef struct {
byte new_ctb; /* uses a new CTB */
byte is_partial; /* partial length encoded */
byte mdc_method; /* > 0: integrity protected encrypted data packet */
- IOBUF buf; /* IOBUF reference */
+ iobuf_t buf; /* IOBUF reference */
} PKT_encrypted;
typedef struct {
@@ -333,7 +332,7 @@ typedef struct {
typedef struct {
u32 len; /* length of encrypted data */
- IOBUF buf; /* IOBUF reference */
+ iobuf_t buf; /* IOBUF reference */
byte new_ctb;
byte is_partial; /* partial length encoded */
int mode;
@@ -423,25 +422,25 @@ struct notation
};
/*-- mainproc.c --*/
-int proc_packets( void *ctx, IOBUF a );
-int proc_signature_packets( void *ctx, IOBUF a,
+int proc_packets( void *ctx, iobuf_t a );
+int proc_signature_packets( void *ctx, iobuf_t a,
STRLIST signedfiles, const char *sigfile );
-int proc_encryption_packets( void *ctx, IOBUF a );
-int list_packets( IOBUF a );
+int proc_encryption_packets( void *ctx, iobuf_t a );
+int list_packets( iobuf_t a );
/*-- parse-packet.c --*/
int set_packet_list_mode( int mode );
#if DEBUG_PARSE_PACKET
-int dbg_search_packet( IOBUF inp, PACKET *pkt, off_t *retpos, int with_uid,
+int dbg_search_packet( iobuf_t inp, PACKET *pkt, off_t *retpos, int with_uid,
const char* file, int lineno );
-int dbg_parse_packet( IOBUF inp, PACKET *ret_pkt,
+int dbg_parse_packet( iobuf_t inp, PACKET *ret_pkt,
const char* file, int lineno );
-int dbg_copy_all_packets( IOBUF inp, IOBUF out,
+int dbg_copy_all_packets( iobuf_t inp, iobuf_t out,
const char* file, int lineno );
-int dbg_copy_some_packets( IOBUF inp, IOBUF out, off_t stopoff,
+int dbg_copy_some_packets( iobuf_t inp, iobuf_t out, off_t stopoff,
const char* file, int lineno );
-int dbg_skip_some_packets( IOBUF inp, unsigned n,
+int dbg_skip_some_packets( iobuf_t inp, unsigned n,
const char* file, int lineno );
#define search_packet( a,b,c,d ) \
dbg_search_packet( (a), (b), (c), (d), __FILE__, __LINE__ )
@@ -454,14 +453,14 @@ int dbg_skip_some_packets( IOBUF inp, unsigned n,
#define skip_some_packets( a,b ) \
dbg_skip_some_packets((a),(b), __FILE__, __LINE__ )
#else
-int search_packet( IOBUF inp, PACKET *pkt, off_t *retpos, int with_uid );
-int parse_packet( IOBUF inp, PACKET *ret_pkt);
-int copy_all_packets( IOBUF inp, IOBUF out );
-int copy_some_packets( IOBUF inp, IOBUF out, off_t stopoff );
-int skip_some_packets( IOBUF inp, unsigned n );
+int search_packet( iobuf_t inp, PACKET *pkt, off_t *retpos, int with_uid );
+int parse_packet( iobuf_t inp, PACKET *ret_pkt);
+int copy_all_packets( iobuf_t inp, iobuf_t out );
+int copy_some_packets( iobuf_t inp, iobuf_t out, off_t stopoff );
+int skip_some_packets( iobuf_t inp, unsigned n );
#endif
-int parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
+int parse_signature( iobuf_t inp, int pkttype, unsigned long pktlen,
PKT_signature *sig );
const byte *enum_sig_subpkt ( const subpktarea_t *subpkts,
sigsubpkttype_t reqtype,
@@ -481,7 +480,7 @@ PACKET *create_gpg_control ( ctrlpkttype_t type,
size_t datalen );
/*-- build-packet.c --*/
-int build_packet( IOBUF inp, PACKET *pkt );
+int build_packet( iobuf_t inp, PACKET *pkt );
u32 calc_packet_length( PACKET *pkt );
void build_sig_subpkt( PKT_signature *sig, sigsubpkttype_t type,
const byte *buffer, size_t buflen );
@@ -521,8 +520,8 @@ int cmp_user_ids( PKT_user_id *a, PKT_user_id *b );
/*-- sig-check.c --*/
-int signature_check( PKT_signature *sig, MD_HANDLE digest );
-int signature_check2( PKT_signature *sig, MD_HANDLE digest, u32 *r_expiredate,
+int signature_check( PKT_signature *sig, gcry_md_hd_t digest );
+int signature_check2( PKT_signature *sig, gcry_md_hd_t digest, u32 *r_expiredate,
int *r_expired, int *r_revoked, PKT_public_key *ret_pk );
/*-- seckey-cert.c --*/
@@ -536,7 +535,7 @@ int get_override_session_key( DEK *dek, const char *string );
/*-- compress.c --*/
int handle_compressed( void *ctx, PKT_compressed *cd,
- int (*callback)(IOBUF, void *), void *passthru );
+ int (*callback)(iobuf_t, void *), void *passthru );
/*-- encr-data.c --*/
int decrypt_data( void *ctx, PKT_encrypted *ed, DEK *dek );
@@ -544,7 +543,7 @@ int decrypt_data( void *ctx, PKT_encrypted *ed, DEK *dek );
/*-- plaintext.c --*/
int handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
int nooutput, int clearsig );
-int ask_for_detached_datafile( MD_HANDLE md, MD_HANDLE md2,
+int ask_for_detached_datafile( gcry_md_hd_t md, gcry_md_hd_t md2,
const char *inname, int textmode );
/*-- sign.c --*/