84#define UDIF_ANCHOR_INTERVAL_SEC 3600U
90#define UDIF_ANCHOR_MAX_AGE_MAX 7200U
96#define UDIF_ANCHOR_MAX_SIZE (512U + UDIF_SIGNED_HASH_SIZE)
102#define UDIF_ANCHOR_MEMBERSHIP_EVENT_COUNTER 4U
108#define UDIF_ANCHOR_REGISTRY_OBJECT_COUNTER 4U
114#define UDIF_ANCHOR_REGISTRY_TRANSACTION_COUNTER 4U
120#define UDIF_ANCHOR_SEQUENCE_SIZE 8U
126#define UDIF_ANCHOR_RECORD_SIZE (UDIF_SIGNED_HASH_SIZE + \
127 UDIF_CRYPTO_HASH_SIZE +\
128 UDIF_CRYPTO_HASH_SIZE + \
129 UDIF_CRYPTO_HASH_SIZE + \
130 UDIF_SERIAL_NUMBER_SIZE + \
131 UDIF_ANCHOR_SEQUENCE_SIZE + \
132 UDIF_VALID_TIME_SIZE + \
133 UDIF_ANCHOR_MEMBERSHIP_EVENT_COUNTER + \
134 UDIF_ANCHOR_REGISTRY_OBJECT_COUNTER + \
135 UDIF_ANCHOR_REGISTRY_TRANSACTION_COUNTER)
141#define UDIF_ANCHOR_SIGNING_SIZE (UDIF_CRYPTO_HASH_SIZE + \
142 UDIF_CRYPTO_HASH_SIZE + \
143 UDIF_CRYPTO_HASH_SIZE + \
144 UDIF_SERIAL_NUMBER_SIZE + \
145 UDIF_VALID_TIME_SIZE + \
146 UDIF_ANCHOR_MEMBERSHIP_EVENT_COUNTER + \
147 UDIF_ANCHOR_REGISTRY_OBJECT_COUNTER + \
148 UDIF_ANCHOR_SEQUENCE_SIZE + \
149 UDIF_ANCHOR_REGISTRY_TRANSACTION_COUNTER)
193 const uint8_t* regroot,
const uint8_t* txroot,
const uint8_t* mroot, uint32_t regcount, uint32_t txcount,
194 uint32_t memcount,
const uint8_t* childsigkey,
bool (*rng_generate)(uint8_t*,
size_t));
UDIF_EXPORT_API bool udif_anchor_verify(const udif_anchor_record *anchor, const uint8_t *childverkey, uint64_t expseq)
Verify an anchor record.
Definition anchor.c:297
UDIF_EXPORT_API udif_errors udif_anchor_create(udif_anchor_record *anchor, const uint8_t *childser, uint64_t sequence, uint64_t timestamp, const uint8_t *regroot, const uint8_t *txroot, const uint8_t *mroot, uint32_t regcount, uint32_t txcount, uint32_t memcount, const uint8_t *childsigkey, bool(*rng_generate)(uint8_t *, size_t))
Create an anchor record.
Definition anchor.c:7
UDIF_EXPORT_API udif_errors udif_anchor_deserialize(udif_anchor_record *anchor, const uint8_t *input, size_t inplen)
Deserialize an anchor record.
Definition anchor.c:54
UDIF_EXPORT_API bool udif_anchor_is_fresh(const udif_anchor_record *anchor, uint64_t ctime, uint64_t maxage)
Check anchor freshness.
Definition anchor.c:210
UDIF_EXPORT_API bool udif_anchor_verify_chain(const udif_anchor_record *prevanchor, const udif_anchor_record *nextanchor, const uint8_t *childverkey)
Verify anchor chain continuity.
Definition anchor.c:337
UDIF_EXPORT_API size_t udif_anchor_encoded_size(const udif_anchor_record *anchor)
Get anchor encoded size.
Definition anchor.c:192
UDIF_EXPORT_API udif_errors udif_anchor_serialize(uint8_t *output, size_t outlen, const udif_anchor_record *anchor)
Serialize an anchor record.
Definition anchor.c:231
UDIF_EXPORT_API udif_errors udif_anchor_compute_signature(udif_anchor_record *anchor, const uint8_t *sigkey, bool(*rng_generate)(uint8_t *, size_t))
Compute object digest and signature.
Definition anchor.c:132
UDIF_EXPORT_API void udif_anchor_clear(udif_anchor_record *anchor)
Clear an anchor record.
Definition anchor.c:167
UDIF_EXPORT_API bool udif_anchor_compare(const udif_anchor_record *a, const udif_anchor_record *b)
Compare two anchor records.
Definition anchor.c:175
UDIF_EXPORT_API bool udif_anchor_validate_sequence(const udif_anchor_record *anchor, uint64_t prevseq)
Validate anchor sequence.
Definition anchor.c:272
UDIF_EXPORT_API udif_errors udif_anchor_compute_digest(uint8_t *digest, const udif_anchor_record *anchor)
Compute anchor digest.
Definition anchor.c:95
Anchor record.
Definition anchor.h:159
uint32_t memcount
Definition anchor.h:167
uint8_t mroot[UDIF_CRYPTO_HASH_SIZE]
Definition anchor.h:161
uint64_t timestamp
Definition anchor.h:166
uint8_t signature[UDIF_SIGNED_HASH_SIZE]
Definition anchor.h:160
uint32_t regcount
Definition anchor.h:168
uint8_t txroot[UDIF_CRYPTO_HASH_SIZE]
Definition anchor.h:163
uint8_t childser[UDIF_SERIAL_NUMBER_SIZE]
Definition anchor.h:164
uint64_t sequence
Definition anchor.h:165
uint8_t regroot[UDIF_CRYPTO_HASH_SIZE]
Definition anchor.h:162
uint32_t txcount
Definition anchor.h:169
UDIF Common Definitions and Protocol Configuration.
#define UDIF_SERIAL_NUMBER_SIZE
The serial number field length.
Definition udif.h:519
#define UDIF_SIGNED_HASH_SIZE
The combined size of a signature and hash.
Definition udif.h:525
#define UDIF_CRYPTO_HASH_SIZE
The size of the certificate hash in bytes.
Definition udif.h:439
udif_errors
UDIF error codes.
Definition udif.h:628
#define UDIF_EXPORT_API
The api export prefix.
Definition udifcommon.h:103