CI+ protocol implementation in minisatip

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

CI+ protocol implementation in minisatip

Post by Yuri » Tue Jun 27, 2017 11:20 am

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 replace the file src/ca.c in the sources of the master branch to the file under the link https://ru.files.fm/u/4gzsdus6 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: change link to ca.c suitable to last git changes
update 15.07.2017: change link to ca.c suitable to last git changes
update 10.08.2017: change link to ca.c Added support OpenSSL 1.1, thanks to ciminus
update 23.08.2017: change link to ca.c suitable to last git changes
Last edited by Yuri on Mon Sep 24, 2018 1:06 pm, edited 11 times in total.

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

Re: CI+ protocol implementation in minisatip

Post by sharky » Wed Jun 28, 2017 6:58 pm

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: 36
Joined: Thu Oct 01, 2015 7:26 pm

Re: CI+ protocol implementation in minisatip

Post by Yuri » Wed Jun 28, 2017 8:50 pm

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 » Thu Jun 29, 2017 8:54 am

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: 483
Joined: Tue May 12, 2015 1:01 am

Re: CI+ protocol implementation in minisatip

Post by cata » Thu Jun 29, 2017 10:59 am

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 » Fri Jun 30, 2017 12:41 pm


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

Re: CI+ protocol implementation in minisatip

Post by cata » Fri Jun 30, 2017 2:15 pm


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

Re: CI+ protocol implementation in minisatip

Post by sharky » Sat Jul 01, 2017 10:12 am

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: 36
Joined: Thu Oct 01, 2015 7:26 pm

Re: CI+ protocol implementation in minisatip

Post by Yuri » Tue Jul 04, 2017 11:46 am

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

Yuri
Posts: 36
Joined: Thu Oct 01, 2015 7:26 pm

Re: CI+ protocol implementation in minisatip

Post by Yuri » Sat Jul 15, 2017 4:47 pm

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

Post Reply