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.

parallel_generic.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* FFdecsa -- fast decsa algorithm
  2. *
  3. * Copyright (C) 2003-2004 fatih89r
  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 as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #if 0
  20. //// generics
  21. #define COPY4BY(d,s) do{ int *pd=(int *)(d), *ps=(int *)(s); \
  22. *pd = *ps; }while(0)
  23. #define COPY8BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  24. *pd = *ps; }while(0)
  25. #define COPY16BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  26. *pd = *ps; \
  27. *(pd+1) = *(ps+1); }while(0)
  28. #define COPY32BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  29. *pd = *ps; \
  30. *(pd+1) = *(ps+1) \
  31. *(pd+2) = *(ps+2) \
  32. *(pd+3) = *(ps+3); }while(0)
  33. #define XOR4BY(d,s1,s2) do{ int *pd=(int *)(d), *ps1=(int *)(s1), *ps2=(int *)(s2); \
  34. *pd = *ps1 ^ *ps2; }while(0)
  35. #define XOR8BY(d,s1,s2) do{ long long int *pd=(long long int *)(d), *ps1=(long long int *)(s1), *ps2=(long long int *)(s2); \
  36. *pd = *ps1 ^ *ps2; }while(0)
  37. #define XOR16BY(d,s1,s2) do{ long long int *pd=(long long int *)(d), *ps1=(long long int *)(s1), *ps2=(long long int *)(s2); \
  38. *pd = *ps1 ^ *ps2; \
  39. *(pd+8) = *(ps1+8) ^ *(ps2+8); }while(0)
  40. #define XOR32BY(d,s1,s2) do{ long long int *pd=(long long int *)(d), *ps1=(long long int *)(s1), *ps2=(long long int *)(s2); \
  41. *pd = *ps1 ^ *ps2; \
  42. *(pd+1) = *(ps1+1) ^ *(ps2+1); \
  43. *(pd+2) = *(ps1+2) ^ *(ps2+2); \
  44. *(pd+3) = *(ps1+3) ^ *(ps2+3); }while(0)
  45. #define XOR32BV(d,s1,s2) do{ int *const pd=(int *const)(d), *ps1=(const int *const)(s1), *ps2=(const int *const)(s2); \
  46. int z; \
  47. for(z=0;z<8;z++){ \
  48. pd[z]=ps1[z]^ps2[z]; \
  49. } \
  50. }while(0)
  51. #define XOREQ4BY(d,s) do{ int *pd=(int *)(d), *ps=(int *)(s); \
  52. *pd ^= *ps; }while(0)
  53. #define XOREQ8BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  54. *pd ^= *ps; }while(0)
  55. #define XOREQ16BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  56. *pd ^= *ps; \
  57. *(pd+1) ^=*(ps+1); }while(0)
  58. #define XOREQ32BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  59. *pd ^= *ps; \
  60. *(pd+1) ^=*(ps+1); \
  61. *(pd+2) ^=*(ps+2); \
  62. *(pd+3) ^=*(ps+3); }while(0)
  63. #define XOREQ32BY4(d,s) do{ int *pd=(int *)(d), *ps=(int *)(s); \
  64. *pd ^= *ps; \
  65. *(pd+1) ^=*(ps+1); \
  66. *(pd+2) ^=*(ps+2); \
  67. *(pd+3) ^=*(ps+3); \
  68. *(pd+4) ^=*(ps+4); \
  69. *(pd+5) ^=*(ps+5); \
  70. *(pd+6) ^=*(ps+6); \
  71. *(pd+7) ^=*(ps+7); }while(0)
  72. #define XOREQ32BV(d,s) do{ unsigned char *pd=(unsigned char *)(d), *ps=(unsigned char *)(s); \
  73. int z; \
  74. for(z=0;z<32;z++){ \
  75. pd[z]^=ps[z]; \
  76. } \
  77. }while(0)
  78. #else
  79. #define XOR_4_BY(d,s1,s2) do{ int *pd=(int *)(d), *ps1=(int *)(s1), *ps2=(int *)(s2); \
  80. *pd = *ps1 ^ *ps2; }while(0)
  81. #define XOR_8_BY(d,s1,s2) do{ long long int *pd=(long long int *)(d), *ps1=(long long int *)(s1), *ps2=(long long int *)(s2); \
  82. *pd = *ps1 ^ *ps2; }while(0)
  83. #define XOREQ_4_BY(d,s) do{ int *pd=(int *)(d), *ps=(int *)(s); \
  84. *pd ^= *ps; }while(0)
  85. #define XOREQ_8_BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  86. *pd ^= *ps; }while(0)
  87. #define COPY_4_BY(d,s) do{ int *pd=(int *)(d), *ps=(int *)(s); \
  88. *pd = *ps; }while(0)
  89. #define COPY_8_BY(d,s) do{ long long int *pd=(long long int *)(d), *ps=(long long int *)(s); \
  90. *pd = *ps; }while(0)
  91. #define BEST_SPAN 8
  92. #define XOR_BEST_BY(d,s1,s2) do{ XOR_8_BY(d,s1,s2); }while(0);
  93. #define XOREQ_BEST_BY(d,s) do{ XOREQ_8_BY(d,s); }while(0);
  94. #define COPY_BEST_BY(d,s) do{ COPY_8_BY(d,s); }while(0);
  95. #define END_MM do{ }while(0);
  96. #endif