tree checksum vpatch file split hunks

all signers: diana_coman

antecedents: ch1_mpi

press order:

eucrypt_genesisdiana_coman
ch1_mpidiana_coman
eucrypt_mpi_fix_copy_incrdiana_coman

patch:

- 4C06FE251CB2613489112E141996AACC96DF8663971921487AA423F35648F26B8C57EAEBB4C392196EF382778C6150B5D73921AAAFC3ED3CD65216F4EB6C1CF0
+ 0EC90EEED7BB58E2D737FDDAF5CD8101CFB114C9D0824457384E5C199B4E1A75F1762BCD465CD4B675FE19DA36197EE9BFF0D3E24ED6B9E4C26A1A05FFC7386E
eucrypt/mpi/include/mpi-internal.h
(1 . 5)(1 . 6)
5 /* mpi-internal.h - Internal to the Multi Precision Integers
6 * Modified by No Such Labs. (C) 2015. See README.
7 * Modified by S.MG, 2017: fixing broken MPN_COPY_INCR macro. See EuCrypt patches.
8 *
9 * This file was originally part of Gnu Privacy Guard (GPG), ver. 1.4.10,
10 * SHA256(gnupg-1.4.10.tar.gz):
(100 . 7)(101 . 7)
12 do { \
13 mpi_size_t _i; \
14 for( _i = 0; _i < (n); _i++ ) \
15 (d)[_i] = (d)[_i]; \
16 (d)[_i] = (s)[_i]; \
17 } while (0)
18
19 #define MPN_COPY_DECR( d, s, n ) \
- 85384BC9E48590DA125A7440103EBC5549A2C1E10DD2335810C06F6BCA4CA4F22F0626B0F625128F8D73DE47C0A2AA9260F1014EACCCC5CBDB2E37498347E99C
+ 587D20E7235B57076203A9C3B8774F60EAD751978F1A4ED87AE7CC96548A021919E77C0799B8FFF9900A83EDB74E173114BAC8FDDB7FF23FF275472FB0C24603
eucrypt/mpi/tests/test_mpi.c
(1 . 4)(1 . 5)
24 #include "mpi.h"
25 #include "mpi-internal.h" /* for BITS_PER_MPI_LIMB */
26 #include <stdlib.h>
27
28 void err(char *msg)
(12 . 10)(13 . 66)
30 fprintf(fp, "\n");
31 }
32
33 void print_results(MPI in, MPI out, char * title)
34 {
35 fprintf(stdout, "******** %s ********", title);
36 terpri(stdout);
37
38 fprintf(stdout, "input : ");
39 mpi_print(stdout, in, 1);
40 terpri(stdout);
41
42 fprintf(stdout, "output: ");
43 mpi_print(stdout, out, 1);
44 terpri(stdout);
45
46 terpri(stdout);
47 fflush(stdout);
48 }
49
50 /*
51 * Test that will fail on original code and will pass after EuCrypt fix is applied.
52 */
53 void test_rshift()
54 {
55 MPI out, in, copy_in;
56 out = mpi_alloc(0);
57 in = mpi_alloc(0);
58 copy_in = mpi_alloc(0);
59
60 mpi_fromstr(out, "0x20E92FE28E1929"); /* some value */
61 mpi_fromstr(in, "0x2000000010000001000000002");
62 mpi_fromstr(copy_in, "0x2000000010000001000000002"); /* to make sure the actual input is print, since call can modify in */
63
64 /* print value of BITS_PER_MPI_LIMB */
65 fprintf(stdout, "BITS_PER_MPI_LIMB is %d\n", BITS_PER_MPI_LIMB);
66
67 /* shift by 0 */
68 mpi_tdiv_q_2exp(out, in, 0);
69 print_results(copy_in, out, "TEST: right shift by 0");
70
71 /* shift by multiple of BITS_PER_MPI_LIMB */
72 mpi_fromstr(in, "0x2000000010000001000000002");
73
74 mpi_tdiv_q_2exp(out, in, BITS_PER_MPI_LIMB);
75 print_results(copy_in, out, "TEST: right shift by BITS_PER_MPI_LIMB");
76
77 /* shift by non-multiple of BITS_PER_MPI_LIMB */
78 mpi_fromstr(in, "0x2000000010000001000000002");
79 mpi_tdiv_q_2exp(out, in, BITS_PER_MPI_LIMB - 3);
80 print_results(copy_in, out, "TEST: right shift by BITS_PER_MPI_LIMB - 3");
81
82 mpi_free(copy_in);
83 mpi_free(out);
84 mpi_free(in);
85 }
86
87 int main(int ac, char **av)
88 {
89 MPI a, b, y;
90 int r;
91
92 test_rshift();
93
94 r = secmem_init(1000);
95 if (r==0) err("secmem init");
(29 . 6)(86 . 8)
97 mpi_free(a);
98 mpi_free(b);
99
100 fprintf(stdout, "******** TEST: mpi_mul, see README ********");
101 terpri(stdout);
102 mpi_print(stdout, y, 1);
103 mpi_free(y);
104