Init sk if loaded from service blob to be on the curve

diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c index 81b37eab4..300fedc4f 100644 --- a/src/feature/hs/hs_service.c +++ b/src/feature/hs/hs_service.c @@ -3548,6 +3548,12 @@ hs_service_add_ephemeral(ed25519_secret_key_t *sk, smartlist_t *ports,

/* Handle the keys. */ memcpy(&service->keys.identity_sk, sk, sizeof(service->keys.identity_sk)); +

  • /* QAD make sure the scalar is on the curve since ed25519_donna_pubkey will probably return 0 */
  • service->keys.identity_sk[0] &= 248;
  • service->keys.identity_sk[31] &= 127;
  • service->keys.identity_sk[31] |= 64;
  • if (ed25519_public_key_generate(&service->keys.identity_pk, &service->keys.identity_sk) < 0) { log_warn(LD_CONFIG, "Unable to generate ed25519 public key"

Trac:
Username: saibato