Browse Source

Remove unnecessary endianness difference

The current code results in the same output regardless of endianness.
Verified using a QEMU VM to emulate MIPS.
master
Joost Rijneveld 7 years ago
parent
commit
138a380a26
No known key found for this signature in database GPG Key ID: A4FE39CF49CBC553
2 changed files with 0 additions and 7 deletions
  1. +0
    -5
      hash.c
  2. +0
    -2
      hash.h

+ 0
- 5
hash.c View File

@@ -10,14 +10,10 @@


unsigned char* addr_to_byte(unsigned char *bytes, const uint32_t addr[8]) unsigned char* addr_to_byte(unsigned char *bytes, const uint32_t addr[8])
{ {
#if IS_LITTLE_ENDIAN==1
int i; int i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
to_byte(bytes + i*4, addr[i], 4); to_byte(bytes + i*4, addr[i], 4);
} }
#else
memcpy(bytes, addr, 32);
#endif
return bytes; return bytes;
} }


@@ -90,7 +86,6 @@ int hash_h(const xmss_params *params,
set_key_and_mask(addr, 0); set_key_and_mask(addr, 0);
addr_to_byte(byte_addr, addr); addr_to_byte(byte_addr, addr);
prf(params, key, byte_addr, pub_seed, params->n); prf(params, key, byte_addr, pub_seed, params->n);
// Use MSB order
set_key_and_mask(addr, 1); set_key_and_mask(addr, 1);
addr_to_byte(byte_addr, addr); addr_to_byte(byte_addr, addr);
prf(params, bitmask, byte_addr, pub_seed, params->n); prf(params, bitmask, byte_addr, pub_seed, params->n);


+ 0
- 2
hash.h View File

@@ -4,8 +4,6 @@
#include <stdint.h> #include <stdint.h>
#include "params.h" #include "params.h"


#define IS_LITTLE_ENDIAN 1

unsigned char* addr_to_byte(unsigned char *bytes, const uint32_t addr[8]); unsigned char* addr_to_byte(unsigned char *bytes, const uint32_t addr[8]);


int prf(const xmss_params *params, int prf(const xmss_params *params,


Loading…
Cancel
Save