Skip to content

Commit 540155b

Browse files
committed
pgcrypto uses non-standard type uint, which causes compile
failures on FreeBSD. This patch replaces uint -> unsigned. This was reported by Daniel Holtzman against 0.4pre3 standalone package, but it needs fixing in contrib/pgcrypto too. Marko Kreen
1 parent 01e0dae commit 540155b

File tree

9 files changed

+97
-97
lines changed

9 files changed

+97
-97
lines changed

contrib/pgcrypto/internal.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $Id: internal.c,v 1.8 2001/11/05 17:46:23 momjian Exp $
29+
* $Id: internal.c,v 1.9 2001/11/20 15:50:53 momjian Exp $
3030
*/
3131

3232

@@ -90,7 +90,7 @@ int_md5_block_len(PX_MD * h)
9090
}
9191

9292
static void
93-
int_md5_update(PX_MD * h, const uint8 *data, uint dlen)
93+
int_md5_update(PX_MD * h, const uint8 *data, unsigned dlen)
9494
{
9595
MD5_CTX *ctx = (MD5_CTX *) h->p.ptr;
9696

@@ -137,7 +137,7 @@ int_sha1_block_len(PX_MD * h)
137137
}
138138

139139
static void
140-
int_sha1_update(PX_MD * h, const uint8 *data, uint dlen)
140+
int_sha1_update(PX_MD * h, const uint8 *data, unsigned dlen)
141141
{
142142
SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr;
143143

@@ -225,7 +225,7 @@ struct int_ctx
225225
blf_ctx bf;
226226
rijndael_ctx rj;
227227
} ctx;
228-
uint keylen;
228+
unsigned keylen;
229229
int is_init;
230230
int mode;
231231
};
@@ -269,7 +269,7 @@ rj_iv_size(PX_Cipher * c)
269269
}
270270

271271
static int
272-
rj_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
272+
rj_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
273273
{
274274
struct int_ctx *cx = (struct int_ctx *) c->ptr;
275275

@@ -298,7 +298,7 @@ rj_real_init(struct int_ctx * cx, int dir)
298298
}
299299

300300
static int
301-
rj_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
301+
rj_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
302302
{
303303
struct int_ctx *cx = (struct int_ctx *) c->ptr;
304304

@@ -328,7 +328,7 @@ rj_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
328328
}
329329

330330
static int
331-
rj_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
331+
rj_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
332332
{
333333
struct int_ctx *cx = (struct int_ctx *) c->ptr;
334334

@@ -407,7 +407,7 @@ bf_iv_size(PX_Cipher * c)
407407
}
408408

409409
static int
410-
bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
410+
bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
411411
{
412412
struct int_ctx *cx = (struct int_ctx *) c->ptr;
413413

@@ -419,7 +419,7 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
419419
}
420420

421421
static int
422-
bf_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
422+
bf_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
423423
{
424424
struct int_ctx *cx = (struct int_ctx *) c->ptr;
425425

@@ -443,7 +443,7 @@ bf_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
443443
}
444444

445445
static int
446-
bf_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
446+
bf_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
447447
{
448448
struct int_ctx *cx = (struct int_ctx *) c->ptr;
449449

contrib/pgcrypto/mhash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $Id: mhash.c,v 1.5 2001/10/25 05:49:19 momjian Exp $
29+
* $Id: mhash.c,v 1.6 2001/11/20 15:50:53 momjian Exp $
3030
*/
3131

3232
#include <postgres.h>
@@ -75,7 +75,7 @@ digest_reset(PX_MD * h)
7575
}
7676

