Tools to make secret sharing easier.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.6 KiB

/*
* gfsec - Secret sharing tools
* Copyright (C) 2016 Damien Goutte-Gattat
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "share.h"
#include <string.h>
/**
* Frees the specified share object.
*
* @param share The share object to destroy.
* @param linked If non-zero, also free all linked share objects.
*/
void
gfsec_destroy_share(gfsec_share_t *share, int linked)
{
while ( share ) {
if ( share->authority )
free(share->authority);
if ( share->path )
free(share->path);
if ( share->data ) {
memset(share->data, 0, share->length);
free(share->data);
}
if ( share->sha256 )
free(share->sha256);
if ( linked ) {
gfsec_share_t *tmp = share->next;
free(share);
share = tmp;
}
else {
free(share);
share = NULL;
}
}
}