Helper function to walk through keydata chained blocks.

This commit is contained in:
Giovanni Bajo authored and Simon Kelley committed 2013-08-20 15:41:21 +01:00
1 parent a7338645d7
commit 458824dcb4
2 files changed
+18

No files matched your search

+17
View File
@@ -1364,6 +1364,23 @@ struct keydata *keydata_alloc(char *data, size_t len)
return ret;
}
size_t keydata_walk(struct keydata **key, unsigned char **p, size_t cnt)
{
size_t ret;
if (*p == NULL)
*p = (*key)->key;
else if (*p == (*key)->key + KEYBLOCK_LEN)
{
*key = (*key)->next;
if (*key == NULL)
return 0;
*p = (*key)->key;
}
return MIN(cnt, (*key)->key + KEYBLOCK_LEN - (*p));
}
void keydata_free(struct keydata *blocks)
{
struct keydata *tmp;
+1
View File
@@ -925,6 +925,7 @@ char *cache_get_name(struct crec *crecp);
struct crec *cache_enumerate(int init);
#ifdef HAVE_DNSSEC
struct keydata *keydata_alloc(char *data, size_t len);
size_t keydata_walk(struct keydata **key, unsigned char **p, size_t cnt);
void keydata_free(struct keydata *blocks);
#endif