diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-10 14:33:37 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-10 14:33:37 -0700 |
commit | d7e5cc754a937605d1f73db5e7967c58ddd80742 (patch) | |
tree | ed28e012c4d6a46b7f29f15a0c060474c27d4286 /core/src/fdrm | |
parent | bfa9a824a20f37c2dd7111012b46c929cf2ed8a0 (diff) | |
download | pdfium-d7e5cc754a937605d1f73db5e7967c58ddd80742.tar.xz |
Merge to XFA: Remove typdefs for pointer types in fx_system.h.
Original Review URL: https://codereview.chromium.org/1171733003
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1178613002.
Diffstat (limited to 'core/src/fdrm')
-rw-r--r-- | core/src/fdrm/crypto/fx_crypt.cpp | 14 | ||||
-rw-r--r-- | core/src/fdrm/crypto/fx_crypt_aes.cpp | 8 | ||||
-rw-r--r-- | core/src/fdrm/crypto/fx_crypt_sha.cpp | 36 |
3 files changed, 29 insertions, 29 deletions
diff --git a/core/src/fdrm/crypto/fx_crypt.cpp b/core/src/fdrm/crypto/fx_crypt.cpp index da9fcc5693..f6b3148dba 100644 --- a/core/src/fdrm/crypto/fx_crypt.cpp +++ b/core/src/fdrm/crypto/fx_crypt.cpp @@ -14,7 +14,7 @@ extern "C" { struct rc4_state { int x, y, m[256]; }; -void CRYPT_ArcFourSetup(void* context, FX_LPCBYTE key, FX_DWORD length ) +void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length ) { rc4_state *s = (rc4_state*)context; int i, j, k, *m, a; @@ -53,7 +53,7 @@ void CRYPT_ArcFourCrypt(void* context, unsigned char *data, FX_DWORD length ) s->x = x; s->y = y; } -void CRYPT_ArcFourCryptBlock(FX_LPBYTE pData, FX_DWORD size, FX_LPCBYTE key, FX_DWORD keylen) +void CRYPT_ArcFourCryptBlock(uint8_t* pData, FX_DWORD size, const uint8_t* key, FX_DWORD keylen) { rc4_state s; CRYPT_ArcFourSetup(&s, key, keylen); @@ -193,7 +193,7 @@ void CRYPT_MD5Start(void* context) ctx->state[2] = 0x98BADCFE; ctx->state[3] = 0x10325476; } -void CRYPT_MD5Update(FX_LPVOID pctx, FX_LPCBYTE input, FX_DWORD length ) +void CRYPT_MD5Update(void* pctx, const uint8_t* input, FX_DWORD length ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD left, fill; @@ -228,7 +228,7 @@ const uint8_t md5_padding[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -void CRYPT_MD5Finish(FX_LPVOID pctx, uint8_t digest[16] ) +void CRYPT_MD5Finish(void* pctx, uint8_t digest[16] ) { struct md5_context *ctx = (struct md5_context *)pctx; FX_DWORD last, padn; @@ -244,15 +244,15 @@ void CRYPT_MD5Finish(FX_LPVOID pctx, uint8_t digest[16] ) PUT_FX_DWORD( ctx->state[2], digest, 8 ); PUT_FX_DWORD( ctx->state[3], digest, 12 ); } -void CRYPT_MD5Generate(FX_LPCBYTE input, FX_DWORD length, uint8_t digest[16]) +void CRYPT_MD5Generate(const uint8_t* input, FX_DWORD length, uint8_t digest[16]) { md5_context ctx; CRYPT_MD5Start(&ctx); CRYPT_MD5Update(&ctx, input, length); CRYPT_MD5Finish(&ctx, digest); } -static FX_BOOL (*g_PubKeyDecryptor)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len) = NULL; -void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len)) +static FX_BOOL (*g_PubKeyDecryptor)(const uint8_t* pData, FX_DWORD size, uint8_t* data_buf, FX_DWORD& data_len) = NULL; +void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, FX_DWORD size, uint8_t* data_buf, FX_DWORD& data_len)) { g_PubKeyDecryptor = func; } diff --git a/core/src/fdrm/crypto/fx_crypt_aes.cpp b/core/src/fdrm/crypto/fx_crypt_aes.cpp index 6efa935be3..4de0f7e752 100644 --- a/core/src/fdrm/crypto/fx_crypt_aes.cpp +++ b/core/src/fdrm/crypto/fx_crypt_aes.cpp @@ -989,22 +989,22 @@ static void aes_encrypt_cbc(unsigned char *dest, const unsigned char *src, int l } FXSYS_memcpy32(ctx->iv, iv, sizeof(iv)); } -void CRYPT_AESSetKey(FX_LPVOID context, FX_DWORD blocklen, FX_LPCBYTE key, FX_DWORD keylen, FX_BOOL bEncrypt) +void CRYPT_AESSetKey(void* context, FX_DWORD blocklen, const uint8_t* key, FX_DWORD keylen, FX_BOOL bEncrypt) { aes_setup((AESContext*)context, blocklen, key, keylen); } -void CRYPT_AESSetIV(FX_LPVOID context, FX_LPCBYTE iv) +void CRYPT_AESSetIV(void* context, const uint8_t* iv) { int i; for (i = 0; i < ((AESContext*)context)->Nb; i++) { ((AESContext*)context)->iv[i] = GET_32BIT_MSB_FIRST(iv + 4 * i); } } -void CRYPT_AESDecrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD len) +void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) { aes_decrypt_cbc(dest, src, len, (AESContext*)context); } -void CRYPT_AESEncrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD len) +void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, FX_DWORD len) { aes_encrypt_cbc(dest, src, len, (AESContext*)context); } diff --git a/core/src/fdrm/crypto/fx_crypt_sha.cpp b/core/src/fdrm/crypto/fx_crypt_sha.cpp index 1a55d11633..55a3f0e5bf 100644 --- a/core/src/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/src/fdrm/crypto/fx_crypt_sha.cpp @@ -82,14 +82,14 @@ static void SHATransform(unsigned int * digest, unsigned int * block) digest[3] += d; digest[4] += e; } -void CRYPT_SHA1Start(FX_LPVOID context) +void CRYPT_SHA1Start(void* context) { SHA_State * s = (SHA_State*)context; SHA_Core_Init(s->h); s->blkused = 0; s->lenhi = s->lenlo = 0; } -void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) +void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size) { SHA_State * s = (SHA_State*)context; unsigned char *q = (unsigned char *)data; @@ -121,7 +121,7 @@ void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) s->blkused = len; } } -void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]) +void CRYPT_SHA1Finish(void* context, uint8_t digest[20]) { SHA_State * s = (SHA_State*)context; int i; @@ -154,7 +154,7 @@ void CRYPT_SHA1Finish(FX_LPVOID context, uint8_t digest[20]) digest[i * 4 + 3] = (s->h[i]) & 0xFF; } } -void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[20]) +void CRYPT_SHA1Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[20]) { SHA_State s; CRYPT_SHA1Start(&s); @@ -181,7 +181,7 @@ sha256_context; (b)[(i) + 2] = (uint8_t) ( (n) >> 8 ); \ (b)[(i) + 3] = (uint8_t) ( (n) ); \ } -void CRYPT_SHA256Start( FX_LPVOID context ) +void CRYPT_SHA256Start( void* context ) { sha256_context *ctx = (sha256_context *)context; ctx->total[0] = 0; @@ -315,7 +315,7 @@ static void sha256_process( sha256_context *ctx, const uint8_t data[64] ) ctx->state[6] += G; ctx->state[7] += H; } -void CRYPT_SHA256Update( void* context, FX_LPCBYTE input, FX_DWORD length ) +void CRYPT_SHA256Update( void* context, const uint8_t* input, FX_DWORD length ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD left, fill; @@ -353,7 +353,7 @@ static const uint8_t sha256_padding[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -void CRYPT_SHA256Finish( FX_LPVOID context, uint8_t digest[32] ) +void CRYPT_SHA256Finish( void* context, uint8_t digest[32] ) { sha256_context *ctx = (sha256_context *)context; FX_DWORD last, padn; @@ -377,7 +377,7 @@ void CRYPT_SHA256Finish( FX_LPVOID context, uint8_t digest[32] ) PUT_FX_DWORD( ctx->state[6], digest, 24 ); PUT_FX_DWORD( ctx->state[7], digest, 28 ); } -void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[32]) +void CRYPT_SHA256Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[32]) { sha256_context ctx; CRYPT_SHA256Start(&ctx); @@ -389,7 +389,7 @@ typedef struct { uint64_t state[8]; uint8_t buffer[128]; } sha384_context; -uint64_t FX_ato64i(FX_LPCSTR str) +uint64_t FX_ato64i(const FX_CHAR* str) { FXSYS_assert(str != NULL); uint64_t ret = 0; @@ -411,7 +411,7 @@ uint64_t FX_ato64i(FX_LPCSTR str) } return ret; } -void CRYPT_SHA384Start(FX_LPVOID context) +void CRYPT_SHA384Start(void* context) { if (context == NULL) { return; @@ -452,7 +452,7 @@ static const uint8_t sha384_padding[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #define SHA384_R(t) (W[t] = SHA384_S1(W[t - 2]) + W[t - 7] + SHA384_S0(W[t - 15]) + W[t - 16]) -static FX_LPCSTR constants[] = { +static const FX_CHAR* constants[] = { "428a2f98d728ae22", "7137449123ef65cd", "b5c0fbcfec4d3b2f", @@ -624,7 +624,7 @@ static void sha384_process( sha384_context *ctx, const uint8_t data[128] ) ctx->state[6] += G; ctx->state[7] += H; } -void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) +void CRYPT_SHA384Update(void* context, const uint8_t* input, FX_DWORD length) { sha384_context *ctx = (sha384_context *)context; FX_DWORD left, fill; @@ -655,7 +655,7 @@ void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE input, FX_DWORD length) (void *) input, length ); } } -void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]) +void CRYPT_SHA384Finish(void* context, uint8_t digest[48]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; @@ -678,14 +678,14 @@ void CRYPT_SHA384Finish(FX_LPVOID context, uint8_t digest[48]) PUT_FX_64DWORD(ctx->state[4], digest, 32); PUT_FX_64DWORD(ctx->state[5], digest, 40); } -void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) +void CRYPT_SHA384Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA384Start(&context); CRYPT_SHA384Update(&context, data, size); CRYPT_SHA384Finish(&context, digest); } -void CRYPT_SHA512Start(FX_LPVOID context) +void CRYPT_SHA512Start(void* context) { if (context == NULL) { return; @@ -701,11 +701,11 @@ void CRYPT_SHA512Start(FX_LPVOID context) ctx->state[6] = FX_ato64i("1f83d9abfb41bd6b"); ctx->state[7] = FX_ato64i("5be0cd19137e2179"); } -void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size) +void CRYPT_SHA512Update(void* context, const uint8_t* data, FX_DWORD size) { CRYPT_SHA384Update(context, data, size); } -void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]) +void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) { sha384_context *ctx = (sha384_context *)context; FX_DWORD last, padn; @@ -730,7 +730,7 @@ void CRYPT_SHA512Finish(FX_LPVOID context, uint8_t digest[64]) PUT_FX_64DWORD(ctx->state[6], digest, 48); PUT_FX_64DWORD(ctx->state[7], digest, 56); } -void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, uint8_t digest[64]) +void CRYPT_SHA512Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA512Start(&context); |