Previous: , Up: Utilities   [Contents][Index]


14.4 How to return Libgcrypt’s configuration.

Although GCRYCTL_PRINT_CONFIG can be used to print configuration options, it is sometimes necessary to check them in a program. This can be accomplished by using this function:

Function: char * gcry_get_config (int mode, const char *what)

This function returns a malloced string with colon delimited configure options. With a value of 0 for mode this string resembles the output of GCRYCTL_PRINT_CONFIG. However, if what is not NULL, only the line where the first field (e.g. "cpu-arch") matches what is returned.

Other values than 0 for mode are not defined. The caller shall free the string using gcry_free. On error NULL is returned and ERRNO is set; if a value for WHAT is unknow ERRNO will be set to 0.