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

PEM_write_TYPE() wrong return value in man-pages #20218

Closed
devio opened this issue Feb 5, 2023 · 8 comments
Closed

PEM_write_TYPE() wrong return value in man-pages #20218

devio opened this issue Feb 5, 2023 · 8 comments
Labels
branch: master Merge to master branch branch: 1.1.1 Merge to OpenSSL_1_1_1-stable branch branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 good first issue Bite size change that could be a good start help wanted triaged: documentation The issue/pr deals with documentation (errors)

Comments

@devio
Copy link

devio commented Feb 5, 2023

Affected:

  • openssl 1.1.1s
  • openssl 3.0.7

Example: https://www.openssl.org/docs/man3.0/man3/PEM_write_bio_ECPrivateKey.html

[...]
PEM_write_TYPE() and PEM_write_bio_TYPE() return the number of bytes written or zero on error.
[...]

Actually this is wrong. For example, PEM_write_bio_ECPrivateKey is implemented using macros (see include/openssl/pem.h:133 for openssl 1.1.1s. The macro returns PEM_ASN1_write_bio(...) which is implemented in crypto/pem/pem_lib.c but returns 1 on success, and 0 on error. Length of data is never returned back to the caller.

This probably affects all PEM_write_TYPE() functions.

@devio devio added the issue: documentation The issue reports errors in (or missing) documentation label Feb 5, 2023
@paulidale paulidale added branch: master Merge to master branch branch: 1.1.1 Merge to OpenSSL_1_1_1-stable branch good first issue Bite size change that could be a good start help wanted triaged: documentation The issue/pr deals with documentation (errors) branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 and removed issue: documentation The issue reports errors in (or missing) documentation labels Feb 6, 2023
@LingkKang
Copy link

@paulidale Hi, can I work on this as my first contribution to open source?

@t8m
Copy link
Member

t8m commented Feb 13, 2023

@paulidale Hi, can I work on this as my first contribution to open source?

Sure, just submit a PR, please

@blazmonster
Copy link
Contributor

Hi, can I work on this if nobody is working ? I will wait for response for few hours.

@LingkKang
Copy link

@blazmonster Hi, can you find where this sentence is written in this repo?

PEM_write_TYPE() and PEM_write_bio_TYPE() return the number of bytes written or zero on error.

I went through the doc folder and tried to search but did not find it.

Other functions' doc are correctly stated in the repo. For example doc of PEM_write_bio_CMS_stream gives that 'returns 1 for success or 0 for failure.'

I'm not sure there anything I missed or not.

@mattcaswell
Copy link
Member

@paulidale Hi, can I work on this as my first contribution to open source?

Please feel free to do so.

@Anis-cpu-13
Copy link
Contributor

Hello, this issue is Always open, i would like work on this

@paulidale
Copy link
Contributor

Feel free to work on this.

@blazmonster
Copy link
Contributor

@LingkKang
We can find the description (about PEM_write_TYPE() and PEM_write_bio_TYPE() return the number of bytes written or zero on error) in following link.
https://github.com/openssl/openssl/blob/OpenSSL_1_1_1s/doc/man3/PEM_read_CMS.pod

you can find some hint from https://www.openssl.org/docs/man1.1.1/man3/PEM_write_bio_ECPrivateKey.html.

openssl-machine pushed a commit that referenced this issue Apr 11, 2023
…man-pages.

Fixes #20218

CLA: trivial

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #20673)

(cherry picked from commit dfb8e18)
openssl-machine pushed a commit that referenced this issue Apr 11, 2023
…man-pages.

Fixes #20218

CLA: trivial

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #20673)

(cherry picked from commit dfb8e18)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch: master Merge to master branch branch: 1.1.1 Merge to OpenSSL_1_1_1-stable branch branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 good first issue Bite size change that could be a good start help wanted triaged: documentation The issue/pr deals with documentation (errors)
Projects
None yet
Development

No branches or pull requests

7 participants