unsigned encr_pos;
} archive_crypto_ctx;
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+
+#define AES_MAX_KEY_SIZE 32
+#define AES_BLOCK_SIZE 16
+typedef struct {
+ int ctx;
+ uint8_t key[AES_MAX_KEY_SIZE];
+ unsigned key_len;
+ uint8_t nonce[AES_BLOCK_SIZE];
+ uint8_t encr_buf[AES_BLOCK_SIZE];
+ unsigned encr_pos;
+} archive_crypto_ctx;
+
#elif defined(HAVE_LIBNETTLE)
#if defined(HAVE_NETTLE_PBKDF2_H)
#include <nettle/pbkdf2.h>
}
static void
-__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out)
+__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
(void)ctx;/* UNUSED */
(void)out;/* UNUSED */
+ (void)out_len;/* UNUSED */
}
static void
typedef CCHmacContext archive_hmac_sha1_ctx;
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+
+typedef int archive_hmac_sha1_ctx;
+
#elif defined(HAVE_LIBNETTLE)
#include <nettle/hmac.h>
#include <pthread.h>
#endif
-#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
-#include <wincrypt.h>
-#endif
-
static void arc4random_buf(void *, size_t);
#endif /* HAVE_ARC4RANDOM_BUF */
#include "archive.h"
#include "archive_random_private.h"
+#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
+#include <wincrypt.h>
+#endif
+
/*
* Random number generator function.
* This simply calls arc4random_buf function if the platform provides it.
PROV_RSA_FULL, CRYPT_NEWKEYSET);
}
if (success) {
- success = CryptGenRandom(hProv, (DWORD)nbytes, (BYTE*)buf))
+ success = CryptGenRandom(hProv, (DWORD)nbytes, (BYTE*)buf);
CryptReleaseContext(hProv, 0);
if (success)
return ARCHIVE_OK;
if (bytes_avail > lha->entry_bytes_remaining)
bytes_avail = (ssize_t)lha->entry_bytes_remaining;
- lha->strm.avail_in = bytes_avail;
+ lha->strm.avail_in = (int)bytes_avail;
lha->strm.total_in = 0;
lha->strm.avail_out = 0;
lzh_emit_window(struct lzh_stream *strm, size_t s)
{
strm->ref_ptr = strm->ds->w_buff;
- strm->avail_out = s;
+ strm->avail_out = (int)s;
strm->total_out += s;
}
"Missing number");
return ARCHIVE_WARN;
}
- numbers[argc++] = mtree_atol(&p);
+ numbers[argc++] = (unsigned long)mtree_atol(&p);
if (argc > MAX_PACK_ARGS) {
archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
"Too many arguments");
unsigned int i, j, size;
char **test_strings, *tmp;
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
size = sizeof(strings) / sizeof(char *);
assert((test_strings = (char **)calloc(1, sizeof(strings))) != NULL);
for (i = 0; i < (size - 1); i++)
#include "test.h"
__FBSDID("$FreeBSD");
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define close _close
+#define open _open
+#endif
+
/*
* Extract a non-encoded file.
* The header of the 7z archive files is not encoded.
/* It's header or metadata, copy and save it. */
block = (struct fileblock *)malloc(sizeof(*block));
memset(block, 0, sizeof(*block));
- block->size = size;
+ block->size = (int)size;
block->buff = malloc(size);
memcpy(block->buff, buff, size);
if (private->last == NULL) {