summaryrefslogtreecommitdiff
path: root/vpx
diff options
context:
space:
mode:
authorJeff Petkau <jpet@chromium.org>2013-06-13 12:16:58 -0700
committerJohn Koleszar <jkoleszar@google.com>2013-06-17 11:32:16 -0700
commit368c72374e14109a0af72567e4190b8e7bef302c (patch)
treeaf02b63ca9f5d4f97ed027c21c1e369f1f6a5fe7 /vpx
parentf616cfe4d7a77de114a5cad6f8ee4d22eff1f4f6 (diff)
downloadlibvpx-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 'vpx')
-rw-r--r--vpx/vp8dx.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/vpx/vp8dx.h b/vpx/vp8dx.h
index 201df88fe..97f111d69 100644
--- a/vpx/vp8dx.h
+++ b/vpx/vp8dx.h
@@ -63,11 +63,11 @@ enum vp8_dec_control_id {
*/
VP8D_GET_LAST_REF_USED,
- /** decryption key to protect encoded data buffer before decoding,
- * pointer to 32 byte array which is copied, so the array passed
- * does not need to be preserved
+ /** decryption function to decrypt encoded buffer data immediately
+ * before decoding. Takes a vp8_decrypt_init, which contains
+ * a callback function and opaque context pointer.
*/
- VP8_SET_DECRYPT_KEY,
+ VP8D_SET_DECRYPTOR,
/** For testing. */
VP9_INVERT_TILE_DECODE_ORDER,
@@ -76,6 +76,17 @@ enum vp8_dec_control_id {
};
+/*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 vp8_decrypt_init {
+ vp8_decrypt_cb *decrypt_cb;
+ void *decrypt_state;
+} vp8_decrypt_init;
+
/*!\brief VP8 decoder control function parameter type
*
* Defines the data types that VP8D control functions take. Note that
@@ -87,7 +98,7 @@ enum vp8_dec_control_id {
VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *)
VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
-VPX_CTRL_USE_TYPE(VP8_SET_DECRYPT_KEY, const unsigned char *)
+VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vp8_decrypt_init *)
VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
/*! @} - end defgroup vp8_decoder */