Next: , Previous: Working with sets of data, Up: AC Interface


6.6.3 Working with IO objects

Note: IO objects are currently only used in the context of message encoding/decoding and encryption/signature schemes.

— Data type: gcry_ac_io_t

gcry_ac_io_t is the type to be used for IO objects.

IO objects provide an uniform IO layer on top of different underlying IO mechanisms; either they can be used for providing data to the library (mode is GCRY_AC_IO_READABLE) or they can be used for retrieving data from the library (mode is GCRY_AC_IO_WRITABLE).

IO object need to be initialized by calling on of the following functions:

— Function: void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, ...);

Initialize ac_io according to mode, type and the variable list of arguments. The list of variable arguments to specify depends on the given type.

— Function: void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, gcry_ac_io_type_t type, va_list ap);

Initialize ac_io according to mode, type and the variable list of arguments ap. The list of variable arguments to specify depends on the given type.

The following types of IO objects exist:

GCRY_AC_IO_STRING
In case of GCRY_AC_IO_READABLE the IO object will provide data from a memory string. Arguments to specify at initialization time:
unsigned char *
Pointer to the beginning of the memory string
size_t
Size of the memory string
In case of GCRY_AC_IO_WRITABLE the object will store retrieved data in a newly allocated memory string. Arguments to specify at initialization time:
unsigned char **
Pointer to address, at which the pointer to the newly created memory string is to be stored
size_t *
Pointer to address, at which the size of the newly created memory string is to be stored

GCRY_AC_IO_CALLBACK
In case of GCRY_AC_IO_READABLE the object will forward read requests to a provided callback function. Arguments to specify at initialization time:
gcry_ac_data_read_cb_t
Callback function to use
void *
Opaque argument to provide to the callback function
In case of GCRY_AC_IO_WRITABLE the object will forward write requests to a provided callback function. Arguments to specify at initialization time:
gcry_ac_data_write_cb_t
Callback function to use
void *
Opaque argument to provide to the callback function