简体   繁体   中英

How to apply the patch for fully hashed menezes-qu-vanstone (fhmqv) to crypto++ that has been installed from the Ubuntu repository

I want to use Elliptic Curve Diffie-Hellman (ECDH) key exchange protocol for a key agreement process. It is already implemented in crypto++ library and I wanted to utilize it. I have already installed crypto++ (by typing sudo apt-get... command in a terminal) but since traditional ECDH is vulnerable to man-in-the-middle attack.

I want to use fully hashed menezes-qu-vanstone protocol. Although it is implemented for crypto++ it is not in the main stream so I need to patch it. There is an explanation here but it is for those who built the library from the source code.

Is there anyone who knows how to apply this patch to crypto++ that has been installed from Ubuntu repository? I am using Ubuntu 15.

but since traditional ECDH is vulnerable to man-in-the-middle attack.

What others often do is to pair ECDH with a signature scheme. For example, TLS uses ECDH with a scheme like RSA or ECDSA.

I'm not saying you should do it; I'm only letting you know what others are doing.


it is not in the main stream so I need to patch it...

We will be adding HMQV and FHMQV at the next release. The next release will be happening in the next couple of months.


Is there anyone who knows how to apply this patch to crypto++ that has been installed from Ubuntu repository?

The easiest thing to do would be to probably be to build a new version of the library, and then install it into /usr/local . I presume you know how to download and patch. To build and install:

# Crypto++ build directory
...
make static dynamic cryptest.exe
sudo make install PREFIX=/usr/local

You might be able to patch Ubuntu version because FHMQV is mostly a header-only implementation. However, cryptest.exe will not have the validation stuff included. You really need to build the library for it.

Download the patch and perform the following. fhmqv.h is the "meat and potatoes" of the patch.

sudo cp fhmqv.h /usr/include/cryptopp

You also need to add the following to eccrypto.h . Start by opening the file with privileges (ie, sudo emacs /usr/include/cryptopp/eccrypto.h ).

Then, add this to the top of eccrypto.h :

#include "fhmqv.h"

And add this to the bottom of eccrypto.h :

//! Fully Hashed Menezes-Qu-Vanstone in GF(p) with key validation,
/*! <a href="http://eprint.iacr.org/2009/408">A Secure and Efficient Authenticated DiffieHellman Protocol</a>
    Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C.
*/
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption, class HASH = SHA256>
struct FHMQV
{
    typedef FHMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain;
};

Most of the other stuff in the DIFF file is not needed, like the changes to wait.h and wait.cpp . It was added to address outstanding bugs. The bugs were cleared at Crypto++ 5.6.3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM