fix compiler warnings
Karel Miko
7 years ago
175 | 175 |
} *Crypt__PK__ECC;
|
176 | 176 |
|
177 | 177 |
int str_add_leading_zero(char *str, int maxlen, int minlen) {
|
178 | |
int rv, len;
|
|
178 |
int len;
|
179 | 179 |
len = strlen(str);
|
180 | 180 |
if (len > 0 && len % 2 && len < maxlen-2) {
|
181 | 181 |
memmove(str+1, str, len+1); /* incl. NUL byte */
|
|
190 | 190 |
}
|
191 | 191 |
|
192 | 192 |
int mp_tohex_with_leading_zero(mp_int * a, char *str, int maxlen, int minlen) {
|
193 | |
int rv, len;
|
|
193 |
int rv;
|
194 | 194 |
if (mp_isneg(a) == MP_YES) {
|
195 | 195 |
*str = '\0';
|
196 | 196 |
return MP_VAL;
|
|
215 | 215 |
{
|
216 | 216 |
HV *h;
|
217 | 217 |
SV *param, **pref;
|
218 | |
SV **sv_cofactor, **sv_prime, **sv_A, **sv_B, **sv_order, **sv_Gx, **sv_Gy, **sv_oid;
|
|
218 |
SV **sv_cofactor, **sv_prime, **sv_A, **sv_B, **sv_order, **sv_Gx, **sv_Gy;
|
219 | 219 |
int err;
|
220 | 220 |
char *ch_name;
|
221 | 221 |
STRLEN l_name;
|
0 | 0 |
MODULE = CryptX PACKAGE = Crypt::Checksum::Adler32
|
1 | 1 |
|
2 | 2 |
Crypt::Checksum::Adler32
|
3 | |
new(SV *class)
|
|
3 |
new(Class)
|
4 | 4 |
CODE:
|
5 | 5 |
Newz(0, RETVAL, 1, adler32_state);
|
6 | 6 |
if (!RETVAL) croak("FATAL: Newz failed");
|
0 | 0 |
MODULE = CryptX PACKAGE = Crypt::Checksum::CRC32
|
1 | 1 |
|
2 | 2 |
Crypt::Checksum::CRC32
|
3 | |
new(SV *class)
|
|
3 |
new(Class)
|
4 | 4 |
CODE:
|
5 | 5 |
Newz(0, RETVAL, 1, crc32_state);
|
6 | 6 |
if (!RETVAL) croak("FATAL: Newz failed");
|
123 | 123 |
not_used = hv_store(rv_hash, "d", 1, newSVpv("", 0), 0);
|
124 | 124 |
}
|
125 | 125 |
/* =====> N */
|
126 | |
siz = (self->key.N) ? mp_unsigned_bin_size(self->key.N) : 0;
|
|
126 |
siz = (self->key.N) ? nsize : 0;
|
127 | 127 |
if (siz>10000) {
|
128 | 128 |
croak("FATAL: key2hash failed - 'N' too big number");
|
129 | 129 |
}
|
|
195 | 195 |
not_used = hv_store(rv_hash, "dQ", 2, newSVpv("", 0), 0);
|
196 | 196 |
}
|
197 | 197 |
/* =====> size */
|
198 | |
not_used = hv_store(rv_hash, "size", 4, newSViv(mp_unsigned_bin_size(self->key.N)), 0);
|
|
198 |
not_used = hv_store(rv_hash, "size", 4, newSViv(nsize), 0);
|
199 | 199 |
/* =====> type */
|
200 | 200 |
not_used = hv_store(rv_hash, "type", 4, newSViv(self->key.type), 0);
|
201 | 201 |
if (not_used) not_used = NULL; /* just silence the warning: variable 'not_used' set but not used */
|
2 | 2 |
|
3 | 3 |
/* macros for various libc functions you can change for embedded targets */
|
4 | 4 |
#ifndef XMALLOC
|
5 | |
#ifdef malloc
|
|
5 |
#if !defined(LTC_NO_PROTOTYPES) && defined(malloc)
|
6 | 6 |
#define LTC_NO_PROTOTYPES
|
7 | 7 |
#endif
|
8 | 8 |
#define XMALLOC malloc
|
9 | 9 |
#endif
|
10 | 10 |
#ifndef XREALLOC
|
11 | |
#ifdef realloc
|
|
11 |
#if !defined(LTC_NO_PROTOTYPES) && defined(realloc)
|
12 | 12 |
#define LTC_NO_PROTOTYPES
|
13 | 13 |
#endif
|
14 | 14 |
#define XREALLOC realloc
|
15 | 15 |
#endif
|
16 | 16 |
#ifndef XCALLOC
|
17 | |
#ifdef calloc
|
|
17 |
#if !defined(LTC_NO_PROTOTYPES) && defined(calloc)
|
18 | 18 |
#define LTC_NO_PROTOTYPES
|
19 | 19 |
#endif
|
20 | 20 |
#define XCALLOC calloc
|
21 | 21 |
#endif
|
22 | 22 |
#ifndef XFREE
|
23 | |
#ifdef free
|
|
23 |
#if !defined(LTC_NO_PROTOTYPES) && defined(free)
|
24 | 24 |
#define LTC_NO_PROTOTYPES
|
25 | 25 |
#endif
|
26 | 26 |
#define XFREE free
|
27 | 27 |
#endif
|
28 | 28 |
|
29 | 29 |
#ifndef XMEMSET
|
30 | |
#ifdef memset
|
|
30 |
#if !defined(LTC_NO_PROTOTYPES) && defined(memset)
|
31 | 31 |
#define LTC_NO_PROTOTYPES
|
32 | 32 |
#endif
|
33 | 33 |
#define XMEMSET memset
|
34 | 34 |
#endif
|
35 | 35 |
#ifndef XMEMCPY
|
36 | |
#ifdef memcpy
|
|
36 |
#if !defined(LTC_NO_PROTOTYPES) && defined(memcpy)
|
37 | 37 |
#define LTC_NO_PROTOTYPES
|
38 | 38 |
#endif
|
39 | 39 |
#define XMEMCPY memcpy
|
40 | 40 |
#endif
|
41 | 41 |
#ifndef XMEMCMP
|
42 | |
#ifdef memcmp
|
|
42 |
#if !defined(LTC_NO_PROTOTYPES) && defined(memcmp)
|
43 | 43 |
#define LTC_NO_PROTOTYPES
|
44 | 44 |
#endif
|
45 | 45 |
#define XMEMCMP memcmp
|
|
48 | 48 |
#define XMEM_NEQ mem_neq
|
49 | 49 |
#endif
|
50 | 50 |
#ifndef XSTRCMP
|
51 | |
#ifdef strcmp
|
|
51 |
#if !defined(LTC_NO_PROTOTYPES) && defined(strcmp)
|
52 | 52 |
#define LTC_NO_PROTOTYPES
|
53 | 53 |
#endif
|
54 | 54 |
#define XSTRCMP strcmp
|
|
62 | 62 |
#endif
|
63 | 63 |
|
64 | 64 |
#ifndef XQSORT
|
65 | |
#ifdef qsort
|
|
65 |
#if !defined(LTC_NO_PROTOTYPES) && defined(qsort)
|
66 | 66 |
#define LTC_NO_PROTOTYPES
|
67 | 67 |
#endif
|
68 | 68 |
#define XQSORT qsort
|
423 | 423 |
const unsigned char *hash, unsigned long hashlen,
|
424 | 424 |
int *stat, dh_key *key)
|
425 | 425 |
{
|
426 | |
void *a, *b, *p, *g, *m, *tmp;
|
|
426 |
void *a, *b, *m, *tmp;
|
427 | 427 |
unsigned long x, y;
|
428 | 428 |
int err;
|
429 | 429 |
|
15 | 15 |
portable way to get secure random bits to feed a PRNG (Tom St Denis)
|
16 | 16 |
*/
|
17 | 17 |
|
18 | |
#ifdef LTC_DEVRANDOM
|
|
18 |
#if defined(LTC_DEVRANDOM) && !defined(WIN32) && !defined(_WIN32) && !defined(WINCE)
|
19 | 19 |
/* on *NIX read /dev/random */
|
20 | 20 |
static unsigned long rng_nix(unsigned char *buf, unsigned long len,
|
21 | 21 |
void (*callback)(void))
|