in src/cg21/cg21_utilities.c [757:805]
int CG21_PedersenPriv_from_octet(PEDERSEN_PRIV *priv, octet *oct){
// check whether the length of the octet is correct
if (oct->len != 6*FS_2048+3*HFS_2048)
{
return CG21_UTILITIES_WRONG_PACKED_SIZE;
}
char t[6][FS_2048];
octet T1[6];
init_octets((char *)t, T1, FS_2048, 6);
char tt[3][HFS_2048];
octet T2[3];
init_octets((char *)tt, T2, HFS_2048, 3);
// split packed octet into several small octets in different for loops based on their sizes
for (int i=0; i<3; i++) {
OCT_chop(oct, &T2[i], oct->len - (HFS_2048));
}
for (int i=0; i<6; i++) {
OCT_chop(oct, &T1[i], oct->len - (FS_2048));
}
FF_2048_fromOctet(priv->mod.invpq, &T2[0],HFLEN_2048 );
FF_2048_fromOctet(priv->mod.q, &T2[1],HFLEN_2048 );
FF_2048_fromOctet(priv->mod.p, &T2[2],HFLEN_2048 );
FF_2048_fromOctet(priv->mod.n, &T1[0],FFLEN_2048 );
FF_2048_fromOctet(priv->pq, &T1[1],FFLEN_2048 );
FF_2048_fromOctet(priv->ialpha, &T1[2],FFLEN_2048 );
FF_2048_fromOctet(priv->alpha, &T1[3],FFLEN_2048 );
FF_2048_fromOctet(priv->b1, &T1[4],FFLEN_2048 );
FF_2048_fromOctet(priv->b0, &T1[5],FFLEN_2048 );
// recover the length of the packed octet
oct->len = 6*FS_2048+3*HFS_2048;
// clean up
for (int i=0; i<6; i++) {
OCT_clear(&T1[i]);
}
for (int i=0; i<3; i++) {
OCT_clear(&T2[i]);
}
return CG21_OK;
}