Browse Source

Update secret object upon splitting

When splitting, update the threshold field of the secret object,
and the length field of each share.
develop
Damien Goutte-Gattat 5 years ago
parent
commit
d1c1c9f72e
  1. 4
      src/secret.c
  2. 3
      src/secretcfg.h

4
src/secret.c

@ -544,6 +544,8 @@ gfsec_secret_split(gfsec_secret_t *secret, unsigned char threshold)
if ( threshold >= n )
return GFSEC_ERR_NOT_ENOUGH_SHARES;
secret->threshold = threshold;
if ( gfshare_fill_rand == NULL )
gfshare_fill_rand = gfsec_fill_rand;
@ -557,6 +559,8 @@ gfsec_secret_split(gfsec_secret_t *secret, unsigned char threshold)
rc = GFSEC_ERR_SYSTEM_ERROR;
if ( ! (share->hash = malloc(32)) )
rc = GFSEC_ERR_SYSTEM_ERROR;
share->len = secret->len;
}
if ( rc == 0 && ! (ctx = gfshare_ctx_init_enc(sharenrs, n, threshold,

3
src/secretcfg.h

@ -31,6 +31,9 @@ gfsec_parse_uri(const char *, gfsec_secret_t *, int);
int
gfsec_read_config(gfsec_secret_t **, const char *, unsigned int *);
int
gfsec_write_config(gfsec_secret_t *, const char *);
#ifdef __cplusplus
}
#endif

Loading…
Cancel
Save