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: Remove unneeded cast #7025

Closed
wants to merge 1 commit into from

Conversation

ccawley2011
Copy link
Contributor

@ccawley2011 ccawley2011 commented May 6, 2021

This is needed when building with older Windows toolchains.

ebejan
ebejan approved these changes May 6, 2021
@bagder bagder added TLS Windows labels May 6, 2021
@@ -2888,8 +2888,7 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
if((SSL_CONN_CONFIG(verifypeer) || SSL_CONN_CONFIG(verifyhost)) &&
(SSL_SET_OPTION(native_ca_store))) {
X509_STORE *store = SSL_CTX_get_cert_store(backend->ctx);
HCERTSTORE hStore = CertOpenSystemStore((HCRYPTPROV_LEGACY)NULL,
TEXT("ROOT"));
HCERTSTORE hStore = CertOpenSystemStore(0, TEXT("ROOT"));
Copy link
Member

@bagder bagder May 7, 2021

Choose a reason for hiding this comment

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

This is curious I think as the docs says:

This parameter is not used and should be set to NULL

So, the removed typecast is one thing but is this a pointer or not a pointer?

Copy link
Contributor Author

@ccawley2011 ccawley2011 May 7, 2021

Choose a reason for hiding this comment

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

HCRYPTPROV_LEGACY is a typedef for ULONG_PTR, which is an integer type that's the size of a pointer, so it seems to make more sense to use 0 instead.

Copy link
Member

@bagder bagder May 7, 2021

Choose a reason for hiding this comment

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

Wait, ULONG_PTR is not a pointer? I just have to double-check this!

Copy link
Member

@bagder bagder May 7, 2021

Choose a reason for hiding this comment

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

If it is an integer with the size of a pointer, that's 64 bit on modern systems, while 0 will be a 32 bit integer, then shouldn't it be casted to 64 bit sized integer?

Update: nah, that shouldn't be necessary.

@bagder bagder closed this in 3f25c01 May 8, 2021
@bagder
Copy link
Member

@bagder bagder commented May 8, 2021

Thanks!

@ccawley2011 ccawley2011 deleted the hcryptprov-legacy branch May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TLS Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants