~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to contrib/pgcrypto/rijndael.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*      $OpenBSD: rijndael.c,v 1.6 2000/12/09 18:51:34 markus Exp $ */
2
2
 
3
 
/* $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.c,v 1.13 2007/04/06 05:36:50 tgl Exp $ */
 
3
/* $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.c,v 1.14 2009/06/11 14:48:52 momjian Exp $ */
4
4
 
5
5
/* This is an independent implementation of the encryption algorithm:   */
6
6
/*                                                                                                                                              */
302
302
} while (0)
303
303
 
304
304
rijndael_ctx *
305
 
rijndael_set_key(rijndael_ctx * ctx, const u4byte * in_key, const u4byte key_len,
 
305
rijndael_set_key(rijndael_ctx *ctx, const u4byte *in_key, const u4byte key_len,
306
306
                                 int encrypt)
307
307
{
308
308
        u4byte          i,
384
384
} while (0)
385
385
 
386
386
void
387
 
rijndael_encrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk)
 
387
rijndael_encrypt(rijndael_ctx *ctx, const u4byte *in_blk, u4byte *out_blk)
388
388
{
389
389
        u4byte          k_len = ctx->k_len;
390
390
        u4byte     *e_key = ctx->e_key;
448
448
} while (0)
449
449
 
450
450
void
451
 
rijndael_decrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk)
 
451
rijndael_decrypt(rijndael_ctx *ctx, const u4byte *in_blk, u4byte *out_blk)
452
452
{
453
453
        u4byte          b0[4],
454
454
                                b1[4],
501
501
 */
502
502
 
503
503
void
504
 
aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc)
 
504
aes_set_key(rijndael_ctx *ctx, const uint8 *key, unsigned keybits, int enc)
505
505
{
506
506
        uint32     *k;
507
507
 
510
510
}
511
511
 
512
512
void
513
 
aes_ecb_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len)
 
513
aes_ecb_encrypt(rijndael_ctx *ctx, uint8 *data, unsigned len)
514
514
{
515
515
        unsigned        bs = 16;
516
516
        uint32     *d;
526
526
}
527
527
 
528
528
void
529
 
aes_ecb_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len)
 
529
aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len)
530
530
{
531
531
        unsigned        bs = 16;
532
532
        uint32     *d;
542
542
}
543
543
 
544
544
void
545
 
aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len)
 
545
aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len)
546
546
{
547
547
        uint32     *iv = (uint32 *) iva;
548
548
        uint32     *d = (uint32 *) data;
564
564
}
565
565
 
566
566
void
567
 
aes_cbc_decrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len)
 
567
aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len)
568
568
{
569
569
        uint32     *d = (uint32 *) data;
570
570
        unsigned        bs = 16;