New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X509_STORE_CTX accessors. #1044
Conversation
@@ -294,25 +294,22 @@ X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) | |||
} | |||
} | |||
|
|||
X509_OBJECT *X509_STORE_get_X509_by_subject(X509_STORE_CTX *vs, int type, | |||
X509_NAME *name) | |||
X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, int type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the prefix from X509_STORE_CTX_
to X509_STORE_
. You're not manipulating the ctx, nor are you retrieving values from it, you'r just using it to get information from the associated store, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the arg is a store_ctx and so it's an operation on the STORE_CTX. the old name exists in the compatibility section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(never mind)
If the functions take an X509_STORE_CTX as the first argument then they really should actually be named with X509_STORE_CTX as the prefix - so I guess @levitte and I have a different view on this one. |
@@ -525,27 +526,28 @@ STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v) | |||
return v->objs; | |||
} | |||
|
|||
STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm) | |||
STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing above. it's like having an RSA function take a PKEY parameter :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(never mind)
I've love to hear the reasoning for having |
I think BN API's that don't take a BN are misnamed :) |
Add some functions that were missing when a number of X509 objects became opaque (thanks, Roumen!)
And I could not find an |
First argument? What does that have to do with anything? The difference as I see it is if the function's main task is to manipulate the context variable or merely use it. |
The context is opaque. I have no idea what the function is doing :) |
For the record, DrH agrees with @richsalz . |
okay, so ... plus-one anyone? |
X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE); | ||
return 0; | ||
} | ||
obj = X509_OBJECT_new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for NULL
Last remarks, this is not entirely plusone-ready |
pushed new commit to address your feedback, @levitte |
if (obj == NULL) { | ||
X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE); | ||
obj = X509_OBJECT_new(); | ||
if (obj == NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, sometimes this functions adds an error code on error, and sometimes not? That's not consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The X509_STORE_new sets an error code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Ok.
{ | ||
int i, idx, cnt; | ||
STACK_OF(X509) *sk; | ||
STACK_OF(X509) *sk = sk_X509_new_null(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, considering how it's used, I would initialise sk
to NULL
here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and do the allocation just before the for
loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. pushing new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you pushed yet? Can't see the change...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! I did "push gitlab" not "github" :)
Awright, I'm satisfied. |
I suggest waiting for Travis and Appveyor before merging |
Travis seems happy |
done. |
Add some functions that were missing when a number of X509
objects became opaque (thanks, Roumen!)