On reference counting keydata returned from keymgmt_load()

Selva Nair selva.nair at gmail.com
Tue Sep 14 02:08:41 UTC 2021


Hi,

When an EVP_PKEY is created with some custom data, provider's
keymgmt_load() gets called. I want to keep a reference count on the keydata
returned from it. But there is no call to keymgmt_free() or anything
similar when the EVP_PKEY is freed. How does one keep track of references
to keydata? I have something like:

OSSL_STORE_open_ex(my_custom_uri, libctx, props,....)

while (!OSSL_STORE_eof(ctx)) {
        OSSL_STORE_INFO *info = OSSL_STORE_load(ctx);
        switch(OSSL_STORE_INFO_get_type(info)) {
        case OSSL_STORE_INFO_PKEY:
            pkey = OSSL_STORE_INFO_get0_PKEY(info);
                        (tried .._get1_PKEY(info) as well).
            ....

The pkey seems to be correctly constructed with a call to my keymgmt_load()
where I construct keydata from the passed in reference.

On duplicating the key I do see calls to keymgmt_dup() and a matching
keymgmt_free() (when the key is freed), so that part is good.

I'm still figuring out the new interface and likely doing something wrong.

Thanks,

Selva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20210913/2b3e450b/attachment.html>


More information about the openssl-users mailing list