static void generate_k(uint8_t k[32], uint8_t V[32], uint8_t K[32]) {
  // h.
  // Note that T = V, as qlen = hlen
  ecdsa_sha256_hmac(V, K, V, 32);
  memcpy(k, V, 32);

  // The following steps are preparation for the next iteration (in case the generated k is invalid)
  {
    uint8_t input[32+1];
    memcpy(input, V, 32);
    input[32] = 0x00;
    ecdsa_sha256_hmac(K, K, input, sizeof(input));
  }
  ecdsa_sha256_hmac(V, K, V, 32);
}
static void generate_k(uint8_t k[32], uint8_t V[32], uint8_t K[32]) {
   
   
  ecdsa_sha256_hmac(V, K, V, 32);
  memcpy(k, V, 32);

   
  {
    uint8_t input[32+1];
    memcpy(input, V, 32);
    input[32] = 0x00;
    ecdsa_sha256_hmac(K, K, input, sizeof(input));
  }
  ecdsa_sha256_hmac(V, K, V, 32);
}