Guardtime KSI c SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
blocksigner.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013-2016 Guardtime, Inc.
3  *
4  * This file is part of the Guardtime client SDK.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License").
7  * You may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  * http://www.apache.org/licenses/LICENSE-2.0
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES, CONDITIONS, OR OTHER LICENSES OF ANY KIND, either
13  * express or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  * "Guardtime" and "KSI" are trademarks or registered trademarks of
16  * Guardtime, Inc., and no license to trademarks is granted; Guardtime
17  * reserves and retains all trademark rights.
18  */
19 
20 #ifndef BLOCKSIGNER_H_
21 #define BLOCKSIGNER_H_
22 
23 #include "ksi.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 typedef struct KSI_BlockSigner_st KSI_BlockSigner;
30 typedef struct KSI_BlockSignerHandle_st KSI_BlockSignerHandle;
31 
33 #define KSI_BlockSignerHandleList_append(lst, o) KSI_APPLY_TO_NOT_NULL((lst), append, ((lst), (o)))
34 #define KSI_BlockSignerHandleList_remove(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), removeElement, ((lst), (pos), (o)))
35 #define KSI_BlockSignerHandleList_indexOf(lst, o, i) KSI_APPLY_TO_NOT_NULL((lst), indexOf, ((lst), (o), (i)))
36 #define KSI_BlockSignerHandleList_insertAt(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), insertAt, ((lst), (pos), (o)))
37 #define KSI_BlockSignerHandleList_replaceAt(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), replaceAt, ((lst), (pos), (o)))
38 #define KSI_BlockSignerHandleList_elementAt(lst, pos, o) KSI_APPLY_TO_NOT_NULL((lst), elementAt, ((lst), (pos), (o)))
39 #define KSI_BlockSignerHandleList_length(lst) (((lst) != NULL && (lst)->length != NULL) ? (lst)->length((lst)) : 0)
40 #define KSI_BlockSignerHandleList_sort(lst, cmp) KSI_APPLY_TO_NOT_NULL((lst), sort, ((lst), (cmp)))
41 #define KSI_BlockSignerHandleList_foldl(lst, foldCtx, foldFn) (((lst) != NULL) ? (((lst)->foldl != NULL) ? ((lst)->foldl((lst), (foldCtx), (foldFn))) : KSI_INVALID_STATE) : KSI_OK)
42 #define KSI_BlockSignerHandleList_find(lst, o,f, i) KSI_APPLY_TO_NOT_NULL((lst), find, ((lst), (o), (f), (i)))
43 
53 int KSI_BlockSigner_new(KSI_CTX *ctx, KSI_HashAlgorithm algoId, KSI_DataHash *prevLeaf, KSI_OctetString *initVal, KSI_BlockSigner **signer);
54 
60 
67 
69 
77 
84 #define KSI_BlockSigner_add(signer, hsh) KSI_BlockSigner_addLeaf((signer), (hsh), 0, NULL, NULL)
85 
98 int KSI_BlockSigner_addLeaf(KSI_BlockSigner *signer, KSI_DataHash *hsh, int level, KSI_MetaData *metaData, KSI_BlockSignerHandle **handle);
99 
107 int KSI_BlockSigner_getPrevLeaf(const KSI_BlockSigner *signer, KSI_DataHash **prevLeaf);
108 
118 
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif /* BLOCKSIGNER_H_ */
int KSI_BlockSigner_addLeaf(KSI_BlockSigner *signer, KSI_DataHash *hsh, int level, KSI_MetaData *metaData, KSI_BlockSignerHandle **handle)
int KSI_BlockSigner_reset(KSI_BlockSigner *signer)
int KSI_BlockSignerHandle_getSignature(const KSI_BlockSignerHandle *handle, KSI_Signature **sig)
struct KSI_DataHash_st KSI_DataHash
Definition: hash.h:52
void KSI_BlockSigner_free(KSI_BlockSigner *signer)
struct KSI_BlockSignerHandle_st KSI_BlockSignerHandle
Definition: blocksigner.h:30
int KSI_BlockSigner_closeAndSign(KSI_BlockSigner *signer)
enum KSI_HashAlgorithm_en KSI_HashAlgorithm
#define KSI_FN_DEPRECATED(decl, comment)
Definition: common.h:50
int KSI_BlockSigner_new(KSI_CTX *ctx, KSI_HashAlgorithm algoId, KSI_DataHash *prevLeaf, KSI_OctetString *initVal, KSI_BlockSigner **signer)
struct KSI_OctetString_st KSI_OctetString
Definition: types_base.h:145
int KSI_BlockSigner_getPrevLeaf(const KSI_BlockSigner *signer, KSI_DataHash **prevLeaf)
struct KSI_Signature_st KSI_Signature
Definition: types.h:67
#define KSI_DEFINE_LIST(type)
Definition: list.h:159
struct KSI_CTX_st KSI_CTX
Definition: types_base.h:124
struct KSI_BlockSigner_st KSI_BlockSigner
Definition: blocksigner.h:29
void KSI_BlockSignerHandle_free(KSI_BlockSignerHandle *handle)
int KSI_BlockSigner_close(KSI_BlockSigner *signer, void *)
struct KSI_MetaData_st KSI_MetaData
Definition: types.h:42