Problem in trying EVP Key Derivation example in openssl

Matt Caswell matt at openssl.org
Mon Sep 16 07:47:58 UTC 2019



On 14/09/2019 22:28, Bhuvan Sharma wrote:
> Hey all,
> I'm new to openssl community and I don't know much about it. I tried to use
> openssl on my linux machine. I clone openssl git repo and executed these
> commands as mentioned in the file "INSTALL": "./config", "make", "make test",
> "make install". It went alright. Then I tried an "EVP KEY Derivation" example
> from this

Please note that the KDF API is only in the dev version of OpenSSL so the API is
not yet stable. For stable versions you have to use the older EVP_PKEY_dervie APIs.

Matt


> link: https://wiki.openssl.org/index.php?title=EVP_Key_Derivation&redirect=no#targetText=HKDF%20was%20designed%20by%20Krawczyk,from%20the%20OpenSSL%20man%20pages.
> But it gives me some error for undeclared function. 
> ~/openssl$ gcc -std=c99 test.c -o test.exe -l:libcrypto.a -pthread -ldl
> test.c: In function ‘main’:
> test.c:12:17: warning: implicit declaration of function ‘EVP_KDF_CTX_new_id’;
> did you mean ‘EVP_KDF_CTX_new’? [-Wimplicit-function-declaration]
>      if ((kctx = EVP_KDF_CTX_new_id(EVP_KDF_HKDF)) == NULL) {
>                  ^~~~~~~~~~~~~~~~~~
>                  EVP_KDF_CTX_new
> test.c:12:36: error: ‘EVP_KDF_HKDF’ undeclared (first use in this function); did
> you mean ‘EVP_PKEY_HKDF’?
>      if ((kctx = EVP_KDF_CTX_new_id(EVP_KDF_HKDF)) == NULL) {
>                                     ^~~~~~~~~~~~
>                                     EVP_PKEY_HKDF
> test.c:12:36: note: each undeclared identifier is reported only once for each
> function it appears in
> test.c:13:9: warning: implicit declaration of function ‘error’; did you mean
> ‘perror’? [-Wimplicit-function-declaration]
>          error("EVP_KDF_CTX_new_id");
>          ^~~~~
>          perror
> test.c:15:9: warning: implicit declaration of function ‘EVP_KDF_ctrl’; did you
> mean ‘EVP_KDF_size’? [-Wimplicit-function-declaration]
>      if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_MD, EVP_sha256()) <= 0) {
>          ^~~~~~~~~~~~
>          EVP_KDF_size
> 
> Is there any problem with the installation or am I missing something else?
> Your help is much appreciated.
> 
> Thanks & Regards,
> Bhuvan Sharma


More information about the openssl-users mailing list