@@ -20,6 +20,7 @@ static void random_bytes(void *dst, size_t n)
2020 d [i ] = random () % 256 ;
2121}
2222
23+ #if 0
2324/* Compressed key would start with 0x3? Subtract from group. Thanks
2425 * Greg Maxwell. */
2526static void flip_key (struct seckey * seckey )
@@ -47,6 +48,7 @@ static void flip_key(struct seckey *seckey)
4748 seckey -> u .be64 [i ] = cpu_to_be64 (v );
4849 }
4950}
51+ #endif
5052
5153#if 0
5254int main (int argc , char * argv [])
@@ -97,7 +99,7 @@ static void random_key(secp256k1_context *ctx,
9799
98100/* We don't want to spend a byte encoding sign, so make sure it's 0x2 */
99101static void gen_keys (secp256k1_context * ctx ,
100- struct seckey * seckey , struct onion_pubkey * pubkey )
102+ struct seckey * seckey , struct compressed_pubkey * pubkey )
101103{
102104 unsigned char tmp [33 ];
103105 secp256k1_pubkey pkey ;
@@ -108,16 +110,18 @@ static void gen_keys(secp256k1_context *ctx,
108110 secp256k1_ec_pubkey_serialize (ctx , tmp , & len , & pkey ,
109111 SECP256K1_EC_COMPRESSED );
110112 assert (len == sizeof (tmp ));
113+ #if 0
111114 if (tmp [0 ] == 0x3 )
112115 flip_key (seckey );
113- memcpy (pubkey , tmp + 1 , sizeof (* pubkey ));
116+ #endif
117+ memcpy (pubkey , tmp , sizeof (* pubkey ));
114118}
115119
116120void print_keypair (int pub , int priv )
117121{
118122 secp256k1_context * ctx ;
119123 struct seckey seckey ;
120- struct onion_pubkey pubkey ;
124+ struct compressed_pubkey pubkey ;
121125 char sechex [hex_str_size (sizeof (seckey ))];
122126 char pubhex [hex_str_size (sizeof (pubkey ))];
123127
0 commit comments