… | |
… | |
180 | } |
180 | } |
181 | |
181 | |
182 | static void |
182 | static void |
183 | auth_hash (const auth_data &auth, const ecdh_key &b, auth_mac &mac) |
183 | auth_hash (const auth_data &auth, const ecdh_key &b, auth_mac &mac) |
184 | { |
184 | { |
185 | hkdf kdf (&auth.ecdh, sizeof (auth.ecdh), AUTH_DIGEST ()); // use remote ecdh b as salt |
185 | hkdf kdf (b, sizeof b, AUTH_DIGEST ()); // use response ecdh b as salt |
186 | kdf.extract (&auth.rsa, sizeof (auth.rsa)); |
186 | kdf.extract (&auth.rsa, sizeof (auth.rsa)); |
187 | kdf.extract_done (); |
187 | kdf.extract_done (); |
188 | kdf.expand (mac, sizeof mac, b, sizeof b); // use response ecdh b as info |
188 | kdf.expand (mac, sizeof mac, auth.ecdh, sizeof (auth.ecdh)); // use challenge ecdh b as info |
189 | } |
189 | } |
190 | |
190 | |
191 | void |
191 | void |
192 | connection::generate_auth_data () |
192 | connection::generate_auth_data () |
193 | { |
193 | { |