Re: Provider: cannot sign with ed25519-like key

Matt Caswell <[email protected]>
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>

On 12/08/2024 11:08, 'Bernd Ritter' via openssl-users wrote:
> I do not understand how the parameter list can change? As my debugging 
> logs are called, it seems that my get_params is called accordingly.
>

I don't really understand what you mean by this. Each invocation of your 
get_params function may request different parameters depending on which 
parameters the caller is interested in for any given context.

As I previously mentioned the "unknown max size" error comes from the 
EVP_PKEY_get_size() function, and this ultimately gets the size by 
querying the OSSL_PKEY_PARAM_MAX_SIZE parameter.

The value of this parameter is cached in the pkey. This happens here in 
OpenSSL:

https://github.com/openssl/openssl/blob/2f33265039cdbd0e4589c80970e02e208f3f94d2/crypto/evp/keymgmt_lib.c#L289-L313

This is the point in libcrypto where your provider is called and the 
OSSL_PKEY_PARAM_MAX_SIZE parameter is queried - the result of which is 
cached in the cache.size field of the pkey. All subsequent calls to 
`EVP_PEKY_get_size()` will refer to this cache and give the "unknown 
max_size" error if this cached size is <= 0.

If you are struggling to see how this fits together with what your code 
is doing then I suggest you build OpenSSL with debug symbols on and set 
a breakpoint in the `evp_keymgmt_util_cache_keyinfo` function I linked 
to above and step through what is happening in the interaction with your 
provider.

Matt

-- 
You received this message because you are subscribed to the Google Groups "openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion on the web visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/8e71dff1-e770-4d25-96a0-9642a3143e86%40openssl.org.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.