-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* master: (24 commits) [MenuList] * partialy revert aa2c1a7 add vti workaroud [ServiceScan.py] Update after this commit aa2c1a7! [dvbci_ccmgr_helper] * Replace call to the non reentrant function "localtime" by a call to "localtime_r". ci add ci+ 1.4 support [skin.py] Small corrections and adjustments [TemplatedMultiContent.py] Sort imports [MultiContent.py] Remove unneeded import [eListbox] * rename setSpacerColor -> setSpacingColor GUI Updates (#2943) [Geolocation.py] Code updates (#2950) [main] * checkInternetAccess change return codes to: [Timers] * remove duplicate getSpace Unicable connected (#2949) [enigma] (#2947) [StackTrace.py] Small code clean up multiboot fix slot R target selection for kexecmultiboot information.py, multiboot sortslots [VideoWizard] * stop timer after press red for language selection [VideoWizard] * enable red button for language selection in video wizard ...
- Loading branch information
Showing
75 changed files
with
5,421 additions
and
1,271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <stdint.h> | ||
#include <string.h> | ||
#include <openssl/aes.h> | ||
|
||
#include "aes_xcbc_mac.h" | ||
|
||
int aes_xcbc_mac_init(struct aes_xcbc_mac_ctx *ctx, const uint8_t *key) | ||
{ | ||
AES_KEY aes_key; | ||
int y, x; | ||
|
||
AES_set_encrypt_key(key, 128, &aes_key); | ||
|
||
for (y = 0; y < 3; y++) { | ||
for (x = 0; x < 16; x++) | ||
ctx->K[y][x] = y + 1; | ||
AES_ecb_encrypt(ctx->K[y], ctx->K[y], &aes_key, 1); | ||
} | ||
|
||
/* setup K1 */ | ||
AES_set_encrypt_key(ctx->K[0], 128, &ctx->key); | ||
|
||
memset(ctx->IV, 0, 16); | ||
ctx->buflen = 0; | ||
|
||
return 0; | ||
} | ||
|
||
int aes_xcbc_mac_process(struct aes_xcbc_mac_ctx *ctx, const uint8_t *in, unsigned int len) | ||
{ | ||
while (len) { | ||
if (ctx->buflen == 16) { | ||
AES_ecb_encrypt(ctx->IV, ctx->IV, &ctx->key, 1); | ||
ctx->buflen = 0; | ||
} | ||
ctx->IV[ctx->buflen++] ^= *in++; | ||
--len; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
int aes_xcbc_mac_done(struct aes_xcbc_mac_ctx *ctx, uint8_t *out) | ||
{ | ||
int i; | ||
|
||
if (ctx->buflen == 16) { | ||
/* K2 */ | ||
for (i = 0; i < 16; i++) | ||
ctx->IV[i] ^= ctx->K[1][i]; | ||
} else { | ||
ctx->IV[ctx->buflen] ^= 0x80; | ||
/* K3 */ | ||
for (i = 0; i < 16; i++) | ||
ctx->IV[i] ^= ctx->K[2][i]; | ||
} | ||
|
||
AES_ecb_encrypt(ctx->IV, ctx->IV, &ctx->key, 1); | ||
memcpy(out, ctx->IV, 16); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef __AES_XCBC_H_ | ||
#define __AES_XCBC_H_ | ||
|
||
#include <openssl/aes.h> | ||
|
||
struct aes_xcbc_mac_ctx { | ||
uint8_t K[3][16]; | ||
uint8_t IV[16]; | ||
AES_KEY key; | ||
int buflen; | ||
}; | ||
|
||
int aes_xcbc_mac_init(struct aes_xcbc_mac_ctx *ctx, const uint8_t *key); | ||
int aes_xcbc_mac_process(struct aes_xcbc_mac_ctx *ctx, const uint8_t *in, unsigned int len); | ||
int aes_xcbc_mac_done(struct aes_xcbc_mac_ctx *ctx, uint8_t *out); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include <fcntl.h> | ||
#include <stdlib.h> | ||
#include <sys/ioctl.h> | ||
#include <linux/dvb/ca.h> | ||
|
||
#include <lib/base/eerror.h> | ||
|
||
#ifndef CA_SET_PID | ||
/** | ||
* CA_SET_PID and ca_pid struct removed on 4.14 kernel | ||
* Check commit 833ff5e7feda1a042b83e82208cef3d212ca0ef1 | ||
**/ | ||
struct ca_pid { | ||
unsigned int pid; | ||
int index; /* -1 == disable*/ | ||
}; | ||
#define CA_SET_PID _IOW('o', 135, struct ca_pid) | ||
#endif | ||
|
||
enum ca_descr_data_type { | ||
CA_DATA_IV, | ||
CA_DATA_KEY, | ||
}; | ||
|
||
enum ca_descr_parity { | ||
CA_PARITY_EVEN, | ||
CA_PARITY_ODD, | ||
}; | ||
|
||
struct ca_descr_data { | ||
unsigned int index; | ||
enum ca_descr_parity parity; | ||
enum ca_descr_data_type data_type; | ||
unsigned int length; | ||
unsigned char *data; | ||
}; | ||
|
||
|
||
#define CA_SET_DESCR_DATA _IOW('o', 137, struct ca_descr_data) | ||
|
||
int descrambler_set_key(int desc_fd, int index, int parity, unsigned char *data) | ||
{ | ||
struct ca_descr_data d; | ||
|
||
d.index = index; | ||
d.parity = (enum ca_descr_parity)parity; | ||
d.data_type = CA_DATA_KEY; | ||
d.length = 16; | ||
d.data = data; | ||
|
||
if (ioctl(desc_fd, CA_SET_DESCR_DATA, &d) == -1) { | ||
eWarning("[CI descrambler] set key failed"); | ||
return -1; | ||
} | ||
|
||
d.index = index; | ||
d.parity = (enum ca_descr_parity)parity; | ||
d.data_type = CA_DATA_IV; | ||
d.length = 16; | ||
d.data = data + 16; | ||
|
||
if (ioctl(desc_fd, CA_SET_DESCR_DATA, &d) == -1) { | ||
eWarning("[CI descrambler] set iv failed"); | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
int descrambler_set_pid(int desc_fd, int index, int enable, int pid) | ||
{ | ||
struct ca_pid p; | ||
unsigned int flags = 0x80; | ||
|
||
if (index) | ||
flags |= 0x40; | ||
|
||
if (enable) | ||
flags |= 0x20; | ||
|
||
p.pid = pid; | ||
p.index = flags; | ||
|
||
if (ioctl(desc_fd, CA_SET_PID, &p) == -1) { | ||
eWarning("[CI descrambler] set pid failed"); | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
int descrambler_init(void) | ||
{ | ||
int desc_fd; | ||
const char *filename = "/dev/dvb/adapter0/ca0"; | ||
|
||
desc_fd = open(filename, O_RDWR); | ||
if (desc_fd == -1) { | ||
eWarning("[CI descrambler] can not open %s", filename); | ||
} | ||
|
||
return desc_fd; | ||
} | ||
|
||
void descrambler_deinit(int desc_fd) | ||
{ | ||
close(desc_fd); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef __DESCR_H_ | ||
#define __DESCR_H_ | ||
|
||
int descrambler_init(void); | ||
void descrambler_deinit(int desc_fd); | ||
int descrambler_set_key(int desc_fd, int index, int parity, unsigned char *data); | ||
int descrambler_set_pid(int desc_fd, int index, int enable, int pid); | ||
|
||
#endif |
Oops, something went wrong.