use libc::c_char;
#[repr(C)]
enum ParamSetId {
Xxx20140508401,
Xxx20140508439,
Xxx20140508593,
Xxx20140508743,
Xxx20151024401,
Xxx20151024443,
Xxx20151024563,
Xxx20151024743,
Xxx20151024907,
}
#[repr(C)]
pub struct ParamSet {
id: ParamSetId,
name: *const c_char,
oid: [u8; 3],
n_bits: u8,
q_bits: u8,
n: u16,
p: i8,
q: i64,
b_s: i64,
b_t: i64,
norm_bound_s: i64,
norm_bound_t: i64,
d1: u8,
d2: u8,
d3: u8,
padded_n: u16,
}
impl ParamSet {
pub fn get_n(&self) -> u16 {
self.n
}
pub fn get_p(&self) -> i8 {
self.p
}
pub fn get_d1(&self) -> u8 {
self.d1
}
pub fn get_d2(&self) -> u8 {
self.d2
}
pub fn get_d3(&self) -> u8 {
self.d3
}
pub fn product_form_bytes(&self) -> usize {
4 * (self.d1 as usize + self.d2 as usize + self.d3 as usize)
}
pub fn polynomial_bytes(&self) -> usize {
self.padded_n as usize * 8
}
pub fn privkey_packed_bytes(&self) -> usize {
5 +
2 *
((2 * (self.d1 as usize + self.d2 as usize + self.d3 as usize) *
self.n_bits as usize + 7) / 8) + ((self.n as usize + 4) / 5)
}
pub fn pubkey_packed_bytes(&self) -> usize {
5 + (self.n as usize * self.q_bits as usize + 7) / 8 + 64
}
}
pub const XXX_20140508_401: ParamSet = ParamSet {
id: ParamSetId::Xxx20140508401,
name: &[120, 120, 120, 45, 50, 48, 49, 52, 48, 53, 48, 56, 45, 52, 48, 49i8, 0][0],
oid: [0xff, 0xff, 0xff],
n_bits: 9,
q_bits: 18,
n: 401,
p: 3,
q: 1 << 18,
b_s: 240,
b_t: 80,
norm_bound_s: (1 << 17) - 240,
norm_bound_t: (1 << 17) - 80,
d1: 8,
d2: 8,
d3: 6,
padded_n: 416,
};
pub const XXX_20140508_439: ParamSet = ParamSet {
id: ParamSetId::Xxx20140508439,
name: &[120, 120, 120, 45, 50, 48, 49, 52, 48, 53, 48, 56, 45, 52, 51, 57, 0][0],
oid: [0xff, 0xff, 0xfe],
n_bits: 9,
q_bits: 19,
n: 439,
p: 3,
q: 1 << 19,
b_s: 264,
b_t: 88,
norm_bound_s: (1 << 18) - 264,
norm_bound_t: (1 << 18) - 88,
d1: 9,
d2: 8,
d3: 5,
padded_n: 448,
};
pub const XXX_20140508_593: ParamSet = ParamSet {
id: ParamSetId::Xxx20140508593,
name: &[120, 120, 120, 45, 50, 48, 49, 52, 48, 53, 48, 56, 45, 53, 57, 51, 0][0],
oid: [0xff, 0xff, 0xfd],
n_bits: 10,
q_bits: 19,
n: 593,
p: 3,
q: 1 << 19,
b_s: 300,
b_t: 100,
norm_bound_s: (1 << 18) - 300,
norm_bound_t: (1 << 18) - 100,
d1: 10,
d2: 10,
d3: 8,
padded_n: 608,
};
pub const XXX_20140508_743: ParamSet = ParamSet {
id: ParamSetId::Xxx20140508743,
name: &[120, 120, 120, 45, 50, 48, 49, 52, 48, 53, 48, 56, 45, 55, 52, 51, 0][0],
oid: [0xff, 0xff, 0xfc],
n_bits: 10,
q_bits: 20,
n: 743,
p: 3,
q: 1 << 20,
b_s: 336,
b_t: 112,
norm_bound_s: (1 << 19) - 336,
norm_bound_t: (1 << 19) - 112,
d1: 11,
d2: 11,
d3: 15,
padded_n: 768,
};
pub const XXX_20151024_401: ParamSet = ParamSet {
id: ParamSetId::Xxx20151024401,
name: &[120, 120, 120, 45, 50, 48, 49, 53, 49, 48, 50, 52, 45, 52, 48, 49, 0][0],
oid: [0xff, 0xff, 0xfb],
n_bits: 9,
q_bits: 15,
n: 401,
p: 3,
q: 1 << 15,
b_s: 138,
b_t: 46,
norm_bound_s: (1 << 14) - 138,
norm_bound_t: (1 << 14) - 46,
d1: 8,
d2: 8,
d3: 6,
padded_n: 416,
};
pub const XXX_20151024_443: ParamSet = ParamSet {
id: ParamSetId::Xxx20151024443,
name: &[120, 120, 120, 45, 50, 48, 49, 53, 49, 48, 50, 52, 45, 52, 52, 51, 0][0],
oid: [0xff, 0xff, 0xfa],
n_bits: 9,
q_bits: 16,
n: 443,
p: 3,
q: 1 << 16,
b_s: 138,
b_t: 46,
norm_bound_s: (1 << 15) - 138,
norm_bound_t: (1 << 15) - 46,
d1: 9,
d2: 8,
d3: 5,
padded_n: 448,
};
pub const XXX_20151024_563: ParamSet = ParamSet {
id: ParamSetId::Xxx20151024563,
name: &[120, 120, 120, 45, 50, 48, 49, 53, 49, 48, 50, 52, 45, 53, 54, 51, 0][0],
oid: [0xff, 0xff, 0xf9],
n_bits: 10,
q_bits: 16,
n: 563,
p: 3,
q: 1 << 16,
b_s: 174,
b_t: 58,
norm_bound_s: (1 << 15) - 174,
norm_bound_t: (1 << 15) - 58,
d1: 10,
d2: 9,
d3: 8,
padded_n: 592,
};
pub const XXX_20151024_743: ParamSet = ParamSet {
id: ParamSetId::Xxx20151024743,
name: &[120, 120, 120, 45, 50, 48, 49, 53, 49, 48, 50, 52, 45, 55, 52, 51, 0][0],
oid: [0xff, 0xff, 0xf7],
n_bits: 10,
q_bits: 17,
n: 743,
p: 3,
q: 1 << 17,
b_s: 186,
b_t: 62,
norm_bound_s: (1 << 16) - 186,
norm_bound_t: (1 << 16) - 62,
d1: 11,
d2: 11,
d3: 6,
padded_n: 752,
};
pub const XXX_20151024_907: ParamSet = ParamSet {
id: ParamSetId::Xxx20151024907,
name: &[120, 120, 120, 45, 50, 48, 49, 53, 49, 48, 50, 52, 45, 57, 48, 55, 0][0],
oid: [0xff, 0xff, 0xf6],
n_bits: 10,
q_bits: 17,
n: 907,
p: 3,
q: 1 << 17,
b_s: 225,
b_t: 75,
norm_bound_s: (1 << 16) - 225,
norm_bound_t: (1 << 16) - 75,
d1: 13,
d2: 12,
d3: 7,
padded_n: 912,
};