3 * Various utility stuff.
5 * Copyright (c) 2005 Marko Kreen
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * contrib/pgcrypto/pgp.c
291 if (level >= 0 && level <= 9)
355 if (
key == NULL ||
len < 1)
void err(int eval, const char *fmt,...)
void pfree(void *pointer)
void * palloc0(Size size)
int px_find_digest(const char *name, PX_MD **res)
int px_find_cipher(const char *name, PX_Cipher **res)
static PgChecksumMode mode
void pgp_key_free(PGP_PubKey *pk)
int pgp_disable_mdc(PGP_Context *ctx, int disable)
int pgp_get_cipher_code(const char *name)
int pgp_init(PGP_Context **ctx_p)
static int def_compress_algo
static int def_s2k_cipher_algo
static int def_convert_crlf
static int def_compress_level
int pgp_set_text_mode(PGP_Context *ctx, int mode)
int pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name)
const char * pgp_get_digest_name(int code)
int pgp_set_s2k_mode(PGP_Context *ctx, int mode)
static int def_s2k_digest_algo
int pgp_get_digest_code(const char *name)
static int def_unicode_mode
int pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int len)
static const struct digest_info digest_list[]
int pgp_get_cipher_block_size(int code)
int pgp_load_cipher(int code, PX_Cipher **res)
static int def_cipher_algo
int pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name)
int pgp_set_compress_algo(PGP_Context *ctx, int algo)
int pgp_get_unicode_mode(PGP_Context *ctx)
static const struct cipher_info cipher_list[]
int pgp_set_cipher_algo(PGP_Context *ctx, const char *name)
static int def_disable_mdc
int pgp_set_convert_crlf(PGP_Context *ctx, int doit)
int pgp_set_unicode_mode(PGP_Context *ctx, int mode)
int pgp_get_cipher_key_size(int code)
int pgp_free(PGP_Context *ctx)
int pgp_set_s2k_count(PGP_Context *ctx, int count)
int pgp_set_sess_key(PGP_Context *ctx, int use)
int pgp_load_digest(int code, PX_MD **res)
int pgp_set_compress_level(PGP_Context *ctx, int level)
static const struct cipher_info * get_cipher_info(int code)
static int def_use_sess_key
int pg_strcasecmp(const char *s1, const char *s2)
void px_memset(void *ptr, int c, size_t len)
#define PXE_ARGUMENT_ERROR
#define PXE_PGP_CORRUPT_DATA
#define PXE_PGP_UNSUPPORTED_CIPHER
#define PXE_PGP_UNSUPPORTED_HASH