|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| src/ | H | 03-May-2022 | - | 4,588 | 3,303 |
| test/ | H | 02-Apr-2011 | - | 2,104 | 1,518 |
| AUTHORS | H A D | 10-Feb-2011 | 456 | 13 | 7 |
| COPYING | H A D | 28-Nov-2008 | 17.6 KiB | 341 | 281 |
| ChangeLog | H A D | 17-Feb-2011 | 38 | 3 | 2 |
| INSTALL | H A D | 28-Nov-2008 | 2.4 KiB | 68 | 45 |
| Makefile.am | H A D | 28-Nov-2008 | 93 | 7 | 3 |
| Makefile.in | H A D | 02-Apr-2011 | 21.9 KiB | 717 | 628 |
| NEWS | H A D | 28-Nov-2008 | 0 | | |
| README | H A D | 28-Nov-2008 | 4.2 KiB | 144 | 91 |
| aclocal.m4 | H A D | 02-Apr-2011 | 330.4 KiB | 9,391 | 8,454 |
| config.guess | H A D | 10-Feb-2011 | 43.9 KiB | 1,502 | 1,291 |
| config.h.in | H A D | 02-Apr-2011 | 2.4 KiB | 99 | 67 |
| config.sub | H A D | 10-Feb-2011 | 33.6 KiB | 1,706 | 1,558 |
| configure | H A D | 02-Apr-2011 | 410.2 KiB | 14,224 | 11,858 |
| configure.ac | H A D | 02-Apr-2011 | 2.8 KiB | 96 | 74 |
| depcomp | H A D | 10-Feb-2011 | 18.2 KiB | 631 | 407 |
| install-sh | H A D | 10-Feb-2011 | 13.3 KiB | 521 | 344 |
| ltmain.sh | H A D | 10-Feb-2011 | 276.1 KiB | 9,637 | 7,288 |
| missing | H A D | 10-Feb-2011 | 11.2 KiB | 377 | 281 |
README
1
2
3Introduction
4============
5
6libdvbcsa is a free and portable implementation of the DVB Common
7Scrambling algorithm with decryption and encryption capabilities.
8
9It comes in two flavors: a classical single packet implementation and
10a faster parallel bitslice implementation.
11
12
13Installation
14============
15
16Some configuration options are available to tune performance of the
17parallel implementation. See INSTALL.
18
19
20Algorithm overview
21==================
22
23The DVB CSA is composed of a two distinct ciphers which are applied to
24scrambled content data packets. The block cipher and the stream cipher
25both use the same 64 bits key. This key is called a control word.
26
27
28Classical implementation API
29============================
30
31The classical implementation can process a single packet on each
32function call. It is the slowest implementation and must be used when
33data packets are not available as a large batch at the same time.
34
35This implementation average processing bitrate is between 20 Mbits/s
36and 50 Mbits/s on modern PCs.
37
38 #include <dvbcsa/dvbcsa.h>
39
40Two functions are available to allocate and free expanded key context:
41
42 struct dvbcsa_key_s * dvbcsa_key_alloc();
43 void dvbcsa_key_free(struct dvbcsa_key_s *key);
44
45The control word can be changed as needed using this function:
46
47 void dvbcsa_key_set (const dvbcsa_cw_t cw,
48 struct dvbcsa_key_s *key);
49
50Data encryption and decryption is done with these functions:
51
52 void dvbcsa_decrypt (const struct dvbcsa_key_s *key,
53 unsigned char *data, unsigned int len);
54
55 void dvbcsa_encrypt (const struct dvbcsa_key_s *key,
56 unsigned char *data, unsigned int len);
57
58
59Parallel implementation API
60===========================
61
62The parallel implementation is faster but data packets need to be
63batched together.
64
65This implementation average processing bitrate is between 80 Mbits/s
66and 200 Mbits/s on modern PCs. Performance heavily depends on bitslice
67word width used, see install section.
68
69 #include <dvbcsa/dvbcsa.h>
70
71Two functions are available to allocate and free expanded key context:
72
73 struct dvbcsa_bs_key_s * dvbcsa_bs_key_alloc();
74
75 void dvbcsa_bs_key_free(struct dvbcsa_bs_key_s *key);
76
77The control word can be changed as needed using this function:
78
79 void dvbcsa_bs_key_set(const dvbcsa_cw_t cw,
80 struct dvbcsa_bs_key_s *key);
81
82Packet batch must be available as an array of struct dvbcsa_bs_batch_s
83to invoke encryption or decryption functions.
84
85 struct dvbcsa_bs_batch_s
86 {
87 unsigned char *data; /* pointer to payload */
88 unsigned int len; /* payload bytes lenght */
89 };
90
91The array must not be greater than the maximum batch size returned by:
92
93 unsigned int dvbcsa_bs_batch_size(void);
94
95An extra entry with NULL data pointer must be added to terminate the
96array. Arrays with less entries than the maximum batch size will take
97the _same_ time to process as a full batch array.
98
99An additional maximum packet lenght parameter must be provided to the
100processing functions. Packet greater than this limit will only be
101partially processed. It must be a multiple of 8. This parameter
102directly control algorithm cycles count (and processing time) and
103should be kept as low as possible. When processing Mpeg TS packets,
104it should be 184.
105
106Encryption and decryption batch processing functions are:
107
108 void dvbcsa_bs_decrypt(const struct dvbcsa_bs_key_s *key,
109 const struct dvbcsa_bs_batch_s *pcks,
110 unsigned int maxlen);
111
112 void dvbcsa_bs_encrypt(const struct dvbcsa_bs_key_s *key,
113 const struct dvbcsa_bs_batch_s *pcks,
114 unsigned int maxlen);
115
116Example:
117
118 int i, s = dvbcsa_bs_batch_size();
119 struct dvbcsa_bs_batch_s b[s + 1];
120
121 struct dvbcsa_bs_key_s *key = dvbcsa_bs_key_alloc();
122 unsigned char cw[8] = "testtest";
123
124 dvbcsa_bs_key_set(cw, key);
125
126 for (i = 0; i < s; i++)
127 {
128 b[i].data = ... ;
129 b[i].len = ... ;
130 }
131
132 b[i].data = NULL;
133
134 dvbcsa_bs_encrypt(key, b, 184);
135
136
137Portability
138===========
139
140This library has been successfully tested on different platforms with
14132 bits and 64 bits word width, little-endian and big-endian bytes
142ordering.
143
144