Skip to content

openssl: Remove unneeded cast#7025

Closed
ccawley2011 wants to merge 1 commit intocurl:masterfrom
ccawley2011:hcryptprov-legacy
Closed

openssl: Remove unneeded cast#7025
ccawley2011 wants to merge 1 commit intocurl:masterfrom
ccawley2011:hcryptprov-legacy

Conversation

@ccawley2011
Copy link
Contributor

This is needed when building with older Windows toolchains.

@bagder bagder added TLS Windows Windows-specific labels May 6, 2021
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

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

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

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 commented May 8, 2021

Thanks!

@ccawley2011 ccawley2011 deleted the hcryptprov-legacy branch May 8, 2021 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TLS Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

3 participants