Skip to content
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

Fix 2054 -- missing get/set for inheritance flags #2079

Closed
wants to merge 1 commit into from
Closed

Fix 2054 -- missing get/set for inheritance flags #2079

wants to merge 1 commit into from

Conversation

richsalz
Copy link
Contributor

Fixes #2054

For 1.1.0 and then forward-pick to master.

@@ -16,7 +16,7 @@
struct X509_VERIFY_PARAM_st {
char *name;
time_t check_time; /* Time to use */
unsigned long inh_flags; /* Inheritance flags */
uint32_t inh_flags; /* Inheritance flags */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that type change important?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because "long" is a useful type in an ABI (no formal width defined). So making it uint32 is better and since the structure is opaque, I can make the change all the way back to the structure itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean "Because "long" isN'T a useful type in an ABI"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. oops. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, I'm not sure how int32_t is better unless we're talking interop between systems, i.e. that a dump of this structure could be passed between systems where the system ABI isn't the same.

It's just that it strikes me as oddly arbitrary, considering the types of the other fields in that structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppose LONG is 64 bits. Then the structure type will not match the API/ABI parameter type. And binaries will not port across.

{
param->inh_flags = flags;
return 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking the discussion here. Why is int32_t important as a flags type at all, i.e. as an input type and return type. This is really the same question I'm asking about the inh_flags field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On platforms today, a long can be 32 or 64 bits depending on the compiler flags. In order to have ABI portability across hosts with different compiler flag settings, we need to use a type that has a strictly-defined width (number of bytes). u32int is that. long isn't. Since the API is correct, might as well change the field type as well, because we can, and it avoids compile issues on places where sizeof(uint32_t) != sizeof(long). @ekasper has written about this on the team mailing list, I believe.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I get you there. However, the rest of the file is littered with long / int, and so goes for the rest of libcrypto and libssl. It strikes me as odd to do this for one arbitrary function.

I guess you and I have a different view on how to do this. I'm thinking in terms of overhauls, while this change has me guess you want to start a grassroot kinda trend.

Either way, I think I have my question answered...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't change the API now, but we can stop adding to the mistake :)

@levitte
Copy link
Member

levitte commented Dec 13, 2016

Just to be safe, I'll do a VMS build on this... just to make sure we don't forget to include some needed header file.

If B<X509_VP_FLAG_LOCKED> is set then no values are copied.

If B<X509_VP_FLAG_ONCE> is set then the current setting is zeroed
after the next call.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these flags all mutually exclusive? If not, which ones are and how do they interact?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated commit pushed to answer this.

levitte pushed a commit that referenced this pull request Dec 13, 2016
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #2079)
levitte pushed a commit that referenced this pull request Dec 13, 2016
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #2079)
@richsalz
Copy link
Contributor Author

commit a47bc28 in master and 6212179 in 1.1.0. Thanks.

@richsalz richsalz closed this Dec 13, 2016
@richsalz richsalz deleted the gh2054 branch December 22, 2016 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants