Skip to content

Fix the converters between the old and new BIO_read functions to handle end-of-file properly.#29290

Closed
igus68 wants to merge 1 commit intoopenssl:masterfrom
igus68:project-1745
Closed

Fix the converters between the old and new BIO_read functions to handle end-of-file properly.#29290
igus68 wants to merge 1 commit intoopenssl:masterfrom
igus68:project-1745

Conversation

@igus68
Copy link
Copy Markdown
Contributor

@igus68 igus68 commented Dec 2, 2025

Fixes openssl/project#1745

Checklist
  • documentation is added or updated
  • tests are added or updated

@igus68 igus68 added backlog fix The issue was closed as part of the backlog reduction initiative. branch: master Applies to master branch labels Dec 2, 2025
@igus68 igus68 added branch: 3.0 Applies to openssl-3.0 branch branch: 3.3 Applies to openssl-3.3 (EOL) branch: 3.4 Applies to openssl-3.4 branch: 3.5 Applies to openssl-3.5 branch: 3.6 Applies to openssl-3.6 labels Dec 2, 2025
@igus68 igus68 closed this Dec 2, 2025
@igus68 igus68 reopened this Dec 2, 2025
@t8m t8m added the triaged: bug The issue/pr is/fixes a bug label Dec 2, 2025
Comment thread crypto/bio/bio_lib.c Outdated
Comment on lines +257 to +258
* This is essentially the same as BIO_read_ex() except that it allows
* 0 or a negative value to indicate failure (retryable or not) in the return.
* This is essentially the same as BIO_read_ex() except that it returns 0 in
* case of EOF and a negative value to indicate failure (retryable or not).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really wonder if the original comment was not trying to say that 0 is retryable error and negative return is not. However it is really undocumented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implementation of BIO_read() definitely relies on the return values of bio_read_intern() described in my version of this comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is a very poor description of an internal function to compare it to a public function which is implemented by it. Could we rewrite it properly saying what the internal function itself does?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've tried to rewrite it in the proper way.

Comment thread doc/man3/BIO_meth_new.pod Outdated
Functions set by BIO_meth_set_write_ex(), BIO_meth_set_write(),
BIO_meth_set_read_ex() and BIO_meth_set_read() must call BIO_set_flags() to
set the BIO_FLAGS_SHOULD_RETRY flag in relevant situations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Superfluous empty line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@t8m t8m added approval: review pending This pull request needs review by a committer tests: present The PR has suitable tests present labels Dec 3, 2025
@t8m t8m requested review from a team and t8m December 3, 2025 14:37
@t8m
Copy link
Copy Markdown
Member

t8m commented Dec 11, 2025

This needs to be rebased after the reformat

@igus68
Copy link
Copy Markdown
Contributor Author

igus68 commented Dec 12, 2025

Rebased

t8m
t8m previously approved these changes Dec 12, 2025
@t8m t8m requested review from a team and jogme December 12, 2025 18:42
@t8m
Copy link
Copy Markdown
Member

t8m commented Dec 15, 2025

ping @openssl/committers for the second review

@igus68 igus68 marked this pull request as draft December 15, 2025 14:50
@igus68
Copy link
Copy Markdown
Contributor Author

igus68 commented Dec 15, 2025

There are some considerations in the comment #8208 (comment) that may cause a redesign of this solution, so I've converted this PR to a draft.

t8m
t8m previously approved these changes Jan 8, 2026
@t8m t8m requested a review from mattcaswell January 8, 2026 07:52
@t8m
Copy link
Copy Markdown
Member

t8m commented Jan 13, 2026

@mattcaswell please re-review

@igus68
Copy link
Copy Markdown
Contributor Author

igus68 commented Jan 21, 2026

CI claims that BIO_eof() should be mentioned in CHANGES.md as a new function. I'm not sure it is really needed in case of converting a macro into a function.

@t8m t8m requested a review from a team January 21, 2026 16:50
@t8m
Copy link
Copy Markdown
Member

t8m commented Jan 28, 2026

ping @openssl/committers for second review

@t8m t8m moved this to Waiting Review in Development Board Feb 9, 2026
@github-project-automation github-project-automation Bot moved this from Waiting Review to Waiting Merge in Development Board Feb 10, 2026
@mattcaswell mattcaswell added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Feb 10, 2026
@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Feb 11, 2026
@openssl-machine
Copy link
Copy Markdown
Collaborator

This pull request is ready to merge

openssl-machine pushed a commit that referenced this pull request Feb 12, 2026
end-of-file state properly.

Related to openssl/project#1745

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Thu Feb 12 08:34:31 2026
(Merged from #29290)
@jogme
Copy link
Copy Markdown
Contributor

jogme commented Feb 12, 2026

Merged to master as be42447. Thank you!

@jogme jogme closed this Feb 12, 2026
@github-project-automation github-project-automation Bot moved this from Waiting Merge to Done in Development Board Feb 12, 2026
bob-beck pushed a commit to bob-beck/openssl that referenced this pull request Feb 24, 2026
end-of-file state properly.

Related to openssl/project#1745

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
MergeDate: Thu Feb 12 08:34:31 2026
(Merged from openssl#29290)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge backlog fix The issue was closed as part of the backlog reduction initiative. branch: master Applies to master branch severity: ABI change This pull request contains ABI changes severity: fips change The pull request changes FIPS provider sources tests: present The PR has suitable tests present triaged: bug The issue/pr is/fixes a bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Fix the converters (bread_conv and bio_read_intern)

5 participants