Guardtime KSI c SDK
hashchain.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013-2015 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 KSI_HASHCHAIN_H_
21 #define KSI_HASHCHAIN_H_
22 
23 #include <time.h>
24 
25 #include "hash.h"
26 #include "types.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
55 
58 
69  int KSI_HashChain_aggregate(KSI_CTX *, KSI_LIST(KSI_HashChainLink) *chain, const KSI_DataHash *inputHash, int startLevel, KSI_HashAlgorithm algo_id, int *endLevel, KSI_DataHash **outputHash);
70 
78  int KSI_HashChain_aggregateCalendar(KSI_CTX *, KSI_LIST(KSI_HashChainLink) *chain, const KSI_DataHash *inputHash, KSI_DataHash **outputHash);
79 
85 
94 
101  int KSI_HashChainLink_getIsLeft(const KSI_HashChainLink *t, int *isLeft);
102 
110  int KSI_HashChainLink_getLevelCorrection(const KSI_HashChainLink *t, KSI_Integer **levelCorrection);
111 
120 
129 
138 
146 
155 
164 
173 
182 
185 
187  int KSI_HashChainLink_LegacyId_toTlv(KSI_CTX *ctx, const KSI_OctetString *legacyId, unsigned tag, int isNonCritical, int isForward, KSI_TLV **tlv);
188 
191 
198  int KSI_CalendarHashChain_calculateAggregationTime(const KSI_CalendarHashChain *chain, time_t *aggrTime);
207 
225 
228 
236 
245 
251 
259 
261 
270  int KSI_AggregationHashChain_aggregate(KSI_AggregationHashChain *aggr, int startLevel, int *endLevel, KSI_DataHash **root);
271 
282 
284 
291 
300 
312  int KSI_AggregationHashChainList_aggregate(KSI_AggregationHashChainList *chainList, KSI_CTX *ctx, int level, KSI_DataHash **outputHash);
313 
314 
318 #ifdef __cplusplus
319 }
320 #endif
321 
322 #endif /* KSI_HASHCHAIN_H_ */
int KSI_HashChainLink_setLegacyId(KSI_HashChainLink *t, KSI_OctetString *legacyId)
int KSI_CalendarHashChain_setInputHash(KSI_CalendarHashChain *t, KSI_DataHash *inputHash)
KSI_HashChainLink KSI_CalendarHashChainLink
Definition: types.h:45
#define KSI_uint64_t
Definition: types_base.h:105
int KSI_AggregationHashChain_setInputData(KSI_AggregationHashChain *aggr, KSI_OctetString *inputData)
#define KSI_DEFINE_FN_TO_TLV(typ)
Definition: types_base.h:41
int KSI_AggregationHashChain_getAggregationTime(const KSI_AggregationHashChain *aggr, KSI_Integer **aggregationTime)
void KSI_CalendarHashChain_free(KSI_CalendarHashChain *t)
int KSI_AggregationHashChain_getChainIndex(const KSI_AggregationHashChain *aggr, KSI_LIST(KSI_Integer)**chainIndex)
struct KSI_Integer_st KSI_Integer
Definition: types_base.h:140
int KSI_HashChain_aggregate(KSI_CTX *, KSI_LIST(KSI_HashChainLink)*chain, const KSI_DataHash *inputHash, int startLevel, KSI_HashAlgorithm algo_id, int *endLevel, KSI_DataHash **outputHash)
int KSI_HashChainLinkIdentity_getSequenceNr(const KSI_HashChainLinkIdentity *o, KSI_Integer **v)
int KSI_HashChainLinkIdentity_getMachineId(const KSI_HashChainLinkIdentity *o, KSI_Utf8String **v)
int KSI_HashChainLinkIdentity_getRequestTime(const KSI_HashChainLinkIdentity *o, KSI_Integer **v)
int KSI_HashChainLink_setImprint(KSI_HashChainLink *t, KSI_DataHash *imprint)
Definition: hashchain.h:48
int KSI_AggregationHashChain_setAggrHashId(KSI_AggregationHashChain *aggr, KSI_Integer *aggrHashId)
int KSI_HashChainLink_setIsLeft(KSI_HashChainLink *t, int isLeft)
struct KSI_MetaDataElement_st KSI_MetaDataElement
Definition: types.h:38
int KSI_HashChainLink_LegacyId_fromTlv(KSI_TLV *tlv, KSI_OctetString **legacyId)
#define KSI_DEFINE_FN_FROM_TLV(typ)
Definition: types_base.h:30
int KSI_AggregationHashChain_getIdentity(const KSI_AggregationHashChain *aggr, KSI_HashChainLinkIdentityList **identity)
int KSI_AggregationHashChain_new(KSI_CTX *ctx, KSI_AggregationHashChain **out)
Definition: types.h:436
struct KSI_HashChainLink_st KSI_HashChainLink
Definition: types.h:44
int KSI_HashChainLink_setMetaData(KSI_HashChainLink *t, KSI_MetaDataElement *metaData)
void KSI_AggregationHashChain_free(KSI_AggregationHashChain *aggr)
int KSI_AggregationHashChainList_aggregate(KSI_AggregationHashChainList *chainList, KSI_CTX *ctx, int level, KSI_DataHash **outputHash)
#define KSI_DEFINE_REF(typ)
Definition: types_base.h:56
struct KSI_DataHash_st KSI_DataHash
Definition: hash.h:52
int KSI_SignatureBuilder_appendAggregationChain(KSI_SignatureBuilder *builder, KSI_AggregationHashChain *aggr)
int KSI_HashChainLink_getMetaData(const KSI_HashChainLink *t, KSI_MetaDataElement **metaData)
enum KSI_HashChainLinkIdentityType_en KSI_HashChainLinkIdentityType
int KSI_AggregationHashChain_setInputHash(KSI_AggregationHashChain *aggr, KSI_DataHash *inputHash)
int KSI_CalendarHashChain_getAggregationTime(const KSI_CalendarHashChain *t, KSI_Integer **aggregationTime)
enum KSI_HashAlgorithm_en KSI_HashAlgorithm
void KSI_HashChainLinkIdentity_free(KSI_HashChainLinkIdentity *identity)
#define KSI_FN_DEPRECATED(decl, comment)
Definition: common.h:50
int KSI_AggregationHashChain_getInputHash(const KSI_AggregationHashChain *aggr, KSI_DataHash **inputHash)
struct KSI_CalendarHashChain_st KSI_CalendarHashChain
Definition: types.h:46
int KSI_CalendarHashChain_getHashChain(const KSI_CalendarHashChain *t, KSI_LIST(KSI_HashChainLink)**hashChain)
int KSI_AggregationHashChain_getInputData(const KSI_AggregationHashChain *aggr, KSI_OctetString **inputData)
struct KSI_OctetString_st KSI_OctetString
Definition: types_base.h:145
int KSI_CalendarHashChain_getPublicationTime(const KSI_CalendarHashChain *t, KSI_Integer **publicationTime)
Definition: hashchain.h:56
int KSI_CalendarHashChain_setPublicationTime(KSI_CalendarHashChain *t, KSI_Integer *publicationTime)
int KSI_CalendarHashChain_verifyCompatibilityTo(const KSI_CalendarHashChain *a, const KSI_CalendarHashChain *b)
int KSI_HashChainLink_getIsLeft(const KSI_HashChainLink *t, int *isLeft)
int KSI_CalendarHashChain_setHashChain(KSI_CalendarHashChain *t, KSI_LIST(KSI_HashChainLink)*hashChain)
struct KSI_Signature_st KSI_Signature
Definition: types.h:67
int KSI_AggregationHashChain_calculateShape(const KSI_AggregationHashChain *chn, KSI_uint64_t *shape)
int KSI_HashChainLink_new(KSI_CTX *ctx, KSI_HashChainLink **t)
KSI_HashChainLinkIdentityType_en
Definition: hashchain.h:43
void KSI_HashChainLink_free(KSI_HashChainLink *t)
int KSI_HashChainLink_getImprint(const KSI_HashChainLink *t, KSI_DataHash **imprint)
int KSI_HashChainLink_setLevelCorrection(KSI_HashChainLink *t, KSI_Integer *levelCorrection)
int KSI_CalendarHashChain_calculateAggregationTime(const KSI_CalendarHashChain *chain, time_t *aggrTime)
#define KSI_DEFINE_WRITE_BYTES(typ)
Definition: types_base.h:89
int KSI_CalendarHashChain_aggregate(KSI_CalendarHashChain *chain, KSI_DataHash **hsh)
struct KSI_CTX_st KSI_CTX
Definition: types_base.h:124
struct KSI_TLV_st KSI_TLV
Definition: types_base.h:129
int KSI_CalendarHashChain_setAggregationTime(KSI_CalendarHashChain *t, KSI_Integer *aggregationTime)
int KSI_AggregationHashChain_getAggrHashId(const KSI_AggregationHashChain *aggr, KSI_Integer **aggrHashId)
struct KSI_AggregationHashChain_st KSI_AggregationHashChain
Definition: types.h:132
int KSI_HashChainLinkIdentity_getClientId(const KSI_HashChainLinkIdentity *o, KSI_Utf8String **v)
int KSI_AggregationHashChain_setChain(KSI_AggregationHashChain *aggr, KSI_LIST(KSI_HashChainLink)*chain)
struct KSI_Utf8String_st KSI_Utf8String
Definition: types_base.h:150
int KSI_AggregationHashChain_compare(const KSI_AggregationHashChain **left, const KSI_AggregationHashChain **right)
Definition: types.h:172
int KSI_AggregationHashChain_setChainIndex(KSI_AggregationHashChain *aggr, KSI_LIST(KSI_Integer)*chainIndex)
int KSI_CalendarHashChain_getInputHash(const KSI_CalendarHashChain *t, KSI_DataHash **inputHash)
int KSI_HashChainLinkIdentity_getType(const KSI_HashChainLinkIdentity *o, KSI_HashChainLinkIdentityType *v)
int KSI_HashChain_aggregateCalendar(KSI_CTX *, KSI_LIST(KSI_HashChainLink)*chain, const KSI_DataHash *inputHash, KSI_DataHash **outputHash)
int KSI_AggregationHashChain_setAggregationTime(KSI_AggregationHashChain *aggr, KSI_Integer *aggregationTime)
Definition: hashchain.h:54
struct KSI_HashChainLinkIdentity_st KSI_HashChainLinkIdentity
Definition: types.h:43
int KSI_AggregationHashChain_getChain(const KSI_AggregationHashChain *aggr, KSI_LIST(KSI_HashChainLink)**chain)
int KSI_HashChainLink_getLevelCorrection(const KSI_HashChainLink *t, KSI_Integer **levelCorrection)
int KSI_AggregationHashChain_aggregate(KSI_AggregationHashChain *aggr, int startLevel, int *endLevel, KSI_DataHash **root)
#define KSI_LIST(type)
Definition: list.h:44
int KSI_CalendarHashChain_new(KSI_CTX *ctx, KSI_CalendarHashChain **t)
int KSI_HashChainLink_LegacyId_toTlv(KSI_CTX *ctx, const KSI_OctetString *legacyId, unsigned tag, int isNonCritical, int isForward, KSI_TLV **tlv)
int KSI_Signature_appendAggregationChain(KSI_Signature *sig, KSI_AggregationHashChain *aggr)
int KSI_HashChainLink_getLegacyId(const KSI_HashChainLink *t, KSI_OctetString **legacyId)