I am working on an embedded system with only 128KB of flash memory available and I am looking for a C library that will let me use an algorithm for key exchange.
Basically the devices A and B don't support asymmetric cryptography and certificates but I still have to generate a key that can be used to encrypt the communication between A and B so Diffie-Hellman was my first idea but it is vulnerable to man in the middle attacks so I would like to use another algorithm which is more secure, keeping in mind that I can't use public key encryption and certificates.
I think a good solution could be a password-authenticated key agreement algorithm since the shared secret (the password) could be injected in the device during the device initialization (that will be done on a secure pc).
Is there any C library for a PAKE algorithm that you know of? I can find a lot of general informations online but I am not able to find a specific library that I can use directly with my code. Another alternative could be an EKE algorithm library, like DH-EKE algorithm.