File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -348,7 +348,8 @@ typedef struct PFXState {
348348 * st: the AesState structure to be populated.
349349 * key: a 16-byte AES key.
350350 */
351- static void __vectorcall expand_key (KeySchedule rkeys , const unsigned char key [IPCRYPT_KEYBYTES ])
351+ static void __vectorcall
352+ expand_key (KeySchedule rkeys , const unsigned char key [IPCRYPT_KEYBYTES ])
352353{
353354 BlockVec t , s ;
354355 size_t i = 0 ;
@@ -978,11 +979,11 @@ ipcrypt_pfx_get_bit(const uint8_t ip16[16], const unsigned int bit_index)
978979static void
979980ipcrypt_pfx_set_bit (uint8_t ip16 [16 ], const unsigned int bit_index , const uint8_t bit_value )
980981{
981- if ( bit_value ) {
982- ip16 [ 15 - bit_index / 8 ] |= (1 << (bit_index % 8 ));
983- } else {
984- ip16 [ 15 - bit_index / 8 ] &= ~( 1 << ( bit_index % 8 ));
985- }
982+ const size_t byte_index = 15 - bit_index / 8 ;
983+ const uint8_t bit_mask = ( uint8_t ) (1 << (bit_index % 8 ));
984+ const uint8_t mask = ( uint8_t ) - (( bit_value & 1 ));
985+
986+ ip16 [ byte_index ] = ( ip16 [ byte_index ] & ~ bit_mask ) | ( bit_mask & mask );
986987}
987988
988989static void
You can’t perform that action at this time.
0 commit comments