From 7349c7e8bede89ecc888dcca66b74c9928f4458f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Pr=C3=BC=C3=9Fner?= Date: Sat, 3 May 2014 14:03:03 +0200 Subject: [PATCH] used pb_starmultiply for the first multiplication and added p, q, N --- src/ntru_decrypt.c | 10 ++++++++-- src/ntru_decrypt.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ntru_decrypt.c b/src/ntru_decrypt.c index cfe08f4..5e048db 100644 --- a/src/ntru_decrypt.c +++ b/src/ntru_decrypt.c @@ -21,11 +21,12 @@ #include "ntru_decrypt.h" #include "poly.h" +#include "context.h" /* * Legend * - * N : highest degree of the polynom + * N : maximal degree of the polynom * q : "is given" (... mod q) * p : "is given" (... mod p) * f : private key @@ -36,10 +37,15 @@ * */ // 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 = ? + unsigned int q = *context->q; + unsigned int p = *context->p; + unsigned int N = *context->N; //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++){ if(a[i] < 0 ) { diff --git a/src/ntru_decrypt.h b/src/ntru_decrypt.h index 9da81cc..2d89c13 100644 --- a/src/ntru_decrypt.h +++ b/src/ntru_decrypt.h @@ -25,6 +25,6 @@ #include "poly.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 */