<div dir="ltr"><div dir="ltr">On Sun, Sep 6, 2020 at 6:55 AM Richard Levitte <<a href="mailto:levitte@openssl.org">levitte@openssl.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'd rank the algorithm name as the most important, it really can't do<br>
anything of value without it.<br></blockquote><div><br></div><div>It also cannot do anything without knowing which libctx to use. Look at the implementation.</div><div>Without the libctx there is no "from-where" to specify. </div><div><br></div><div>This is again hitting the concept of where do things come from and what is a default.</div><div>Once "global" disappears as such, logically everything comes from a libctx.</div><div><br></div><div>Your argument is basically "what" is more important than "from" or "where".</div><div>And the specific context here is where you see "from" or "where" can be defaulted to a value so it can be deduced so it isn't (as) important in the API.</div><div><br></div><div>That would basically indicate you would (applying the same pattern/rule in a different context) change:</div><div><br></div><div><i>int EVP_PKEY_get_int_param(EVP_PKEY *pkey, const char *key_name, int *out);<br></i></div><div><br></div><div>To the following (putting what you want as the most important rather than from):</div><div><br></div><div><i>int EVP_PKEY_get_int_param(char *key_name, EVP_PKEY *pkey, int *out);<br></i></div><div><br></div><div>Or pushing it right to the end after the output parameter:</div><div><br></div><div><div><i>int EVP_PKEY_get_int_param(char *key_name, int *out,EVP_PKEY *pkey);<br></i></div><div><i><br></i></div><div>The context of where things come from is actually the most critical item in any of the APIs we have.</div><div>Even though what you want to get from where you want to get it is in the point of the API call you need to specify where from first as that context sets the frame of the call.</div><div><br></div><div>Think of it around this way - we could have an implementation where we remember the last key that we have used and allow you to simply indicate you use the last key or if we didn't want the last key used to be able to specify it via a non-NULL pointer. This isn't that unusual an API but not something I'm suggesting we add - just trying to get the point across that you are still thinking of global and libctx as something super special with an exception in its handling rather than applying a general rule which is pretty much what we use everywhere else.</div><div><br></div><div>And in which case where you generally don't provide a reference as there is some default meaning for it in general and can provide a reference for that sort of API would this make sense to you:</div><div><br></div><div><div><i>int EVP_PKEY_get_int_param(char *key_name, int *out,EVP_PKEY *pkey);<br></i></div><div></div></div><div><br></div><div>If pkey is NULL then you use the last key that you referenced, if it is not then you use the specified pkey. For the application the specific key_name is the most important thing (using your argument that basically states the "what" is what counts). </div><div><br></div><div>I would suggest that you really would still want to place the EVP_PKEY first - even if you had a defaulting mechanism of referring to the last key used. Conceptually you always have to have knowledge of from-where when you are performing a function. And that *context* is what is the most important.</div><div></div></div><div><br></div><div>Tim.</div><div><br></div></div></div>