I'm developping a device based on STM32L4x6. It is connected through BLE to a smartphone and it exchanges encrypted data with it. Data consists of health data of patients.
Encryption is AES-GCM 256 bits and I'm using the reference implementation provided by STMicro.
I have implemented a classical shared secret exchange mechanism using Diffie-Helman protocol on Curve25519. Right now I am using this shared secret directly as the AES key.
I know that I need to derive a "cryptographycally good" AES key from this shared secret.
I was planning to use HKDF-SHA512 for that, because it seems to be a widely used algorithm and also because a reference implementation is also provided by STMicro. Is it a good choice ?
I'm confused about the size and the nature of the salt to derive the key. Do you have any advice for that ?
From what I understood one can use HKDF-SHA512 to generate a key of 256 bits, do you confirm ?
Also regarding the derivation frequency : at what frequency should I derive a new key ?