3 void *worker_fast_pass(void *task
)
5 union pubonionunion pubonion
;
6 u8
* const pk
= &pubonion
.raw
[PKPREFIX_SIZE
];
7 u8 secret
[SKPREFIX_SIZE
+ SECRET_LEN
];
8 u8
* const sk
= &secret
[SKPREFIX_SIZE
];
10 u8 hashsrc
[checksumstrlen
+ PUBLIC_LEN
+ 1];
11 u8 wpk
[PUBLIC_LEN
+ 1];
15 size_t counter
,oldcounter
;
19 struct statstruct
*st
= (struct statstruct
*)task
;
26 memcpy(secret
,skprefix
,SKPREFIX_SIZE
);
28 memset(&pubonion
,0,sizeof(pubonion
));
29 memcpy(pubonion
.raw
,pkprefix
,PKPREFIX_SIZE
);
30 // write version later as it will be overwritten by hash
31 memcpy(hashsrc
,checksumstr
,checksumstrlen
);
32 hashsrc
[checksumstrlen
+ PUBLIC_LEN
] = 0x03; // version
41 pthread_mutex_lock(&determseed_mutex
);
42 for (int i
= 0; i
< SEED_LEN
; i
++)
45 memcpy(seed
, determseed
, SEED_LEN
);
46 pthread_mutex_unlock(&determseed_mutex
);
48 ed25519_seckey_expand(sk
,seed
);
50 ge_scalarmult_base(&ge_public
,sk
);
51 ge_p3_tobytes(pk
,&ge_public
);
53 for (counter
= oldcounter
= 0;counter
< DETERMINISTIC_LOOP_COUNT
;counter
+= 8) {
56 if (unlikely(endwork
))
61 shiftpk(wpk
,pk
,filter_len(i
));
64 DOFILTER(j
,wpk
,goto secondfind
);
69 shiftpk(wpk
,wpk
,filter_len(j
));
73 // update secret key with delta since last hit (if any)
74 addsztoscalar32(sk
,counter
-oldcounter
);
77 if ((sk
[0] & 248) != sk
[0] || ((sk
[31] & 63) | 64) != sk
[31])
80 // reseed right half of key to avoid reuse, it won't change public key anyway
86 memcpy(&hashsrc
[checksumstrlen
],pk
,PUBLIC_LEN
);
87 FIPS202_SHA3_256(hashsrc
,sizeof(hashsrc
),&pk
[PUBLIC_LEN
]);
89 pk
[PUBLIC_LEN
+ 2] = 0x03;
91 strcpy(base32_to(&sname
[direndpos
],pk
,PUBONION_LEN
),".onion");
92 onionready(sname
,secret
,pubonion
.raw
);
93 pk
[PUBLIC_LEN
] = 0; // what is this for?
96 ge_add(&sum
, &ge_public
,&ge_eightpoint
);
97 ge_p1p1_to_p3(&ge_public
,&sum
);
98 ge_p3_tobytes(pk
,&ge_public
);
108 sodium_memzero(secret
,sizeof(secret
));
109 sodium_memzero(seed
,sizeof(seed
));