Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

project.c 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "elmoasmfunctionsdef-extension.h"
  4. // ELMO API :
  5. // - printbyte(addr): Print single byte located at address 'addr' to output file;
  6. // - randbyte(addr): Load byte of random to memory address 'addr';
  7. // - readbyte(addr): Read byte from input file to address 'addr'.
  8. // ELMO API (extension) :
  9. // - print2bytes, rand2bytes and read2bytes: idem, but for an address pointing on 2 bytes;
  10. // - print4bytes, rand4bytes and read4bytes: idem, but for an address pointing on 4 bytes.
  11. #include "polyvec.h"
  12. #include "params.h"
  13. int main(void) {
  14. uint16_t num_challenge, nb_challenges;
  15. int j, k;
  16. polyvec skpv;
  17. read2bytes(&nb_challenges);
  18. for(num_challenge=0; num_challenge<nb_challenges; num_challenge++) {
  19. // Load the private vector s
  20. for(j=0;j<KYBER_K;j++)
  21. for(k=0;k<KYBER_N;k++)
  22. read2bytes((uint16_t*) &skpv.vec[j].coeffs[k]);
  23. starttrigger(); // To start a new trace
  24. // Do the leaking operations here...
  25. polyvec_ntt(&skpv);
  26. endtrigger(); // To end the current trace
  27. // Print the results of the computation
  28. for(j=0;j<KYBER_K;j++)
  29. for(k=0;k<KYBER_N;k++)
  30. print2bytes((uint16_t*) &skpv.vec[j].coeffs[k]);
  31. }
  32. endprogram(); // To indicate to ELMO that the simulation is finished
  33. return 0;
  34. }