summaryrefslogtreecommitdiff
path: root/core/src/fdrm/crypto
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-11 12:05:04 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-11 12:05:04 -0700
commit677b8fffb0c76c009ad808ed91a27738e5420254 (patch)
tree3cf9937569b7ca0cb93b6dfd04ac854f414f9d36 /core/src/fdrm/crypto
parent2b5e0d5b20654d116045484868c9e015ed698124 (diff)
downloadpdfium-677b8fffb0c76c009ad808ed91a27738e5420254.tar.xz
Kill FXSYS_mem{cpy,cmp,set.move}{32,8}.
At one point in time, it may have made sense to indicate the expected alignment of the memory you're about to copy, but that was last century. The compiler will take care of it just fine. I stopped short of removing the FXSYS_ wrapper macros entirely. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1179693003.
Diffstat (limited to 'core/src/fdrm/crypto')
-rw-r--r--core/src/fdrm/crypto/fx_crypt.cpp4
-rw-r--r--core/src/fdrm/crypto/fx_crypt_aes.cpp8
-rw-r--r--core/src/fdrm/crypto/fx_crypt_sha.cpp24
3 files changed, 18 insertions, 18 deletions
diff --git a/core/src/fdrm/crypto/fx_crypt.cpp b/core/src/fdrm/crypto/fx_crypt.cpp
index f6b3148dba..8413649311 100644
--- a/core/src/fdrm/crypto/fx_crypt.cpp
+++ b/core/src/fdrm/crypto/fx_crypt.cpp
@@ -207,7 +207,7 @@ void CRYPT_MD5Update(void* pctx, const uint8_t* input, FX_DWORD length )
ctx->total[0] &= 0xFFFFFFFF;
ctx->total[1] += ctx->total[0] < length << 3;
if( left && length >= fill ) {
- FXSYS_memcpy32( (void *) (ctx->buffer + left), (void *) input, fill );
+ FXSYS_memcpy( (void *) (ctx->buffer + left), (void *) input, fill );
md5_process( ctx, ctx->buffer );
length -= fill;
input += fill;
@@ -219,7 +219,7 @@ void CRYPT_MD5Update(void* pctx, const uint8_t* input, FX_DWORD length )
input += 64;
}
if( length ) {
- FXSYS_memcpy32( (void *) (ctx->buffer + left), (void *) input, length );
+ FXSYS_memcpy( (void *) (ctx->buffer + left), (void *) input, length );
}
}
const uint8_t md5_padding[64] = {
diff --git a/core/src/fdrm/crypto/fx_crypt_aes.cpp b/core/src/fdrm/crypto/fx_crypt_aes.cpp
index 4de0f7e752..107bfeace0 100644
--- a/core/src/fdrm/crypto/fx_crypt_aes.cpp
+++ b/core/src/fdrm/crypto/fx_crypt_aes.cpp
@@ -949,7 +949,7 @@ static void aes_decrypt_cbc(unsigned char *dest, const unsigned char *src, int l
unsigned int iv[4], x[4], ct[4];
int i;
ASSERT((len & 15) == 0);
- FXSYS_memcpy32(iv, ctx->iv, sizeof(iv));
+ FXSYS_memcpy(iv, ctx->iv, sizeof(iv));
while (len > 0) {
for (i = 0; i < 4; i++) {
x[i] = ct[i] = GET_32BIT_MSB_FIRST(src + 4 * i);
@@ -963,7 +963,7 @@ static void aes_decrypt_cbc(unsigned char *dest, const unsigned char *src, int l
src += 16;
len -= 16;
}
- FXSYS_memcpy32(ctx->iv, iv, sizeof(iv));
+ FXSYS_memcpy(ctx->iv, iv, sizeof(iv));
}
static void aes_encrypt(AESContext * ctx, unsigned int * block)
{
@@ -974,7 +974,7 @@ static void aes_encrypt_cbc(unsigned char *dest, const unsigned char *src, int l
unsigned int iv[4];
int i;
ASSERT((len & 15) == 0);
- FXSYS_memcpy32(iv, ctx->iv, sizeof(iv));
+ FXSYS_memcpy(iv, ctx->iv, sizeof(iv));
while (len > 0) {
for (i = 0; i < 4; i++) {
iv[i] ^= GET_32BIT_MSB_FIRST(src + 4 * i);
@@ -987,7 +987,7 @@ static void aes_encrypt_cbc(unsigned char *dest, const unsigned char *src, int l
src += 16;
len -= 16;
}
- FXSYS_memcpy32(ctx->iv, iv, sizeof(iv));
+ FXSYS_memcpy(ctx->iv, iv, sizeof(iv));
}
void CRYPT_AESSetKey(void* context, FX_DWORD blocklen, const uint8_t* key, FX_DWORD keylen, FX_BOOL bEncrypt)
{
diff --git a/core/src/fdrm/crypto/fx_crypt_sha.cpp b/core/src/fdrm/crypto/fx_crypt_sha.cpp
index 55a3f0e5bf..ac77873702 100644
--- a/core/src/fdrm/crypto/fx_crypt_sha.cpp
+++ b/core/src/fdrm/crypto/fx_crypt_sha.cpp
@@ -100,11 +100,11 @@ void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size)
s->lenlo += lenw;
s->lenhi += (s->lenlo < lenw);
if (s->blkused && s->blkused + len < 64) {
- FXSYS_memcpy32(s->block + s->blkused, q, len);
+ FXSYS_memcpy(s->block + s->blkused, q, len);
s->blkused += len;
} else {
while (s->blkused + len >= 64) {
- FXSYS_memcpy32(s->block + s->blkused, q, 64 - s->blkused);
+ FXSYS_memcpy(s->block + s->blkused, q, 64 - s->blkused);
q += 64 - s->blkused;
len -= 64 - s->blkused;
for (i = 0; i < 16; i++) {
@@ -117,7 +117,7 @@ void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size)
SHATransform(s->h, wordblock);
s->blkused = 0;
}
- FXSYS_memcpy32(s->block, q, len);
+ FXSYS_memcpy(s->block, q, len);
s->blkused = len;
}
}
@@ -135,7 +135,7 @@ void CRYPT_SHA1Finish(void* context, uint8_t digest[20])
}
lenhi = (s->lenhi << 3) | (s->lenlo >> (32 - 3));
lenlo = (s->lenlo << 3);
- FXSYS_memset32(c, 0, pad);
+ FXSYS_memset(c, 0, pad);
c[0] = 0x80;
CRYPT_SHA1Update(s, c, pad);
c[0] = (lenhi >> 24) & 0xFF;
@@ -330,7 +330,7 @@ void CRYPT_SHA256Update( void* context, const uint8_t* input, FX_DWORD length )
ctx->total[1]++;
}
if( left && length >= fill ) {
- FXSYS_memcpy32( (void *) (ctx->buffer + left),
+ FXSYS_memcpy( (void *) (ctx->buffer + left),
(void *) input, fill );
sha256_process( ctx, ctx->buffer );
length -= fill;
@@ -343,7 +343,7 @@ void CRYPT_SHA256Update( void* context, const uint8_t* input, FX_DWORD length )
input += 64;
}
if( length ) {
- FXSYS_memcpy32( (void *) (ctx->buffer + left),
+ FXSYS_memcpy( (void *) (ctx->buffer + left),
(void *) input, length );
}
}
@@ -417,7 +417,7 @@ void CRYPT_SHA384Start(void* context)
return;
}
sha384_context *ctx = (sha384_context *)context;
- FXSYS_memset32(ctx, 0, sizeof(sha384_context));
+ FXSYS_memset(ctx, 0, sizeof(sha384_context));
ctx->state[0] = FX_ato64i("cbbb9d5dc1059ed8");
ctx->state[1] = FX_ato64i("629a292a367cd507");
ctx->state[2] = FX_ato64i("9159015a3070dd17");
@@ -638,7 +638,7 @@ void CRYPT_SHA384Update(void* context, const uint8_t* input, FX_DWORD length)
ctx->total[1]++;
}
if( left && length >= fill ) {
- FXSYS_memcpy32( (void *) (ctx->buffer + left),
+ FXSYS_memcpy( (void *) (ctx->buffer + left),
(void *) input, fill );
sha384_process( ctx, ctx->buffer );
length -= fill;
@@ -651,7 +651,7 @@ void CRYPT_SHA384Update(void* context, const uint8_t* input, FX_DWORD length)
input += 128;
}
if( length ) {
- FXSYS_memcpy32( (void *) (ctx->buffer + left),
+ FXSYS_memcpy( (void *) (ctx->buffer + left),
(void *) input, length );
}
}
@@ -660,7 +660,7 @@ void CRYPT_SHA384Finish(void* context, uint8_t digest[48])
sha384_context *ctx = (sha384_context *)context;
FX_DWORD last, padn;
uint8_t msglen[16];
- FXSYS_memset32(msglen, 0, 16);
+ FXSYS_memset(msglen, 0, 16);
uint64_t high, low;
high = ( ctx->total[0] >> 29 )
| ( ctx->total[1] << 3 );
@@ -691,7 +691,7 @@ void CRYPT_SHA512Start(void* context)
return;
}
sha384_context *ctx = (sha384_context *)context;
- FXSYS_memset32(ctx, 0, sizeof(sha384_context));
+ FXSYS_memset(ctx, 0, sizeof(sha384_context));
ctx->state[0] = FX_ato64i("6a09e667f3bcc908");
ctx->state[1] = FX_ato64i("bb67ae8584caa73b");
ctx->state[2] = FX_ato64i("3c6ef372fe94f82b");
@@ -710,7 +710,7 @@ void CRYPT_SHA512Finish(void* context, uint8_t digest[64])
sha384_context *ctx = (sha384_context *)context;
FX_DWORD last, padn;
uint8_t msglen[16];
- FXSYS_memset32(msglen, 0, 16);
+ FXSYS_memset(msglen, 0, 16);
uint64_t high, low;
high = ( ctx->total[0] >> 29 )
| ( ctx->total[1] << 3 );