CI+ protocol implementation in minisatip

Support forum for minisatip
Post Reply
Yuri
Posts: 68
Joined: Thu Oct 01, 2015 7:26 pm

CI+ protocol implementation in minisatip

Post by Yuri »

Hi,
I am glad to present the basic implementation of the CI+ protocol for minisatip. The implementation is based on the source code of the dreamciplus plugin.
For this to work, it's enough to ̶r̶e̶p̶l̶a̶c̶e̶ ̶t̶h̶e̶ ̶f̶i̶l̶e̶ ̶s̶r̶c̶/̶c̶a̶.̶c̶ ̶i̶n̶ ̶t̶h̶e̶ ̶s̶o̶u̶r̶c̶e̶s̶ ̶o̶f̶ ̶t̶h̶e̶ ̶m̶a̶s̶t̶e̶r̶ ̶b̶r̶a̶n̶c̶h̶ ̶t̶o̶ ̶t̶h̶e̶ ̶f̶i̶l̶e̶ ̶u̶n̶d̶e̶r̶ ̶t̶h̶e̶ ̶l̶i̶n̶k̶ ̶h̶t̶t̶p̶s̶:̶/̶/̶f̶i̶l̶e̶s̶.̶f̶m̶/̶u̶/̶u̶4̶v̶r̶4̶u̶f̶d̶ and put certificates from the plugin dreamciplus along the path /etc/ssl/certs
Some functions are not implemented, some require further development, but basically everything works stable for my CI+ v1.0 and v1.3 CAM's
BR

update 04.07.2017: changed link to ca.c suitable to last git changes
update 15.07.2017: changed link to ca.c suitable to last git changes
update 10.08.2017: changed link to ca.c Added support OpenSSL 1.1, thanks to ciminus
update 23.08.2017: changed link to ca.c suitable to last git changes
update 01.01.2019: changed link to ca.c suitable to last git changes, now bin files created in home directory instead /etc

Replace the file ca.c no longer necessary, all necessary functions are supported in the master branch.
Last edited by Yuri on Thu Jun 20, 2019 5:30 am, edited 16 times in total.
sharky
Posts: 11
Joined: Sat May 14, 2016 6:15 pm

Re: CI+ protocol implementation in minisatip

Post by sharky »

Hello Yuri,

just for clarification it is "only" for CI+ modules or can use it with a CI card like alphacrypt too ?

best regards, sharky
Yuri
Posts: 68
Joined: Thu Oct 01, 2015 7:26 pm

Re: CI+ protocol implementation in minisatip

Post by Yuri »

Hi,
worked with CI and CI+ modules. CI+ is just extensions of the "ordinary" CI.
BR
sharky
Posts: 11
Joined: Sat May 14, 2016 6:15 pm

Re: CI+ protocol implementation in minisatip

Post by sharky »

Hey Juri ,

I was abe to get my CI Modul working with latest git version. If I try to compile it with your version of the ca.c it breaks compiling.

Just for verification.

I downloaded your ca.c file
git clone minisatip repo
cd minisatip
mv ca.c ca.c_org
cp ca.c minisatip #(yuri_version)
cd minisatip
configure
make -> crash

Code: Select all

root@raspberrypi:/home/pi/minisatip# make                                                                                                                                                                                                    [35/1953]
gcc -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c ca.c -o ca.o
ca.c:832:5: error: conflicting types for ‘dvbca_process_pmt’
 int dvbca_process_pmt(adapter *ad, SPMT *spmt)
     ^
In file included from ca.c:59:0:
ca.h:7:5: note: previous declaration of ‘dvbca_process_pmt’ was here
 int dvbca_process_pmt(adapter *ad, void *arg);
     ^
ca.c: In function ‘dvbca_process_pmt’:
ca.c:840:24: error: ‘TABLES_RESULT_ERROR_NORETRY’ undeclared (first use in this function)
                 return TABLES_RESULT_ERROR_NORETRY;
                        ^
ca.c:840:24: note: each undeclared identifier is reported only once for each function it appears in
In file included from socketworks.h:5:0,
                 from ca.c:54:
ca.c:842:32: error: ‘TABLES_RESULT_ERROR_RETRY’ undeclared (first use in this function)
                 LOG_AND_RETURN(TABLES_RESULT_ERROR_RETRY, "CAM not yet initialized");
                                ^
