summaryrefslogtreecommitdiff
path: root/libavformat/rtmpcrypt.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-23 21:04:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-23 21:25:09 +0200
commit2cb4d516549526b5e17e941f6d2375a2c501ade6 (patch)
treef472c62e0b34c2faaa955d51874cddb6be759910 /libavformat/rtmpcrypt.h
parent7e15df7551cf45ad1d3e39d20fdc8d6c651d4705 (diff)
parentd04c5293ce88927ad359ca276e287bfa63c2329d (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: v410dec: Implement explode mode support zerocodec: fix direct rendering. wav: init st to NULL to avoid a false-positive warning. wavpack: set bits_per_raw_sample for S32 samples to properly identify 24-bit h264: refactor NAL decode loop RTMPTE protocol support RTMPE protocol support rtmp: Add ff_rtmp_calc_digest_pos() rtmp: Rename rtmp_calc_digest to ff_rtmp_calc_digest and make it global swscale: add missing HAVE_INLINE_ASM check. lavfi: place x86 inline assembly under HAVE_INLINE_ASM. vc1: Add a test for interlaced field pictures swscale: Mark all init functions as av_cold swscale: x86: Drop pointless _mmx suffix from filenames lavf: use conditional notation for default codec in muxer declarations. swscale: place inline assembly bilinear scaler under HAVE_INLINE_ASM. dsputil: ppc: cosmetics: pretty-print dsputil: x86: add SHUFFLE_MASK_W macro configure: respect CC_O setting in check_cc Conflicts: Changelog configure libavcodec/v410dec.c libavcodec/zerocodec.c libavformat/asfenc.c libavformat/version.h libswscale/utils.c libswscale/x86/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtmpcrypt.h')
-rw-r--r--libavformat/rtmpcrypt.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/libavformat/rtmpcrypt.h b/libavformat/rtmpcrypt.h
new file mode 100644
index 0000000000..590a8c81b8
--- /dev/null
+++ b/libavformat/rtmpcrypt.h
@@ -0,0 +1,69 @@
+/*
+ * RTMPE encryption utilities
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_RTMPCRYPT_H
+#define AVFORMAT_RTMPCRYPT_H
+
+#include <stdint.h>
+
+#include "url.h"
+
+/**
+ * Initialize the Diffie-Hellmann context and generate the public key.
+ *
+ * @param h an URLContext
+ * @param buf handshake data (1536 bytes)
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmpe_gen_pub_key(URLContext *h, uint8_t *buf);
+
+/**
+ * Compute the shared secret key and initialize the RC4 encryption.
+ *
+ * @param h an URLContext
+ * @param serverdata server data (1536 bytes)
+ * @param clientdata client data (1536 bytes)
+ * @param type the position of the server digest
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmpe_compute_secret_key(URLContext *h, const uint8_t *serverdata,
+ const uint8_t *clientdata, int type);
+
+/**
+ * Encrypt the signature.
+ *
+ * @param h an URLContext
+ * @param signature the signature to encrypt
+ * @param digest the digest used for finding the encryption key
+ * @param type type of encryption (8 for XTEA, 9 for Blowfish)
+ */
+void ff_rtmpe_encrypt_sig(URLContext *h, uint8_t *signature,
+ const uint8_t *digest, int type);
+
+/**
+ * Update the keystream and set RC4 keys for encryption.
+ *
+ * @param h an URLContext
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmpe_update_keystream(URLContext *h);
+
+#endif /* AVFORMAT_RTMPCRYPT_H */