#include <mbedtls/aes.h>
#include <mbedtls/md.h>
Go to the source code of this file.
|
#define | HAVE_SECURE_RANDOM |
|
#define | _zip_crypto_aes_t mbedtls_aes_context |
|
#define | _zip_crypto_hmac_t mbedtls_md_context_t |
|
#define | _zip_crypto_aes_encrypt_block(aes, in, out) (mbedtls_aes_crypt_ecb((aes), MBEDTLS_AES_ENCRYPT, (in), (out)) == 0) |
|
#define | _zip_crypto_hmac(hmac, data, length) (mbedtls_md_hmac_update((hmac), (data), (length)) == 0) |
|
#define | _zip_crypto_hmac_output(hmac, data) (mbedtls_md_hmac_finish((hmac), (data)) == 0) |
|
|
_zip_crypto_aes_t * | _zip_crypto_aes_new (const zip_uint8_t *key, zip_uint16_t key_size, zip_error_t *error) |
|
void | _zip_crypto_aes_free (_zip_crypto_aes_t *aes) |
|
_zip_crypto_hmac_t * | _zip_crypto_hmac_new (const zip_uint8_t *secret, zip_uint64_t secret_length, zip_error_t *error) |
|
void | _zip_crypto_hmac_free (_zip_crypto_hmac_t *hmac) |
|
bool | _zip_crypto_pbkdf2 (const zip_uint8_t *key, zip_uint64_t key_length, const zip_uint8_t *salt, zip_uint16_t salt_length, int iterations, zip_uint8_t *output, zip_uint64_t output_length) |
|
◆ _zip_crypto_aes_encrypt_block
#define _zip_crypto_aes_encrypt_block |
( |
|
aes, |
|
|
|
in, |
|
|
|
out |
|
) |
| (mbedtls_aes_crypt_ecb((aes), MBEDTLS_AES_ENCRYPT, (in), (out)) == 0) |
◆ _zip_crypto_aes_t
◆ _zip_crypto_hmac
#define _zip_crypto_hmac |
( |
|
hmac, |
|
|
|
data, |
|
|
|
length |
|
) |
| (mbedtls_md_hmac_update((hmac), (data), (length)) == 0) |
◆ _zip_crypto_hmac_output
#define _zip_crypto_hmac_output |
( |
|
hmac, |
|
|
|
data |
|
) |
| (mbedtls_md_hmac_finish((hmac), (data)) == 0) |
◆ _zip_crypto_hmac_t
◆ HAVE_SECURE_RANDOM
#define HAVE_SECURE_RANDOM |
◆ _zip_crypto_aes_free()
◆ _zip_crypto_aes_new()
Definition at line 62 of file zip_crypto_commoncrypto.c.
66 ret = CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES, kCCOptionECBMode,
key, key_size / 8,
NULL, &aes);
72 case kCCMemoryFailure:
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
void error(const char *msg)
◆ _zip_crypto_hmac_free()
◆ _zip_crypto_hmac_new()
Definition at line 99 of file zip_crypto_commoncrypto.c.
107 CCHmacInit(hmac, kCCHmacAlgSHA1, secret, secret_length);
void * malloc(size_t size)
◆ _zip_crypto_pbkdf2()
Definition at line 116 of file zip_crypto_mbedtls.c.
117 mbedtls_md_context_t sha1_ctx;
120 mbedtls_md_init(&sha1_ctx);
122 if (mbedtls_md_setup(&sha1_ctx, mbedtls_md_info_from_type(MBEDTLS_MD_SHA1), 1) != 0) {
126 if (
ok && mbedtls_pkcs5_pbkdf2_hmac(&sha1_ctx, (
const unsigned char *)
key, (
size_t)key_length, (
const unsigned char *)salt, (
size_t)salt_length, (
unsigned int)iterations, (
uint32_t)output_length, (
unsigned char *)
output) != 0) {
130 mbedtls_md_free(&sha1_ctx);
References key, ok, and output.