How to get NID value of a custom provider

Hareesh Das Ulleri hareesh.ulleri at
Mon Apr 3 01:45:30 UTC 2023

Dear OpenSSL users,

  I am reposting my previous mail with what exactly my intention since it older post might be confused.

  I have my custom provider which support for HSM encryption on AES, DES. When an application uses the custom provider, it has to pass the respective cryption mode to driver.

  Can someone tell me how the custom provider get the nid value (or the cryption mode) from OpenSSL library (pls correct me if this is not the correct way !) ? Any hint is highly appreciated.

I tried below way, not sure correct way or not...but not successful.

  const EVP_CIPHER * evp = EVP_CIPHER_CTX_get0_cipher(custom_provider_ctx);
  int mode = EVP_CIPHER_get_nid(evp);


From: Hareesh Das Ulleri
Sent: Friday, March 31, 2023 2:37 PM
To: openssl-users at
Subject: Help needed: "setting OSSL_PARAM Param[] values"

Dear OpenSSL users,

  I have implemented a custom provider (OpenSSL 3.0.7) and its working when I hardcode with specific Cipher and blocksize in provider. I need to get this info from the application so that it can be settable in the custom provider. I have the function implemented for OSSL_FUNC_cipher_gettable_params, ... _get_ctx_params and _set_ctx_params etc in my provider.

  I tested with openssl command line utility program (e.g. openssl enc -cipher -aes-256-ctr -in in.bin -out out.bin -K ... -iv ... -nopad).  What I expect here or my understanding is openssl will pass or call the cipher operation parameters function in the custom provider so that it can set these values internally.

  Any help will appreciate if someone can give hint on what is missing here or needed to set cipher operation parameters !

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the openssl-users mailing list