Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

eerhardt
Copy link
Member

Add shims for the next set of SSL interop methods.
I also moved the SSL SafeHandle classes out of the Interop class to be
better aligned with the rest of the SafeHandles.

Instead of having managed code duplicate the SSL_CIPHER struct, moving all the code that uses the cipher struct into a native shim method.

That also pulled a lot of algorithm constants to be defined in native instead of managed.

@bartonjs @stephentoub @vijaykota @rajansingh10 @shrutigarg @nguerrera

Copy link
Contributor

Choose a reason for hiding this comment

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

Doubt: Doesn't this macro already exist in ssl header files?

Copy link
Member

Choose a reason for hiding this comment

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

I'm equally confused. I see this for 0.9.8zg in ssl_locl.h. If that's not automatically in the include chain, should we just include it? At least for the 0.9.8 series?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, these values are in the source file ssl_locl.h. But neither that file nor those defines appear anywhere in the header files on my Mac.
Any suggestions?

Copy link
Member

Choose a reason for hiding this comment

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

neither that file nor those defines appear anywhere in the header files on my Mac.

Ah, well, that's a good enough reason for me :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree.. sounds reasonable to me. We had same problem with some other macros that are only available in the source code but not in public headers

@vijaykota
Copy link
Contributor

LGTM

Copy link
Member

Choose a reason for hiding this comment

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

Do we expose these two ErrGetError and ErrGetErrorAlloc APIs because the only error code we need to know about is ERR_R_MALLOC_FAILURE, and this is a simpler approach than PAL'ing all error codes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the MALLOC_FAILURE is the only error code we needed to know about. When we need to know about more, we can make a PAL enum for it.

@stephentoub
Copy link
Member

LGTM

Copy link
Member

Choose a reason for hiding this comment

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

Casing consistency: Everything else was "Ssl", this is "SSL"

Copy link
Member Author

Choose a reason for hiding this comment

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

Will fix.

@bartonjs
Copy link
Member

A few minor points, but otherwise LGTM.

Copy link
Contributor

Choose a reason for hiding this comment

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

The declarations in the .h should be things that managed code can depend on unconditionally. There shouldn't be ifdefs changing enum values. If these are only used in the implementation and not expected to be known values to managed code, move them to the .cpp.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense. I'll move them to the .cpp as these values are only used by the native code, and not managed.

@eerhardt
Copy link
Member Author

I don't have problem switching to def/undef, but we should be consisten throughout.
This was easier to audit when we had everything in configure.cmake and pal_config.h.in with the same #cmakedefine01 mechanic.

I am actively working on this in a separate change (now that I am understanding CMake a little more...). I plan on using #cmakedefin01, configure.cmake, config.h.in, like the existing files. These will be in separate, Crypto specific files.

@nguerrera
Copy link
Contributor

I am actively working on this in a separate change.

Thanks. :)

@stephentoub
Copy link
Member

@eerhardt, just FYI, this needs to be rebased to fix conflicts.

I also moved the SSL SafeHandle classes out of the Interop class to be
better aligned with the rest of the SafeHandles.
Instead of having managed code duplicate the SSL_CIPHER struct, moving all the code that uses the cipher struct into a native shim method.

That also pulled a lot of algorithm constants to be defined in native instead of managed.
@eerhardt
Copy link
Member Author

Rebased and responded to PR feedback.

Copy link
Contributor

Choose a reason for hiding this comment

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

General question: why do we have to hard-code these constants? Can't we get them from openssl headers? What guarantees/checks do we have to make sure they're right?

Copy link
Member Author

Choose a reason for hiding this comment

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

See #4026 (comment)

Honestly AFAIK, there isn't a way to check/guarantee these values since they aren't defined in headers on either my Linux or OSX machine. I sort of question whether what we are using is a "public" API. The struct is visible, but it just exposes unsigned long members with no exposed defines for their values.

Copy link
Member Author

Choose a reason for hiding this comment

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

@vijaykota and @shrutigarg - do you have any ideas on this issue?

Copy link
Member

Choose a reason for hiding this comment

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

I'm going to go ahead and merge this. If there's a better way to approach this, we can do it in a separate PR. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Hey guys, maybe not exactly relevant to this discussion, but I upgraded a new mac as is to El Capitan (v10.11.1) and it wasn't succeeding git clean -xdf; ./build.sh native with latest AppleClang / Xcode (yesterday's updates) applied. I had to run brew link --force openssl (yeah i had to install brew first). Now it compiles 100% there as well. (more and moar platforms coverage is the spirit!) :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, @jasonwilliams200OK . See #3924 for more details on issues with El Capitan.

Copy link
Contributor

Choose a reason for hiding this comment

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

since they aren't defined in headers on either my Linux or OSX machine

@eerhardt, we haven't found a way around this either

@nguerrera
Copy link
Contributor

LGTM. I had one more question.

@stephentoub
Copy link
Member

LGTM

stephentoub added a commit that referenced this pull request Oct 22, 2015
@stephentoub stephentoub merged commit 00f9ebc into dotnet:master Oct 22, 2015
@eerhardt eerhardt deleted the MoreLibSsl branch October 22, 2015 15:09
eerhardt referenced this pull request in eerhardt/corefx Oct 27, 2015
…to getdomainname and looking for a warning.

Fixing unused parameters build error on OSX.

Update for PR feedback.
- Collapse the 3 HAVE_INOTIFY defines into a single define.
@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants