1997-11-18 14:06:00 +00:00
|
|
|
/* filter.h
|
1998-02-24 18:50:46 +00:00
|
|
|
* Copyright (C) 1998 Free Software Foundation, Inc.
|
1997-11-18 14:06:00 +00:00
|
|
|
*
|
1998-02-24 18:50:46 +00:00
|
|
|
* This file is part of GNUPG.
|
1997-11-18 14:06:00 +00:00
|
|
|
*
|
1998-02-24 18:50:46 +00:00
|
|
|
* GNUPG is free software; you can redistribute it and/or modify
|
1997-11-18 14:06:00 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
1998-02-24 18:50:46 +00:00
|
|
|
* GNUPG is distributed in the hope that it will be useful,
|
1997-11-18 14:06:00 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
*/
|
|
|
|
#ifndef G10_FILTER_H
|
|
|
|
#define G10_FILTER_H
|
|
|
|
|
1998-02-18 13:58:46 +00:00
|
|
|
#include "types.h"
|
1997-11-18 14:06:00 +00:00
|
|
|
#include "cipher.h"
|
|
|
|
|
|
|
|
typedef struct {
|
1998-01-12 10:18:17 +00:00
|
|
|
MD_HANDLE md; /* catch all */
|
1997-11-18 14:06:00 +00:00
|
|
|
size_t maxbuf_size;
|
|
|
|
} md_filter_context_t;
|
|
|
|
|
1997-11-21 14:53:57 +00:00
|
|
|
typedef struct {
|
|
|
|
int status;
|
|
|
|
int what;
|
1998-10-16 16:00:17 +00:00
|
|
|
int only_keyblocks; /* skip all headers but ".... key block" */
|
1997-11-21 14:53:57 +00:00
|
|
|
byte radbuf[4];
|
|
|
|
int idx, idx2;
|
|
|
|
u32 crc;
|
1997-12-23 17:30:18 +00:00
|
|
|
byte helpbuf[100];
|
|
|
|
int helpidx, helplen;
|
1998-02-04 18:54:31 +00:00
|
|
|
unsigned empty; /* empty line counter */
|
1998-06-25 10:19:08 +00:00
|
|
|
int hashes; /* detected hash algorithms */
|
1998-01-28 16:09:43 +00:00
|
|
|
int faked;
|
|
|
|
int parse_state;
|
1997-11-21 14:53:57 +00:00
|
|
|
int inp_checked; /* set if inp has been checked */
|
|
|
|
int inp_bypass; /* set if the input is not armored */
|
1998-09-28 19:25:31 +00:00
|
|
|
int any_data;
|
1998-02-18 13:58:46 +00:00
|
|
|
const char *hdrlines;
|
1997-11-21 14:53:57 +00:00
|
|
|
} armor_filter_context_t;
|
|
|
|
|
1997-11-18 14:06:00 +00:00
|
|
|
|
1997-11-23 15:38:27 +00:00
|
|
|
typedef struct {
|
|
|
|
int status;
|
|
|
|
void *opaque; /* (used for z_stream) */
|
|
|
|
byte *inbuf;
|
|
|
|
unsigned inbufsize;
|
|
|
|
byte *outbuf;
|
|
|
|
unsigned outbufsize;
|
1998-05-15 18:49:19 +00:00
|
|
|
int algo; /* compress algo */
|
1997-11-23 15:38:27 +00:00
|
|
|
} compress_filter_context_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
DEK *dek;
|
|
|
|
u32 datalen;
|
1998-04-07 18:16:10 +00:00
|
|
|
CIPHER_HANDLE cipher_hd;
|
1997-11-23 15:38:27 +00:00
|
|
|
int header;
|
|
|
|
} cipher_filter_context_t;
|
|
|
|
|
|
|
|
|
1998-01-02 20:40:10 +00:00
|
|
|
|
1997-12-23 17:30:18 +00:00
|
|
|
typedef struct {
|
|
|
|
int eof;
|
1998-02-04 18:54:31 +00:00
|
|
|
size_t idx;
|
|
|
|
size_t len;
|
|
|
|
byte buf[256];
|
1997-12-23 17:30:18 +00:00
|
|
|
} text_filter_context_t;
|
1997-11-23 15:38:27 +00:00
|
|
|
|
1998-01-02 20:40:10 +00:00
|
|
|
|
|
|
|
/* encrypt_filter_context_t defined in main.h */
|
|
|
|
|
1997-11-18 14:06:00 +00:00
|
|
|
/*-- mdfilter.c --*/
|
|
|
|
int md_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len);
|
1997-11-24 11:04:11 +00:00
|
|
|
void free_md_filter_context( md_filter_context_t *mfx );
|
1997-11-18 14:06:00 +00:00
|
|
|
|
1997-11-21 14:53:57 +00:00
|
|
|
/*-- armor.c --*/
|
1998-02-16 20:05:02 +00:00
|
|
|
int use_armor_filter( IOBUF a );
|
1997-11-21 14:53:57 +00:00
|
|
|
int armor_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
1997-11-23 15:38:27 +00:00
|
|
|
/*-- compress.c --*/
|
|
|
|
int compress_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
|
|
|
/*-- cipher.c --*/
|
|
|
|
int cipher_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
1997-12-23 17:30:18 +00:00
|
|
|
/*-- textfilter.c --*/
|
|
|
|
int text_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
1997-11-23 15:38:27 +00:00
|
|
|
|
|
|
|
|
1997-11-18 14:06:00 +00:00
|
|
|
#endif /*G10_FILTER_H*/
|