utils.h:125:63: note: in definition of macro ‘LOG_AND_RETURN’
 #define LOG_AND_RETURN(rc,a,...) {LOG(a,##__VA_ARGS__);return rc;}
                                                               ^
ca.c:851:36: error: ‘SPMT’ has no member named ‘id’
                 d->pmt_id[i] = spmt->id;
                                    ^
ca.c:887:41: error: ‘SPMT’ has no member named ‘id’
                 if (d->pmt_id[i] != spmt->id)
                                         ^
ca.c:900:29: error: ‘SPMT’ has no member named ‘id’
                 send_cw(spmt->id, CA_ALGO_AES128_CBC, 0, d->key[0], d->iv[0]);
                             ^
ca.c:900:35: error: ‘CA_ALGO_AES128_CBC’ undeclared (first use in this function)
                 send_cw(spmt->id, CA_ALGO_AES128_CBC, 0, d->key[0], d->iv[0]);
                                   ^
ca.c:902:29: error: ‘SPMT’ has no member named ‘id’
                 send_cw(spmt->id, CA_ALGO_AES128_CBC, 1, d->key[1], d->iv[1]);
                             ^
ca.c: In function ‘dvbca_del_pmt’:
ca.c:912:41: error: ‘SPMT’ has no member named ‘id’
                 if (d->pmt_id[i] == spmt->id)
                                         ^
ca.c: In function ‘check_new_key’:
ca.c:1956:47: error: ‘CA_ALGO_AES128_CBC’ undeclared (first use in this function)
                         send_cw(d->pmt_id[i], CA_ALGO_AES128_CBC, slot, d->key[slot], d->iv[slot]);
                                               ^
ca.c: In function ‘dvbca_init_dev’:
ca.c:3137:24: error: ‘TABLES_RESULT_OK’ undeclared (first use in this function)
                 return TABLES_RESULT_OK;
                        ^
ca.c:3140:24: error: ‘TABLES_RESULT_ERROR_NORETRY’ undeclared (first use in this function)
                 return TABLES_RESULT_ERROR_NORETRY;
                        ^
ca.c: At top level:
ca.c:3316:1: error: unknown type name ‘SCA_op’
 SCA_op dvbca;
 ^
ca.c: In function ‘dvbca_init’:
ca.c:3321:14: error: request for member ‘ca_init_dev’ in something not a structure or union
         dvbca.ca_init_dev = dvbca_init_dev;
              ^
ca.c:3322:14: error: request for member ‘ca_close_dev’ in something not a structure or union
         dvbca.ca_close_dev = dvbca_close_dev;
              ^
ca.c:3323:14: error: request for member ‘ca_add_pmt’ in something not a structure or union
         dvbca.ca_add_pmt = dvbca_process_pmt;
              ^
ca.c:3324:14: error: request for member ‘ca_del_pmt’ in something not a structure or union
         dvbca.ca_del_pmt = dvbca_del_pmt;
              ^
ca.c:3325:14: error: request for member ‘ca_close_ca’ in something not a structure or union
         dvbca.ca_close_ca = dvbca_close;
              ^
ca.c:3326:14: error: request for member ‘ca_ts’ in something not a structure or union
         dvbca.ca_ts = NULL; // dvbca_ts;
              ^
ca.c:3327:27: warning: passing argument 1 of ‘add_ca’ from incompatible pointer type
         dvbca_id = add_ca(&dvbca, 0xFFFFFFFF);
                           ^
In file included from ca.h:4:0,
                 from ca.c:59:
tables.h:50:5: note: expected ‘struct SCA *’ but argument is of type ‘int *’
 int add_ca(SCA *c);
     ^
ca.c:3327:20: error: too many arguments to function ‘add_ca’
         dvbca_id = add_ca(&dvbca, 0xFFFFFFFF);
                    ^
In file included from ca.h:4:0,
                 from ca.c:59:
tables.h:50:5: note: declared here
 int add_ca(SCA *c);
     ^
Makefile:104: recipe for target 'ca.o' failed
make: *** [ca.o] Error 1
cata
Site Admin
Posts: 768
Joined: Tue May 12, 2015 1:01 am

Re: CI+ protocol implementation in minisatip

Post by cata »

Hi,

Are you using 0.7-ca branch?

