Changeset 10429
- Timestamp:
- 02/06/15 15:45:59 (9 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/globals.h
r10428 r10429 1075 1075 uchar ucrc[4]; // needed by monitor and used by camd35 1076 1076 uint32_t pcrc; // password crc 1077 struct aes_keys aes_keys;1077 struct aes_keys *aes_keys; // used by camd33 and camd35 1078 1078 uint16_t ncd_msgid; 1079 1079 uint16_t ncd_client_id; -
trunk/module-camd33.c
r10283 r10429 20 20 cs_log_dump_dbg(D_CLIENT, buf, l, "send %d bytes to client", l); 21 21 if(cur_client()->crypted) 22 { aes_encrypt_idx( &cur_client()->aes_keys, buf, l); }22 { aes_encrypt_idx(cur_client()->aes_keys, buf, l); } 23 23 return (send(cur_client()->pfd, buf, l, 0)); 24 24 } … … 32 32 client->last = time((time_t *) 0); 33 33 if(client->crypted) 34 { aes_encrypt_idx( &cur_client()->aes_keys, buf, n); }34 { aes_encrypt_idx(cur_client()->aes_keys, buf, n); } 35 35 } 36 36 cs_log_dump_dbg(D_CLIENT, buf, n, "received %d bytes from client", n); … … 82 82 83 83 if(cl->crypted) 84 { aes_set_key(&cl->aes_keys, (char *)cfg.c33_key); } 84 { 85 if (!aes_set_key_alloc(&cl->aes_keys, (char *)cfg.c33_key)) 86 { 87 cs_disconnect_client(cl); 88 return; 89 } 90 } 85 91 86 92 mbuf[0] = 0; -
trunk/module-camd35.c
r10405 r10429 57 57 l = boundary(4, l); 58 58 cs_log_dump_dbg(cl->typ == 'c' ? D_CLIENT : D_READER, sbuf, l, "send %d bytes to %s", l, username(cl)); 59 aes_encrypt_idx( &cl->aes_keys, sbuf, l);59 aes_encrypt_idx(cl->aes_keys, sbuf, l); 60 60 61 61 int32_t status; … … 125 125 memcpy(cl->ucrc, ucrc, 4); 126 126 cs_strncpy((char *)cl->upwd, account->pwd, sizeof(cl->upwd)); 127 aes_set_key(&cl->aes_keys, (char *) MD5(cl->upwd, strlen((char *)cl->upwd), md5tmp)); 127 if (!aes_set_key_alloc(&cl->aes_keys, (char *) MD5(cl->upwd, strlen((char *)cl->upwd), md5tmp))) 128 { 129 return 1; 130 } 128 131 return 0; 129 132 } … … 207 210 break; 208 211 case 2: 209 aes_decrypt( &client->aes_keys, buf, rs);212 aes_decrypt(client->aes_keys, buf, rs); 210 213 if(rs != boundary(4, rs)) 211 214 cs_log_dbg(client->typ == 'c' ? D_CLIENT : D_READER, … … 251 254 { 252 255 rs += len; 253 aes_decrypt( &client->aes_keys, buf + 32, len);256 aes_decrypt(client->aes_keys, buf + 32, len); 254 257 } 255 258 if(len < 0) … … 597 600 cs_strncpy((char *)cl->upwd, cl->reader->r_pwd, sizeof(cl->upwd)); 598 601 i2b_buf(4, crc32(0L, MD5((unsigned char *)cl->reader->r_usr, strlen(cl->reader->r_usr), md5tmp), 16), cl->ucrc); 599 aes_set_key(&cl->aes_keys, (char *)MD5(cl->upwd, strlen((char *)cl->upwd), md5tmp)); 602 if (!aes_set_key_alloc(&cl->aes_keys, (char *)MD5(cl->upwd, strlen((char *)cl->upwd), md5tmp))) 603 { 604 return 1; 605 } 600 606 cl->crypted=1; 601 607 -
trunk/oscam-aes.c
r10255 r10429 10 10 AES_set_decrypt_key((const unsigned char *)key, 128, &aes->aeskey_decrypt); 11 11 AES_set_encrypt_key((const unsigned char *)key, 128, &aes->aeskey_encrypt); 12 } 13 14 bool aes_set_key_alloc(struct aes_keys **aes, char *key) 15 { 16 if (!cs_malloc(aes, sizeof(struct aes_keys))) 17 return false; 18 aes_set_key(*aes, key); 19 return true; 12 20 } 13 21 -
trunk/oscam-aes.h
r8951 r10429 3 3 4 4 void aes_set_key(struct aes_keys *aes, char *key); 5 bool aes_set_key_alloc(struct aes_keys **aes, char *key); 5 6 void aes_decrypt(struct aes_keys *aes, uchar *buf, int32_t n); 6 7 void aes_encrypt_idx(struct aes_keys *aes, uchar *buf, int32_t n); -
trunk/oscam-client.c
r10428 r10429 732 732 NULLFREE(cl->cw_rass); 733 733 NULLFREE(cl->via_rass); 734 NULLFREE(cl->aes_keys); 734 735 735 736 #ifdef MODULE_CCCAM
Note:
See TracChangeset
for help on using the changeset viewer.