extra

## extra extra |

## Synopsis

    #define             GNUTLS_EXTRA_VERSION
    enum                gnutls_ia_apptype_t;
    int                 (*gnutls_ia_avp_func)               (gnutls_session_t session,
                                                             void *ptr,
                                                             const char *last,
                                                             size_t lastlen,
                                                             char **next,
                                                             size_t *nextlen);
    void                gnutls_ia_free_client_credentials   ();
    int                 gnutls_ia_verify_endphase           (gnutls_session_t session,
                                                             const char *checksum);
    ssize_t             gnutls_ia_send                      (gnutls_session_t session,
                                                             const char *data,
                                                             size_t sizeofdata);
    ssize_t             gnutls_ia_recv                      (gnutls_session_t session,
                                                             char *data,
                                                             size_t sizeofdata);
    int                 gnutls_ia_generate_challenge        (gnutls_session_t session,
                                                             size_t buffer_size);
    int                 gnutls_register_md5_handler         (void);
    const char *        gnutls_extra_check_version          (const char *req_version);

## Description

## Details

### GNUTLS_EXTRA_VERSION

    #define GNUTLS_EXTRA_VERSION GNUTLS_VERSION

### enum gnutls_ia_apptype_t

    typedef enum {
        GNUTLS_IA_APPLICATION_PAYLOAD = 0,
        GNUTLS_IA_INTERMEDIATE_PHASE_FINISHED = 1,
        GNUTLS_IA_FINAL_PHASE_FINISHED = 2
    } gnutls_ia_apptype_t;

Enumeration of different certificate encoding formats.

`GNUTLS_IA_APPLICATION_PAYLOAD` | TLS/IA application payload.
`GNUTLS_IA_INTERMEDIATE_PHASE_FINISHED` | TLS/IA intermediate phase finished.
`GNUTLS_IA_FINAL_PHASE_FINISHED` | TLS/IA final phase finished.

### gnutls_ia_avp_func ()

    int                 (*gnutls_ia_avp_func)               (gnutls_session_t session,
                                                             void *ptr,
                                                             const char *last,
                                                             size_t lastlen,
                                                             char **next,
                                                             size_t *nextlen);

### gnutls_ia_free_client_credentials ()

    void                gnutls_ia_free_client_credentials   ();

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

`sc` : | is a gnutls_ia_client_credentials_t structure.

### gnutls_ia_verify_endphase ()

    int                 gnutls_ia_verify_endphase           (gnutls_session_t session,
                                                             const char *checksum);

Verify TLS/IA end phase checksum data. If verification fails, the `GNUTLS_A_INNER_APPLICATION_VERIFICATION` alert is sent to the other sie.

This function is called when `gnutls_ia_recv()` return `GNUTLS_E_WARNING_IA_IPHF_RECEIVED` or `GNUTLS_E_WARNING_IA_FPHF_RECEIVED`.

`session` : | is a gnutls_session_t structure.
`checksum` : | 12-byte checksum data, received from `gnutls_ia_recv()`.
Returns : | Return 0 on successful verification, or an error code. If the checksum verification of the end phase message fails, `GNUTLS_E_IA_VERIFY_FAILED` is returned.

### gnutls_ia_send ()

    ssize_t             gnutls_ia_send                      (gnutls_session_t session,
                                                             const char *data,
                                                             size_t sizeofdata);

Send TLS/IA application payload data. This function has the similar semantics with `send()`. The only difference is that it accepts a GnuTLS session, and uses different error codes.

The TLS/IA protocol is synchronous, so you cannot send more than one packet at a time. The client always send the first packet.

To finish an application phase in the server, use `gnutls_ia_endphase_send()`. The client cannot end an application phase unilaterally; rather, a client is required to respond with an endphase of its own if gnutls_ia_recv indicates that the server has sent one.

If the EINTR is returned by the internal push function (the default is `send()`} then `GNUTLS_E_INTERRUPTED` will be returned. If `GNUTLS_E_INTERRUPTED` or `GNUTLS_E_AGAIN` is returned, you must call this function again, with the same parameters; alternatively you could provide a `NULL` pointer for data, and 0 for size.

`session` : | is a gnutls_session_t structure.
`data` : | contains the data to send
`sizeofdata` : | is the length of the data
Returns : | The number of bytes sent, or a negative error code.

### gnutls_ia_recv ()

    ssize_t             gnutls_ia_recv                      (gnutls_session_t session,
                                                             char *data,
                                                             size_t sizeofdata);

Receive TLS/IA data. This function has the similar semantics with `recv()`. The only difference is that it accepts a GnuTLS session, and uses different error codes.

If the server attempt to finish an application phase, this function will return `GNUTLS_E_WARNING_IA_IPHF_RECEIVED` or `GNUTLS_E_WARNING_IA_FPHF_RECEIVED`. The caller should then invoke `gnutls_ia_verify_endphase()`, and if it runs the client side, also send an endphase message of its own using gnutls_ia_endphase_send.

If EINTR is returned by the internal push function (the default is `code`{`recv()`}) then GNUTLS_E_INTERRUPTED will be returned. If GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must call this function again, with the same parameters; alternatively you could provide a NULL pointer for data, and 0 for size.

`session` : | is a gnutls_session_t structure.
`data` : | the buffer that the data will be read into, must hold >= 12 bytes.
`sizeofdata` : | the number of requested bytes, must be >= 12.
Returns : | The number of bytes received. A negative error code is returned in case of an error. The `GNUTLS_E_WARNING_IA_IPHF_RECEIVED` and `GNUTLS_E_WARNING_IA_FPHF_RECEIVED` errors are returned when an application phase finished message has been sent by the server.

### gnutls_ia_generate_challenge ()

    int                 gnutls_ia_generate_challenge        (gnutls_session_t session,
                                                             size_t buffer_size);

Generate an application challenge that the client cannot control or predict, based on the TLS/IA inner secret.

`session` : | is a gnutls_session_t structure.
`buffer_size` : | size of output buffer.
Returns : | Returns 0 on success, or an negative error code.

### gnutls_register_md5_handler ()

    int                 gnutls_register_md5_handler         (void);

Register a non-libgcrypt based MD5 and HMAC-MD5 handler. This is useful if you run Libgcrypt in FIPS-mode. Normally TLS requires use of MD5, so without this you cannot use GnuTLS with libgcrypt in FIPS mode.

Returns : | `GNUTLS_E_SUCCESS` on success, otherwise an error.

Since 2.6.0

### gnutls_extra_check_version ()

    const char *        gnutls_extra_check_version          (const char *req_version);

Check GnuTLS Extra Library version.

See `GNUTLS_EXTRA_VERSION` for a suitable `req_version` string.

`req_version` : | version string to compare with, or `NULL`.
Returns : | Check that the version of the library is at minimum the one given as a string in `req_version` and return the actual version string of the library; return `NULL` if the condition is not met. If `NULL` is passed to this function no check is done and only the version string is returned.