Guardtime KSI c SDK
|
#include "ksi.h"
Go to the source code of this file.
Data Structures | |
struct | KSI_BlockSignerHandle_list_st |
Macros | |
#define | KSI_BlockSignerHandleList_append(lst, o) KSI_APPLY_TO_NOT_NULL((lst), append, ((lst), (o))) |
#define | KSI_BlockSignerHandleList_remove(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), removeElement, ((lst), (pos), (o))) |
#define | KSI_BlockSignerHandleList_indexOf(lst, o, i) KSI_APPLY_TO_NOT_NULL((lst), indexOf, ((lst), (o), (i))) |
#define | KSI_BlockSignerHandleList_insertAt(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), insertAt, ((lst), (pos), (o))) |
#define | KSI_BlockSignerHandleList_replaceAt(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), replaceAt, ((lst), (pos), (o))) |
#define | KSI_BlockSignerHandleList_elementAt(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), elementAt, ((lst), (pos), (o))) |
#define | KSI_BlockSignerHandleList_length(lst) (((lst) != NULL && (lst)->length != NULL) ? (lst)->length((lst)) : 0) |
#define | KSI_BlockSignerHandleList_sort(lst, cmp) KSI_APPLY_TO_NOT_NULL((lst), sort, ((lst), (cmp))) |
#define | KSI_BlockSignerHandleList_foldl(lst, foldCtx, foldFn) (((lst) != NULL) ? (((lst)->foldl != NULL) ? ((lst)->foldl((lst), (foldCtx), (foldFn))) : KSI_INVALID_STATE) : KSI_OK) |
#define | KSI_BlockSignerHandleList_find(lst, o, f, i) KSI_APPLY_TO_NOT_NULL((lst), find, ((lst), (o), (f), (i))) |
#define | KSI_BlockSigner_add(signer, hsh) KSI_BlockSigner_addLeaf((signer), (hsh), 0, NULL, NULL) |
Typedefs | |
typedef struct KSI_BlockSigner_st | KSI_BlockSigner |
typedef struct KSI_BlockSignerHandle_st | KSI_BlockSignerHandle |
typedef struct KSI_BlockSignerHandle_list_st | KSI_BlockSignerHandleList |
Functions | |
int | KSI_BlockSignerHandleList_new (KSI_BlockSignerHandleList **list) |
void | KSI_BlockSignerHandleList_free (KSI_BlockSignerHandleList *list) |
int | KSI_BlockSigner_new (KSI_CTX *ctx, KSI_HashAlgorithm algoId, KSI_DataHash *prevLeaf, KSI_OctetString *initVal, KSI_BlockSigner **signer) |
void | KSI_BlockSigner_free (KSI_BlockSigner *signer) |
int | KSI_BlockSigner_closeAndSign (KSI_BlockSigner *signer) |
int | KSI_BlockSigner_close (KSI_BlockSigner *signer, void *) |
int | KSI_BlockSigner_reset (KSI_BlockSigner *signer) |
int | KSI_BlockSigner_addLeaf (KSI_BlockSigner *signer, KSI_DataHash *hsh, int level, KSI_MetaData *metaData, KSI_BlockSignerHandle **handle) |
int | KSI_BlockSigner_getPrevLeaf (const KSI_BlockSigner *signer, KSI_DataHash **prevLeaf) |
int | KSI_BlockSignerHandle_getSignature (const KSI_BlockSignerHandle *handle, KSI_Signature **sig) |
void | KSI_BlockSignerHandle_free (KSI_BlockSignerHandle *handle) |
#define KSI_BlockSigner_add | ( | signer, | |
hsh | |||
) | KSI_BlockSigner_addLeaf((signer), (hsh), 0, NULL, NULL) |
Add a new leaf to the tree.
[in] | signer | Instance of the KSI_BlockSigner. |
[in] | hsh | Hash value of the leaf. |
#define KSI_BlockSignerHandleList_append | ( | lst, | |
o | |||
) | KSI_APPLY_TO_NOT_NULL((lst), append, ((lst), (o))) |
#define KSI_BlockSignerHandleList_elementAt | ( | lst, | |
pos, | |||
o | |||
) | KSI_APPLY_TO_NOT_NULL((lst), elementAt, ((lst), (pos), (o))) |
#define KSI_BlockSignerHandleList_find | ( | lst, | |
o, | |||
f, | |||
i | |||
) | KSI_APPLY_TO_NOT_NULL((lst), find, ((lst), (o), (f), (i))) |
#define KSI_BlockSignerHandleList_foldl | ( | lst, | |
foldCtx, | |||
foldFn | |||
) | (((lst) != NULL) ? (((lst)->foldl != NULL) ? ((lst)->foldl((lst), (foldCtx), (foldFn))) : KSI_INVALID_STATE) : KSI_OK) |
#define KSI_BlockSignerHandleList_indexOf | ( | lst, | |
o, | |||
i | |||
) | KSI_APPLY_TO_NOT_NULL((lst), indexOf, ((lst), (o), (i))) |
#define KSI_BlockSignerHandleList_insertAt | ( | lst, | |
pos, | |||
o | |||
) | KSI_APPLY_TO_NOT_NULL((lst), insertAt, ((lst), (pos), (o))) |
#define KSI_BlockSignerHandleList_length | ( | lst | ) | (((lst) != NULL && (lst)->length != NULL) ? (lst)->length((lst)) : 0) |
#define KSI_BlockSignerHandleList_remove | ( | lst, | |
pos, | |||
o | |||
) | KSI_APPLY_TO_NOT_NULL((lst), removeElement, ((lst), (pos), (o))) |
#define KSI_BlockSignerHandleList_replaceAt | ( | lst, | |
pos, | |||
o | |||
) | KSI_APPLY_TO_NOT_NULL((lst), replaceAt, ((lst), (pos), (o))) |
#define KSI_BlockSignerHandleList_sort | ( | lst, | |
cmp | |||
) | KSI_APPLY_TO_NOT_NULL((lst), sort, ((lst), (cmp))) |
typedef struct KSI_BlockSigner_st KSI_BlockSigner |
typedef struct KSI_BlockSignerHandle_st KSI_BlockSignerHandle |
typedef struct KSI_BlockSignerHandle_list_st KSI_BlockSignerHandleList |
int KSI_BlockSigner_addLeaf | ( | KSI_BlockSigner * | signer, |
KSI_DataHash * | hsh, | ||
int | level, | ||
KSI_MetaData * | metaData, | ||
KSI_BlockSignerHandle ** | handle | ||
) |
Lowlevel function for adding leafs to the aggregation tree.
[in] | signer | Instance of the KSI_BlockSigner. |
[in] | hsh | Hash value of the leaf node. |
[in] | level | Level of the leaf node. |
[in] | metaData | A meta-data object to associate the input hash with, can be NULL . |
[out] | handle | Handle for the current leaf; may be NULL. |
hsh
, metaData
nor handle
, it is the responsibility of the caller to free the objects. int KSI_BlockSigner_close | ( | KSI_BlockSigner * | signer, |
void * | |||
) |
int KSI_BlockSigner_closeAndSign | ( | KSI_BlockSigner * | signer | ) |
This function finalizes the computation of the tree but does not free the resources.
[in] | signer | Instance of the KSI_BlockSigner. |
void KSI_BlockSigner_free | ( | KSI_BlockSigner * | signer | ) |
Cleanup method for the KSI_BlockSigner.
[in] | signer | Instance of the KSI_BlockSigner. |
int KSI_BlockSigner_getPrevLeaf | ( | const KSI_BlockSigner * | signer, |
KSI_DataHash ** | prevLeaf | ||
) |
Getter method for prevLeaf
.
[in] | signer | Pointer to KSI_BlockSigner. |
[out] | prevLeaf | Pointer to receiving pointer. |
prevLeaf
is passed to the caller who is responsible for freeing the object. int KSI_BlockSigner_new | ( | KSI_CTX * | ctx, |
KSI_HashAlgorithm | algoId, | ||
KSI_DataHash * | prevLeaf, | ||
KSI_OctetString * | initVal, | ||
KSI_BlockSigner ** | signer | ||
) |
Create a new instance of KSI_BlockSigner.
[in] | ctx | KSI context. |
[in] | algoId | Algorithm to be used for the internal hash node computation. |
[in] | prevLeaf | For linking two trees, the user may add the last leaf value (can be NULL ) |
[in] | initVal | The initial value for masking. |
[out] | signer | Pointer to the receiving pointer. |
int KSI_BlockSigner_reset | ( | KSI_BlockSigner * | signer | ) |
Resets the block signer to its initial state. This will invalidate all the KSI_BlockSignerHandle instances still remaining.
[in] | signer | Instance of the KSI_BlockSigner. |
void KSI_BlockSignerHandle_free | ( | KSI_BlockSignerHandle * | handle | ) |
Cleanup method for the handle.
[in] | handle | Instance of the KSI_BlockSignerHandle |
int KSI_BlockSignerHandle_getSignature | ( | const KSI_BlockSignerHandle * | handle, |
KSI_Signature ** | sig | ||
) |
This function creates a new instance of a KSI signature and stores it in the output parameter.
[in] | handle | Handle for the block signature. |
[out] | sig | Pointer to the receiving pointer. |
void KSI_BlockSignerHandleList_free | ( | KSI_BlockSignerHandleList * | list | ) |
int KSI_BlockSignerHandleList_new | ( | KSI_BlockSignerHandleList ** | list | ) |