tsdecrypt reads and decrypts CSA encrypted incoming mpeg transport stream over UDP/RTP using code words obtained from OSCAM or similar CAM server. tsdecrypt communicates with CAM server using cs378x (camd35 over tcp) protocol or newcamd protocol. https://georgi.unixsol.org/programs/tsdecrypt/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

csa.h 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * CSA functions
  3. * Copyright (C) 2012 Unix Solutions Ltd.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  17. */
  18. #ifndef CSA_H
  19. #define CSA_H
  20. // The following *MUST* be the same as struct dvbcsa_bs_batch_s from libdvbcsa
  21. struct csa_batch {
  22. uint8_t *data; // Pointer to payload
  23. unsigned int len; // Payload bytes lenght
  24. };
  25. #if USE_LIBDVBCSA
  26. #include <dvbcsa/dvbcsa.h>
  27. #define use_dvbcsa 1
  28. #else
  29. #define use_dvbcsa 0
  30. #define dvbcsa_key_t void
  31. #define dvbcsa_bs_key_t void
  32. #define dvbcsa_bs_batch_s csa_batch
  33. static inline dvbcsa_key_t * dvbcsa_key_alloc(void) { return NULL; }
  34. static inline void dvbcsa_key_free(dvbcsa_key_t *key) { (void)key; }
  35. static inline void dvbcsa_key_set(const uint8_t *cw, dvbcsa_key_t *key) { (void)cw; (void)key; }
  36. static inline void dvbcsa_decrypt(const uint8_t *key, uint8_t *data, unsigned int len) { (void)key; (void)data; (void)len; }
  37. static inline unsigned int dvbcsa_bs_batch_size(void) { return 0; }
  38. static inline dvbcsa_bs_key_t * dvbcsa_bs_key_alloc(void) { return NULL; }
  39. static inline void dvbcsa_bs_key_free(dvbcsa_bs_key_t *key) { (void)key; }
  40. static inline void dvbcsa_bs_key_set(uint8_t *cw, dvbcsa_bs_key_t *key) { (void)cw; (void)key; }
  41. static inline void dvbcsa_bs_decrypt(const dvbcsa_bs_key_t *key, const struct dvbcsa_bs_batch_s *pcks, unsigned int maxlen) { (void)key; (void)pcks; (void)maxlen; }
  42. #endif
  43. #include "data.h"
  44. struct csakey {
  45. dvbcsa_key_t *s_csakey[2];
  46. dvbcsa_bs_key_t *bs_csakey[2];
  47. };
  48. csakey_t * csa_key_alloc (void);
  49. void csa_key_free (csakey_t **pcsakey);
  50. unsigned int csa_get_batch_size (void);
  51. void csa_set_even_cw (csakey_t *csakey, uint8_t *even_cw);
  52. void csa_set_odd_cw (csakey_t *csakey, uint8_t *odd_cw);
  53. void csa_decrypt_single_packet (csakey_t *csakey, uint8_t *ts_packet);
  54. void csa_decrypt_multiple_even (csakey_t *csakey, struct csa_batch *batch);
  55. void csa_decrypt_multiple_odd (csakey_t *csakey, struct csa_batch *batch);
  56. void csa_benchmark(void);
  57. #endif