krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
910 stars 336 forks source link

SPM usage and headers #101

Closed mallorypaine closed 3 years ago

mallorypaine commented 3 years ago

Apologies for the extremely noob question. I've added your OpenSSL as a package (via Swift Package Manager) to a project I'm working on, but I am having trouble getting the project to be able to find the headers inside the xcframework. I've spent the morning googling without success. How can I get my project to be able to see these headers?

I'm seeing build errors about BIGNUM not found in scope. In the C headers, it looks like BIGNUM is defined in ossl_type.h, and if I view the equivalent swift interface for OpenSSL.ossl_typ, I don't find it there. I'm probably missing something really silly. Thanks for your help.

krzyzanowskim commented 3 years ago

you have a good point here. ossl_type.h is missing in the module umbrella header https://github.com/krzyzanowskim/OpenSSL/blob/master/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s/OpenSSL.framework/Headers/OpenSSL.h

krzyzanowskim commented 3 years ago

no, wait a minute, there's no ossl_type.h because there's openssl_typ.h and that is correct

mallorypaine commented 3 years ago

https://github.com/krzyzanowskim/OpenSSL/blob/master/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s/OpenSSL.framework/Headers/OpenSSL.h#L73

the header is in the umbrella header on line 73. i'm still not sure why BIGNUM doesn't end up being visible to my project.

krzyzanowskim commented 3 years ago

Ok, it looks like It's OpenSSL 1.1.x thing

From OpenSSL project NEWS, probably because of that:

Major changes between OpenSSL 1.0.2h and OpenSSL 1.1.0 [25 Aug 2016]

o Most libcrypto and libssl public structures were made opaque, including: BIGNUM and associated types, EC_KEY and EC_KEY_METHOD, DH and DH_METHOD, DSA and DSA_METHOD, RSA and RSA_METHOD, BIO and BIO_METHOD, EVP_MD_CTX, EVP_MD, EVP_CIPHER_CTX, EVP_CIPHER, EVP_PKEY and associated types, HMAC_CTX, X509, X509_CRL, X509_OBJECT, X509_STORE_CTX, X509_STORE, X509_LOOKUP, X509_LOOKUP_METHOD

So we have a definition, without implementation:

typedef struct bignum_st BIGNUM;

but bitnum_st is not in public headers (it's in bn_local.h that is private)