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
Move definition of BIO_FLAGS_UPLINK completely to bio.h #7307
Move definition of BIO_FLAGS_UPLINK completely to bio.h #7307
Conversation
This is really an internal macro. The right move is to make it completely internal, which is the contrary of what you do here. |
Hmm... |
I think it should have a fixed value, not a variable one. Grepping the source, I see the following in bio_lcl.h:
So it looks like the only obstacle for making that constant really constant is that it is (mis-)used for short-circuiting the applink calls. I recall that @dot-asm made some comment recently about short-circuiting in certain circumstances and that it doesn't work correctly anymore. But I don't recall the details and didn't find the location. So maybe we should consult @dot-asm, he seems to be the only one who fully understands the applink beast... |
And I agree with @levitte that it should not appear in public headers. |
I found it: #7054 (comment) |
If that helps, the public header could define BIO_FLAGS_UPLINK = 0, |
and rename the internally used macro to BIO_FLAGS_UPLINK_INTERNAL. [extended tests]
224c793
to
dcbae40
Compare
crypto/bio/bss_file.c
Outdated
ret = UP_fread(out, 1, (int)outl, b->ptr); | ||
else | ||
ret = fread(out, 1, (int)outl, (FILE *)b->ptr); | ||
if (ret == 0 | ||
&& (b->flags & BIO_FLAGS_UPLINK) ? UP_ferror((FILE *)b->ptr) : | ||
ferror((FILE *)b->ptr)) { | ||
&& (b->flags & BIO_FLAGS_UPLINK_INTERNAL) |
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.
Funny, I think the brackets are misplaced here.
isn't this effectively if ( (ret == 0 && b->flags & BIO_FLAGS_UPLINK) ? UP_ferror (b->ptr) : ferror(b->ptr) ) {
That's what Pauli told me to do in a similar situation: |
[extended tests]
I see no reason to rename it internally, just deprecate it publically. |
The reason is that BIO_FLAGS_UPLINK is defined as 0 when only bio.h is included |
Ah, so it's to ensure that none of our code uses the |
and rename the internally used macro to BIO_FLAGS_UPLINK_INTERNAL. Deprecate the externally visible definition of BIO_FLAGS_UPLINK. Backport of openssl#7307 to 110 [extended tests]
and rename the internally used macro to BIO_FLAGS_UPLINK_INTERNAL. Backport of openssl#7307 to 110 [extended tests]
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.
Looks ok. Needs second review from @openssl/omc
[extended tests]
&& (b->flags & BIO_FLAGS_UPLINK) ? UP_ferror((FILE *)b->ptr) : | ||
ferror((FILE *)b->ptr)) { | ||
&& (b->flags & BIO_FLAGS_UPLINK_INTERNAL | ||
? UP_ferror((FILE *)b->ptr) : ferror((FILE *)b->ptr))) { |
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.
Hmm, actually, this is a bug-fix.
ping? |
Merged to master as b113279. Thanks! |
and rename the internally used macro to BIO_FLAGS_UPLINK_INTERNAL. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from #7307)
Move definition of BIO_FLAGS_UPLINK to bio.h