Codebase list libcryptx-perl / 8af0333
MSVC6 related fixes (needed for older ActivePerl@MSWin32) Karel Miko 8 years ago
3 changed file(s) with 23 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
223223 {
224224 int rv;
225225 unsigned long int out_len = 4096;
226 unsigned char out[out_len];
226 unsigned char out[4096];
227227
228228 RETVAL = newSVpvn(NULL, 0); /* undef */
229229 if (strnEQ(type, "private", 7)) {
251251 unsigned char *data_ptr=NULL;
252252 STRLEN data_len=0;
253253 unsigned long buffer_len = 1024;
254 unsigned char buffer[buffer_len];
254 unsigned char buffer[1024];
255255
256256 data_ptr = (unsigned char *)SvPVbyte(data, data_len);
257257
274274 unsigned char *data_ptr=NULL;
275275 STRLEN data_len=0;
276276 unsigned long buffer_len = 1024;
277 unsigned char buffer[buffer_len];
277 unsigned char buffer[1024];
278278
279279 data_ptr = (unsigned char *)SvPVbyte(data, data_len);
280280
293293 unsigned char *data_ptr=NULL;
294294 STRLEN data_len=0;
295295 unsigned long buffer_len = 1024;
296 unsigned char buffer[buffer_len];
296 unsigned char buffer[1024];
297297
298298 data_ptr = (unsigned char *)SvPVbyte(data, data_len);
299299
332332 {
333333 int rv;
334334 unsigned long buffer_len = 1024;
335 unsigned char buffer[buffer_len];
335 unsigned char buffer[1024];
336336
337337 rv = dh_shared_secret(&self->key, &pubkey->key, buffer, &buffer_len);
338338 if (rv != CRYPT_OK) croak("FATAL: dh_shared_secret failed: %s", error_to_string(rv));
345345 export_key_raw(Crypt::PK::DH self, char * type)
346346 CODE:
347347 {
348 int rv, len;
349 unsigned long buffer_len = 1024;
350 unsigned char buffer[buffer_len];
348 int rv;
349 unsigned long len, buffer_len = 1024;
350 unsigned char buffer[1024];
351351 void *key;
352352
353353 RETVAL = newSVpvn(NULL, 0); /* undef */
2828
2929 void adler32_update(adler32_state *ctx, const unsigned char *input, unsigned long length)
3030 {
31 unsigned long s1, s2;
32
3133 LTC_ARGCHKVD(ctx != NULL);
3234 LTC_ARGCHKVD(input != NULL);
33 unsigned long s1 = ctx->s[0];
34 unsigned long s2 = ctx->s[1];
35 s1 = ctx->s[0];
36 s2 = ctx->s[1];
3537
3638 if (length % 8 != 0) {
3739 do {
8082
8183 void adler32_finish(adler32_state *ctx, void *hash, unsigned long size)
8284 {
85 unsigned char* h;
86
8387 LTC_ARGCHKVD(ctx != NULL);
8488 LTC_ARGCHKVD(hash != NULL);
8589
86 unsigned char* h = hash;
90 h = hash;
8791
8892 switch (size) {
8993 default:
148148
149149 void crc32_update(crc32_state *ctx, const unsigned char *input, unsigned long length)
150150 {
151 ulong32 crc;
151152 LTC_ARGCHKVD(ctx != NULL);
152153 LTC_ARGCHKVD(input != NULL);
153 ulong32 crc = ctx->crc;
154 crc = ctx->crc;
154155
155156 while (length--)
156157 crc = crc32_m_tab[CRC32_INDEX(crc) ^ *input++] ^ CRC32_SHIFTED(crc);
160161
161162 void crc32_finish(crc32_state *ctx, void *hash, unsigned long size)
162163 {
164 unsigned char* h;
165 unsigned long i;
166 ulong32 crc;
167
163168 LTC_ARGCHKVD(ctx != NULL);
164169 LTC_ARGCHKVD(hash != NULL);
165170
166 unsigned char* h = hash;
167 unsigned long i;
168
169 ulong32 crc = ctx->crc;
171 h = hash;
172 crc = ctx->crc;
170173 crc ^= _CRC32_NEGL;
171174 for (i = 0; i < size; i++) {
172175 h[size-i-1] = ((unsigned char*)&(crc))[i];