mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
CHG: some clearing of memory
This commit is contained in:
parent
36e78d669c
commit
2de9622f0e
1 changed files with 5 additions and 2 deletions
|
@ -80,7 +80,9 @@ inline const bitslice_value_t crypto1_bs_lfsr_rollback(const bitslice_value_t in
|
||||||
// note that bytes are sliced and unsliced with reversed endianness
|
// note that bytes are sliced and unsliced with reversed endianness
|
||||||
inline void crypto1_bs_convert_states(bitslice_t bitsliced_states[], state_t regular_states[]){
|
inline void crypto1_bs_convert_states(bitslice_t bitsliced_states[], state_t regular_states[]){
|
||||||
size_t bit_idx = 0, slice_idx = 0;
|
size_t bit_idx = 0, slice_idx = 0;
|
||||||
state_t values[MAX_BITSLICES] = {{0x00}};
|
state_t values[MAX_BITSLICES];
|
||||||
|
memset(values, 0x0, sizeof(values));
|
||||||
|
|
||||||
for(slice_idx = 0; slice_idx < MAX_BITSLICES; slice_idx++){
|
for(slice_idx = 0; slice_idx < MAX_BITSLICES; slice_idx++){
|
||||||
for(bit_idx = 0; bit_idx < STATE_SIZE; bit_idx++){
|
for(bit_idx = 0; bit_idx < STATE_SIZE; bit_idx++){
|
||||||
bool bit = get_vector_bit(slice_idx, bitsliced_states[bit_idx]);
|
bool bit = get_vector_bit(slice_idx, bitsliced_states[bit_idx]);
|
||||||
|
@ -90,7 +92,8 @@ inline void crypto1_bs_convert_states(bitslice_t bitsliced_states[], state_t reg
|
||||||
// swap endianness
|
// swap endianness
|
||||||
values[slice_idx].value = rev_state_t(values[slice_idx].value);
|
values[slice_idx].value = rev_state_t(values[slice_idx].value);
|
||||||
// roll off unused bits
|
// roll off unused bits
|
||||||
values[slice_idx].value >>= ((sizeof(state_t)*8)-STATE_SIZE);
|
//values[slice_idx].value >>= ((sizeof(state_t)*8)-STATE_SIZE); // - 48
|
||||||
|
values[slice_idx].value >>= 16;
|
||||||
}
|
}
|
||||||
memcpy(regular_states, values, sizeof(values));
|
memcpy(regular_states, values, sizeof(values));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue