cangrepp

Some cryptographic attacks
Log | Files | Refs | README

context.h (783B)


      1 #ifndef CONTEXT_H
      2 #define CONTEXT_H
      3 
      4 #include <flint.h>
      5 #include <fmpq.h>
      6 #include <fmpq_vec.h>
      7 #include <fmpz.h>
      8 #include <fmpz_vec.h>
      9 
     10 #include <string.h>
     11 
     12 #include "precomputed.h"
     13 
     14 extern const ulong pc_primorial_ui_array[PC_PRIMORIAL_UI_ARRAY_LEN];
     15 extern const ulong pc_smallprimes[PC_SMALLPRIMES_LEN];
     16 
     17 #define INITIAL_NUMBER_OF_ZS 4
     18 #define INITIAL_NUMBER_OF_QS 4
     19 
     20 typedef struct _context_t {
     21   fmpz *zs;
     22   slong zs_alloc;
     23 
     24   fmpq *qs;
     25   slong qs_alloc;
     26 
     27   int has_primorial;
     28   fmpz_t primorial;
     29 
     30   fmpz *smallprimes;
     31   slong nsmallprimes;
     32 } ctx_t;
     33 
     34 void ctx_init(ctx_t *ctx);
     35 void ctx_clear(ctx_t *ctx);
     36 void ctx_require(ctx_t *ctx, const slong nzs, const slong nqs);
     37 
     38 void ctx_set_precomputed_primorial(ctx_t *ctx);
     39 void ctx_set_precomputed_smallprimes(ctx_t *ctx);
     40 
     41 #endif