1 #ifndef __ISDS_CRYPTO_H__
2 #define __ISDS_CRYPTO_H__
6 /* Initialize libgrcypt if not yet done by application or other library.
7 * @current_version is static string describing current gcrypt version
8 * @return IE_SUCCESS if everything is O.k. */
9 isds_error
_isds_init_gcrypt(const char **current_version
);
11 /* Computes hash from @input with @length and store it into @hash.
12 * The hash algorithm is defined inside @hash.
13 * @input is input block to hash
14 * @length is @input block length in bytes
15 * @hash input algorithm, output hash value and hash length; hash value will be
16 * reallocated, it's always valid pointer or NULL (before and after call) */
17 isds_error
_isds_compute_hash(const void *input
, const size_t length
,
18 struct isds_hash
*hash
);
21 * @current_version is pointer to static string describing current gpgme
22 * @return IE_SUCCESS if everything is O.k. */
23 isds_error
_isds_init_gpgme(const char **current_version
);
25 /* Free CMS data buffer allocated inside _isds_extract_cms_data().
26 * This is necessary because GPGME.
27 * @buffer is pointer to memory to free */
28 void _isds_cms_data_free(void *buffer
);
30 /* Extract data from CMS (successor of PKCS#7)
31 * @context is session context
32 * @cms is input block with CMS structure
33 * @cms_length is @cms block length in bytes
34 * @data are automatically reallocated bit stream with data found in @cms
35 * You must free them with _isds_cms_data_free().
36 * @data_length is length of @data in bytes */
37 isds_error
_isds_extract_cms_data(struct isds_ctx
*context
,
38 const void *cms
, const size_t cms_length
,
39 void **data
, size_t *data_length
);