Contains functions for internal obfuscation. More...
Go to the source code of this file.
Defines | |
#define | obf_sig(x) (obf_mode ? obfuscate_name(x,'s') : x) |
#define | obf_funit(x) (obf_mode ? obfuscate_name(x,'f') : x) |
#define | obf_file(x) (obf_mode ? obfuscate_name(x,'v') : x) |
#define | obf_inst(x) (obf_mode ? obfuscate_name(x,'i') : x) |
Functions | |
void | obfuscate_set_mode (bool value) |
Sets the global 'obf_mode' variable to the specified value. | |
char * | obfuscate_name (const char *real_name, char prefix) |
Gets an obfuscated name for the given actual name. | |
void | obfuscate_dealloc () |
Deallocates all memory associated with obfuscation. | |
Variables | |
bool | obf_mode |
Contains functions for internal obfuscation.
#define obf_file | ( | x | ) | (obf_mode ? obfuscate_name(x,'v') : x) |
Used for obfuscating file names. Improves performance when obfuscation mode is not turned on.
Referenced by assertion_funit_summary(), assertion_funit_verbose(), assertion_instance_verbose(), bind_perform(), bind_signal(), bind_task_function_namedblock(), combination_funit_summary(), combination_funit_verbose(), combination_instance_verbose(), covered_cb_error_handler(), db_add_file_version(), db_add_function_task_namedblock(), db_add_instance(), db_add_module(), db_create_expression(), db_read(), db_statement_connect(), db_write(), enumerate_resolve(), fsm_arg_parse_attr(), fsm_arg_parse_trans(), fsm_funit_summary(), fsm_funit_verbose(), fsm_instance_verbose(), line_funit_summary(), line_funit_verbose(), line_instance_verbose(), memory_ae_funit_summary(), memory_funit_verbose(), memory_instance_verbose(), memory_toggle_funit_summary(), print_output(), race_handle_race_condition(), race_report_summary(), race_report_verbose(), scope_find_param(), scope_find_signal(), scope_find_task_function_namedblock(), toggle_funit_summary(), toggle_funit_verbose(), toggle_instance_verbose(), VLerror(), and VLwarn().
#define obf_funit | ( | x | ) | (obf_mode ? obfuscate_name(x,'f') : x) |
Used for obfuscating functional unit names. Improves performance when obfuscation mode is not turned on.
Referenced by bind_display_list(), bind_signal(), combination_funit_summary(), covered_parse_instance(), covered_parse_task_func(), db_add_function_task_namedblock(), db_add_instance(), db_add_module(), db_create_expression(), db_find_signal(), db_remove_statement_from_current_funit(), fsm_var_bind_expr(), funit_db_write(), funit_display_expressions(), funit_display_signals(), funit_link_display(), gen_item_resolve(), memory_funit_verbose(), ovl_display_verbose(), race_report_verbose(), scope_find_param(), scope_find_signal(), scope_find_task_function_namedblock(), and toggle_funit_verbose().
#define obf_inst | ( | x | ) | (obf_mode ? obfuscate_name(x,'i') : x) |
Used for obfuscating instance names. Improves performance when obfuscation mode is not turned on.
Referenced by combination_instance_summary(), covered_parse_instance(), db_add_instance(), db_add_override_param(), db_assign_symbol(), db_set_vcd_scope(), db_vcd_upscope(), gen_item_resolve(), gen_item_stringify(), and ovl_display_verbose().
#define obf_sig | ( | x | ) | (obf_mode ? obfuscate_name(x,'s') : x) |
Used for obfuscating signal names. Improves performance when obfuscation mode is not turned on.
Referenced by bind_display_list(), bind_signal(), covered_create_value_change_cb(), covered_parse_signals(), covered_parse_task_func(), covered_value_change_bin(), covered_value_change_real(), db_add_declared_param(), db_add_defparam(), db_add_override_param(), db_add_signal(), db_add_vector_param(), db_assign_symbol(), db_find_signal(), defparam_add(), fsm_arg_parse_attr(), fsm_var_bind_expr(), gen_item_resolve(), gen_item_stringify(), mod_parm_display(), scope_find_param(), scope_find_signal(), scope_gen_printable(), sig_link_display(), vsignal_display(), and vsignal_vcd_assign().
void obfuscate_dealloc | ( | ) |
Deallocates all memory associated with obfuscation.
References PROFILE, PROFILE_END, and tree_dealloc().
Referenced by main().
00109 { PROFILE(OBFUSCATE_DEALLOC); 00110 00111 tree_dealloc( obf_tree ); 00112 00113 PROFILE_END; 00114 00115 }
char* obfuscate_name | ( | const char * | real_name, | |
char | prefix | |||
) |
Gets an obfuscated name for the given actual name.
Looks up the given real name in the obfuscation tree. If it exists, simply return the given name; otherwise, create a new element in the tree to represent this new name.
real_name | Name of actual object in design | |
prefix | Character representing the prefix of the obfuscated name |
References FALSE, free_safe, malloc_safe, obf_curr_id, PROFILE, PROFILE_END, tree_add(), tree_find(), and tnode_s::value.
00070 { PROFILE(OBFUSCATE_NAME); 00071 00072 tnode* obfnode; /* Pointer to obfuscated tree node */ 00073 char* key; /* Temporary name used for searching */ 00074 char tname[30]; /* Temporary name used for sizing obfuscation ID */ 00075 unsigned int rv; /* Return value from snprintf calls */ 00076 unsigned int slen; /* String length */ 00077 00078 /* Create temporary name */ 00079 slen = strlen( real_name ) + 3; 00080 key = (char*)malloc_safe( slen ); 00081 rv = snprintf( key, slen, "%s-%c", real_name, prefix ); 00082 assert( rv < slen ); 00083 00084 /* If the name was not previously obfuscated, create a new obfuscated entry in the tree and return the new name */ 00085 if( (obfnode = tree_find( key, obf_tree )) == NULL ) { 00086 00087 /* Create obfuscated name */ 00088 rv = snprintf( tname, 30, "%c%04d", prefix, obf_curr_id ); 00089 assert( rv < 30 ); 00090 obf_curr_id++; 00091 00092 /* Add the obfuscated name to the tree and get the pointer to the new node */ 00093 obfnode = tree_add( key, tname, FALSE, &obf_tree ); 00094 00095 } 00096 00097 /* Deallocate key string */ 00098 free_safe( key, (strlen( key ) + 1) ); 00099 00100 PROFILE_END; 00101 00102 return( obfnode->value ); 00103 00104 }
void obfuscate_set_mode | ( | bool | value | ) |
Sets the global 'obf_mode' variable to the specified value.
value | Boolean value to set obfuscation mode to |
References obf_mode, PROFILE, and PROFILE_END.
Referenced by main().
00052 { PROFILE(OBFUSCATE_SET_MODE); 00053 00054 obf_mode = value; 00055 00056 PROFILE_END; 00057 00058 }
Specifies obfuscation mode.
Referenced by obfuscate_set_mode().