Thanks
sharky
Posts: 11
Joined: Sat May 14, 2016 6:15 pm

Re: CI+ protocol implementation in minisatip

Post by sharky »

cata
Site Admin
Posts: 768
Joined: Tue May 12, 2015 1:01 am

Re: CI+ protocol implementation in minisatip

Post by cata »

sharky
Posts: 11
Joined: Sat May 14, 2016 6:15 pm

Re: CI+ protocol implementation in minisatip

Post by sharky »

Ah okay !

Now it looks like this.

Default

Code: Select all

pi@raspberrypi:~/minisatip $ make
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c minisatip.c -o minisatip.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c socketworks.c -o socketworks.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c stream.c -o stream.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c adapter.c -o adapter.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c utils.c -o utils.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c aes.c -o aes.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c csa.c -o csa.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c dvbapi.c -o dvbapi.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c ca.c -o ca.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c pmt.c -o pmt.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c tables.c -o tables.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c satipc.c -o satipc.o
satipc.c: In function ‘satip_getxml’:
satipc.c:1283:2: warning: implicit declaration of function ‘http_client’ [-Wimplicit-function-declaration]
  http_client("http://10.0.0.3:8080/desc.xml", "", satip_getxml_data, "");
  ^
satipc.c:1263:6: warning: unused variable ‘la’ [-Wunused-variable]
  int la;
      ^
satipc.c:1262:8: warning: unused variable ‘arg’ [-Wunused-variable]
  char *arg[50];
        ^
satipc.c:1261:7: warning: unused variable ‘satip_xml’ [-Wunused-variable]
  char satip_xml[SATIP_STR_LEN];
       ^
satipc.c:1260:7: warning: unused variable ‘satip_xml_servers’ [-Wunused-variable]
  char satip_xml_servers[SATIP_STR_LEN];
       ^
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c dvb.c -o dvb.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -o minisatip minisatip.o socketworks.o stream.o adapter.o utils.o aes.o csa.o dvbapi.o ca.o pmt.o tables.o satipc.o dvb.o  -lpthread -lrt  -lcrypto -ldvbcsa -ldvben50221 -ldvbapi -lucsi
With yuri ca.c

Code: Select all

pi@raspberrypi:~/minisatip $ make
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c minisatip.c -o minisatip.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c socketworks.c -o socketworks.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c stream.c -o stream.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c adapter.c -o adapter.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c utils.c -o utils.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c aes.c -o aes.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c csa.c -o csa.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c dvbapi.c -o dvbapi.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c ca.c -o ca.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c pmt.c -o pmt.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c tables.c -o tables.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c satipc.c -o satipc.o
satipc.c: In function ‘satip_getxml’:
satipc.c:1283:2: warning: implicit declaration of function ‘http_client’ [-Wimplicit-function-declaration]
  http_client("http://10.0.0.3:8080/desc.xml", "", satip_getxml_data, "");
  ^
satipc.c:1263:6: warning: unused variable ‘la’ [-Wunused-variable]
  int la;
      ^
satipc.c:1262:8: warning: unused variable ‘arg’ [-Wunused-variable]
  char *arg[50];
        ^
satipc.c:1261:7: warning: unused variable ‘satip_xml’ [-Wunused-variable]
  char satip_xml[SATIP_STR_LEN];
       ^
satipc.c:1260:7: warning: unused variable ‘satip_xml_servers’ [-Wunused-variable]
  char satip_xml_servers[SATIP_STR_LEN];
       ^
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -c dvb.c -o dvb.o
gcc -Wall -Wno-switch -ggdb -fPIC   -DDISABLE_NETCVCLIENT  -o minisatip minisatip.o socketworks.o stream.o adapter.o utils.o aes.o csa.o dvbapi.o ca.o pmt.o tables.o satipc.o dvb.o  -lpthread -lrt  -lcrypto -ldvbcsa -ldvben50221 -ldvbapi -lucsi
Yuri
Posts: 68
Joined: Thu Oct 01, 2015 7:26 pm

Re: CI+ protocol implementation in minisatip

Post by Yuri »

In first post changed link to new file version suitable to last git.
Yuri
Posts: 68
Joined: Thu Oct 01, 2015 7:26 pm

Re: CI+ protocol implementation in minisatip

Post by Yuri »

In first post changed link to new file version suitable to last git.
Post Reply