src/excrypt_bn.c
void ExCryptBnQw_SwapDwQwLeBe(const uint64_t* source, uint64_t* dest, uint32_t num_qwords)
{
#ifdef OLD_CODE
  const uint32_t* source_dw = (const uint32_t*)source;
  uint32_t* dest_dw = (uint32_t*)dest;
  for (uint32_t i = 0; i < num_qwords; i++)
  {
    uint32_t first = _byteswap_ulong(source_dw[0]);
    uint32_t second = _byteswap_ulong(source_dw[1]);
    dest_dw[0] = second;
    dest_dw[1] = first;
    source_dw += 2;
    dest_dw += 2;
  }
#else
  for (uint32_t i = 0; i < num_qwords; i++)
  {
    dest[i] = _byteswap_uint64(source[i]);
  }
#endif
}
// Endian-swaps & swaps around the two DWORDs inside a QWORD
Endian-swaps & swaps around the two DWORDs inside a QWORD
Endian - swaps & swaps around the two DWORDs inside a QWORD
void ExCryptBnQw_SwapDwQwLeBe(const uint64_t* source, uint64_t* dest, uint32_t num_qwords)
{
#ifdef OLD_CODE
  const uint32_t* source_dw = (const uint32_t*)source;
  uint32_t* dest_dw = (uint32_t*)dest;
  for (uint32_t i = 0; i < num_qwords; i++)
  {
    uint32_t first = _byteswap_ulong(source_dw[0]);
    uint32_t second = _byteswap_ulong(source_dw[1]);
    dest_dw[0] = second;
    dest_dw[1] = first;
    source_dw += 2;
    dest_dw += 2;
  }
#else
  for (uint32_t i = 0; i < num_qwords; i++)
  {
    dest[i] = _byteswap_uint64(source[i]);
  }
#endif
}
void ExCryptBnQw_SwapDwQwLeBe ( const uint64_t * source , uint64_t * dest , uint32_t num_qwords ) { #ifdef OLD_CODE const uint32_t * source_dw = ( const uint32_t * ) source ; uint32_t * dest_dw = ( uint32_t * ) dest ; for ( uint32_t i = 0 ; i < num_qwords ; i ++ ) { uint32_t first = _byteswap_ulong ( source_dw [ 0 ] ) ; uint32_t second = _byteswap_ulong ( source_dw [ 1 ] ) ; dest_dw [ 0 ] = second ; dest_dw [ 1 ] = first ; source_dw += 2 ; dest_dw += 2 ; } #else for ( uint32_t i = 0 ; i < num_qwords ; i ++ ) { dest [ i ] = _byteswap_uint64 ( source [ i ] ) ; } #endif }
Endian-swaps & swaps around the two DWORDs inside a QWORD
Endian - swaps & swaps around the two DWORDs inside a QWORD