Implemented ntru_private_key class
This commit is contained in:
@@ -28,6 +28,26 @@ typedef struct ntru_param_set_t ntru_param_set_t;
|
||||
|
||||
#include <library.h>
|
||||
|
||||
/**
|
||||
* Encoding types for NTRU encryption public/private key blobs
|
||||
*/
|
||||
#define NTRU_PUBKEY_TAG 0x01
|
||||
#define NTRU_PRIVKEY_DEFAULT_TAG 0x02
|
||||
#define NTRU_PRIVKEY_TRITS_TAG 0xfe
|
||||
#define NTRU_PRIVKEY_INDICES_TAG 0xff
|
||||
|
||||
/**
|
||||
* Size in octets of the OID designating the NTRU encryption parameter set
|
||||
*/
|
||||
#define NTRU_OID_LEN 3
|
||||
|
||||
/**
|
||||
* Packing types for NTRU encryption public/private keys
|
||||
*/
|
||||
#define NTRU_KEY_PACKED_COEFFICIENTS 0x01
|
||||
#define NTRU_KEY_PACKED_INDICES 0x02
|
||||
#define NTRU_KEY_PACKED_TRITS 0x03
|
||||
|
||||
/**
|
||||
* NTRU encryption parameter set ID list
|
||||
*/
|
||||
@@ -60,23 +80,23 @@ extern enum_name_t *ntru_param_set_id_names;
|
||||
* NTRU encryption parameter set definitions
|
||||
*/
|
||||
struct ntru_param_set_t {
|
||||
ntru_param_set_id_t id; /* NTRU parameter set ID */
|
||||
uint8_t oid[3]; /* pointer to OID */
|
||||
uint8_t der_id; /* parameter-set DER id */
|
||||
uint8_t N_bits; /* no. of bits in N (i.e. in an index */
|
||||
uint16_t N; /* ring dimension */
|
||||
uint16_t sec_strength_len; /* no. of octets of security strength */
|
||||
uint16_t q; /* big modulus */
|
||||
uint8_t q_bits; /* no. of bits in q (i.e. in a coefficient */
|
||||
bool is_product_form; /* if product form used */
|
||||
uint32_t dF_r; /* no. of +1 or -1 coefficients in ring elements
|
||||
F, r */
|
||||
uint16_t dg; /* no. - 1 of +1 coefficients or
|
||||
no. of -1 coefficients in ring element g */
|
||||
uint16_t m_len_max; /* max no. of plaintext octets */
|
||||
uint16_t min_msg_rep_wt; /* min. message representative weight */
|
||||
uint8_t c_bits; /* no. bits in candidate for deriving an index */
|
||||
uint8_t m_len_len; /* no. of octets to hold mLenOctets */
|
||||
ntru_param_set_id_t id; /* NTRU parameter set ID */
|
||||
uint8_t oid[NTRU_OID_LEN]; /* pointer to OID */
|
||||
uint8_t der_id; /* parameter-set DER id */
|
||||
uint8_t N_bits; /* no. of bits in N (i.e. in an index */
|
||||
uint16_t N; /* ring dimension */
|
||||
uint16_t sec_strength_len; /* no. of octets of security strength */
|
||||
uint16_t q; /* big modulus */
|
||||
uint8_t q_bits; /* no. of bits in q (i.e. in a coefficient */
|
||||
bool is_product_form; /* if product form used */
|
||||
uint32_t dF_r; /* no. of +1 or -1 coefficients in ring elements
|
||||
F, r */
|
||||
uint16_t dg; /* no. - 1 of +1 coefficients or
|
||||
no. of -1 coefficients in ring element g */
|
||||
uint16_t m_len_max; /* max no. of plaintext octets */
|
||||
uint16_t min_msg_rep_wt; /* min. message representative weight */
|
||||
uint8_t c_bits; /* no. bits in candidate for deriving an index */
|
||||
uint8_t m_len_len; /* no. of octets to hold mLenOctets */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user