📄 ssl.h
字号:
long verify_result; /* only for servers */ int references; long timeout; long time; int compress_meth; /* Need to lookup the method */ SSL_CIPHER *cipher; unsigned long cipher_id; /* when ASN.1 loaded, this * needs to be used to load * the 'cipher' structure */ STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */ CRYPTO_EX_DATA ex_data; /* application specific data */ /* These are used to make removal of session-ids more * efficient and to implement a maximum cache size. */ struct ssl_session_st *prev,*next; } SSL_SESSION;#define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L#define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x00000040L#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L#define SSL_OP_TLS_D5_BUG 0x00000100L#define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L#define SSL_OP_TLS_ROLLBACK_BUG 0x00000400L/* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added * in OpenSSL 0.9.6d. Usually (depending on the application protocol) * the workaround is not needed. Unfortunately some broken SSL/TLS * implementations cannot handle it at all, which is why we include * it in SSL_OP_ALL. */#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800L /* added in 0.9.6e *//* SSL_OP_ALL: various bug workarounds that should be rather harmless */#define SSL_OP_ALL 0x000FFFFFL/* If set, always create a new key when using tmp_dh parameters */#define SSL_OP_SINGLE_DH_USE 0x00100000L/* Set to also use the tmp_rsa key when doing RSA operations. */#define SSL_OP_EPHEMERAL_RSA 0x00200000L#define SSL_OP_NO_SSLv2 0x01000000L#define SSL_OP_NO_SSLv3 0x02000000L#define SSL_OP_NO_TLSv1 0x04000000L/* The next flag deliberately changes the ciphertest, this is a check * for the PKCS#1 attack */#define SSL_OP_PKCS1_CHECK_1 0x08000000L#define SSL_OP_PKCS1_CHECK_2 0x10000000L#define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L/* SSL_OP_NON_EXPORT_FIRST looks utterly broken .. */#define SSL_OP_NON_EXPORT_FIRST 0x40000000L#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x80000000L/* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success * when just a single record has been written): */#define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L/* Make it possible to retry SSL_write() with changed buffer location * (buffer contents must stay the same!); this is not the default to avoid * the misconception that non-blocking SSL_write() behaves like * non-blocking write(): */#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L/* Never bother the application with retries if the transport * is blocking: */#define SSL_MODE_AUTO_RETRY 0x00000004L/* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, * they cannot be used to clear bits. */#define SSL_CTX_set_options(ctx,op) \ SSL_CTX_ctrl(ctx,SSL_CTRL_OPTIONS,op,NULL)#define SSL_CTX_get_options(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_OPTIONS,0,NULL)#define SSL_set_options(ssl,op) \ SSL_ctrl(ssl,SSL_CTRL_OPTIONS,op,NULL)#define SSL_get_options(ssl) \ SSL_ctrl(ssl,SSL_CTRL_OPTIONS,0,NULL)#define SSL_CTX_set_mode(ctx,op) \ SSL_CTX_ctrl(ctx,SSL_CTRL_MODE,op,NULL)#define SSL_CTX_get_mode(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_MODE,0,NULL)#define SSL_set_mode(ssl,op) \ SSL_ctrl(ssl,SSL_CTRL_MODE,op,NULL)#define SSL_get_mode(ssl) \ SSL_ctrl(ssl,SSL_CTRL_MODE,0,NULL)#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20)typedef struct ssl_comp_st { int id; char *name;#ifndef NO_COMP COMP_METHOD *method;#else char *method;#endif } SSL_COMP;DECLARE_STACK_OF(SSL_COMP)struct ssl_ctx_st { SSL_METHOD *method; unsigned long options; unsigned long mode; STACK_OF(SSL_CIPHER) *cipher_list; /* same as above but sorted for lookup */ STACK_OF(SSL_CIPHER) *cipher_list_by_id; struct x509_store_st /* X509_STORE */ *cert_store; struct lhash_st /* LHASH */ *sessions; /* a set of SSL_SESSIONs */ /* Most session-ids that will be cached, default is * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */ unsigned long session_cache_size; struct ssl_session_st *session_cache_head; struct ssl_session_st *session_cache_tail; /* This can have one of 2 values, ored together, * SSL_SESS_CACHE_CLIENT, * SSL_SESS_CACHE_SERVER, * Default is SSL_SESSION_CACHE_SERVER, which means only * SSL_accept which cache SSL_SESSIONS. */ int session_cache_mode; /* If timeout is not 0, it is the default timeout value set * when SSL_new() is called. This has been put in to make * life easier to set things up */ long session_timeout; /* If this callback is not null, it will be called each * time a session id is added to the cache. If this function * returns 1, it means that the callback will do a * SSL_SESSION_free() when it has finished using it. Otherwise, * on 0, it means the callback has finished with it. * If remove_session_cb is not null, it will be called when * a session-id is removed from the cache. After the call, * OpenSSL will SSL_SESSION_free() it. */ int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess); void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess); SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,int len,int *copy); struct { int sess_connect; /* SSL new conn - started */ int sess_connect_renegotiate;/* SSL reneg - requested */ int sess_connect_good; /* SSL new conne/reneg - finished */ int sess_accept; /* SSL new accept - started */ int sess_accept_renegotiate;/* SSL reneg - requested */ int sess_accept_good; /* SSL accept/reneg - finished */ int sess_miss; /* session lookup misses */ int sess_timeout; /* reuse attempt on timeouted session */ int sess_cache_full; /* session removed due to full cache */ int sess_hit; /* session reuse actually done */ int sess_cb_hit; /* session-id that was not * in the cache was * passed back via the callback. This * indicates that the application is * supplying session-id's from other * processes - spooky :-) */ } stats; int references;/**/ void (*info_callback)(); /* if defined, these override the X509_verify_cert() calls *//**/ int (*app_verify_callback)();/**/ char *app_verify_arg; /* never used; should be void * */ /* default values to use in SSL structures *//**/ struct cert_st /* CERT */ *cert;/**/ int read_ahead;/**/ int verify_mode;/**/ int verify_depth;/**/ unsigned int sid_ctx_length;/**/ unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];/**/ int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); int purpose; /* Purpose setting */ int trust; /* Trust setting */ /* Default password callback. *//**/ pem_password_cb *default_passwd_callback; /* Default password callback user data. *//**/ void *default_passwd_callback_userdata; /* get client cert callback *//**/ int (*client_cert_cb)(/* SSL *ssl, X509 **x509, EVP_PKEY **pkey */); /* what we put in client cert requests */ STACK_OF(X509_NAME) *client_CA;/**/ int quiet_shutdown; CRYPTO_EX_DATA ex_data; const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */ const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ STACK_OF(X509) *extra_certs; STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ };#define SSL_SESS_CACHE_OFF 0x0000#define SSL_SESS_CACHE_CLIENT 0x0001#define SSL_SESS_CACHE_SERVER 0x0002#define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)#define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100#define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200#define SSL_SESS_CACHE_NO_INTERNAL \ (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx);#define SSL_CTX_sess_number(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)#define SSL_CTX_sess_connect(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)#define SSL_CTX_sess_connect_good(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)#define SSL_CTX_sess_connect_renegotiate(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)#define SSL_CTX_sess_accept(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)#define SSL_CTX_sess_accept_renegotiate(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)#define SSL_CTX_sess_accept_good(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)#define SSL_CTX_sess_hits(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)#define SSL_CTX_sess_cb_hits(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)#define SSL_CTX_sess_misses(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)#define SSL_CTX_sess_timeouts(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)#define SSL_CTX_sess_cache_full(ctx) \ SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)#define SSL_CTX_sess_set_new_cb(ctx,cb) ((ctx)->new_session_cb=(cb))#define SSL_CTX_sess_get_new_cb(ctx) ((ctx)->new_session_cb)#define SSL_CTX_sess_set_remove_cb(ctx,cb) ((ctx)->remove_session_cb=(cb))#define SSL_CTX_sess_get_remove_cb(ctx) ((ctx)->remove_session_cb)#define SSL_CTX_sess_set_get_cb(ctx,cb) ((ctx)->get_session_cb=(cb))#define SSL_CTX_sess_get_get_cb(ctx) ((ctx)->get_session_cb)#define SSL_CTX_set_info_callback(ctx,cb) ((ctx)->info_callback=(cb))#define SSL_CTX_get_info_callback(ctx) ((ctx)->info_callback)#define SSL_CTX_set_client_cert_cb(ctx,cb) ((ctx)->client_cert_cb=(cb))#define SSL_CTX_get_client_cert_cb(ctx) ((ctx)->client_cert_cb)#define SSL_NOTHING 1#define SSL_WRITING 2#define SSL_READING 3#define SSL_X509_LOOKUP 4/* These will only be used when doing non-blocking IO */#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING)#define SSL_want_read(s) (SSL_want(s) == SSL_READING)#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING)#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP)struct ssl_st { /* protocol version * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION) */ int version; int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */ SSL_METHOD *method; /* SSLv3 */ /* There are 2 BIO's even though they are normally both the * same. This is so data can be read and written to different * handlers */#ifndef NO_BIO BIO *rbio; /* used by SSL_read */ BIO *wbio; /* used by SSL_write */ BIO *bbio; /* used during session-id reuse to concatenate * messages */#else char *rbio; /* used by SSL_read */ char *wbio; /* used by SSL_write */ char *bbio;#endif /* This holds a variable that indicates what we were doing * when a 0 or -1 is returned. This is needed for * non-blocking IO so we know what request needs re-doing when * in SSL_accept or SSL_connect */ int rwstate; /* true when we are actually in SSL_accept() or SSL_connect() */ int in_handshake; int (*handshake_func)(); /* Imagine that here's a boolean member "init" that is * switched as soon as SSL_set_{accept/connect}_state * is called for the first time, so that "state" and * "handshake_func" are properly initialized. But as * handshake_func is == 0 until then, we use this * test instead of an "init" member. */ int server; /* are we the server side? - mostly used by SSL_clear*/ int new_session;/* 1 if we are to use a new session. * 2 if we are a server and are inside a handshake * (i.e. not just sending a HelloRequest) * NB: For servers, the 'new' session may actually be a previously * cached session or even the previous session */ int quiet_shutdown;/* don't send shutdown packets */ int shutdown; /* we have shut things down, 0x01 sent, 0x02 * for received */ int state; /* where we are */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -