diff options
author | Jeff Petkau <jpet@chromium.org> | 2013-06-13 12:16:58 -0700 |
---|---|---|
committer | John Koleszar <jkoleszar@google.com> | 2013-06-17 11:32:16 -0700 |
commit | 368c72374e14109a0af72567e4190b8e7bef302c (patch) | |
tree | af02b63ca9f5d4f97ed027c21c1e369f1f6a5fe7 /vp8/decoder/dboolhuff.h | |
parent | f616cfe4d7a77de114a5cad6f8ee4d22eff1f4f6 (diff) | |
download | libvpx-368c72374e14109a0af72567e4190b8e7bef302c.tar libvpx-368c72374e14109a0af72567e4190b8e7bef302c.tar.gz libvpx-368c72374e14109a0af72567e4190b8e7bef302c.tar.bz2 libvpx-368c72374e14109a0af72567e4190b8e7bef302c.zip |
Change the encryption feature to use a callback for decryption.
This allows code calling the library can choose an arbitrary
encryption algorithm.
Decoder control parameter VP8_SET_DECRYPT_KEY is renamed to
VP8D_SET_DECRYPTOR, and now takes an small config struct instead
of just a byte array.
Change-Id: I0462b3388d8d45057e4f79a6b6777fe713dc546e
Diffstat (limited to 'vp8/decoder/dboolhuff.h')
-rw-r--r-- | vp8/decoder/dboolhuff.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h index 46a4dd60e..4c0ca1ce7 100644 --- a/vp8/decoder/dboolhuff.h +++ b/vp8/decoder/dboolhuff.h @@ -28,17 +28,11 @@ typedef size_t VP8_BD_VALUE; Even relatively modest values like 100 would work fine.*/ #define VP8_LOTS_OF_BITS (0x40000000) -static unsigned char decrypt_byte(const unsigned char *ch, - const unsigned char *origin, - const unsigned char *key) -{ -#if CONFIG_DECRYPT - const int offset = (int)(ch - origin); - return *ch ^ key[offset % 32]; // VP8_DECRYPT_KEY_SIZE -#else - return *ch; -#endif -} +/*Decrypt n bytes of data from input -> output, using the decrypt_state + passed in VP8D_SET_DECRYPTOR. +*/ +typedef void (vp8_decrypt_cb)(void *decrypt_state, const unsigned char *input, + unsigned char *output, int count); typedef struct { @@ -47,8 +41,8 @@ typedef struct VP8_BD_VALUE value; int count; unsigned int range; - const unsigned char *origin; - const unsigned char *key; + vp8_decrypt_cb *decrypt_cb; + void *decrypt_state; } BOOL_DECODER; DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); @@ -56,8 +50,8 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); int vp8dx_start_decode(BOOL_DECODER *br, const unsigned char *source, unsigned int source_sz, - const unsigned char *origin, - const unsigned char *key); + vp8_decrypt_cb *decrypt_cb, + void *decrypt_state); void vp8dx_bool_decoder_fill(BOOL_DECODER *br); |