~noskcaj/ubuntu/saucy/libav/merge0.8.7-1

« back to all changes in this revision

Viewing changes to libavformat/asfcrypt.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:30:00 UTC
  • mfrom: (1.2.8) (1.1.13 experimental)
  • Revision ID: package-import@ubuntu.com-20120112223000-cmfo7w78q13i2fd9
Tags: 4:0.8~beta2-1ubuntu1
* Merge from debian, remaining changes:
  - don't build against libdirac, lame, libopenjpeg, librtmp, 
    x264, and xvid  (all in universe)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "asfcrypt.h"
29
29
 
30
30
/**
31
 
 * \brief find multiplicative inverse modulo 2 ^ 32
32
 
 * \param v number to invert, must be odd!
33
 
 * \return number so that result * v = 1 (mod 2^32)
 
31
 * @brief find multiplicative inverse modulo 2 ^ 32
 
32
 * @param v number to invert, must be odd!
 
33
 * @return number so that result * v = 1 (mod 2^32)
34
34
 */
35
35
static uint32_t inverse(uint32_t v) {
36
36
    // v ^ 3 gives the inverse (mod 16), could also be implemented
45
45
}
46
46
 
47
47
/**
48
 
 * \brief read keys from keybuf into keys
49
 
 * \param keybuf buffer containing the keys
50
 
 * \param keys output key array containing the keys for encryption in
 
48
 * @brief read keys from keybuf into keys
 
49
 * @param keybuf buffer containing the keys
 
50
 * @param keys output key array containing the keys for encryption in
51
51
 *             native endianness
52
52
 */
53
53
static void multiswap_init(const uint8_t keybuf[48], uint32_t keys[12]) {
57
57
}
58
58
 
59
59
/**
60
 
 * \brief invert the keys so that encryption become decryption keys and
 
60
 * @brief invert the keys so that encryption become decryption keys and
61
61
 *        the other way round.
62
 
 * \param keys key array of ints to invert
 
62
 * @param keys key array of ints to invert
63
63
 */
64
64
static void multiswap_invert_keys(uint32_t keys[12]) {
65
65
    int i;
92
92
}
93
93
 
94
94
/**
95
 
 * \brief "MultiSwap" encryption
96
 
 * \param keys 32 bit numbers in machine endianness,
 
95
 * @brief "MultiSwap" encryption
 
96
 * @param keys 32 bit numbers in machine endianness,
97
97
 *             0-4 and 6-10 must be inverted from decryption
98
 
 * \param key another key, this one must be the same for the decryption
99
 
 * \param data data to encrypt
100
 
 * \return encrypted data
 
98
 * @param key another key, this one must be the same for the decryption
 
99
 * @param data data to encrypt
 
100
 * @return encrypted data
101
101
 */
102
102
static uint64_t multiswap_enc(const uint32_t keys[12], uint64_t key, uint64_t data) {
103
103
    uint32_t a = data;
114
114
}
115
115
 
116
116
/**
117
 
 * \brief "MultiSwap" decryption
118
 
 * \param keys 32 bit numbers in machine endianness,
 
117
 * @brief "MultiSwap" decryption
 
118
 * @param keys 32 bit numbers in machine endianness,
119
119
 *             0-4 and 6-10 must be inverted from encryption
120
 
 * \param key another key, this one must be the same as for the encryption
121
 
 * \param data data to decrypt
122
 
 * \return decrypted data
 
120
 * @param key another key, this one must be the same as for the encryption
 
121
 * @param data data to decrypt
 
122
 * @return decrypted data
123
123
 */
124
124
static uint64_t multiswap_dec(const uint32_t keys[12], uint64_t key, uint64_t data) {
125
125
    uint32_t a;