7777
static void
78-
digest_update(PX_MD * h, const uint8 *data, uint dlen)
78+
digest_update(PX_MD * h, const uint8 *data, unsigned dlen)
7979
{
8080
MHASH mh = (MHASH) h->p.ptr;
8181

@@ -86,7 +86,7 @@ static void
8686
digest_finish(PX_MD * h, uint8 *dst)
8787
{
8888
MHASH mh = (MHASH) h->p.ptr;
89-
uint hlen = digest_result_size(h);
89+
unsigned hlen = digest_result_size(h);
9090
hashid id = mhash_get_mhash_algo(mh);
9191
uint8 *buf = mhash_end(mh);
9292

@@ -136,7 +136,7 @@ cipher_iv_size(PX_Cipher * c)
136136
}
137137

138138
static int
139-
cipher_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
139+
cipher_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
140140
{
141141
int err;
142142
MCRYPT ctx = (MCRYPT) c->ptr;
@@ -150,7 +150,7 @@ cipher_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
150150
}
151151

152152
static int
153-
cipher_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
153+
cipher_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
154154
{
155155
int err;
156156
MCRYPT ctx = (MCRYPT) c->ptr;
@@ -164,7 +164,7 @@ cipher_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
164164
}
165165

166166
static int
167-
cipher_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
167+
cipher_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
168168
{
169169
int err;
170170
MCRYPT ctx = (MCRYPT) c->ptr;

contrib/pgcrypto/openssl.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $Id: openssl.c,v 1.8 2001/11/05 17:46:23 momjian Exp $
29+
* $Id: openssl.c,v 1.9 2001/11/20 15:50:53 momjian Exp $
3030
*/
3131

3232
#include <postgres.h>
@@ -60,7 +60,7 @@ digest_reset(PX_MD * h)
6060
}
6161

6262
static void
63-
digest_update(PX_MD * h, const uint8 *data, uint dlen)
63+
digest_update(PX_MD * h, const uint8 *data, unsigned dlen)
6464
{
6565
EVP_MD_CTX *ctx = (EVP_MD_CTX *) h->p.ptr;
6666

@@ -108,8 +108,8 @@ typedef struct
108108
const EVP_CIPHER *evp_ciph;
109109
uint8 key[EVP_MAX_KEY_LENGTH];
110110
uint8 iv[EVP_MAX_IV_LENGTH];
111-
uint klen;
112-
uint init;
111+
unsigned klen;
112+
unsigned init;
113113
} ossldata;
114114

115115
/* generic EVP */
@@ -133,7 +133,7 @@ gen_evp_key_size(PX_Cipher * c)
133133
static uint
134134
gen_evp_iv_size(PX_Cipher * c)
135135
{
136-
uint ivlen;
136+
unsigned ivlen;
137137
ossldata *od = (ossldata *) c->ptr;
138138

139139
ivlen = EVP_CIPHER_iv_length(od->evp_ciph);
@@ -153,10 +153,10 @@ gen_evp_free(PX_Cipher * c)
153153
/* fun */
154154

155155
static int
156-
gen_evp_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
156+
gen_evp_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
157157
{
158158
ossldata *od = (ossldata *) c->ptr;
159-
uint bs = gen_evp_block_size(c);
159+
unsigned bs = gen_evp_block_size(c);
160160

161161
if (iv)
162162
memcpy(od->iv, iv, bs);
@@ -179,7 +179,7 @@ _gen_init(PX_Cipher * c, int enc)
179179
}
180180

181181
static int
182-
gen_evp_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
182+
gen_evp_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
183183
{
184184
ossldata *od = c->ptr;
185185

@@ -190,7 +190,7 @@ gen_evp_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
190190
}
191191

192192
static int
193-
gen_evp_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
193+
gen_evp_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
194194
{
195195
ossldata *od = c->ptr;
196196

@@ -203,7 +203,7 @@ gen_evp_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
203203
/* Blowfish */
204204

205205
static int
206-
bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
206+
bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
207207
{
208208
ossldata *od = c->ptr;
209209

@@ -217,9 +217,9 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
217217
}
218218

219219
static int
220-
bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
220+
bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
221221
{
222-
uint bs = gen_evp_block_size(c),
222+
unsigned bs = gen_evp_block_size(c),
223223
i;
224224
ossldata *od = c->ptr;
225225

@@ -229,9 +229,9 @@ bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
229229
}
230230

231231
static int
232-
bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
232+
bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
233233
{
234-
uint bs = gen_evp_block_size(c),
234+
unsigned bs = gen_evp_block_size(c),
235235
i;
236236
ossldata *od = c->ptr;
237237

@@ -241,7 +241,7 @@ bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
241241
}
242242

243243
static int
244-
bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
244+
bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
245245
{
246246
ossldata *od = c->ptr;
247247

@@ -250,7 +250,7 @@ bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
250250
}
251251

252252
static int
253-
bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
253+
bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
254254
{
255255
ossldata *od = c->ptr;
256256

@@ -259,7 +259,7 @@ bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
259259
}
260260

261261
static int
262-
bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
262+
bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
263263
{
264264
ossldata *od = c->ptr;
265265

@@ -269,7 +269,7 @@ bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
269269
}
270270

271271
static int
272-
bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
272+
bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
273273
{
274274
ossldata *od = c->ptr;
275275

@@ -279,7 +279,7 @@ bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
279279
}
280280

281281
static int
282-
bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
282+
bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
283283
{
284284
ossldata *od = c->ptr;
285285

@@ -288,7 +288,7 @@ bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
288288
}
289289

290290
static int
291-
bf_ofb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
291+
bf_ofb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
292292
{
293293
ossldata *od = c->ptr;
294294

@@ -371,7 +371,7 @@ static PX_Cipher gen_evp_handler = {
371371
static int px_openssl_initialized = 0;
372372

373373
/* ATM not needed
374-
static void *o_alloc(uint s) { return px_alloc(s); }
374+
static void *o_alloc(unsigned s) { return px_alloc(s); }
375375
static void *o_realloc(void *p) { return px_realloc(p); }
376376
static void o_free(void *p) { px_free(p); }
377377
*/
@@ -416,7 +416,7 @@ px_find_digest(const char *name, PX_MD ** res)
416416
int
417417
px_find_cipher(const char *name, PX_Cipher ** res)
418418
{
419-
uint i;
419+
unsigned i;
420420
PX_Cipher *c = NULL,
421421
*csrc;
422422
ossldata *od;

0 commit comments

Comments
 (0)