~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to g10/filter.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* filter.h
2
 
 * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
2
 * Copyright (C) 1998, 1999, 2000, 2001, 2003,
 
3
 *               2005 Free Software Foundation, Inc.
3
4
 *
4
5
 * This file is part of GnuPG.
5
6
 *
6
7
 * GnuPG is free software; you can redistribute it and/or modify
7
8
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * the Free Software Foundation; either version 3 of the License, or
9
10
 * (at your option) any later version.
10
11
 *
11
12
 * GnuPG is distributed in the hope that it will be useful,
14
15
 * GNU General Public License for more details.
15
16
 *
16
17
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
18
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19
19
 */
20
20
#ifndef G10_FILTER_H
21
21
#define G10_FILTER_H
22
22
 
23
23
#include "types.h"
24
24
#include "cipher.h"
25
 
#include "iobuf.h"
26
25
 
27
26
typedef struct {
28
 
    MD_HANDLE md;      /* catch all */
29
 
    MD_HANDLE md2;     /* if we want to calculate an alternate hash */
 
27
    gcry_md_hd_t md;      /* catch all */
 
28
    gcry_md_hd_t md2;     /* if we want to calculate an alternate hash */
30
29
    size_t maxbuf_size;
31
30
} md_filter_context_t;
32
31
 
33
32
typedef struct {
 
33
    int  refcount;          /* Initialized to 1.  */
 
34
 
34
35
    /* these fields may be initialized */
35
36
    int what;               /* what kind of armor headers to write */
36
37
    int only_keyblocks;     /* skip all headers but ".... key block" */
37
38
    const char *hdrlines;   /* write these headerlines */
38
39
 
39
 
    /* these fileds must be initialized to zero */
 
40
    /* these fields must be initialized to zero */
40
41
    int no_openpgp_data;    /* output flag: "No valid OpenPGP data found" */
41
42
 
42
43
    /* the following fields must be initialized to zero */
49
50
    int truncated;          /* number of truncated lines */
50
51
    int qp_detected;
51
52
    int pgp2mode;
 
53
    byte eol[3];            /* The end of line characters as a
 
54
                               zero-terminated string.  Defaults
 
55
                               (eol[0]=='\0') to whatever the local
 
56
                               platform uses. */
52
57
 
53
58
    byte *buffer;           /* malloced buffer */
54
59
    unsigned buffer_size;   /* and size of this buffer */
87
92
typedef struct {
88
93
    DEK *dek;
89
94
    u32 datalen;
90
 
    CIPHER_HANDLE cipher_hd;
 
95
    gcry_cipher_hd_t cipher_hd;
91
96
    int header;
92
 
    MD_HANDLE mdc_hash;
 
97
    gcry_md_hd_t mdc_hash;
93
98
    byte enchash[20];
94
99
    int create_mdc; /* flag will be set by the cipher filter */
95
100
} cipher_filter_context_t;
104
109
    int truncated;          /* number of truncated lines */
105
110
    int not_dash_escaped;
106
111
    int escape_from;
107
 
    MD_HANDLE md;
 
112
    gcry_md_hd_t md;
108
113
    int pending_lf;
109
114
    int pending_esc;
110
115
} text_filter_context_t;
116
121
    unsigned long last;         /* last amount reported */
117
122
    unsigned long offset;       /* current amount */
118
123
    unsigned long total;        /* total amount */
 
124
    int  refcount;              
119
125
} progress_filter_context_t;
120
126
 
121
127
/* encrypt_filter_context_t defined in main.h */
125
131
void free_md_filter_context( md_filter_context_t *mfx );
126
132
 
127
133
/*-- armor.c --*/
 
134
armor_filter_context_t *new_armor_context (void);
 
135
void release_armor_context (armor_filter_context_t *afx);
 
136
int push_armor_filter (armor_filter_context_t *afx, iobuf_t iobuf);
128
137
int use_armor_filter( iobuf_t a );
129
 
int armor_filter( void *opaque, int control,
130
 
                  iobuf_t chain, byte *buf, size_t *ret_len);
131
138
UnarmorPump unarmor_pump_new (void);
132
139
void        unarmor_pump_release (UnarmorPump x);
133
140
int         unarmor_pump (UnarmorPump x, int c);
134
141
 
135
142
/*-- compress.c --*/
136
 
int compress_filter( void *opaque, int control,
137
 
                     iobuf_t chain, byte *buf, size_t *ret_len);
 
143
void push_compress_filter(iobuf_t out,compress_filter_context_t *zfx,int algo);
 
144
void push_compress_filter2(iobuf_t out,compress_filter_context_t *zfx,
 
145
                           int algo,int rel);
138
146
 
139
147
/*-- cipher.c --*/
140
148
int cipher_filter( void *opaque, int control,
143
151
/*-- textfilter.c --*/
144
152
int text_filter( void *opaque, int control,
145
153
                 iobuf_t chain, byte *buf, size_t *ret_len);
146
 
int copy_clearsig_text( iobuf_t out, iobuf_t inp, MD_HANDLE md,
147
 
                          int escape_dash, int escape_from, int pgp2mode );
 
154
int copy_clearsig_text (iobuf_t out, iobuf_t inp, gcry_md_hd_t md,
 
155
                        int escape_dash, int escape_from, int pgp2mode);
148
156
 
149
157
/*-- progress.c --*/
150
 
int progress_filter (void *opaque, int control,
151
 
                     iobuf_t a, byte *buf, size_t *ret_len);
 
158
progress_filter_context_t *new_progress_context (void);
 
159
void release_progress_context (progress_filter_context_t *pfx);
152
160
void handle_progress (progress_filter_context_t *pfx,
153
161
                      iobuf_t inp, const char *name);
154
162