int CG21_AUX_ROUND3_CHECK_SSID()

in src/cg21/cg21_aux.c [154:201]


int CG21_AUX_ROUND3_CHECK_SSID(CG21_SSID *his_ssid, octet *my_rid, octet *my_rho,
                               CG21_SSID *my_ssid, int n, bool rho){

    int ret;

    char o[SFS_SECP256K1 + 1];
    octet G_oct = {0, sizeof(o), o};

    char qq[EGS_SECP256K1];
    octet q_oct = {0, sizeof(qq), qq};

    // check whether given X_set and j_set are valid
    ret = CG21_set_comp(his_ssid->X_set_packed, his_ssid->j_set_packed,
                        my_ssid->X_set_packed,
                        my_ssid->j_set_packed, n, EFS_SECP256K1 + 1);
    if (ret != 1){
        return CG21_UNKNOWN_SSID;
    }

    // check the given rid
    ret = OCT_comp(his_ssid->rid, my_rid);
    if (ret != 1){
        return CG21_UNKNOWN_SSID;
    }

    // check the given curve generator
    CG21_get_G(&G_oct);
    ret = OCT_comp(his_ssid->g, &G_oct);
    if (ret != 1){
        return CG21_UNKNOWN_SSID;
    }

    // check the given curve order
    CG21_get_q(&q_oct);
    ret = OCT_comp(his_ssid->q, &q_oct);
    if (ret != 1){
        return CG21_UNKNOWN_SSID;
    }

    if (rho){
        ret = OCT_comp(his_ssid->rho, my_rho);
        if (ret != 1){
            return CG21_UNKNOWN_SSID;
        }
    }

    return CG21_OK;
}