Guardtime KSI c SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
hash.h File Reference
#include <time.h>
#include "types_base.h"
#include "common.h"

Go to the source code of this file.

Data Structures

struct  KSI_DataHash_list_st
 

Macros

#define KSI_MAX_IMPRINT_LEN   65 /* Algorithm ID (1 byte) + longest digest. */
 
#define KSI_DataHashList_append(lst, o)   KSI_APPLY_TO_NOT_NULL((lst), append, ((lst), (o)))
 
#define KSI_DataHashList_remove(lst, pos, o)   KSI_APPLY_TO_NOT_NULL((lst), removeElement, ((lst), (pos), (o)))
 
#define KSI_DataHashList_indexOf(lst, o, i)   KSI_APPLY_TO_NOT_NULL((lst), indexOf, ((lst), (o), (i)))
 
#define KSI_DataHashList_insertAt(lst, pos, o)   KSI_APPLY_TO_NOT_NULL((lst), insertAt, ((lst), (pos), (o)))
 
#define KSI_DataHashList_replaceAt(lst, pos, o)   KSI_APPLY_TO_NOT_NULL((lst), replaceAt, ((lst), (pos), (o)))
 
#define KSI_DataHashList_elementAt(lst, pos, o)   KSI_APPLY_TO_NOT_NULL((lst), elementAt, ((lst), (pos), (o)))
 
#define KSI_DataHashList_length(lst)   (((lst) != NULL && (lst)->length != NULL) ? (lst)->length((lst)) : 0)
 
#define KSI_DataHashList_sort(lst, cmp)   KSI_APPLY_TO_NOT_NULL((lst), sort, ((lst), (cmp)))
 
#define KSI_DataHashList_foldl(lst, foldCtx, foldFn)   (((lst) != NULL) ? (((lst)->foldl != NULL) ? ((lst)->foldl((lst), (foldCtx), (foldFn))) : KSI_INVALID_STATE) : KSI_OK)
 
#define KSI_DataHashList_find(lst, o, f, i)   KSI_APPLY_TO_NOT_NULL((lst), find, ((lst), (o), (f), (i)))
 

Typedefs

typedef struct KSI_DataHasher_st KSI_DataHasher
 
typedef struct KSI_DataHash_st KSI_DataHash
 
typedef enum KSI_HashAlgorithm_en KSI_HashAlgorithm
 
typedef struct KSI_DataHash_list_st KSI_DataHashList
 

Enumerations

enum  KSI_HashAlgorithm_en {
  __KSI_HASHALG_DO_NOT_USE = -1, KSI_HASHALG_SHA1 = 0x00, KSI_HASHALG_SHA2_256 = 0x01, KSI_HASHALG_RIPEMD160 = 0x02,
  KSI_HASHALG_SHA2_384 = 0x04, KSI_HASHALG_SHA2_512 = 0x05, KSI_HASHALG_SHA3_224 = 0x07, KSI_HASHALG_SHA3_256 = 0x08,
  KSI_HASHALG_SHA3_384 = 0x09, KSI_HASHALG_SHA3_512 = 0x0a, KSI_HASHALG_SM3 = 0x0b, KSI_NUMBER_OF_KNOWN_HASHALGS,
  KSI_HASHALG_INVALID_VALUE = 0x100
}
 

Functions

int KSI_DataHasher_open (KSI_CTX *ctx, KSI_HashAlgorithm algo_id, KSI_DataHasher **hasher)
 
int KSI_DataHasher_reset (KSI_DataHasher *hasher)
 
int KSI_DataHasher_add (KSI_DataHasher *hasher, const void *data, size_t data_length)
 
int KSI_DataHasher_addImprint (KSI_DataHasher *hasher, const KSI_DataHash *hsh)
 
int KSI_DataHasher_addOctetString (KSI_DataHasher *hasher, const KSI_OctetString *data)
 
int KSI_DataHasher_close (KSI_DataHasher *hasher, KSI_DataHash **hash)
 
void KSI_DataHasher_free (KSI_DataHasher *hasher)
 
void KSI_DataHash_free (KSI_DataHash *hash)
 
int KSI_DataHash_create (KSI_CTX *ctx, const void *data, size_t data_length, KSI_HashAlgorithm algo_id, KSI_DataHash **hash)
 
int KSI_DataHash_clone (KSI_DataHash *from, KSI_DataHash **to)
 
int KSI_DataHash_extract (const KSI_DataHash *hash, KSI_HashAlgorithm *algo_id, const unsigned char **digest, size_t *digest_length)
 
int KSI_DataHash_fromDigest (KSI_CTX *ctx, KSI_HashAlgorithm algo_id, const unsigned char *digest, size_t digest_length, KSI_DataHash **hash)
 
int KSI_DataHash_getImprint (const KSI_DataHash *hash, const unsigned char **imprint, size_t *imprint_length)
 
int KSI_DataHash_fromImprint (KSI_CTX *ctx, const unsigned char *imprint, size_t imprint_length, KSI_DataHash **hash)
 
KSI_HashAlgorithm KSI_getHashAlgorithmByName (const char *name)
 
unsigned int KSI_getHashLength (KSI_HashAlgorithm algo_id)
 
unsigned int KSI_HashAlgorithm_getBlockSize (KSI_HashAlgorithm algo_id)
 
time_t KSI_HashAlgorithm_getDeprecatedFrom (KSI_HashAlgorithm algo_id)
 
time_t KSI_HashAlgorithm_getObsoleteFrom (KSI_HashAlgorithm algo_id)
 
int KSI_isHashAlgorithmTrusted (KSI_HashAlgorithm algo_id)
 
int KSI_checkHashAlgorithmAt (KSI_HashAlgorithm algo_id, time_t used_at)
 
int KSI_isHashAlgorithmSupported (KSI_HashAlgorithm algo_id)
 
const char * KSI_getHashAlgorithmName (KSI_HashAlgorithm algo_id)
 
int KSI_DataHash_equals (const KSI_DataHash *left, const KSI_DataHash *right)
 
int KSI_DataHash_fromTlv (KSI_TLV *tlv, KSI_DataHash **o)
 
int KSI_DataHash_toTlv (KSI_CTX *ctx, const KSI_DataHash *o, unsigned tag, int isNonCritical, int isForward, KSI_TLV **tlv)
 
int KSI_DataHash_getHashAlg (const KSI_DataHash *hash, KSI_HashAlgorithm *algo_id)
 
char * KSI_DataHash_toString (const KSI_DataHash *hsh, char *buf, size_t buf_len)
 
int KSI_DataHash_createZero (KSI_CTX *ctx, KSI_HashAlgorithm algo_id, KSI_DataHash **hsh)
 
KSI_DataHashKSI_DataHash_ref (KSI_DataHash *o)
 
int KSI_DataHashList_new (KSI_DataHashList **list)
 
void KSI_DataHashList_free (KSI_DataHashList *list)
 

Variables

const int KSI_HASHALG_INVALID
 
const int KSI_HASHALG_SHA3_244