(SSLConnectionRef)(long)sockfd
works and should be safe as long as sizeof(void*) > sizeof(int)
which is true for all current compilers, but not necessarily guaranteed.
Another approach would be to temporarily disable the warning:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wint-to-point-cast"
SSLSetConnection(sslContext, (SSLConnectionRef)sockfd);
#pragma clang diagnostic pop
Ultimately, the "right" solution would be to actually pass in a pointer to an integer that you allocate via malloc or some other scheme. If this is all in an object, store the fd in an instance variable and pass in &_sockfd;