used pb_starmultiply for the first multiplication and added p, q, N

This commit is contained in:
Christoph Prüßner 2014-05-03 14:03:03 +02:00
parent 4de50e2390
commit 7349c7e8be
2 changed files with 9 additions and 3 deletions

View File

@ -21,11 +21,12 @@
#include "ntru_decrypt.h" #include "ntru_decrypt.h"
#include "poly.h" #include "poly.h"
#include "context.h"
/* /*
* Legend * Legend
* *
* N : highest degree of the polynom * N : maximal degree of the polynom
* q : "is given" (... mod q) * q : "is given" (... mod q)
* p : "is given" (... mod p) * p : "is given" (... mod p)
* f : private key * f : private key
@ -36,10 +37,15 @@
* */ * */
// Require: N , q, p, secret key f , inverse polynomial Fp , and encrypted message e. // Require: N , q, p, secret key f , inverse polynomial Fp , and encrypted message e.
int ntru_decrypt(char *encr_msg, pb_poly *private_key, ntru_context *context, char ** decr_msg){ int ntru_decrypt(pb_poly *encr_msg, pb_poly *private_key, ntru_context *context, char ** decr_msg){
// toDo q = ?, p = ?, fp = ? // toDo q = ?, p = ?, fp = ?
unsigned int q = *context->q;
unsigned int p = *context->p;
unsigned int N = *context->N;
//toDO StarMultiply(f, e, a, N, q) //toDO StarMultiply(f, e, a, N, q)
pb_poly *a;
pb_starmultiply(private_key, encr_msg, a, context, q);
for(int i = 0, i < N, i++){ for(int i = 0, i < N, i++){
if(a[i] < 0 ) { if(a[i] < 0 ) {

View File

@ -25,6 +25,6 @@
#include "poly.h" #include "poly.h"
#include "context.h" #include "context.h"
int ntru_decrypt(char *encr_msg, pb_poly *private_key, ntru_context *context, char ** decr_msg); int ntru_decrypt(pb_poly *encr_msg, pb_poly *private_key, ntru_context *context, char ** decr_msg);
#endif /* NTRU_DECRYPT */ #endif /* NTRU_DECRYPT */