1 #ifndef __ISDS_CRYPTO_H__
2 #define __ISDS_CRYPTO_H__
6 /* Initialise all cryptographic libraries which libisds depends on.
7 * @return IE_SUCCESS if everything went all-right. */
8 isds_error
_isds_init_crypto(void);
10 /* Computes hash from @input with @length and store it into @hash.
11 * The hash algorithm is defined inside @hash.
12 * @input is input block to hash
13 * @length is @input block length in bytes
14 * @hash input algorithm, output hash value and hash length; hash value will be
15 * reallocated, it's always valid pointer or NULL (before and after call) */
16 isds_error
_isds_compute_hash(const void *input
, const size_t length
,
17 struct isds_hash
*hash
);
19 /* Free CMS data buffer allocated inside _isds_extract_cms_data().
20 * This is necessary because GPGME.
21 * @buffer is pointer to memory to free */
22 void _isds_cms_data_free(void *buffer
);
24 /* Extract data from CMS (successor of PKCS#7)
25 * The CMS' signature is is not verified.
26 * @context is session context
27 * @cms is input block with CMS structure
28 * @cms_length is @cms block length in bytes
29 * @data are automatically reallocated bit stream with data found in @cms
30 * You must free them with _isds_cms_data_free().
31 * @data_length is length of @data in bytes */
32 isds_error
_isds_extract_cms_data(struct isds_ctx
*context
,
33 const void *cms
, const size_t cms_length
,
34 void **data
, size_t *data_length
);