⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssl.h

📁 很有名的一款用于组织DDoS的恶意机器人程序。仅供研究学习
💻 H
📖 第 1 页 / 共 5 页
字号:
	int rstate;	/* where we are when reading */	BUF_MEM *init_buf;	/* buffer used during init */	int init_num;		/* amount read/written */	int init_off;		/* amount read/written */	/* used internally to point at a raw packet */	unsigned char *packet;	unsigned int packet_length;	struct ssl2_state_st *s2; /* SSLv2 variables */	struct ssl3_state_st *s3; /* SSLv3 variables */	int read_ahead;		/* Read as many input bytes as possible	               	 	 * (for non-blocking reads) */	int hit;		/* reusing a previous session */	int purpose;		/* Purpose setting */	int trust;		/* Trust setting */	/* crypto */	STACK_OF(SSL_CIPHER) *cipher_list;	STACK_OF(SSL_CIPHER) *cipher_list_by_id;	/* These are the ones being used, the ones in SSL_SESSION are	 * the ones to be 'copied' into these ones */	EVP_CIPHER_CTX *enc_read_ctx;		/* cryptographic state */	const EVP_MD *read_hash;		/* used for mac generation */#ifndef NO_COMP	COMP_CTX *expand;			/* uncompress */#else	char *expand;#endif	EVP_CIPHER_CTX *enc_write_ctx;		/* cryptographic state */	const EVP_MD *write_hash;		/* used for mac generation */#ifndef NO_COMP	COMP_CTX *compress;			/* compression */#else	char *compress;	#endif	/* session info */	/* client cert? */	/* This is used to hold the server certificate used */	struct cert_st /* CERT */ *cert;	/* the session_id_context is used to ensure sessions are only reused	 * in the appropriate context */	unsigned int sid_ctx_length;	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];	/* This can also be in the session once a session is established */	SSL_SESSION *session;	/* Used in SSL2 and SSL3 */	int verify_mode;	/* 0 don't care about verify failure.				 * 1 fail if verify fails */	int verify_depth;	int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */	void (*info_callback)(); /* optional informational callback */	int error;		/* error bytes to be written */	int error_code;		/* actual code */	SSL_CTX *ctx;	/* set this flag to 1 and a sleep(1) is put into all SSL_read()	 * and SSL_write() calls, good for nbio debuging :-) */	int debug;		/* extra application data */	long verify_result;	CRYPTO_EX_DATA ex_data;	/* for server side, keep the list of CA_dn we can use */	STACK_OF(X509_NAME) *client_CA;	int references;	unsigned long options; /* protocol behaviour */	unsigned long mode; /* API behaviour */	int first_packet;	int client_version;	/* what was passed, used for				 * SSLv3/TLS rollback check */	};#ifdef __cplusplus}#endif#include <openssl/ssl2.h>#include <openssl/ssl3.h>#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */#include <openssl/ssl23.h>#ifdef  __cplusplusextern "C" {#endif/* compatibility */#define SSL_set_app_data(s,arg)		(SSL_set_ex_data(s,0,(char *)arg))#define SSL_get_app_data(s)		(SSL_get_ex_data(s,0))#define SSL_SESSION_set_app_data(s,a)	(SSL_SESSION_set_ex_data(s,0,(char *)a))#define SSL_SESSION_get_app_data(s)	(SSL_SESSION_get_ex_data(s,0))#define SSL_CTX_get_app_data(ctx)	(SSL_CTX_get_ex_data(ctx,0))#define SSL_CTX_set_app_data(ctx,arg)	(SSL_CTX_set_ex_data(ctx,0,(char *)arg))/* The following are the possible values for ssl->state are are * used to indicate where we are up to in the SSL connection establishment. * The macros that follow are about the only things you should need to use * and even then, only when using non-blocking IO. * It can also be useful to work out where you were when the connection * failed */#define SSL_ST_CONNECT			0x1000#define SSL_ST_ACCEPT			0x2000#define SSL_ST_MASK			0x0FFF#define SSL_ST_INIT			(SSL_ST_CONNECT|SSL_ST_ACCEPT)#define SSL_ST_BEFORE			0x4000#define SSL_ST_OK			0x03#define SSL_ST_RENEGOTIATE		(0x04|SSL_ST_INIT)#define SSL_CB_LOOP			0x01#define SSL_CB_EXIT			0x02#define SSL_CB_READ			0x04#define SSL_CB_WRITE			0x08#define SSL_CB_ALERT			0x4000 /* used in callback */#define SSL_CB_READ_ALERT		(SSL_CB_ALERT|SSL_CB_READ)#define SSL_CB_WRITE_ALERT		(SSL_CB_ALERT|SSL_CB_WRITE)#define SSL_CB_ACCEPT_LOOP		(SSL_ST_ACCEPT|SSL_CB_LOOP)#define SSL_CB_ACCEPT_EXIT		(SSL_ST_ACCEPT|SSL_CB_EXIT)#define SSL_CB_CONNECT_LOOP		(SSL_ST_CONNECT|SSL_CB_LOOP)#define SSL_CB_CONNECT_EXIT		(SSL_ST_CONNECT|SSL_CB_EXIT)#define SSL_CB_HANDSHAKE_START		0x10#define SSL_CB_HANDSHAKE_DONE		0x20/* Is the SSL_connection established? */#define SSL_get_state(a)		SSL_state(a)#define SSL_is_init_finished(a)		(SSL_state(a) == SSL_ST_OK)#define SSL_in_init(a)			(SSL_state(a)&SSL_ST_INIT)#define SSL_in_before(a)		(SSL_state(a)&SSL_ST_BEFORE)#define SSL_in_connect_init(a)		(SSL_state(a)&SSL_ST_CONNECT)#define SSL_in_accept_init(a)		(SSL_state(a)&SSL_ST_ACCEPT)/* The following 2 states are kept in ssl->rstate when reads fail, * you should not need these */#define SSL_ST_READ_HEADER			0xF0#define SSL_ST_READ_BODY			0xF1#define SSL_ST_READ_DONE			0xF2/* Obtain latest Finished message *   -- that we sent (SSL_get_finished) *   -- that we expected from peer (SSL_get_peer_finished). * Returns length (0 == no Finished so far), copies up to 'count' bytes. */size_t SSL_get_finished(SSL *s, void *buf, size_t count);size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);/* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options * are 'ored' with SSL_VERIFY_PEER if they are desired */#define SSL_VERIFY_NONE			0x00#define SSL_VERIFY_PEER			0x01#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT	0x02#define SSL_VERIFY_CLIENT_ONCE		0x04#define OpenSSL_add_ssl_algorithms()	SSL_library_init()#define SSLeay_add_ssl_algorithms()	SSL_library_init()/* this is for backward compatibility */#if 0 /* NEW_SSLEAY */#define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c)#define SSL_set_pref_cipher(c,n)	SSL_set_cipher_list(c,n)#define SSL_add_session(a,b)            SSL_CTX_add_session((a),(b))#define SSL_remove_session(a,b)		SSL_CTX_remove_session((a),(b))#define SSL_flush_sessions(a,b)		SSL_CTX_flush_sessions((a),(b))#endif/* More backward compatibility */#define SSL_get_cipher(s) \		SSL_CIPHER_get_name(SSL_get_current_cipher(s))#define SSL_get_cipher_bits(s,np) \		SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)#define SSL_get_cipher_version(s) \		SSL_CIPHER_get_version(SSL_get_current_cipher(s))#define SSL_get_cipher_name(s) \		SSL_CIPHER_get_name(SSL_get_current_cipher(s))#define SSL_get_time(a)		SSL_SESSION_get_time(a)#define SSL_set_time(a,b)	SSL_SESSION_set_time((a),(b))#define SSL_get_timeout(a)	SSL_SESSION_get_timeout(a)#define SSL_set_timeout(a,b)	SSL_SESSION_set_timeout((a),(b))#if 1 /*SSLEAY_MACROS*/#define d2i_SSL_SESSION_bio(bp,s_id) (SSL_SESSION *)ASN1_d2i_bio( \	(char *(*)())SSL_SESSION_new,(char *(*)())d2i_SSL_SESSION, \	(bp),(unsigned char **)(s_id))#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio(i2d_SSL_SESSION, \	bp,(unsigned char *)s_id)#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \	(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \	(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u)#define PEM_write_SSL_SESSION(fp,x) \	PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \		PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)#define PEM_write_bio_SSL_SESSION(bp,x) \	PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \		PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL)#endif#define SSL_AD_REASON_OFFSET		1000/* These alert types are for SSLv3 and TLSv1 */#define SSL_AD_CLOSE_NOTIFY		SSL3_AD_CLOSE_NOTIFY#define SSL_AD_UNEXPECTED_MESSAGE	SSL3_AD_UNEXPECTED_MESSAGE /* fatal */#define SSL_AD_BAD_RECORD_MAC		SSL3_AD_BAD_RECORD_MAC     /* fatal */#define SSL_AD_DECRYPTION_FAILED	TLS1_AD_DECRYPTION_FAILED#define SSL_AD_RECORD_OVERFLOW		TLS1_AD_RECORD_OVERFLOW#define SSL_AD_DECOMPRESSION_FAILURE	SSL3_AD_DECOMPRESSION_FAILURE/* fatal */#define SSL_AD_HANDSHAKE_FAILURE	SSL3_AD_HANDSHAKE_FAILURE/* fatal */#define SSL_AD_NO_CERTIFICATE		SSL3_AD_NO_CERTIFICATE /* Not for TLS */#define SSL_AD_BAD_CERTIFICATE		SSL3_AD_BAD_CERTIFICATE#define SSL_AD_UNSUPPORTED_CERTIFICATE	SSL3_AD_UNSUPPORTED_CERTIFICATE#define SSL_AD_CERTIFICATE_REVOKED	SSL3_AD_CERTIFICATE_REVOKED#define SSL_AD_CERTIFICATE_EXPIRED	SSL3_AD_CERTIFICATE_EXPIRED#define SSL_AD_CERTIFICATE_UNKNOWN	SSL3_AD_CERTIFICATE_UNKNOWN#define SSL_AD_ILLEGAL_PARAMETER	SSL3_AD_ILLEGAL_PARAMETER   /* fatal */#define SSL_AD_UNKNOWN_CA		TLS1_AD_UNKNOWN_CA	/* fatal */#define SSL_AD_ACCESS_DENIED		TLS1_AD_ACCESS_DENIED	/* fatal */#define SSL_AD_DECODE_ERROR		TLS1_AD_DECODE_ERROR	/* fatal */#define SSL_AD_DECRYPT_ERROR		TLS1_AD_DECRYPT_ERROR#define SSL_AD_EXPORT_RESTRICTION	TLS1_AD_EXPORT_RESTRICTION/* fatal */#define SSL_AD_PROTOCOL_VERSION		TLS1_AD_PROTOCOL_VERSION /* fatal */#define SSL_AD_INSUFFICIENT_SECURITY	TLS1_AD_INSUFFICIENT_SECURITY/* fatal */#define SSL_AD_INTERNAL_ERROR		TLS1_AD_INTERNAL_ERROR	/* fatal */#define SSL_AD_USER_CANCELLED		TLS1_AD_USER_CANCELLED#define SSL_AD_NO_RENEGOTIATION		TLS1_AD_NO_RENEGOTIATION#define SSL_ERROR_NONE			0#define SSL_ERROR_SSL			1#define SSL_ERROR_WANT_READ		2#define SSL_ERROR_WANT_WRITE		3#define SSL_ERROR_WANT_X509_LOOKUP	4#define SSL_ERROR_SYSCALL		5 /* look at error stack/return value/errno */#define SSL_ERROR_ZERO_RETURN		6#define SSL_ERROR_WANT_CONNECT		7#define SSL_CTRL_NEED_TMP_RSA			1#define SSL_CTRL_SET_TMP_RSA			2#define SSL_CTRL_SET_TMP_DH			3#define SSL_CTRL_SET_TMP_RSA_CB			4#define SSL_CTRL_SET_TMP_DH_CB			5/* Add these ones */#define SSL_CTRL_GET_SESSION_REUSED		6#define SSL_CTRL_GET_CLIENT_CERT_REQUEST	7#define SSL_CTRL_GET_NUM_RENEGOTIATIONS		8#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS	9#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS	10#define SSL_CTRL_GET_FLAGS			11#define SSL_CTRL_EXTRA_CHAIN_CERT		12/* Stats */#define SSL_CTRL_SESS_NUMBER			20#define SSL_CTRL_SESS_CONNECT			21#define SSL_CTRL_SESS_CONNECT_GOOD		22#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE	23#define SSL_CTRL_SESS_ACCEPT			24#define SSL_CTRL_SESS_ACCEPT_GOOD		25#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE	26#define SSL_CTRL_SESS_HIT			27#define SSL_CTRL_SESS_CB_HIT			28#define SSL_CTRL_SESS_MISSES			29#define SSL_CTRL_SESS_TIMEOUTS			30#define SSL_CTRL_SESS_CACHE_FULL		31#define SSL_CTRL_OPTIONS			32#define SSL_CTRL_MODE			33#define SSL_CTRL_GET_READ_AHEAD			40#define SSL_CTRL_SET_READ_AHEAD			41#define SSL_CTRL_SET_SESS_CACHE_SIZE		42#define SSL_CTRL_GET_SESS_CACHE_SIZE		43#define SSL_CTRL_SET_SESS_CACHE_MODE		44#define SSL_CTRL_GET_SESS_CACHE_MODE		45#define SSL_session_reused(ssl) \	SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)#define SSL_num_renegotiations(ssl) \	SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)#define SSL_clear_num_renegotiations(ssl) \	SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)#define SSL_total_renegotiations(ssl) \	SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)#define SSL_CTX_need_tmp_RSA(ctx) \	SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL)#define SSL_CTX_set_tmp_rsa(ctx,rsa) \	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)#define SSL_CTX_set_tmp_dh(ctx,dh) \	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)#define SSL_need_tmp_RSA(ssl) \	SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)#define SSL_set_tmp_rsa(ssl,rsa) \	SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)#define SSL_set_tmp_dh(ssl,dh) \	SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)#define SSL_CTX_add_extra_chain_cert(ctx,x509) \	SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)/* VMS uses only 31 characters for symbols. */#ifdef VMS#undef SSL_CTX_set_cert_verify_callback#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb#undef SSL_CTX_use_certificate_chain_file#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file#undef SSL_CTX_set_default_verify_paths#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths#undef SSL_get_ex_data_X509_STORE_CTX_idx#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_data_X509_STOR_CTX_i#undef SSL_add_file_cert_subjects_to_stack#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_sub_to_stack#undef SSL_add_dir_cert_subjects_to_stack#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_sub_to_stack#endif#ifndef NO_BIOBIO_METHOD *BIO_f_ssl(void);BIO *BIO_new_ssl(SSL_CTX *ctx,int client);BIO *BIO_new_ssl_connect(SSL_CTX *ctx);BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);int BIO_ssl_copy_session_id(BIO *to,BIO *from);void BIO_ssl_shutdown(BIO *ssl_bio);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -