oqs-provider: Loading oqsprovider fails via API load under Windows

I am trying to load the oqsprovider via code under Windows since loading the provider over the openssl config is not an option for me. The oqsprovider.dll file is located in D:\projects\certificate_scripts. When running the following commands

OSSL_PROVIDER_set_default_search_path(NULL, "D:\\projects\\certificate_scripts");
auto path = OSSL_PROVIDER_get0_default_search_path(NULL);
auto loaded = OSSL_PROVIDER_load(NULL, "oqsprovider");

path is set correctly, however, loaded is NULL, which indicates that the provider was not successfully loaded.

When printing out the error with

  int err = ERR_get_error();
  char buf[256];
  ERR_error_string_n(err, buf, sizeof(buf));

it says error:078C0105:common libcrypto routines::init fail.

Am I missing something here? I am grateful for every kind of input.

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Thank you very much @baentsch for the quick fixing of the issue.

You’re welcome. Thanks in turn for raising it and helping getting to the cause of this. Made the software a bit better… I hope – could you confirm your issue is truly resolved?

I’m afraid then there’s no way around asking for help from the (Windows) OpenSSL community. Please post a link here when you have opened an issue (or reference this issue) so we can learn the resolution as and when available.

This works like a charm under Linux:

$ cat test.c
#include <openssl/conf.h>
#include <openssl/provider.h>

int main()
{
    OSSL_LIB_CTX* libctx = OSSL_LIB_CTX_new();
    OSSL_PROVIDER_set_default_search_path(libctx, "_build/lib");     // path is set to location of oqsprovider.dll
    printf("load default result: %p\n", OSSL_PROVIDER_load(libctx, "default"));
    printf("load oqsprovider result: %p\n", OSSL_PROVIDER_load(libctx, "oqsprovider"));
}


$ gcc test.c -lcrypto
$ ./a.out 
load default result: 0x55fa28183d50
load oqsprovider result: 0x55fa281846b0