~ubuntu-branches/ubuntu/hardy/postgresql-8.4/hardy-backports

« back to all changes in this revision

Viewing changes to contrib/pgcrypto/pgp.c

  • Committer: Bazaar Package Importer
  • Author(s): Ubuntu Archive Backport
  • Date: 2009-11-09 13:46:16 UTC
  • mfrom: (5.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091109134616-ae14l9tr3g7p2t9y
Tags: 8.4.1-1~hardy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
27
 * SUCH DAMAGE.
28
28
 *
29
 
 * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.c,v 1.3 2005/10/15 02:49:06 momjian Exp $
 
29
 * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.c,v 1.4 2009/06/11 14:48:52 momjian Exp $
30
30
 */
31
31
 
32
32
#include "postgres.h"
165
165
}
166
166
 
167
167
int
168
 
pgp_load_cipher(int code, PX_Cipher ** res)
 
168
pgp_load_cipher(int code, PX_Cipher **res)
169
169
{
170
170
        int                     err;
171
171
        const struct cipher_info *i = get_cipher_info(code);
181
181
}
182
182
 
183
183
int
184
 
pgp_load_digest(int code, PX_MD ** res)
 
184
pgp_load_digest(int code, PX_MD **res)
185
185
{
186
186
        int                     err;
187
187
        const char *name = pgp_get_digest_name(code);
197
197
}
198
198
 
199
199
int
200
 
pgp_init(PGP_Context ** ctx_p)
 
200
pgp_init(PGP_Context **ctx_p)
201
201
{
202
202
        PGP_Context *ctx;
203
203
 
221
221
}
222
222
 
223
223
int
224
 
pgp_free(PGP_Context * ctx)
 
224
pgp_free(PGP_Context *ctx)
225
225
{
226
226
        if (ctx->pub_key)
227
227
                pgp_key_free(ctx->pub_key);
231
231
}
232
232
 
233
233
int
234
 
pgp_disable_mdc(PGP_Context * ctx, int disable)
 
234
pgp_disable_mdc(PGP_Context *ctx, int disable)
235
235
{
236
236
        ctx->disable_mdc = disable ? 1 : 0;
237
237
        return 0;
238
238
}
239
239
 
240
240
int
241
 
pgp_set_sess_key(PGP_Context * ctx, int use)
 
241
pgp_set_sess_key(PGP_Context *ctx, int use)
242
242
{
243
243
        ctx->use_sess_key = use ? 1 : 0;
244
244
        return 0;
245
245
}
246
246
 
247
247
int
248
 
pgp_set_convert_crlf(PGP_Context * ctx, int doit)
 
248
pgp_set_convert_crlf(PGP_Context *ctx, int doit)
249
249
{
250
250
        ctx->convert_crlf = doit ? 1 : 0;
251
251
        return 0;
252
252
}
253
253
 
254
254
int
255
 
pgp_set_s2k_mode(PGP_Context * ctx, int mode)
 
255
pgp_set_s2k_mode(PGP_Context *ctx, int mode)
256
256
{
257
257
        int                     err = PXE_OK;
258
258
 
271
271
}
272
272
 
273
273
int
274
 
pgp_set_compress_algo(PGP_Context * ctx, int algo)
 
274
pgp_set_compress_algo(PGP_Context *ctx, int algo)
275
275
{
276
276
        switch (algo)
277
277
        {
286
286
}
287
287
 
288
288
int
289
 
pgp_set_compress_level(PGP_Context * ctx, int level)
 
289
pgp_set_compress_level(PGP_Context *ctx, int level)
290
290
{
291
291
        if (level >= 0 && level <= 9)
292
292
        {
297
297
}
298
298
 
299
299
int
300
 
pgp_set_text_mode(PGP_Context * ctx, int mode)
 
300
pgp_set_text_mode(PGP_Context *ctx, int mode)
301
301
{
302
302
        ctx->text_mode = mode;
303
303
        return 0;
304
304
}
305
305
 
306
306
int
307
 
pgp_set_cipher_algo(PGP_Context * ctx, const char *name)
 
307
pgp_set_cipher_algo(PGP_Context *ctx, const char *name)
308
308
{
309
309
        int                     code = pgp_get_cipher_code(name);
310
310
 
315
315
}
316
316
 
317
317
int
318
 
pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name)
 
318
pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name)
319
319
{
320
320
        int                     code = pgp_get_cipher_code(name);
321
321
 
326
326
}
327
327
 
328
328
int
329
 
pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name)
 
329
pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name)
330
330
{
331
331
        int                     code = pgp_get_digest_code(name);
332
332
 
337
337
}
338
338
 
339
339
int
340
 
pgp_get_unicode_mode(PGP_Context * ctx)
 
340
pgp_get_unicode_mode(PGP_Context *ctx)
341
341
{
342
342
        return ctx->unicode_mode;
343
343
}
344
344
 
345
345
int
346
 
pgp_set_unicode_mode(PGP_Context * ctx, int mode)
 
346
pgp_set_unicode_mode(PGP_Context *ctx, int mode)
347
347
{
348
348
        ctx->unicode_mode = mode ? 1 : 0;
349
349
        return 0;
350
350
}
351
351
 
352
352
int
353
 
pgp_set_symkey(PGP_Context * ctx, const uint8 *key, int len)
 
353
pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int len)
354
354
{
355
355
        if (key == NULL || len < 1)
356
356
                return PXE_ARGUMENT_ERROR;