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

openssl reads cert.pem in two-byte increments on Windows #786

Open
joshcooper opened this issue Jan 30, 2024 · 3 comments
Open

openssl reads cert.pem in two-byte increments on Windows #786

joshcooper opened this issue Jan 30, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@joshcooper
Copy link
Contributor

Describe the Bug

openssl shipped in the runtime inefficiently reads cert.pem on Windows. A simple puppet --version results in 116k calls to ReadFile with a two-byte buffer as can be seen from Process Monitor:

Process Monitor

Expected Behavior

It should use buffered reads

Steps to Reproduce

Steps to reproduce the behavior:

  1. Install puppet-agent 8.4.0
  2. Start process monitor and filter on process name ruby.exe
  3. Run puppet --version

Environment

C:\ProgramData\PuppetLabs>ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw32]

C:\ProgramData\PuppetLabs>openssl version
OpenSSL 3.0.12 24 Oct 2023 (Library: OpenSSL 3.0.12 24 Oct 2023)

C:\ProgramData\PuppetLabs>puppet --version
8.4.0

Additional Context

This might be a bug in upstream openssl 3.0.x. Need to check if puppet-agent 7.x/openssl 1.1.1 has the same issue.

@joshcooper joshcooper added the bug Something isn't working label Jan 30, 2024
@joshcooper
Copy link
Contributor Author

Can be reproduced using:

#include <openssl/ssl.h>

int main(int argc, char **argv)
{
    SSL_CTX* ctx = SSL_CTX_new(TLS_client_method());
    SSL_CTX_set_default_verify_file(ctx);
    return 0;
}

OpenSSL disabled file buffering when text mode is enabled: openssl/openssl#13190

To work around an issue in the UCRT: https://developercommunity.visualstudio.com/t/fseek-ftell-fail-in-text-mode-for-unix-style-text/425878

@joshcooper
Copy link
Contributor Author

I submitted openssl/openssl#24249

@AriaXLi
Copy link
Contributor

AriaXLi commented Oct 29, 2024

New PR: openssl/openssl#25716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants