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

📄 tls.h

📁 WPA在Linux下实现的原代码 WPA在Linux下实现的原代码
💻 H
📖 第 1 页 / 共 2 页
字号:
int tls_connection_set_verify(void *tls_ctx, struct tls_connection *conn,			      int verify_peer);/** * tls_global_client_cert - Set client certificate for all TLS connections * @tls_ctx: TLS context data from tls_init() * @client_cert: File name for client certificate in PEM or DER format * * Returns: 0 on success, -1 on failure */int tls_global_client_cert(void *tls_ctx, const char *client_cert);/** * tls_global_private_key - Set private key for all TLS connections * @tls_ctx: TLS context data from tls_init() * @private_key: File name for client private key in PEM or DER format * @private_key_passwd: Passphrase for decrypted private key, %NULL if no * passphrase is used. * * Returns: 0 on success, -1 on failure */int tls_global_private_key(void *tls_ctx, const char *private_key,			   const char *private_key_passwd);/** * tls_connection_get_keys - Get master key and random data from TLS connection * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @keys: Structure of key/random data (filled on success) * Returns: 0 on success, -1 on failure */int tls_connection_get_keys(void *tls_ctx, struct tls_connection *conn,			    struct tls_keys *keys);/** * tls_connection_handshake - Process TLS handshake (client side) * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @in_data: Input data from TLS peer * @in_len: Input data length * @out_len: Length of the output buffer. * Returns: Pointer to output data, %NULL on failure * * Caller is responsible for freeing returned output data. * * This function is used during TLS handshake. The first call is done with * in_data == %NULL and the library is expected to return ClientHello packet. * This packet is then send to the server and a response from server is given * to TLS library by calling this function again with in_data pointing to the * TLS message from the server. * * If the TLS handshake fails, this function may return %NULL. However, if the * TLS library has a TLS alert to send out, that should be returned as the * output data. In this case, tls_connection_get_failed() must return failure * (> 0). * * tls_connection_established() should return 1 once the TLS handshake has been * completed successfully. */u8 * tls_connection_handshake(void *tls_ctx, struct tls_connection *conn,			      const u8 *in_data, size_t in_len,			      size_t *out_len);/** * tls_connection_server_handshake - Process TLS handshake (server side) * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @in_data: Input data from TLS peer * @in_len: Input data length * @out_len: Length of the output buffer. * Returns: pointer to output data, %NULL on failure * * Caller is responsible for freeing returned output data. */u8 * tls_connection_server_handshake(void *tls_ctx,				     struct tls_connection *conn,				     const u8 *in_data, size_t in_len,				     size_t *out_len);/** * tls_connection_encrypt - Encrypt data into TLS tunnel * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @in_data: Pointer to plaintext data to be encrypted * @in_len: Input buffer length * @out_data: Pointer to output buffer (encrypted TLS data) * @out_len: Maximum out_data length  * Returns: Number of bytes written to out_data, -1 on failure * * This function is used after TLS handshake has been completed successfully to * send data in the encrypted tunnel. */int tls_connection_encrypt(void *tls_ctx, struct tls_connection *conn,			   const u8 *in_data, size_t in_len,			   u8 *out_data, size_t out_len);/** * tls_connection_decrypt - Decrypt data from TLS tunnel * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @in_data: Pointer to input buffer (encrypted TLS data) * @in_len: Input buffer length * @out_data: Pointer to output buffer (decrypted data from TLS tunnel) * @out_len: Maximum out_data length * Returns: Number of bytes written to out_data, -1 on failure * * This function is used after TLS handshake has been completed successfully to * receive data from the encrypted tunnel. */int tls_connection_decrypt(void *tls_ctx, struct tls_connection *conn,			   const u8 *in_data, size_t in_len,			   u8 *out_data, size_t out_len);/** * tls_connection_resumed - Was session resumption used * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * Returns: 1 if current session used session resumption, 0 if not */int tls_connection_resumed(void *tls_ctx, struct tls_connection *conn);/** * tls_connection_set_master_key - Configure master secret for TLS connection * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @key: TLS pre-master-secret * @key_len: length of key in bytes * Returns: 0 on success, -1 on failure */int tls_connection_set_master_key(void *tls_ctx, struct tls_connection *conn,				  const u8 *key, size_t key_len);/** * tls_connection_set_anon_dh - Configure TLS connection to use anonymous DH * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * * Returns: 0 on success, -1 on failure * * TODO: consider changing this to more generic routine for configuring allowed * ciphers */int tls_connection_set_anon_dh(void *tls_ctx, struct tls_connection *conn);/** * tls_get_cipher - Get current cipher name * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @buf: Buffer for the cipher name * @buflen: buf size * Returns: 0 on success, -1 on failure * * Get the name of the currently used cipher. */int tls_get_cipher(void *tls_ctx, struct tls_connection *conn,		   char *buf, size_t buflen);/** * tls_connection_enable_workaround - Enable TLS workaround options * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * Returns: 0 on success, -1 on failure * * This function is used to enable connection-specific workaround options for * buffer SSL/TLS implementations. */int tls_connection_enable_workaround(void *tls_ctx,				     struct tls_connection *conn);/** * tls_connection_client_hello_ext - Set TLS extension for ClientHello * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * @ext_type: Extension type * @data: Extension payload (%NULL to remove extension) * @data_len: Extension payload length * Returns: 0 on success, -1 on failure */int tls_connection_client_hello_ext(void *tls_ctx, struct tls_connection *conn,				    int ext_type, const u8 *data,				    size_t data_len);/** * tls_connection_get_failed - Get connection failure status * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * * Returns >0 if connection has failed, 0 if not. */int tls_connection_get_failed(void *tls_ctx, struct tls_connection *conn);/** * tls_connection_get_read_alerts - Get connection read alert status * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * Returns: Number of times a fatal read (remote end reported error) has * happened during this connection. */int tls_connection_get_read_alerts(void *tls_ctx, struct tls_connection *conn);/** * tls_connection_get_write_alerts - Get connection write alert status * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * Returns: Number of times a fatal write (locally detected error) has happened * during this connection. */int tls_connection_get_write_alerts(void *tls_ctx,				    struct tls_connection *conn);/** * tls_connection_get_keyblock_size - Get TLS key_block size * @tls_ctx: TLS context data from tls_init() * @conn: Connection context data from tls_connection_init() * Returns: Size of the key_block for the negotiated cipher suite or -1 on * failure */int tls_connection_get_keyblock_size(void *tls_ctx,				     struct tls_connection *conn);#endif /* TLS_H */

⌨️ 快捷键说明

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