Skip to content

Commit 44b4b67

Browse files
committed
use build-in PostgreSQL types instead of stdint.h types
1 parent 1aded22 commit 44b4b67

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

src/backend/storage/file/rijndael.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Mean: 500 cycles = 51.2 mbits/sec
4242

4343
#include <sys/param.h>
4444
#include <string.h>
45-
#include <stdint.h>
4645

4746
#include "storage/rijndael.h"
4847

@@ -500,23 +499,23 @@ rijndael_decrypt(rijndael_ctx *ctx, const u4byte *in_blk, u4byte *out_blk)
500499
*/
501500

502501
void
503-
aes_set_key(rijndael_ctx *ctx, const uint8_t *key, unsigned keybits, int enc)
502+
aes_set_key(rijndael_ctx *ctx, const uint8 *key, unsigned keybits, int enc)
504503
{
505-
uint32_t *k;
504+
uint32 *k;
506505

507-
k = (uint32_t *) key;
506+
k = (uint32 *) key;
508507
rijndael_set_key(ctx, k, keybits, enc);
509508
}
510509

511510
void
512-
aes_ecb_encrypt(rijndael_ctx *ctx, uint8_t *data, unsigned len)
511+
aes_ecb_encrypt(rijndael_ctx *ctx, uint8 *data, unsigned len)
513512
{
514513
unsigned bs = 16;
515-
uint32_t *d;
514+
uint32 *d;
516515

517516
while (len >= bs)
518517
{
519-
d = (uint32_t *) data;
518+
d = (uint32 *) data;
520519
rijndael_encrypt(ctx, d, d);
521520

522521
len -= bs;
@@ -525,14 +524,14 @@ aes_ecb_encrypt(rijndael_ctx *ctx, uint8_t *data, unsigned len)
525524
}
526525

527526
void
528-
aes_ecb_decrypt(rijndael_ctx *ctx, uint8_t *data, unsigned len)
527+
aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len)
529528
{
530529
unsigned bs = 16;
531-
uint32_t *d;
530+
uint32 *d;
532531

533532
while (len >= bs)
534533
{
535-
d = (uint32_t *) data;
534+
d = (uint32 *) data;
536535
rijndael_decrypt(ctx, d, d);
537536

538537
len -= bs;
@@ -541,10 +540,10 @@ aes_ecb_decrypt(rijndael_ctx *ctx, uint8_t *data, unsigned len)
541540
}
542541

543542
void
544-
aes_cbc_encrypt(rijndael_ctx *ctx, uint8_t *iva, uint8_t *data, unsigned len)
543+
aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len)
545544
{
546-
uint32_t *iv = (uint32_t *) iva;
547-
uint32_t *d = (uint32_t *) data;
545+
uint32 *iv = (uint32 *) iva;
546+
uint32 *d = (uint32 *) data;
548547
unsigned bs = 16;
549548

550549
while (len >= bs)
@@ -563,11 +562,11 @@ aes_cbc_encrypt(rijndael_ctx *ctx, uint8_t *iva, uint8_t *data, unsigned len)
563562
}
564563

565564
void
566-
aes_cbc_decrypt(rijndael_ctx *ctx, uint8_t *iva, uint8_t *data, unsigned len)
565+
aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len)
567566
{
568-
uint32_t *d = (uint32_t *) data;
567+
uint32 *d = (uint32 *) data;
569568
unsigned bs = 16;
570-
uint32_t buf[4],
569+
uint32 buf[4],
571570
iv[4];
572571

573572
memcpy(iv, iva, bs);
@@ -604,7 +603,7 @@ aes_cbc_decrypt(rijndael_ctx *ctx, uint8_t *iva, uint8_t *data, unsigned len)
604603
#ifdef PRINT_TABS
605604

606605
static void
607-
show256u8(char *name, uint8_t *data)
606+
show256u8(char *name, uint8 *data)
608607
{
609608
int i;
610609

@@ -620,7 +619,7 @@ show256u8(char *name, uint8_t *data)
620619

621620

622621
static void
623-
show4x256u32(char *name, uint32_t data[4][256])
622+
show4x256u32(char *name, uint32 data[4][256])
624623
{
625624
int i,
626625
j;

src/include/storage/rijndael.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@
2020
#ifndef _RIJNDAEL_H_
2121
#define _RIJNDAEL_H_
2222

23-
#include <stdint.h>
24-
2523
/* 1. Standard types for AES cryptography source code */
2624

27-
typedef uint8_t u1byte; /* an 8 bit unsigned character type */
28-
typedef uint16_t u2byte; /* a 16 bit unsigned integer type */
29-
typedef uint32_t u4byte; /* a 32 bit unsigned integer type */
25+
typedef uint8 u1byte; /* an 8 bit unsigned character type */
26+
typedef uint16 u2byte; /* a 16 bit unsigned integer type */
27+
typedef uint32 u4byte; /* a 32 bit unsigned integer type */
3028

31-
typedef int8_t s1byte; /* an 8 bit signed character type */
32-
typedef int16_t s2byte; /* a 16 bit signed integer type */
33-
typedef int32_t s4byte; /* a 32 bit signed integer type */
29+
typedef int8 s1byte; /* an 8 bit signed character type */
30+
typedef int16 s2byte; /* a 16 bit signed integer type */
31+
typedef int32 s4byte; /* a 32 bit signed integer type */
3432

3533
typedef struct _rijndael_ctx
3634
{
@@ -53,10 +51,10 @@ void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);
5351

5452
/* conventional interface */
5553

56-
void aes_set_key(rijndael_ctx *ctx, const uint8_t *key, unsigned keybits, int enc);
57-
void aes_ecb_encrypt(rijndael_ctx *ctx, uint8_t *data, unsigned len);
58-
void aes_ecb_decrypt(rijndael_ctx *ctx, uint8_t *data, unsigned len);
59-
void aes_cbc_encrypt(rijndael_ctx *ctx, uint8_t *iva, uint8_t *data, unsigned len);
60-
void aes_cbc_decrypt(rijndael_ctx *ctx, uint8_t *iva, uint8_t *data, unsigned len);
54+
void aes_set_key(rijndael_ctx *ctx, const uint8 *key, unsigned keybits, int enc);
55+
void aes_ecb_encrypt(rijndael_ctx *ctx, uint8 *data, unsigned len);
56+
void aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len);
57+
void aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len);
58+
void aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len);
6159

6260
#endif /* _RIJNDAEL_H_ */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy