Commit Graph

201 Commits

Author SHA1 Message Date
Sebastian Andrzej Siewior
f0f92f033e Add symbols files
Export only used symbols and keep implemetations details hidden.
Stripped away symbols are:

fp_mul_comba20, fp_mul_comba24, fp_mul_comba28, fp_mul_comba32, fp_mul_comba48,
fp_mul_comba64, fp_mul_comba, fp_mul_comba_small, fp_prime_miller_rabin,
fp_sqr_comba20, fp_sqr_comba24, fp_sqr_comba28, fp_sqr_comba32, fp_sqr_comba48,
fp_sqr_comba64, fp_sqr_comba, fp_sqr_comba_small, s_fp_add, s_fp_sub,
fp_reverse, fp_s_rmap

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-04-25 14:58:23 +02:00
Sebastian Andrzej Siewior
c7ce75f920 use LDFLAGS in the link command
required for the hardening flags

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-04-25 14:25:56 +02:00
Sebastian Andrzej Siewior
5d83c4e5ab tfm: use unsigned int for fp_digit on !FP_64BIT
There is a bugzilla entry at clamav [0] reports a problem on s390x
  "mul/fp_mul_comba_20.c:91: warning: right shift count >= width of type"
because fp_digit is 64bit and according to the comment it should be
smaller.
s390x is 64bit platform i.e. long and long long are both 64bit. The
same is true for ppc64, arm64 or sparc64 (RIP alpha).

The headerfile seems only to define FP_64BIT on x86_64.
The current code seems to define SIZEOF_FP_DIGIT either to 8 (64bit) or
to 4 in the else case and 4 looks like int and not long. Therefore the
change here.

If this change makes no sense and you would prefer to use something like
    #if __SIZEOF_LONG__ == 8
       #define FP_64BIT
    #endif

to autodetect a 64bit platform then we could try do this instead. I
haven't tested this patch nor verified that the problem still occures.

If you have no obvious solution and would like to have a confirmation
that this patch solves a problem I could try to get my hands on
something not x86 with 64bit in order to verify.

[0] https://bugzilla.clamav.net/show_bug.cgi?id=9017

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-04-25 14:22:35 +02:00
Steven Morgan
522a092ffb fp_ident: fix incorrect length in strncat() call.
strncat' last argument is the remaining size of the buffer given in the
first argument, not the total buffer length.

Reported-by: contact@oppida.fr via clamav #11166
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-04-25 14:22:34 +02:00
David Raynor
060b2c5697 s_fp_add: completely init c after add
This was reported in clamav via a "coverity report" #11125/#11126. I can't
get the coverity report and I've been told that

|< linnatic> bigeasy: unfortunately, I can't get you the coverity report
|< linnatic> bigeasy: but it does seem that the patch is not
|required as the possible coverity issue is unlikely to occur

so if you thing that this patch is not required (which is what I assume) then
please drop that patch, I just added since it was in the clamav tree…

[sebastian@breakpoint: patch description]
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-04-25 14:22:34 +02:00
Sebastian Andrzej Siewior
6fbf2ba87d fp_toradix_n: make sure too small strings are recognized
If maxlen is too small then we get FP_OKAY as return value but not
everything is part of the string. This patch changes it so that the
caller learns about this short comming.

While at it, drop the doxygen style comment. It is the only of his kind
and does no longer match the code.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-04-25 14:22:34 +02:00
Steffen Jaeckel
e0fe602802 Merge pull request #9 from pattop/master
ppc32: fix fp_montgomery_reduce assembly
2015-04-25 14:22:22 +02:00
Patrick Oppenlander
c9ae4c70d4 ppc32: fix fp_montgomery_reduce assembly
Previous patch modified constraints from =m to =g. Turns out this also
allows registers which doesn't work with the inline assembly
instructions.

If we change back to =m GCC 5.0 warns that constraints do not allow a
register.

In order to work around these issues we now pass the arguments in
registers and let GCC handle the loading & storing.
2015-04-17 10:18:45 +10:00
Steffen Jaeckel
9fe2d66519 Merge pull request #8 from jwillemsen/master
Replace spaces with tab to file GNU make problems
2015-02-26 12:49:39 +01:00
Johnny Willemsen
52932db932 Replace spaces with tab to file GNU make problems 2015-02-26 09:17:20 +01:00
Steffen Jaeckel
87aa730c59 testme: fix traps 2015-02-15 23:40:45 +01:00
Steffen Jaeckel
dde4fbd881 makefiles: update with new file 2015-02-15 23:33:11 +01:00
Steffen Jaeckel
e4f8c04da6 fp_toradix[_n]: revise and split up 2015-02-15 23:33:11 +01:00
Steffen Jaeckel
c485c8d62f makefile: add new target new_file 2015-02-15 23:28:36 +01:00
Sebastian Andrzej Siewior
f734a43b05 implement fp_toradix_n()
It is not implemened yet, just added to the headerfile. Therefore I don't
think it is a ABI breakage if I change maxlen from int to unsigned int.

The function releases fp_toradix() for the work which in turn now calls
fp_toradix_n() with a largest possible maxlen parameter.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-02-15 19:29:12 +01:00
Steffen Jaeckel
8aba8446f2 Merge branch 'fix/issue#6'
This closes #6
This closes #7
2015-02-15 15:35:13 +01:00
Steffen Jaeckel
cfa59b2627 travis.yml: fix build target 2015-02-15 15:17:36 +01:00
Steffen Jaeckel
e4f59d4d61 create new make target test_standalone 2015-02-15 15:13:20 +01:00
Steffen Jaeckel
d02974e02f demo/test: fix warnings 2015-02-15 14:57:21 +01:00
Steffen Jaeckel
cdc82aefe1 add testme.sh 2015-02-15 14:53:09 +01:00
Steffen Jaeckel
77be93c201 fix compile errors 2015-02-15 14:50:20 +01:00
Steffen Jaeckel
b1b9a82d97 demo: split up test to 'test' and a new 'timing' build target 2015-02-15 14:26:06 +01:00
Steffen Jaeckel
6231d132de makefile.shared: fix linker step 2015-02-15 14:26:03 +01:00
Johnny Willemsen
5f37f875b2 Attempt to also build shared using travic-ci 2015-02-05 12:11:49 +01:00
Johnny Willemsen
b5e0346622 Added GCC 4.9 configuratin 2015-02-05 12:09:04 +01:00
Steffen Jaeckel
dedda52a1f Add README.md 2014-10-13 19:36:19 +02:00
Steffen Jaeckel
b5352a5f6b add .travis.yml 2014-10-13 19:25:31 +02:00
Steffen Jaeckel
cb3ed6951e update documentation regarding fp_isprime() 2014-10-13 17:14:10 +02:00
Steffen Jaeckel
3142b0bdfc fp_prime_random_ex: make sure call-back function is not NULL 2014-10-13 16:51:13 +02:00
Steffen Jaeckel
fede300ee8 fp_prime_random_ex: use parameter 't' 2014-10-13 16:46:10 +02:00
Steffen Jaeckel
ce72d69438 add macro FP_PRIME_SIZE 2014-10-13 16:45:34 +02:00
Steffen Jaeckel
4673d82793 improve makefiles
shared makefile now uses libtool
update gitignore according
remove 'timing' target in shared makefile
add dependency of HEADERS to OBJECTS for both makefiles
2014-10-13 16:44:58 +02:00
Giovanni Bajo
08484a1020 Avoid always generating 0x80 as MSB in primes.
When we ask to generate a prime whose size is a multiple of 8,
the code wrongly computes the mask as 0x00 instead of 0xFF, so the
generated prime always has the MSB set to 0x80 (the highest bit is OR'ed
later in the code).
2014-10-13 13:40:57 +02:00
Steffen Jaeckel
86ba42797a update makefiles 2014-10-13 13:40:41 +02:00
Steffen Jaeckel
7a38e49b8e add fp_isprime_ex()
fp_isprime() is now only a wrapper function to fp_isprime_ex()
2014-10-13 13:40:36 +02:00
Steffen Jaeckel
f7b194f741 minor changes, trim trailing spaces 2014-10-13 13:39:30 +02:00
Steffen Jaeckel
3a80f80039 deterministic build of tfm.pdf 2014-10-13 12:32:25 +02:00
Steffen Jaeckel
4e0e2c0f90 update changes 2014-10-13 12:24:45 +02:00
Steffen Jaeckel
b0509acce9 Merge branch 'feature/rand' 2014-08-28 02:58:22 +02:00
Steffen Jaeckel
97248ae23e update makefiles 2014-08-14 21:19:14 +02:00
Steffen Jaeckel
ec7f25200f add fp_rand()
it's a port of the function in libtommath
2014-08-14 21:19:14 +02:00
Steffen Jaeckel
56438df4cf test/mtest/stest: improve a bit
fix compiler warnings
make internal buffer size dependant on its possible size
fix return values
2014-08-14 21:18:23 +02:00
Steffen Jaeckel
0b1ad14d7b makefile: rework a bit 2014-08-14 21:17:11 +02:00
Steffen Jaeckel
03334b30b4 mont: make INNERMUL register clobber list equal to the 64bit version 2014-08-14 21:17:11 +02:00
Steffen Jaeckel
14bb3e83ca gen.pl: update to current directory structure 2014-08-14 21:17:11 +02:00
Steffen Jaeckel
ec6c224b09 fix sqr_comba compiler warnings 2014-08-11 17:54:09 +02:00
Steffen Jaeckel
72fe8e48ba montgomery reduce: change #ifdef
as INNERMUL8 is only defined where it is available, simply check if it's
defined and don't check again for the arch
2014-07-20 16:08:35 +02:00
Steffen Jaeckel
06ef0be491 tfm.h: add missing prototype of fp_radix_size() 2014-06-21 13:24:22 +02:00
Steffen Jaeckel
7882b0370d ed1a1e90e9 was not only a x86-64 problem 2014-06-21 13:24:03 +02:00
Steffen Jaeckel
60cf64919f fp_read_radix: port modifications from libtommath 2014-06-15 18:35:31 +02:00