[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #33069 [Core Tor/Tor]: Init sk if loaded from service blob to be on the curve
#33069: Init sk if loaded from service blob to be on the curve
-------------------------+------------------------------
Reporter: saibato | Owner: (none)
Type: enhancement | Status: new
Priority: Medium | Component: Core Tor/Tor
Version: | Severity: Trivial
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
-------------------------+------------------------------
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"
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33069>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs