- Timestamp:
- 04/09/18 18:22:51 (6 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cscrypt/des.c
r10884 r11413 714 714 { 715 715 case 16: 716 for(i = 8; i < 16; ++i) 717 { 716 for(i = 8; i < 16; ++i){ 718 717 data[i] = v1[i] ^ v2[i]; 719 } 718 } /* fallthrough */ 720 719 case 8: 721 for(i = 4; i < 8; ++i) 722 { 720 for(i = 4; i < 8; ++i){ 723 721 data[i] = v1[i] ^ v2[i]; 724 } 722 } /* fallthrough */ 725 723 case 4: 726 for(i = 0; i < 4; ++i) 727 { 724 for(i = 0; i < 4; ++i){ 728 725 data[i] = v1[i] ^ v2[i]; 729 } 726 } /* fallthrough */ 730 727 break; 731 728 default: -
trunk/cscrypt/idea_lcl.h
r8960 r11413 97 97 l1=l2=0; \ 98 98 switch (n) { \ 99 case 8: l2 =((unsigned long)(*(--(c)))) ; \100 case 7: l2|=((unsigned long)(*(--(c))))<< 8; \101 case 6: l2|=((unsigned long)(*(--(c))))<<16; \102 case 5: l2|=((unsigned long)(*(--(c))))<<24; \103 case 4: l1 =((unsigned long)(*(--(c)))) ; \104 case 3: l1|=((unsigned long)(*(--(c))))<< 8; \105 case 2: l1|=((unsigned long)(*(--(c))))<<16; \106 case 1: l1|=((unsigned long)(*(--(c))))<<24; \99 case 8: l2 =((unsigned long)(*(--(c)))) ; /* fallthrough */ \ 100 case 7: l2|=((unsigned long)(*(--(c))))<< 8; /* fallthrough */ \ 101 case 6: l2|=((unsigned long)(*(--(c))))<<16; /* fallthrough */ \ 102 case 5: l2|=((unsigned long)(*(--(c))))<<24; /* fallthrough */ \ 103 case 4: l1 =((unsigned long)(*(--(c)))) ; /* fallthrough */ \ 104 case 3: l1|=((unsigned long)(*(--(c))))<< 8; /* fallthrough */ \ 105 case 2: l1|=((unsigned long)(*(--(c))))<<16; /* fallthrough */ \ 106 case 1: l1|=((unsigned long)(*(--(c))))<<24; /* fallthrough */ \ 107 107 } \ 108 108 } … … 112 112 c+=n; \ 113 113 switch (n) { \ 114 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \115 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \116 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \117 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \118 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \119 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \120 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \114 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); /* fallthrough */ \ 115 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); /* fallthrough */ \ 116 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); /* fallthrough */ \ 117 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); /* fallthrough */ \ 118 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); /* fallthrough */ \ 119 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); /* fallthrough */ \ 120 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); /* fallthrough */ \ 121 121 case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ 122 122 } \ … … 149 149 l1=l2=0; \ 150 150 switch (n) { \ 151 case 8: l2 =((unsigned long)(*(--(c))))<<24; \152 case 7: l2|=((unsigned long)(*(--(c))))<<16; \153 case 6: l2|=((unsigned long)(*(--(c))))<< 8; \154 case 5: l2|=((unsigned long)(*(--(c)))); \155 case 4: l1 =((unsigned long)(*(--(c))))<<24; \156 case 3: l1|=((unsigned long)(*(--(c))))<<16; \157 case 2: l1|=((unsigned long)(*(--(c))))<< 8; \158 case 1: l1|=((unsigned long)(*(--(c)))); \151 case 8: l2 =((unsigned long)(*(--(c))))<<24; /* fallthrough */ \ 152 case 7: l2|=((unsigned long)(*(--(c))))<<16; /* fallthrough */ \ 153 case 6: l2|=((unsigned long)(*(--(c))))<< 8; /* fallthrough */ \ 154 case 5: l2|=((unsigned long)(*(--(c)))); /* fallthrough */ \ 155 case 4: l1 =((unsigned long)(*(--(c))))<<24; /* fallthrough */ \ 156 case 3: l1|=((unsigned long)(*(--(c))))<<16; /* fallthrough */ \ 157 case 2: l1|=((unsigned long)(*(--(c))))<< 8; /* fallthrough */ \ 158 case 1: l1|=((unsigned long)(*(--(c)))); /* fallthrough */ \ 159 159 } \ 160 160 } … … 164 164 c+=n; \ 165 165 switch (n) { \ 166 case 8: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \167 case 7: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \168 case 6: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \169 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \170 case 4: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \171 case 3: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \172 case 2: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \173 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \166 case 8: *(--(c))=(unsigned char)(((l2)>>24)&0xff); /* fallthrough */ \ 167 case 7: *(--(c))=(unsigned char)(((l2)>>16)&0xff); /* fallthrough */ \ 168 case 6: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); /* fallthrough */ \ 169 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); /* fallthrough */ \ 170 case 4: *(--(c))=(unsigned char)(((l1)>>24)&0xff); /* fallthrough */ \ 171 case 3: *(--(c))=(unsigned char)(((l1)>>16)&0xff); /* fallthrough */ \ 172 case 2: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); /* fallthrough */ \ 173 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); /* fallthrough */ \ 174 174 } \ 175 175 } -
trunk/csctapi/icc_async.c
r11391 r11413 210 210 do 211 211 { 212 switch(reader->protocol_type) 213 { 214 if(try > 1) 215 rdr_log(reader, "Warning: needed try nr %i, next ECM has some delay", try); 212 if(try > 1){ 213 rdr_log(reader, "Warning: needed try nr %i, next ECM has some delay", try); 214 } 215 216 switch(reader->protocol_type){ 217 216 218 case ATR_PROTOCOL_TYPE_T0: 217 219 ret = Protocol_T0_Command(reader, command, command_len, rsp, lr); -
trunk/csctapi/protocol_t0.c
r10283 r11413 64 64 65 65 static int32_t Protocol_T0_Case2E(struct s_reader *reader, unsigned char *command, uint16_t command_len, unsigned char *rsp, uint16_t *lr); 66 67 66 static int32_t Protocol_T0_Case3E(struct s_reader *reader, unsigned char *command, unsigned char *rsp, uint16_t *lr); 68 69 67 static int32_t Protocol_T0_Case4E(struct s_reader *reader, unsigned char *command, uint16_t command_len, unsigned char *rsp, uint16_t *lr); 70 71 68 static int32_t Protocol_T0_ExchangeTPDU(struct s_reader *reader, unsigned char *command, uint16_t command_len, unsigned char *rsp, uint16_t *lr); 72 69 73 static int32_t APDU_Cmd_Case(unsigned char *command, uint16_t command_len) 74 { 70 static int32_t APDU_Cmd_Case(unsigned char *command, uint16_t command_len){ 75 71 unsigned char B1; 76 72 uint16_t B2B3; … … 128 124 { 129 125 case APDU_CASE_2E: 130 return Protocol_T0_Case2E(reader, command, command_len, rsp, lr); 126 return Protocol_T0_Case2E(reader, command, command_len, rsp, lr); /* fallthrough */ 131 127 case APDU_CASE_3E: 132 return Protocol_T0_Case3E(reader, command, rsp, lr); 128 return Protocol_T0_Case3E(reader, command, rsp, lr); /* fallthrough */ 133 129 case APDU_CASE_4E: 134 return Protocol_T0_Case4E(reader, command, command_len, rsp, lr); 130 return Protocol_T0_Case4E(reader, command, command_len, rsp, lr); /* fallthrough */ 135 131 case APDU_CASE_4S: 136 command_len--; / /FIXME this should change 4S to 2S/3S command137 case APDU_CASE_2S: 132 command_len--; /* fallthrough */ //FIXME this should change 4S to 2S/3S command 133 case APDU_CASE_2S: /* fallthrough */ 138 134 case APDU_CASE_3S: 139 return Protocol_T0_ExchangeTPDU(reader, command, command_len, rsp, lr); 135 return Protocol_T0_ExchangeTPDU(reader, command, command_len, rsp, lr); /* fallthrough */ 140 136 default: 141 137 rdr_log_dbg(reader, D_IFD, "Protocol: T=0: Invalid APDU"); -
trunk/module-cccam.c
r11404 r11413 27 27 28 28 //Mode names for CMD_05 command: 29 static const char *cmd05_mode_name[] = { "UNKNOWN", "PLAIN", "AES", "CC_CRYPT", "RC4", 30 "LEN=0" 31 }; 29 static const char *cmd05_mode_name[] = { "UNKNOWN", "PLAIN", "AES", "CC_CRYPT", "RC4", "LEN=0" }; 32 30 33 31 //Mode names for CMD_0C command: … … 46 44 uint8_t j = 0; 47 45 48 for(i = 0; i < 256; i++) 49 { 46 for(i = 0; i < 256; i++){ 50 47 block->keytable[i] = i; 51 48 } 52 49 53 for(i = 0; i < 256; i++) 54 { 50 for(i = 0; i < 256; i++){ 55 51 j += key[i % len] + block->keytable[i]; 56 52 SWAPC(&block->keytable[i], &block->keytable[j]); … … 62 58 } 63 59 64 void cc_crypt(struct cc_crypt_block *block, uint8_t *data, int32_t len, 65 cc_crypt_mode_t mode) 60 void cc_crypt(struct cc_crypt_block *block, uint8_t *data, int32_t len, cc_crypt_mode_t mode) 66 61 { 67 62 int32_t i; … … 83 78 } 84 79 85 void cc_rc4_crypt(struct cc_crypt_block *block, uint8_t *data, int32_t len, 86 cc_crypt_mode_t mode) 87 { 80 void cc_rc4_crypt(struct cc_crypt_block *block, uint8_t *data, int32_t len, cc_crypt_mode_t mode){ 88 81 int32_t i; 89 82 uint8_t z; … … 95 88 SWAPC(&block->keytable[block->counter], &block->keytable[block->sum]); 96 89 z = data[i]; 97 data[i] = z ^ block->keytable[(block->keytable[block->counter] 98 + block->keytable[block->sum]) & 0xff]; 90 data[i] = z ^ block->keytable[(block->keytable[block->counter] + block->keytable[block->sum]) & 0xff]; 99 91 if(!mode) 100 92 { z = data[i]; } … … 111 103 { 112 104 buf[8 + i] = i * buf[i]; 113 if(i <= 5) 114 { 105 if(i <= 5){ 115 106 buf[i] ^= cccam[i]; 116 107 } … … 125 116 int32_t i; 126 117 127 if(cl->typ != 'c') 128 { 118 if(cl->typ != 'c'){ 129 119 node_id = b2ll(8, cc->node_id); 130 } 131 else 132 { 120 }else{ 133 121 node_id = b2ll(8, cc->peer_node_id); 134 122 } … … 1097 1085 { 1098 1086 int32_t ofs = 0; 1099 while(len) 1100 { 1087 while(len){ 1101 1088 memcpy(out + ofs, in, len); 1102 1089 len--; … … 1128 1115 //} 1129 1116 1130 if (caid_is_bulcrypt(caid)) { 1131 out[4] = in[0]; 1132 out[5] = in[1]; 1133 out[6] = in[2]; 1134 out[7] = in[3]; 1135 return; 1136 } 1137 1117 if (caid_is_bulcrypt(caid)){ 1118 out[4] = in[0]; 1119 out[5] = in[1]; 1120 out[6] = in[2]; 1121 out[7] = in[3]; 1122 return; 1123 } 1138 1124 hexserial_to_newcamd(in, tmp + 2, caid); 1139 1125 UA_right(tmp, out, 8); … … 2584 2570 case MSG_SLEEPSEND: 2585 2571 //Server sends SLEEPSEND: 2586 if(l < 5) 2587 { break; } 2588 2589 if(!cfg.c35_suppresscmd08) 2590 { 2591 if(buf[4] == 0xFF) 2592 { 2572 if(l < 5){ 2573 break; 2574 } 2575 if(!cfg.c35_suppresscmd08){ 2576 if(buf[4] == 0xFF){ 2593 2577 cl->stopped = 2; // server says sleep 2594 2578 //rdr->card_status = NO_CARD; 2595 } 2596 else 2597 { 2598 if(config_enabled(WITH_LB) && !cfg.lb_mode) 2599 { 2579 }else{ 2580 if(config_enabled(WITH_LB) && !cfg.lb_mode){ 2600 2581 cl->stopped = 1; // server says invalid 2601 2582 rdr->card_status = CARD_FAILURE; 2602 2583 } 2603 2584 } 2604 } 2605 //NO BREAK!! NOK Handling needed! 2585 } /* fallthrough */ //NO BREAK!! NOK Handling needed! 2606 2586 2607 2587 case MSG_CW_NOK1: -
trunk/module-scam.c
r10966 r11413 30 30 { 31 31 case 16: 32 for(i = 8; i < 16; ++i) 33 { 32 for(i = 8; i < 16; ++i){ 34 33 data[i] = v1[i] ^ v2[i]; 35 } 34 } /* fallthrough */ 36 35 case 8: 37 for(i = 4; i < 8; ++i) 38 { 36 for(i = 4; i < 8; ++i){ 39 37 data[i] = v1[i] ^ v2[i]; 40 } 38 } /* fallthrough */ 41 39 case 4: 42 for(i = 0; i < 4; ++i) 43 { 40 for(i = 0; i < 4; ++i){ 44 41 data[i] = v1[i] ^ v2[i]; 45 } 42 } /* fallthrough */ 46 43 break; 47 44 default: -
trunk/oscam-client.c
r11376 r11413 92 92 #endif 93 93 case 'c': 94 if(cccam_client_extended_mode(cl)) 95 { 94 if(cccam_client_extended_mode(cl)){ 96 95 ctyp = "cccam_ext"; 97 96 break; 98 } 97 } /* fallthrough */ 99 98 default: 100 99 ctyp = get_module(cl)->desc; … … 437 436 } 438 437 } 439 } 438 } /* fallthrough */ 440 439 441 440 case -1: // anonymous grant access -
trunk/oscam-string.c
r11306 r11413 10 10 void **tmp = result; 11 11 *tmp = malloc(size); 12 if(*tmp == NULL) 13 { 12 if(*tmp == NULL){ 14 13 fprintf(stderr, "%s: ERROR: Can't allocate %zu bytes!", __func__, size); 15 } 16 else 17 { 14 }else{ 18 15 memset(*tmp, 0, size); 19 16 } … … 30 27 void **tmp = result, **tmp2 = result; 31 28 *tmp = realloc(*tmp, size); 32 if(*tmp == NULL) 33 { 29 if(*tmp == NULL){ 34 30 fprintf(stderr, "%s: ERROR: Can't allocate %zu bytes!", __func__, size); 35 31 NULLFREE(*tmp2); … … 44 40 if(!str) 45 41 { return NULL; } 46 if(cs_malloc(&newstr, strlen(str) + 1)) 47 { 42 if(cs_malloc(&newstr, strlen(str) + 1)){ 48 43 strncpy(newstr, str, strlen(str)); 49 44 return newstr; … … 58 53 void cs_strncpy(char *destination, const char *source, size_t num) 59 54 { 60 if(!source) 61 { 55 if(!source){ 62 56 destination[0] = '\0'; 63 57 return; … … 76 70 { 77 71 char *p; 78 for(p = txt; *p; p++) 79 { 72 for(p = txt; *p; p++){ 80 73 if(isupper((uchar)*p)) 81 74 { *p = tolower((uchar) * p); } … … 88 81 { 89 82 char *p; 90 for(p = txt; *p; p++) 91 { 83 for(p = txt; *p; p++){ 92 84 if(islower((uchar)*p)) 93 85 { *p = toupper((uchar) * p); } … … 100 92 int32_t l; 101 93 char *p1, *p2; 102 if(*txt == ' ') 103 { 94 if(*txt == ' '){ 104 95 for(p1 = p2 = txt; (*p1 == ' ') || (*p1 == '\t') || (*p1 == '\n') || (*p1 == '\r'); p1++) 105 96 { ; } … … 109 100 } 110 101 l = strlen(txt); 111 if(l > 0) 112 { 102 if(l > 0){ 113 103 for(p1 = txt + l - 1; l > 0 && ((*p1 == ' ') || (*p1 == '\t') || (*p1 == '\n') || (*p1 == '\r')); *p1-- = '\0', l--) 114 104 { ; } … … 140 130 if(NULL != p1) 141 131 { 142 while('\0' != *p1) 143 { 144 if((' ' != *p1) && ('\t' != *p1) && 145 ('\n' != *p1) && ('\r' != *p1)) 146 { 132 while('\0' != *p1){ 133 if((' ' != *p1) && ('\t' != *p1) && ('\n' != *p1) && ('\r' != *p1)){ 147 134 *p2++ = *p1; 148 135 } … … 318 305 b[0] = (i >> 16) & 0xff; 319 306 b[1] = (i >> 8) & 0xff; 320 b[2] = (i) & 0xff; 307 b[2] = (i) & 0xff; /* fallthrough */ 321 308 case 4: 322 309 b[0] = (i >> 24) & 0xff; -
trunk/reader-conax.c
r10607 r11413 320 320 break; 321 321 case -3: 322 rdr_log(reader, "conax RSA pairing- wrong size of data for second round"); 322 rdr_log(reader, "conax RSA pairing- wrong size of data for second round"); /* fallthrough */ 323 323 case -4: 324 324 rdr_log(reader, "card has no right to decode this channel"); -
trunk/reader-nagra.c
r11378 r11413 641 641 rdr_log(reader, "|%04X|%04X |%s |%s |", id, chid, ds, de); 642 642 addProvider(reader, cta_res); 643 } 643 } /* fallthrough */ 644 644 case 0x08: 645 645 case 0x88: 646 if(cta_res[11] == 0x49) { decryptDT08(reader, cta_res); } 646 if(cta_res[11] == 0x49){ 647 decryptDT08(reader, cta_res); 648 } /* fallthrough */ 647 649 default: 648 650 return OK; -
trunk/reader-viaccess.c
r11283 r11413 1444 1444 1445 1445 return (!memcmp(&rdr->sa[0][0], ep->hexserial, 3)); 1446 } 1446 } /* fallthrough */ 1447 1447 1448 1448 default: -
trunk/reader-videoguard-common.c
r11407 r11413 510 510 { 511 511 case 16: 512 for(i = 8; i < 16; ++i) 513 { 512 for(i = 8; i < 16; ++i){ 514 513 data[i] = v1[i] ^ v2[i]; 515 } 514 } /* fallthrough */ 516 515 case 8: 517 for(i = 4; i < 8; ++i) 518 { 516 for(i = 4; i < 8; ++i){ 519 517 data[i] = v1[i] ^ v2[i]; 520 } 518 } /* fallthrough */ 521 519 case 4: 522 for(i = 0; i < 4; ++i) 523 { 520 for(i = 0; i < 4; ++i){ 524 521 data[i] = v1[i] ^ v2[i]; 525 } 522 } /* fallthrough */ 526 523 break; 527 524 default:
Note:
See TracChangeset
for help on using the changeset viewer.