Commit Graph

215 Commits

Author SHA1 Message Date
Steffen Jaeckel
ea6098feea add tfm_private.h to headers, but only install tfm.h 2015-10-07 15:13:23 +02:00
Steffen Jaeckel
24ef85f9e9 trim trailing spaces in mpi.c 2015-10-07 15:13:03 +02:00
Sebastian Andrzej Siewior
f7e7f83718 provide tfm_private.h
tfm.h contains declarations for the public part of the library.
tfm_private.h contains the function which are private to tfm and should
not be exposed to the public.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-08-16 22:04:51 +02:00
Sebastian Andrzej Siewior
24d98570b0 define FP_64BIT on 64bit architectures
This should enable 64bit math on 64bit architecures besides amd64 (like
ppc64, sparc64 and so on)

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-08-16 15:27:31 +02:00
Steffen Jaeckel
993d85de7f as of [1] we have to use this version
[1] https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
2015-08-07 10:51:36 +02:00
Steffen Jaeckel
8fc411f97a update tfm.pdf 2015-08-07 01:03:32 +02:00
Steffen Jaeckel
1f1fafe7fb bump version 2015-08-07 01:03:23 +02:00
Steffen Jaeckel
787ebd1507 update changes 2015-08-07 01:02:01 +02:00
Steffen Jaeckel
1b92bb399b update pre_gen/mpi.c 2015-08-06 20:45:00 +02:00
Steffen Jaeckel
725032ccf8 makefile: update zipup target 2015-08-06 19:54:38 +02:00
Steffen Jaeckel
229f1f890b update .gitignore 2015-04-25 15:25:56 +02:00
Steffen Jaeckel
846d7f36eb add version information 2015-04-25 15:25:42 +02:00
Steffen Jaeckel
6db706e857 bring back __DATE__ to fp_ident(), but it's disabled by default 2015-04-25 15:10:33 +02:00
Sebastian Andrzej Siewior
8ea169937d drop __DATE__ from fp_ident
To meet Debian's reproducible builds [0] goal I remove the __DATE__
macro.
In case this is not acceptable because the date of build is _really_
important / required I could come with a ifdef or something else.

[0] https://wiki.debian.org/ReproducibleBuilds

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2015-04-25 14:59:37 +02:00
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