Blame doc/crypto-api.texi

Packit aea12f
Packit aea12f
@subheading gnutls_aead_cipher_decrypt
Packit aea12f
@anchor{gnutls_aead_cipher_decrypt}
Packit aea12f
@deftypefun {int} {gnutls_aead_cipher_decrypt} (gnutls_aead_cipher_hd_t @var{handle}, const void * @var{nonce}, size_t @var{nonce_len}, const void * @var{auth}, size_t @var{auth_len}, size_t @var{tag_size}, const void * @var{ctext}, size_t @var{ctext_len}, void * @var{ptext}, size_t * @var{ptext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_aead_cipher_hd_t}  type.
Packit aea12f
Packit aea12f
@var{nonce}: the nonce to set
Packit aea12f
Packit aea12f
@var{nonce_len}: The length of the nonce
Packit aea12f
Packit aea12f
@var{auth}: additional data to be authenticated
Packit aea12f
Packit aea12f
@var{auth_len}: The length of the data
Packit aea12f
Packit aea12f
@var{tag_size}: The size of the tag to use (use zero for the default)
Packit aea12f
Packit aea12f
@var{ctext}: the data to decrypt (including the authentication tag)
Packit aea12f
Packit aea12f
@var{ctext_len}: the length of data to decrypt (includes tag size)
Packit aea12f
Packit aea12f
@var{ptext}: the decrypted data
Packit aea12f
Packit aea12f
@var{ptext_len}: the length of decrypted data (initially must hold the maximum available size)
Packit aea12f
Packit aea12f
This function will decrypt the given data using the algorithm
Packit aea12f
specified by the context. This function must be provided the complete
Packit aea12f
data to be decrypted, including the authentication tag. On several
Packit aea12f
AEAD ciphers, the authentication tag is appended to the ciphertext,
Packit aea12f
though this is not a general rule. This function will fail if
Packit aea12f
the tag verification fails.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on verification failure or other error.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit Service 991b93
@subheading gnutls_aead_cipher_decryptv2
Packit Service 991b93
@anchor{gnutls_aead_cipher_decryptv2}
Packit Service 991b93
@deftypefun {int} {gnutls_aead_cipher_decryptv2} (gnutls_aead_cipher_hd_t @var{handle}, const void * @var{nonce}, size_t @var{nonce_len}, const giovec_t * @var{auth_iov}, int @var{auth_iovcnt}, const giovec_t * @var{iov}, int @var{iovcnt}, void * @var{tag}, size_t @var{tag_size})
Packit Service 991b93
@var{handle}: is a @code{gnutls_aead_cipher_hd_t}  type.
Packit Service 991b93
Packit Service 991b93
@var{nonce}: the nonce to set
Packit Service 991b93
Packit Service 991b93
@var{nonce_len}: The length of the nonce
Packit Service 991b93
Packit Service 991b93
@var{auth_iov}: additional data to be authenticated
Packit Service 991b93
Packit Service 991b93
@var{auth_iovcnt}: The number of buffers in  @code{auth_iov} 
Packit Service 991b93
Packit Service 991b93
@var{iov}: the data to decrypt
Packit Service 991b93
Packit Service 991b93
@var{iovcnt}: The number of buffers in  @code{iov} 
Packit Service 991b93
Packit Service 991b93
@var{tag}: The authentication tag
Packit Service 991b93
Packit Service 991b93
@var{tag_size}: The size of the tag to use (use zero for the default)
Packit Service 991b93
Packit Service 991b93
This is similar to @code{gnutls_aead_cipher_decrypt()} , but it performs
Packit Service 991b93
in-place encryption on the provided data buffers.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} Zero or a negative error code on error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.10
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit aea12f
@subheading gnutls_aead_cipher_deinit
Packit aea12f
@anchor{gnutls_aead_cipher_deinit}
Packit aea12f
@deftypefun {void} {gnutls_aead_cipher_deinit} (gnutls_aead_cipher_hd_t @var{handle})
Packit aea12f
@var{handle}: is a @code{gnutls_aead_cipher_hd_t}  type.
Packit aea12f
Packit aea12f
This function will deinitialize all resources occupied by the given
Packit aea12f
authenticated-encryption context.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_aead_cipher_encrypt
Packit aea12f
@anchor{gnutls_aead_cipher_encrypt}
Packit aea12f
@deftypefun {int} {gnutls_aead_cipher_encrypt} (gnutls_aead_cipher_hd_t @var{handle}, const void * @var{nonce}, size_t @var{nonce_len}, const void * @var{auth}, size_t @var{auth_len}, size_t @var{tag_size}, const void * @var{ptext}, size_t @var{ptext_len}, void * @var{ctext}, size_t * @var{ctext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_aead_cipher_hd_t}  type.
Packit aea12f
Packit aea12f
@var{nonce}: the nonce to set
Packit aea12f
Packit aea12f
@var{nonce_len}: The length of the nonce
Packit aea12f
Packit aea12f
@var{auth}: additional data to be authenticated
Packit aea12f
Packit aea12f
@var{auth_len}: The length of the data
Packit aea12f
Packit aea12f
@var{tag_size}: The size of the tag to use (use zero for the default)
Packit aea12f
Packit aea12f
@var{ptext}: the data to encrypt
Packit aea12f
Packit aea12f
@var{ptext_len}: The length of data to encrypt
Packit aea12f
Packit aea12f
@var{ctext}: the encrypted data including authentication tag
Packit aea12f
Packit aea12f
@var{ctext_len}: the length of encrypted data (initially must hold the maximum available size, including space for tag)
Packit aea12f
Packit aea12f
This function will encrypt the given data using the algorithm
Packit aea12f
specified by the context. The output data will contain the
Packit aea12f
authentication tag.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_aead_cipher_encryptv
Packit aea12f
@anchor{gnutls_aead_cipher_encryptv}
Packit aea12f
@deftypefun {int} {gnutls_aead_cipher_encryptv} (gnutls_aead_cipher_hd_t @var{handle}, const void * @var{nonce}, size_t @var{nonce_len}, const giovec_t * @var{auth_iov}, int @var{auth_iovcnt}, size_t @var{tag_size}, const giovec_t * @var{iov}, int @var{iovcnt}, void * @var{ctext}, size_t * @var{ctext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_aead_cipher_hd_t}  type.
Packit aea12f
Packit aea12f
@var{nonce}: the nonce to set
Packit aea12f
Packit aea12f
@var{nonce_len}: The length of the nonce
Packit aea12f
Packit aea12f
@var{auth_iov}: additional data to be authenticated
Packit aea12f
Packit aea12f
@var{auth_iovcnt}: The number of buffers in  @code{auth_iov} 
Packit aea12f
Packit aea12f
@var{tag_size}: The size of the tag to use (use zero for the default)
Packit aea12f
Packit aea12f
@var{iov}: the data to be encrypted
Packit aea12f
Packit aea12f
@var{iovcnt}: The number of buffers in  @code{iov} 
Packit aea12f
Packit aea12f
@var{ctext}: the encrypted data including authentication tag
Packit aea12f
Packit aea12f
@var{ctext_len}: the length of encrypted data (initially must hold the maximum available size, including space for tag)
Packit aea12f
Packit aea12f
This function will encrypt the provided data buffers using the algorithm
Packit aea12f
specified by the context. The output data will contain the
Packit aea12f
authentication tag.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 3.6.3
Packit aea12f
@end deftypefun
Packit aea12f
Packit Service 991b93
@subheading gnutls_aead_cipher_encryptv2
Packit Service 991b93
@anchor{gnutls_aead_cipher_encryptv2}
Packit Service 991b93
@deftypefun {int} {gnutls_aead_cipher_encryptv2} (gnutls_aead_cipher_hd_t @var{handle}, const void * @var{nonce}, size_t @var{nonce_len}, const giovec_t * @var{auth_iov}, int @var{auth_iovcnt}, const giovec_t * @var{iov}, int @var{iovcnt}, void * @var{tag}, size_t * @var{tag_size})
Packit Service 991b93
@var{handle}: is a @code{gnutls_aead_cipher_hd_t}  type.
Packit Service 991b93
Packit Service 991b93
@var{nonce}: the nonce to set
Packit Service 991b93
Packit Service 991b93
@var{nonce_len}: The length of the nonce
Packit Service 991b93
Packit Service 991b93
@var{auth_iov}: additional data to be authenticated
Packit Service 991b93
Packit Service 991b93
@var{auth_iovcnt}: The number of buffers in  @code{auth_iov} 
Packit Service 991b93
Packit Service 991b93
@var{iov}: the data to be encrypted
Packit Service 991b93
Packit Service 991b93
@var{iovcnt}: The number of buffers in  @code{iov} 
Packit Service 991b93
Packit Service 991b93
@var{tag}: The authentication tag
Packit Service 991b93
Packit Service 991b93
@var{tag_size}: The size of the tag to use (use zero for the default)
Packit Service 991b93
Packit Service 991b93
This is similar to @code{gnutls_aead_cipher_encrypt()} , but it performs
Packit Service 991b93
in-place encryption on the provided data buffers.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} Zero or a negative error code on error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.10
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit aea12f
@subheading gnutls_aead_cipher_init
Packit aea12f
@anchor{gnutls_aead_cipher_init}
Packit aea12f
@deftypefun {int} {gnutls_aead_cipher_init} (gnutls_aead_cipher_hd_t * @var{handle}, gnutls_cipher_algorithm_t @var{cipher}, const gnutls_datum_t * @var{key})
Packit aea12f
@var{handle}: is a @code{gnutls_aead_cipher_hd_t}  type.
Packit aea12f
Packit aea12f
@var{cipher}: the authenticated-encryption algorithm to use
Packit aea12f
Packit aea12f
@var{key}: The key to be used for encryption
Packit aea12f
Packit aea12f
This function will initialize an context that can be used for
Packit aea12f
encryption/decryption of data. This will effectively use the
Packit aea12f
current crypto backend in use by gnutls or the cryptographic
Packit aea12f
accelerator in use.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_add_auth
Packit aea12f
@anchor{gnutls_cipher_add_auth}
Packit aea12f
@deftypefun {int} {gnutls_cipher_add_auth} (gnutls_cipher_hd_t @var{handle}, const void * @var{ptext}, size_t @var{ptext_size})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{ptext}: the data to be authenticated
Packit aea12f
Packit aea12f
@var{ptext_size}: the length of the data
Packit aea12f
Packit aea12f
This function operates on authenticated encryption with
Packit aea12f
associated data (AEAD) ciphers and authenticate the
Packit aea12f
input data. This function can only be called once
Packit aea12f
and before any encryption operations.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 3.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_decrypt
Packit aea12f
@anchor{gnutls_cipher_decrypt}
Packit aea12f
@deftypefun {int} {gnutls_cipher_decrypt} (gnutls_cipher_hd_t @var{handle}, void * @var{ctext}, size_t @var{ctext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{ctext}: the data to decrypt
Packit aea12f
Packit aea12f
@var{ctext_len}: the length of data to decrypt
Packit aea12f
Packit aea12f
This function will decrypt the given data using the algorithm
Packit aea12f
specified by the context.
Packit aea12f
Packit aea12f
Note that in AEAD ciphers, this will not check the tag. You will
Packit aea12f
need to compare the tag sent with the value returned from @code{gnutls_cipher_tag()} .
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_decrypt2
Packit aea12f
@anchor{gnutls_cipher_decrypt2}
Packit aea12f
@deftypefun {int} {gnutls_cipher_decrypt2} (gnutls_cipher_hd_t @var{handle}, const void * @var{ctext}, size_t @var{ctext_len}, void * @var{ptext}, size_t @var{ptext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{ctext}: the data to decrypt
Packit aea12f
Packit aea12f
@var{ctext_len}: the length of data to decrypt
Packit aea12f
Packit aea12f
@var{ptext}: the decrypted data
Packit aea12f
Packit aea12f
@var{ptext_len}: the available length for decrypted data
Packit aea12f
Packit aea12f
This function will decrypt the given data using the algorithm
Packit aea12f
specified by the context. For block ciphers the  @code{ctext_len} must be
Packit aea12f
a multiple of the block size. For the supported ciphers the plaintext
Packit aea12f
data length will equal the ciphertext size.
Packit aea12f
Packit aea12f
Note that in AEAD ciphers, this will not check the tag. You will
Packit aea12f
need to compare the tag sent with the value returned from @code{gnutls_cipher_tag()} .
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.12.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_deinit
Packit aea12f
@anchor{gnutls_cipher_deinit}
Packit aea12f
@deftypefun {void} {gnutls_cipher_deinit} (gnutls_cipher_hd_t @var{handle})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
This function will deinitialize all resources occupied by the given
Packit aea12f
encryption context.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_encrypt
Packit aea12f
@anchor{gnutls_cipher_encrypt}
Packit aea12f
@deftypefun {int} {gnutls_cipher_encrypt} (gnutls_cipher_hd_t @var{handle}, void * @var{ptext}, size_t @var{ptext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{ptext}: the data to encrypt
Packit aea12f
Packit aea12f
@var{ptext_len}: the length of data to encrypt
Packit aea12f
Packit aea12f
This function will encrypt the given data using the algorithm
Packit aea12f
specified by the context.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_encrypt2
Packit aea12f
@anchor{gnutls_cipher_encrypt2}
Packit aea12f
@deftypefun {int} {gnutls_cipher_encrypt2} (gnutls_cipher_hd_t @var{handle}, const void * @var{ptext}, size_t @var{ptext_len}, void * @var{ctext}, size_t @var{ctext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{ptext}: the data to encrypt
Packit aea12f
Packit aea12f
@var{ptext_len}: the length of data to encrypt
Packit aea12f
Packit aea12f
@var{ctext}: the encrypted data
Packit aea12f
Packit aea12f
@var{ctext_len}: the available length for encrypted data
Packit aea12f
Packit aea12f
This function will encrypt the given data using the algorithm
Packit aea12f
specified by the context. For block ciphers the  @code{ptext_len} must be
Packit aea12f
a multiple of the block size. For the supported ciphers the encrypted
Packit aea12f
data length will equal the plaintext size.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.12.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_get_block_size
Packit aea12f
@anchor{gnutls_cipher_get_block_size}
Packit aea12f
@deftypefun {unsigned} {gnutls_cipher_get_block_size} (gnutls_cipher_algorithm_t @var{algorithm})
Packit aea12f
@var{algorithm}: is an encryption algorithm
Packit aea12f
Packit aea12f
Packit aea12f
@strong{Returns:} the block size of the encryption algorithm.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_get_iv_size
Packit aea12f
@anchor{gnutls_cipher_get_iv_size}
Packit aea12f
@deftypefun {unsigned} {gnutls_cipher_get_iv_size} (gnutls_cipher_algorithm_t @var{algorithm})
Packit aea12f
@var{algorithm}: is an encryption algorithm
Packit aea12f
Packit aea12f
This function returns the size of the initialization vector (IV) for the
Packit aea12f
provided algorithm. For algorithms with variable size IV (e.g., AES-CCM),
Packit aea12f
the returned size will be the one used by TLS.
Packit aea12f
Packit aea12f
@strong{Returns:} block size for encryption algorithm.
Packit aea12f
Packit aea12f
@strong{Since:} 3.2.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_get_tag_size
Packit aea12f
@anchor{gnutls_cipher_get_tag_size}
Packit aea12f
@deftypefun {unsigned} {gnutls_cipher_get_tag_size} (gnutls_cipher_algorithm_t @var{algorithm})
Packit aea12f
@var{algorithm}: is an encryption algorithm
Packit aea12f
Packit aea12f
This function returns the tag size of an authenticated encryption
Packit aea12f
algorithm. For non-AEAD algorithms, it returns zero.
Packit aea12f
Packit aea12f
@strong{Returns:} the tag size of the authenticated encryption algorithm.
Packit aea12f
Packit aea12f
@strong{Since:} 3.2.2
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_init
Packit aea12f
@anchor{gnutls_cipher_init}
Packit aea12f
@deftypefun {int} {gnutls_cipher_init} (gnutls_cipher_hd_t * @var{handle}, gnutls_cipher_algorithm_t @var{cipher}, const gnutls_datum_t * @var{key}, const gnutls_datum_t * @var{iv})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{cipher}: the encryption algorithm to use
Packit aea12f
Packit aea12f
@var{key}: the key to be used for encryption/decryption
Packit aea12f
Packit aea12f
@var{iv}: the IV to use (if not applicable set NULL)
Packit aea12f
Packit aea12f
This function will initialize the  @code{handle} context to be usable
Packit aea12f
for encryption/decryption of data. This will effectively use the
Packit aea12f
current crypto backend in use by gnutls or the cryptographic
Packit aea12f
accelerator in use.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_set_iv
Packit aea12f
@anchor{gnutls_cipher_set_iv}
Packit aea12f
@deftypefun {void} {gnutls_cipher_set_iv} (gnutls_cipher_hd_t @var{handle}, void * @var{iv}, size_t @var{ivlen})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{iv}: the IV to set
Packit aea12f
Packit aea12f
@var{ivlen}: the length of the IV
Packit aea12f
Packit aea12f
This function will set the IV to be used for the next
Packit aea12f
encryption block.
Packit aea12f
Packit aea12f
@strong{Since:} 3.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_cipher_tag
Packit aea12f
@anchor{gnutls_cipher_tag}
Packit aea12f
@deftypefun {int} {gnutls_cipher_tag} (gnutls_cipher_hd_t @var{handle}, void * @var{tag}, size_t @var{tag_size})
Packit aea12f
@var{handle}: is a @code{gnutls_cipher_hd_t}  type
Packit aea12f
Packit aea12f
@var{tag}: will hold the tag
Packit aea12f
Packit aea12f
@var{tag_size}: the length of the tag to return
Packit aea12f
Packit aea12f
This function operates on authenticated encryption with
Packit aea12f
associated data (AEAD) ciphers and will return the
Packit aea12f
output tag.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 3.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_crypto_register_aead_cipher
Packit aea12f
@anchor{gnutls_crypto_register_aead_cipher}
Packit aea12f
@deftypefun {int} {gnutls_crypto_register_aead_cipher} (gnutls_cipher_algorithm_t @var{algorithm}, int @var{priority}, gnutls_cipher_init_func @var{init}, gnutls_cipher_setkey_func @var{setkey}, gnutls_cipher_aead_encrypt_func @var{aead_encrypt}, gnutls_cipher_aead_decrypt_func @var{aead_decrypt}, gnutls_cipher_deinit_func @var{deinit})
Packit aea12f
@var{algorithm}: is the gnutls AEAD cipher identifier
Packit aea12f
Packit aea12f
@var{priority}: is the priority of the algorithm
Packit aea12f
Packit aea12f
@var{init}: A function which initializes the cipher
Packit aea12f
Packit aea12f
@var{setkey}: A function which sets the key of the cipher
Packit aea12f
Packit aea12f
@var{aead_encrypt}: Perform the AEAD encryption
Packit aea12f
Packit aea12f
@var{aead_decrypt}: Perform the AEAD decryption
Packit aea12f
Packit aea12f
@var{deinit}: A function which deinitializes the cipher
Packit aea12f
Packit aea12f
This function will register a cipher algorithm to be used by
Packit aea12f
gnutls.  Any algorithm registered will override the included
Packit aea12f
algorithms and by convention kernel implemented algorithms have
Packit aea12f
priority of 90 and CPU-assisted of 80.  The algorithm with the lowest priority will be
Packit aea12f
used by gnutls.
Packit aea12f
Packit aea12f
In the case the registered init or setkey functions return @code{GNUTLS_E_NEED_FALLBACK} ,
Packit aea12f
GnuTLS will attempt to use the next in priority registered cipher.
Packit aea12f
Packit aea12f
The functions registered will be used with the new AEAD API introduced in
Packit aea12f
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
Packit aea12f
Packit aea12f
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_crypto_register_cipher
Packit aea12f
@anchor{gnutls_crypto_register_cipher}
Packit aea12f
@deftypefun {int} {gnutls_crypto_register_cipher} (gnutls_cipher_algorithm_t @var{algorithm}, int @var{priority}, gnutls_cipher_init_func @var{init}, gnutls_cipher_setkey_func @var{setkey}, gnutls_cipher_setiv_func @var{setiv}, gnutls_cipher_encrypt_func @var{encrypt}, gnutls_cipher_decrypt_func @var{decrypt}, gnutls_cipher_deinit_func @var{deinit})
Packit aea12f
@var{algorithm}: is the gnutls algorithm identifier
Packit aea12f
Packit aea12f
@var{priority}: is the priority of the algorithm
Packit aea12f
Packit aea12f
@var{init}: A function which initializes the cipher
Packit aea12f
Packit aea12f
@var{setkey}: A function which sets the key of the cipher
Packit aea12f
Packit aea12f
@var{setiv}: A function which sets the nonce/IV of the cipher (non-AEAD)
Packit aea12f
Packit aea12f
@var{encrypt}: A function which performs encryption (non-AEAD)
Packit aea12f
Packit aea12f
@var{decrypt}: A function which performs decryption (non-AEAD)
Packit aea12f
Packit aea12f
@var{deinit}: A function which deinitializes the cipher
Packit aea12f
Packit aea12f
This function will register a cipher algorithm to be used by
Packit aea12f
gnutls.  Any algorithm registered will override the included
Packit aea12f
algorithms and by convention kernel implemented algorithms have
Packit aea12f
priority of 90 and CPU-assisted of 80.  The algorithm with the lowest priority will be
Packit aea12f
used by gnutls.
Packit aea12f
Packit aea12f
In the case the registered init or setkey functions return @code{GNUTLS_E_NEED_FALLBACK} ,
Packit aea12f
GnuTLS will attempt to use the next in priority registered cipher.
Packit aea12f
Packit aea12f
The functions which are marked as non-AEAD they are not required when
Packit aea12f
registering a cipher to be used with the new AEAD API introduced in
Packit aea12f
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
Packit aea12f
Packit aea12f
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_crypto_register_digest
Packit aea12f
@anchor{gnutls_crypto_register_digest}
Packit aea12f
@deftypefun {int} {gnutls_crypto_register_digest} (gnutls_digest_algorithm_t @var{algorithm}, int @var{priority}, gnutls_digest_init_func @var{init}, gnutls_digest_hash_func @var{hash}, gnutls_digest_output_func @var{output}, gnutls_digest_deinit_func @var{deinit}, gnutls_digest_fast_func @var{hash_fast})
Packit aea12f
@var{algorithm}: is the gnutls digest identifier
Packit aea12f
Packit aea12f
@var{priority}: is the priority of the algorithm
Packit aea12f
Packit aea12f
@var{init}: A function which initializes the digest
Packit aea12f
Packit aea12f
@var{hash}: Perform the hash operation
Packit aea12f
Packit aea12f
@var{output}: Provide the output of the digest
Packit aea12f
Packit aea12f
@var{deinit}: A function which deinitializes the digest
Packit aea12f
Packit aea12f
@var{hash_fast}: Perform the digest operation in one go
Packit aea12f
Packit aea12f
This function will register a digest algorithm to be used by gnutls.
Packit aea12f
Any algorithm registered will override the included algorithms and
Packit aea12f
by convention kernel implemented algorithms have priority of 90
Packit aea12f
and CPU-assisted of 80.
Packit aea12f
The algorithm with the lowest priority will be used by gnutls.
Packit aea12f
Packit aea12f
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_crypto_register_mac
Packit aea12f
@anchor{gnutls_crypto_register_mac}
Packit aea12f
@deftypefun {int} {gnutls_crypto_register_mac} (gnutls_mac_algorithm_t @var{algorithm}, int @var{priority}, gnutls_mac_init_func @var{init}, gnutls_mac_setkey_func @var{setkey}, gnutls_mac_setnonce_func @var{setnonce}, gnutls_mac_hash_func @var{hash}, gnutls_mac_output_func @var{output}, gnutls_mac_deinit_func @var{deinit}, gnutls_mac_fast_func @var{hash_fast})
Packit aea12f
@var{algorithm}: is the gnutls MAC identifier
Packit aea12f
Packit aea12f
@var{priority}: is the priority of the algorithm
Packit aea12f
Packit aea12f
@var{init}: A function which initializes the MAC
Packit aea12f
Packit aea12f
@var{setkey}: A function which sets the key of the MAC
Packit aea12f
Packit aea12f
@var{setnonce}: A function which sets the nonce for the mac (may be @code{NULL}  for common MAC algorithms)
Packit aea12f
Packit aea12f
@var{hash}: Perform the hash operation
Packit aea12f
Packit aea12f
@var{output}: Provide the output of the MAC
Packit aea12f
Packit aea12f
@var{deinit}: A function which deinitializes the MAC
Packit aea12f
Packit aea12f
@var{hash_fast}: Perform the MAC operation in one go
Packit aea12f
Packit aea12f
This function will register a MAC algorithm to be used by gnutls.
Packit aea12f
Any algorithm registered will override the included algorithms and
Packit aea12f
by convention kernel implemented algorithms have priority of 90
Packit aea12f
and CPU-assisted of 80.
Packit aea12f
The algorithm with the lowest priority will be used by gnutls.
Packit aea12f
Packit aea12f
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
Packit aea12f
Packit aea12f
@strong{Since:} 3.4.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_decode_ber_digest_info
Packit aea12f
@anchor{gnutls_decode_ber_digest_info}
Packit aea12f
@deftypefun {int} {gnutls_decode_ber_digest_info} (const gnutls_datum_t * @var{info}, gnutls_digest_algorithm_t * @var{hash}, unsigned char * @var{digest}, unsigned int * @var{digest_size})
Packit aea12f
@var{info}: an RSA BER encoded DigestInfo structure
Packit aea12f
Packit aea12f
@var{hash}: will contain the hash algorithm of the structure
Packit aea12f
Packit aea12f
@var{digest}: will contain the hash output of the structure
Packit aea12f
Packit aea12f
@var{digest_size}: will contain the hash size of the structure; initially must hold the maximum size of  @code{digest} 
Packit aea12f
Packit aea12f
This function will parse an RSA PKCS@code{1}  1.5 DigestInfo structure
Packit aea12f
and report the hash algorithm used as well as the digest data.
Packit aea12f
Packit aea12f
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise
Packit aea12f
an error code is returned.
Packit aea12f
Packit aea12f
@strong{Since:} 3.5.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_decode_gost_rs_value
Packit aea12f
@anchor{gnutls_decode_gost_rs_value}
Packit aea12f
@deftypefun {int} {gnutls_decode_gost_rs_value} (const gnutls_datum_t * @var{sig_value}, gnutls_datum_t * @var{r}, gnutls_datum_t * @var{s})
Packit aea12f
@var{sig_value}: will holds a GOST signature according to RFC 4491 section 2.2.2
Packit aea12f
Packit aea12f
@var{r}: will contain the r value
Packit aea12f
Packit aea12f
@var{s}: will contain the s value
Packit aea12f
Packit aea12f
This function will decode the provided  @code{sig_value} , into  @code{r} and  @code{s} elements.
Packit aea12f
See RFC 4491 section 2.2.2 for the format of signature value.
Packit aea12f
Packit aea12f
The output values may be padded with a zero byte to prevent them
Packit aea12f
from being interpreted as negative values. The value
Packit aea12f
should be deallocated using @code{gnutls_free()} .
Packit aea12f
Packit aea12f
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise
Packit aea12f
an error code is returned.
Packit aea12f
Packit aea12f
@strong{Since:} 3.6.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_decode_rs_value
Packit aea12f
@anchor{gnutls_decode_rs_value}
Packit aea12f
@deftypefun {int} {gnutls_decode_rs_value} (const gnutls_datum_t * @var{sig_value}, gnutls_datum_t * @var{r}, gnutls_datum_t * @var{s})
Packit aea12f
@var{sig_value}: holds a Dss-Sig-Value DER or BER encoded structure
Packit aea12f
Packit aea12f
@var{r}: will contain the r value
Packit aea12f
Packit aea12f
@var{s}: will contain the s value
Packit aea12f
Packit aea12f
This function will decode the provided  @code{sig_value} , 
Packit aea12f
into  @code{r} and  @code{s} elements. The Dss-Sig-Value is used for DSA and ECDSA
Packit aea12f
signatures.
Packit aea12f
Packit aea12f
The output values may be padded with a zero byte to prevent them
Packit aea12f
from being interpreted as negative values. The value
Packit aea12f
should be deallocated using @code{gnutls_free()} .
Packit aea12f
Packit aea12f
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise
Packit aea12f
an error code is returned.
Packit aea12f
Packit aea12f
@strong{Since:} 3.6.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_encode_ber_digest_info
Packit aea12f
@anchor{gnutls_encode_ber_digest_info}
Packit aea12f
@deftypefun {int} {gnutls_encode_ber_digest_info} (gnutls_digest_algorithm_t @var{hash}, const gnutls_datum_t * @var{digest}, gnutls_datum_t * @var{output})
Packit aea12f
@var{hash}: the hash algorithm that was used to get the digest
Packit aea12f
Packit aea12f
@var{digest}: must contain the digest data
Packit aea12f
Packit aea12f
@var{output}: will contain the allocated DigestInfo BER encoded data
Packit aea12f
Packit aea12f
This function will encode the provided digest data, and its
Packit aea12f
algorithm into an RSA PKCS@code{1}  1.5 DigestInfo structure. 
Packit aea12f
Packit aea12f
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise
Packit aea12f
an error code is returned.
Packit aea12f
Packit aea12f
@strong{Since:} 3.5.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_encode_gost_rs_value
Packit aea12f
@anchor{gnutls_encode_gost_rs_value}
Packit aea12f
@deftypefun {int} {gnutls_encode_gost_rs_value} (gnutls_datum_t * @var{sig_value}, const gnutls_datum_t * @var{r}, const gnutls_datum_t  * @var{s})
Packit aea12f
@var{sig_value}: will hold a GOST signature according to RFC 4491 section 2.2.2
Packit aea12f
Packit aea12f
@var{r}: must contain the r value
Packit aea12f
Packit aea12f
@var{s}: must contain the s value
Packit aea12f
Packit aea12f
This function will encode the provided r and s values, into binary
Packit aea12f
representation according to RFC 4491 section 2.2.2, used for GOST R
Packit aea12f
34.10-2001 (and thus also for GOST R 34.10-2012) signatures.
Packit aea12f
Packit aea12f
The output value should be deallocated using @code{gnutls_free()} .
Packit aea12f
Packit aea12f
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise
Packit aea12f
an error code is returned.
Packit aea12f
Packit aea12f
@strong{Since:} 3.6.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_encode_rs_value
Packit aea12f
@anchor{gnutls_encode_rs_value}
Packit aea12f
@deftypefun {int} {gnutls_encode_rs_value} (gnutls_datum_t * @var{sig_value}, const gnutls_datum_t * @var{r}, const gnutls_datum_t * @var{s})
Packit aea12f
@var{sig_value}: will hold a Dss-Sig-Value DER encoded structure
Packit aea12f
Packit aea12f
@var{r}: must contain the r value
Packit aea12f
Packit aea12f
@var{s}: must contain the s value
Packit aea12f
Packit aea12f
This function will encode the provided r and s values, 
Packit aea12f
into a Dss-Sig-Value structure, used for DSA and ECDSA
Packit aea12f
signatures.
Packit aea12f
Packit aea12f
The output value should be deallocated using @code{gnutls_free()} .
Packit aea12f
Packit aea12f
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise
Packit aea12f
an error code is returned.
Packit aea12f
Packit aea12f
@strong{Since:} 3.6.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hash
Packit aea12f
@anchor{gnutls_hash}
Packit aea12f
@deftypefun {int} {gnutls_hash} (gnutls_hash_hd_t @var{handle}, const void * @var{ptext}, size_t @var{ptext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_hash_hd_t}  type
Packit aea12f
Packit aea12f
@var{ptext}: the data to hash
Packit aea12f
Packit aea12f
@var{ptext_len}: the length of data to hash
Packit aea12f
Packit aea12f
This function will hash the given data using the algorithm
Packit aea12f
specified by the context.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit Service 991b93
@subheading gnutls_hash_copy
Packit Service 991b93
@anchor{gnutls_hash_copy}
Packit Service 991b93
@deftypefun {gnutls_hash_hd_t} {gnutls_hash_copy} (gnutls_hash_hd_t @var{handle})
Packit Service 991b93
@var{handle}: is a @code{gnutls_hash_hd_t}  type
Packit Service 991b93
Packit Service 991b93
This function will create a copy of Message Digest context, containing all
Packit Service 991b93
its current state. Copying contexts for Message Digests registered using
Packit Service 991b93
@code{gnutls_crypto_register_digest()}  is not supported and will always result in
Packit Service 991b93
an error.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} new Message Digest context or NULL in case of an error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.9
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit aea12f
@subheading gnutls_hash_deinit
Packit aea12f
@anchor{gnutls_hash_deinit}
Packit aea12f
@deftypefun {void} {gnutls_hash_deinit} (gnutls_hash_hd_t @var{handle}, void * @var{digest})
Packit aea12f
@var{handle}: is a @code{gnutls_hash_hd_t}  type
Packit aea12f
Packit aea12f
@var{digest}: is the output value of the hash
Packit aea12f
Packit aea12f
This function will deinitialize all resources occupied by
Packit aea12f
the given hash context.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hash_fast
Packit aea12f
@anchor{gnutls_hash_fast}
Packit aea12f
@deftypefun {int} {gnutls_hash_fast} (gnutls_digest_algorithm_t @var{algorithm}, const void * @var{ptext}, size_t @var{ptext_len}, void * @var{digest})
Packit aea12f
@var{algorithm}: the hash algorithm to use
Packit aea12f
Packit aea12f
@var{ptext}: the data to hash
Packit aea12f
Packit aea12f
@var{ptext_len}: the length of data to hash
Packit aea12f
Packit aea12f
@var{digest}: is the output value of the hash
Packit aea12f
Packit aea12f
This convenience function will hash the given data and return output
Packit aea12f
on a single call.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hash_get_len
Packit aea12f
@anchor{gnutls_hash_get_len}
Packit aea12f
@deftypefun {unsigned} {gnutls_hash_get_len} (gnutls_digest_algorithm_t @var{algorithm})
Packit aea12f
@var{algorithm}: the hash algorithm to use
Packit aea12f
Packit aea12f
This function will return the length of the output data
Packit aea12f
of the given hash algorithm.
Packit aea12f
Packit aea12f
@strong{Returns:} The length or zero on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hash_init
Packit aea12f
@anchor{gnutls_hash_init}
Packit aea12f
@deftypefun {int} {gnutls_hash_init} (gnutls_hash_hd_t * @var{dig}, gnutls_digest_algorithm_t @var{algorithm})
Packit aea12f
@var{dig}: is a @code{gnutls_hash_hd_t}  type
Packit aea12f
Packit aea12f
@var{algorithm}: the hash algorithm to use
Packit aea12f
Packit aea12f
This function will initialize an context that can be used to
Packit aea12f
produce a Message Digest of data.  This will effectively use the
Packit aea12f
current crypto backend in use by gnutls or the cryptographic
Packit aea12f
accelerator in use.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hash_output
Packit aea12f
@anchor{gnutls_hash_output}
Packit aea12f
@deftypefun {void} {gnutls_hash_output} (gnutls_hash_hd_t @var{handle}, void * @var{digest})
Packit aea12f
@var{handle}: is a @code{gnutls_hash_hd_t}  type
Packit aea12f
Packit aea12f
@var{digest}: is the output value of the hash
Packit aea12f
Packit aea12f
This function will output the current hash value
Packit aea12f
and reset the state of the hash.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit Service 991b93
@subheading gnutls_hkdf_expand
Packit Service 991b93
@anchor{gnutls_hkdf_expand}
Packit Service 991b93
@deftypefun {int} {gnutls_hkdf_expand} (gnutls_mac_algorithm_t @var{mac}, const gnutls_datum_t * @var{key}, const gnutls_datum_t * @var{info}, void * @var{output}, size_t @var{length})
Packit Service 991b93
@var{mac}: the mac algorithm used internally
Packit Service 991b93
Packit Service 991b93
@var{key}: the pseudorandom key created with HKDF-Extract
Packit Service 991b93
Packit Service 991b93
@var{info}: the optional informational data
Packit Service 991b93
Packit Service 991b93
@var{output}: the output value of the expand operation
Packit Service 991b93
Packit Service 991b93
@var{length}: the desired length of the output key
Packit Service 991b93
Packit Service 991b93
This function will derive a variable length keying material from
Packit Service 991b93
the pseudorandom key using the HKDF-Expand function as defined in
Packit Service 991b93
RFC 5869.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} Zero or a negative error code on error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.13
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit Service 991b93
@subheading gnutls_hkdf_extract
Packit Service 991b93
@anchor{gnutls_hkdf_extract}
Packit Service 991b93
@deftypefun {int} {gnutls_hkdf_extract} (gnutls_mac_algorithm_t @var{mac}, const gnutls_datum_t * @var{key}, const gnutls_datum_t * @var{salt}, void * @var{output})
Packit Service 991b93
@var{mac}: the mac algorithm used internally
Packit Service 991b93
Packit Service 991b93
@var{key}: the initial keying material
Packit Service 991b93
Packit Service 991b93
@var{salt}: the optional salt
Packit Service 991b93
Packit Service 991b93
@var{output}: the output value of the extract operation
Packit Service 991b93
Packit Service 991b93
This function will derive a fixed-size key using the HKDF-Extract
Packit Service 991b93
function as defined in RFC 5869.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} Zero or a negative error code on error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.13
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit aea12f
@subheading gnutls_hmac
Packit aea12f
@anchor{gnutls_hmac}
Packit aea12f
@deftypefun {int} {gnutls_hmac} (gnutls_hmac_hd_t @var{handle}, const void * @var{ptext}, size_t @var{ptext_len})
Packit aea12f
@var{handle}: is a @code{gnutls_hmac_hd_t}  type
Packit aea12f
Packit aea12f
@var{ptext}: the data to hash
Packit aea12f
Packit aea12f
@var{ptext_len}: the length of data to hash
Packit aea12f
Packit aea12f
This function will hash the given data using the algorithm
Packit aea12f
specified by the context.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit Service 991b93
@subheading gnutls_hmac_copy
Packit Service 991b93
@anchor{gnutls_hmac_copy}
Packit Service 991b93
@deftypefun {gnutls_hmac_hd_t} {gnutls_hmac_copy} (gnutls_hmac_hd_t @var{handle})
Packit Service 991b93
@var{handle}: is a @code{gnutls_hmac_hd_t}  type
Packit Service 991b93
Packit Service 991b93
This function will create a copy of MAC context, containing all its current
Packit Service 991b93
state. Copying contexts for MACs registered using
Packit Service 991b93
@code{gnutls_crypto_register_mac()}  is not supported and will always result in an
Packit Service 991b93
error.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} new MAC context or NULL in case of an error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.9
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit aea12f
@subheading gnutls_hmac_deinit
Packit aea12f
@anchor{gnutls_hmac_deinit}
Packit aea12f
@deftypefun {void} {gnutls_hmac_deinit} (gnutls_hmac_hd_t @var{handle}, void * @var{digest})
Packit aea12f
@var{handle}: is a @code{gnutls_hmac_hd_t}  type
Packit aea12f
Packit aea12f
@var{digest}: is the output value of the MAC
Packit aea12f
Packit aea12f
This function will deinitialize all resources occupied by
Packit aea12f
the given hmac context.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hmac_fast
Packit aea12f
@anchor{gnutls_hmac_fast}
Packit aea12f
@deftypefun {int} {gnutls_hmac_fast} (gnutls_mac_algorithm_t @var{algorithm}, const void * @var{key}, size_t @var{keylen}, const void * @var{ptext}, size_t @var{ptext_len}, void * @var{digest})
Packit aea12f
@var{algorithm}: the hash algorithm to use
Packit aea12f
Packit aea12f
@var{key}: the key to use
Packit aea12f
Packit aea12f
@var{keylen}: the length of the key
Packit aea12f
Packit aea12f
@var{ptext}: the data to hash
Packit aea12f
Packit aea12f
@var{ptext_len}: the length of data to hash
Packit aea12f
Packit aea12f
@var{digest}: is the output value of the hash
Packit aea12f
Packit aea12f
This convenience function will hash the given data and return output
Packit Service 991b93
on a single call. Note, this call will not work for MAC algorithms
Packit Service 991b93
that require nonce (like UMAC or GMAC).
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit Service 991b93
@subheading gnutls_hmac_get_key_size
Packit Service 991b93
@anchor{gnutls_hmac_get_key_size}
Packit Service 991b93
@deftypefun {unsigned} {gnutls_hmac_get_key_size} (gnutls_mac_algorithm_t @var{algorithm})
Packit Service 991b93
@var{algorithm}: the mac algorithm to use
Packit Service 991b93
Packit Service 991b93
This function will return the size of the key to be used with this
Packit Service 991b93
algorithm. On the algorithms which may accept arbitrary key sizes,
Packit Service 991b93
the returned size is the MAC key size used in the TLS protocol.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} The key size or zero on error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.12
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit aea12f
@subheading gnutls_hmac_get_len
Packit aea12f
@anchor{gnutls_hmac_get_len}
Packit aea12f
@deftypefun {unsigned} {gnutls_hmac_get_len} (gnutls_mac_algorithm_t @var{algorithm})
Packit aea12f
@var{algorithm}: the hmac algorithm to use
Packit aea12f
Packit aea12f
This function will return the length of the output data
Packit aea12f
of the given hmac algorithm.
Packit aea12f
Packit aea12f
@strong{Returns:} The length or zero on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hmac_init
Packit aea12f
@anchor{gnutls_hmac_init}
Packit aea12f
@deftypefun {int} {gnutls_hmac_init} (gnutls_hmac_hd_t * @var{dig}, gnutls_mac_algorithm_t @var{algorithm}, const void * @var{key}, size_t @var{keylen})
Packit aea12f
@var{dig}: is a @code{gnutls_hmac_hd_t}  type
Packit aea12f
Packit aea12f
@var{algorithm}: the HMAC algorithm to use
Packit aea12f
Packit aea12f
@var{key}: the key to be used for encryption
Packit aea12f
Packit aea12f
@var{keylen}: the length of the key
Packit aea12f
Packit aea12f
This function will initialize an context that can be used to
Packit aea12f
produce a Message Authentication Code (MAC) of data.  This will
Packit aea12f
effectively use the current crypto backend in use by gnutls or the
Packit aea12f
cryptographic accelerator in use.
Packit aea12f
Packit aea12f
Note that despite the name of this function, it can be used
Packit aea12f
for other MAC algorithms than HMAC.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hmac_output
Packit aea12f
@anchor{gnutls_hmac_output}
Packit aea12f
@deftypefun {void} {gnutls_hmac_output} (gnutls_hmac_hd_t @var{handle}, void * @var{digest})
Packit aea12f
@var{handle}: is a @code{gnutls_hmac_hd_t}  type
Packit aea12f
Packit aea12f
@var{digest}: is the output value of the MAC
Packit aea12f
Packit aea12f
This function will output the current MAC value
Packit aea12f
and reset the state of the MAC.
Packit aea12f
Packit aea12f
@strong{Since:} 2.10.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_hmac_set_nonce
Packit aea12f
@anchor{gnutls_hmac_set_nonce}
Packit aea12f
@deftypefun {void} {gnutls_hmac_set_nonce} (gnutls_hmac_hd_t @var{handle}, const void * @var{nonce}, size_t @var{nonce_len})
Packit aea12f
@var{handle}: is a @code{gnutls_hmac_hd_t}  type
Packit aea12f
Packit aea12f
@var{nonce}: the data to set as nonce
Packit aea12f
Packit aea12f
@var{nonce_len}: the length of data
Packit aea12f
Packit aea12f
This function will set the nonce in the MAC algorithm.
Packit aea12f
Packit aea12f
@strong{Since:} 3.2.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_mac_get_nonce_size
Packit aea12f
@anchor{gnutls_mac_get_nonce_size}
Packit aea12f
@deftypefun {size_t} {gnutls_mac_get_nonce_size} (gnutls_mac_algorithm_t @var{algorithm})
Packit aea12f
@var{algorithm}: is an encryption algorithm
Packit aea12f
Packit aea12f
Returns the size of the nonce used by the MAC in TLS.
Packit aea12f
Packit aea12f
@strong{Returns:} length (in bytes) of the given MAC nonce size, or 0.
Packit aea12f
Packit aea12f
@strong{Since:} 3.2.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit Service 991b93
@subheading gnutls_pbkdf2
Packit Service 991b93
@anchor{gnutls_pbkdf2}
Packit Service 991b93
@deftypefun {int} {gnutls_pbkdf2} (gnutls_mac_algorithm_t @var{mac}, const gnutls_datum_t * @var{key}, const gnutls_datum_t * @var{salt}, unsigned @var{iter_count}, void * @var{output}, size_t @var{length})
Packit Service 991b93
@var{mac}: the mac algorithm used internally
Packit Service 991b93
Packit Service 991b93
@var{key}: the initial keying material
Packit Service 991b93
Packit Service 991b93
@var{salt}: the salt
Packit Service 991b93
Packit Service 991b93
@var{iter_count}: the iteration count
Packit Service 991b93
Packit Service 991b93
@var{output}: the output value
Packit Service 991b93
Packit Service 991b93
@var{length}: the desired length of the output key
Packit Service 991b93
Packit Service 991b93
This function will derive a variable length keying material from
Packit Service 991b93
a password according to PKCS @code{5}  PBKDF2.
Packit Service 991b93
Packit Service 991b93
@strong{Returns:} Zero or a negative error code on error.
Packit Service 991b93
Packit Service 991b93
@strong{Since:} 3.6.13
Packit Service 991b93
@end deftypefun
Packit Service 991b93
Packit aea12f
@subheading gnutls_rnd
Packit aea12f
@anchor{gnutls_rnd}
Packit aea12f
@deftypefun {int} {gnutls_rnd} (gnutls_rnd_level_t @var{level}, void * @var{data}, size_t @var{len})
Packit aea12f
@var{level}: a security level
Packit aea12f
Packit aea12f
@var{data}: place to store random bytes
Packit aea12f
Packit aea12f
@var{len}: The requested size
Packit aea12f
Packit aea12f
This function will generate random data and store it to output
Packit aea12f
buffer. The value of  @code{level} should be one of @code{GNUTLS_RND_NONCE} ,
Packit aea12f
@code{GNUTLS_RND_RANDOM}  and @code{GNUTLS_RND_KEY} . See the manual and
Packit aea12f
@code{gnutls_rnd_level_t}  for detailed information.
Packit aea12f
Packit aea12f
This function is thread-safe and also fork-safe.
Packit aea12f
Packit aea12f
@strong{Returns:} Zero on success, or a negative error code on error.
Packit aea12f
Packit aea12f
@strong{Since:} 2.12.0
Packit aea12f
@end deftypefun
Packit aea12f
Packit aea12f
@subheading gnutls_rnd_refresh
Packit aea12f
@anchor{gnutls_rnd_refresh}
Packit aea12f
@deftypefun {void} {gnutls_rnd_refresh} ( @var{void})
Packit aea12f
Packit aea12f
This function refreshes the random generator state.
Packit aea12f
That is the current precise time, CPU usage, and
Packit aea12f
other values are input into its state.
Packit aea12f
Packit aea12f
On a slower rate input from /dev/urandom is mixed too.
Packit aea12f
Packit aea12f
@strong{Since:} 3.1.7
Packit aea12f
@end deftypefun
Packit aea12f