packages feed

cao-0.1.1: backend_lib/C_generic/CAO_mod.h

/*  CAO Compiler
    Copyright (C) 2014 Cryptography and Information Security Group, HASLab - INESC TEC and Universidade do Minho

    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/>.  */

#ifndef CAO_MOD_H
#define CAO_MOD_H

#include "CAO_globals.h"

#ifdef __cplusplus

#include <NTL/ZZ_p.h>
#include <iostream>
#include <sstream>

NTL_CLIENT

typedef struct CAO_Mod_s {
	ZZ_pBak *bak;
	ZZ_p *val;
} CAO_mod_s;

extern "C" {
#endif

	CAO_RES CAO_mod_decl(CAO_mod *, CAO_int);

	CAO_RES CAO_mod_init(CAO_mod, const char *);
	CAO_RES _CAO_mod_init(CAO_mod, CAO_int);

	CAO_RES CAO_mod_assign(CAO_mod, CAO_mod);
	CAO_RES CAO_mod_assign_one(CAO_mod);
	CAO_RES CAO_mod_assign_zero(CAO_mod);
	CAO_RES CAO_mod_clone(CAO_mod *, CAO_mod);
	CAO_RES CAO_mod_dispose(CAO_mod);
	CAO_RES CAO_mod_add(CAO_mod, CAO_mod, CAO_mod);
	CAO_RES CAO_mod_addTo(CAO_mod, CAO_mod);
	CAO_RES CAO_mod_subTo(CAO_mod, CAO_mod);
	CAO_RES CAO_mod_sub(CAO_mod, CAO_mod, CAO_mod);
	CAO_RES CAO_mod_mul(CAO_mod, CAO_mod, CAO_mod);
	CAO_RES CAO_mod_div(CAO_mod, CAO_mod, CAO_mod);
	CAO_RES CAO_mod_pow(CAO_mod, CAO_mod, CAO_int);
	CAO_RES CAO_mod_sym(CAO_mod, CAO_mod);

	#define CAO_mod_equal(a,b,c) a = _CAO_mod_equal(b,c)
	CAO_bool _CAO_mod_equal(CAO_mod, CAO_mod);
	#define CAO_mod_nequal(a,b,c) a = _CAO_mod_nequal(b,c)
	CAO_bool _CAO_mod_nequal(CAO_mod, CAO_mod);

	CAO_RES CAO_mod_dump(CAO_mod);
	CAO_RES CAO_mod_cast_int(CAO_int, CAO_mod);
	CAO_RES CAO_mod_cast_mod(CAO_mod, CAO_mod);
	CAO_RES CAO_int_cast_mod(CAO_mod, CAO_int);

#ifdef __cplusplus
}
#endif

#endif