mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 12:00:56 +01:00
added pcphash_cleanpub() to free local pubkey hashes, which are not attached to any context
This commit is contained in:
@@ -88,9 +88,12 @@
|
||||
*/
|
||||
void pcphash_del(PCPCTX *ptx, void *key, int type);
|
||||
|
||||
/** Free memory used by key hashes. */
|
||||
/** Free memory used by key global ptx-attached hashes. */
|
||||
void pcphash_clean(PCPCTX *ptx);
|
||||
|
||||
/** Free memory by local pubkey hash */
|
||||
void pcphash_cleanpub(pcp_pubkey_t *pub);
|
||||
|
||||
/** Check if a secret key with a given key-id exists in the hash.
|
||||
|
||||
\param[in] PCP Context object.
|
||||
|
||||
@@ -64,6 +64,14 @@ void pcphash_clean(PCPCTX *ptx) {
|
||||
}
|
||||
}
|
||||
|
||||
void pcphash_cleanpub(pcp_pubkey_t *pub) {
|
||||
pcp_pubkey_t *current_pub, *ptmp;
|
||||
HASH_ITER(hh, pub, current_pub, ptmp) {
|
||||
HASH_DEL(pub, (pcp_pubkey_t *)current_pub);
|
||||
memset(current_pub, 0, sizeof(pcp_pubkey_t));
|
||||
free(current_pub);
|
||||
}
|
||||
}
|
||||
|
||||
pcp_keysig_t *pcphash_keysigexists(PCPCTX *ptx, char *id) {
|
||||
pcp_keysig_t *keysig = NULL;
|
||||
|
||||
Reference in New Issue
Block a user