gestumblinde

Gestumblinde - reference implementation of SLH-DSA
git clone git://www.tkruger.se/gestumblinde.git
Log | Files | Refs | README

sphincsplus_ref.patch (1820B)


      1 diff -Nrau hackedbu/address.c sphincsplus/ref/address.c
      2 --- hackedbu/address.c	Fri Nov 17 07:53:02 2023
      3 +++ sphincsplus/ref/address.c	Fri Nov 17 09:02:08 2023
      4 @@ -64,8 +64,6 @@
      5   * Copy the layer, tree and keypair fields of the address structure.  This is
      6   * used when we're doing multiple things within the same OTS keypair
      7   */
      8 -#pragma clang diagnostic push
      9 -#pragma clang diagnostic ignored "-Wcast-qual"
     10  void copy_keypair_addr(uint32_t out[8], const uint32_t in[8])
     11  {
     12      memcpy( out, in, SPX_OFFSET_TREE+8 );
     13 @@ -74,7 +72,6 @@
     14  #endif
     15      ((unsigned char *)out)[SPX_OFFSET_KP_ADDR1] = ((unsigned char *)in)[SPX_OFFSET_KP_ADDR1];
     16  }
     17 -#pragma clang diagnostic pop
     18  
     19  /*
     20   * Specify which Merkle chain within the OTS we're working with
     21 diff -Nrau hackedbu/fors.c sphincsplus/ref/fors.c
     22 --- hackedbu/fors.c	Fri Nov 17 08:10:50 2023
     23 +++ sphincsplus/ref/fors.c	Fri Nov 17 09:02:08 2023
     24 @@ -56,7 +56,7 @@
     25      for (i = 0; i < SPX_FORS_TREES; i++) {
     26          indices[i] = 0;
     27          for (j = 0; j < SPX_FORS_HEIGHT; j++) {
     28 -            indices[i] ^= ((m[offset >> 3] >> (7-(offset & 0x7))) & 1u) << (SPX_FORS_HEIGHT-1-j);
     29 +            indices[i] ^= ((m[offset >> 3] >> (offset & 0x7)) & 1u) << j;
     30              offset++;
     31          }
     32      }
     33 diff -Nrau hackedbu/sign.c sphincsplus/ref/sign.c
     34 --- hackedbu/sign.c	Fri Nov 17 08:09:18 2023
     35 +++ sphincsplus/ref/sign.c	Fri Nov 17 09:02:08 2023
     36 @@ -122,7 +122,7 @@
     37      /* Optionally, signing can be made non-deterministic using optrand.
     38         This can help counter side-channel attacks that would benefit from
     39         getting a large number of traces when the signer uses the same nodes. */
     40 -    memcpy(optrand, pk, SPX_N);
     41 +    randombytes(optrand, SPX_N);
     42      /* Compute the digest randomization value. */
     43      gen_message_random(sig, sk_prf, optrand, m, mlen, &ctx);
     44