#include <qsossl.h>
SSLHandle* SSL_Create(int socket_descriptor,
int flags)
The SSL_Create() function is used by a program to enable SSL support for the specified socket descriptor.
| SSL_ENCRYPT (1<<0) | Encrypt the connection. |
| SSL_DONT_ENCRYPT (0) | Do not encrypt the connection. |
No authorization is required.
The SSL_Create() API returns a pointer to an SSLHandle. A value of NULL is returned when SSL_Create() fails. An SSLHandle is a typedef for a buffer of type struct SSLHandleStr. In <qsossl.h>, struct SSLHandleStr is defined as the following:
struct SSLHandleStr { /* SSLHandleStr */
int fd; /* Socket descriptor */
int createFlags; /* SSL_Create flags value */
unsigned protocol; /* SSL protocol version */
unsigned timeout; /* Timeout value in seconds */
unsigned char cipherKind[3]; /* Current 2.0 cipher suite*/
unsigned short int cipherSuite; /* Current 3.0 cipher suite */
unsigned short int* cipherSuiteList; /* List of cipher suites */
unsigned int cipherSuiteListLen; /* Number of entries in
the cipher suites list */
unsigned char* peerCert; /* Peer certificate */
unsigned peerCertLen; /* Peer certificate length */
int peerCertValidateRc; /* Return code from
validation of certficate */
int (*exitPgm)(struct SSLHandleStr* sslh);
/* Authentication exit
program called when a
certificate is received
during SSL handshake */
};
Note: A full explanation of each of the members of the above structure are defined in the SSL_Handshake() API description.
The SSLHandle structure returned will be initialized to hexadecimal zeros with the exception of the fd field, which will be initialized to the socket_descriptor input parameter and the createFlags field, which will be initialized to the flags input parameter.
When the SSL_Create() API fails, errno can be set to:
Operation already in progress.
Descriptor not valid.
Bad address.
Parameter not valid.
This error code indicates one of the following:
Input/output error.
There is not enough buffer space for the requested operation.
The specified descriptor does not reference a socket.
Broken pipe.
The protocol required to support the specified address family is not available at this time.
Unknown system state.
| Message ID | Error Message Text |
|---|---|
| CPE3418 E | Possible APAR condition or hardware failure. |
| CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
| CPFA081 E | Unable to set return value or error code. |
| Top | UNIX-Type APIs | APIs by category |