Changeset ab3ddbe for tools/traceanon/traceanon.cc
- Timestamp:
- 01/16/19 11:47:53 (2 years ago)
- Branches:
- develop
- Children:
- e4e33e9
- Parents:
- e9fe6ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/traceanon/traceanon.cc
rbab946c rab3ddbe 49 49 bool enc_dest_opt = false; 50 50 enum enc_type_t enc_type = ENC_NONE; 51 char * key = NULL;51 char *enc_key = NULL; 52 52 53 53 int level = -1; … … 221 221 { 222 222 if (enc_type == ENC_PREFIX_SUBSTITUTION) { 223 PrefixSub *sub = new PrefixSub( key, NULL);223 PrefixSub *sub = new PrefixSub(enc_key, NULL); 224 224 return sub; 225 225 } 226 226 227 227 if (enc_type == ENC_CRYPTOPAN) { 228 if (strlen( key) < 32) {228 if (strlen(enc_key) < 32) { 229 229 fprintf(stderr, "ERROR: Key must be at least 32 " 230 230 "characters long for CryptoPan anonymisation.\n"); … … 232 232 } 233 233 #ifdef HAVE_LIBCRYPTO 234 CryptoAnon *anon = new CryptoAnon((uint8_t *) key,235 (uint8_t)strlen( key), 20);234 CryptoAnon *anon = new CryptoAnon((uint8_t *)enc_key, 235 (uint8_t)strlen(enc_key), 20); 236 236 return anon; 237 237 #else … … 360 360 case 'd': enc_dest_opt =true; break; 361 361 case 'c': 362 if ( key!=NULL) {362 if (enc_key!=NULL) { 363 363 fprintf(stderr,"You can only have one encryption type and one key\n"); 364 364 usage(argv[0]); 365 365 } 366 key=strdup(optarg);366 enc_key=strdup(optarg); 367 367 enc_type = ENC_CRYPTOPAN; 368 368 break; 369 369 case 'F': { 370 if( key != NULL) {370 if(enc_key != NULL) { 371 371 fprintf(stderr,"You can only have one encryption type and one key\n"); 372 372 usage(argv[0]); … … 377 377 return 1; 378 378 } 379 key = (char *) malloc(sizeof(char *) * 32);380 if(fread( key,1,32,infile) != 32) {379 enc_key = (char *) malloc(sizeof(char *) * 32); 380 if(fread(enc_key,1,32,infile) != 32) { 381 381 if(ferror(infile)) { 382 382 perror("Failed while reading cryptopan keyfile"); … … 391 391 break; 392 392 case 'p': 393 if ( key!=NULL) {393 if (enc_key!=NULL) { 394 394 fprintf(stderr,"You can only have one encryption type and one key\n"); 395 395 usage(argv[0]); 396 396 } 397 key=strdup(optarg);397 enc_key=strdup(optarg); 398 398 enc_type = ENC_PREFIX_SUBSTITUTION; 399 399 break;
Note: See TracChangeset
for help on using the changeset viewer.