Commit Graph

19 Commits

Author SHA1 Message Date
Steffen Jaeckel
3a7273b2da Bump version & update tfm.pdf 2017-04-04 12:24:03 +02:00
Steffen Jaeckel
1404af6262 allow external define of FP_GEN_RANDOM 2017-04-04 00:45:06 +02:00
Steffen Jaeckel
8e034dcf6e add FP_GEN_RANDOM logic as in libtommath 2017-03-30 16:15:35 +02:00
Sebastian Andrzej Siewior
dac0895159 tfm: make a few functions static
clamav expects them to be static and it does not seem bad to do so.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2016-04-24 14:00:15 +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
1f1fafe7fb bump version 2015-08-07 01:03:23 +02:00
Steffen Jaeckel
846d7f36eb add version information 2015-04-25 15:25:42 +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
Steffen Jaeckel
e4f8c04da6 fp_toradix[_n]: revise and split up 2015-02-15 23:33:11 +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
ce72d69438 add macro FP_PRIME_SIZE 2014-10-13 16:45:34 +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
ec7f25200f add fp_rand()
it's a port of the function in libtommath
2014-08-14 21:19:14 +02:00
Steffen Jaeckel
06ef0be491 tfm.h: add missing prototype of fp_radix_size() 2014-06-21 13:24:22 +02:00
Steffen Jaeckel
c6b1b8e2f1 fix ulong64 typedef that led to broken builds for several platforms
x86_64-w64-mingw32 and 32Bit mode on 64Bit system

x86_64-w64-mingw32-gcc
'gcc -m32'
'gcc -mx32'
2014-06-14 17:39:10 +02:00
Steffen Jaeckel
82aeb1d824 change DIGIT_BIT define to be able to test e.g. FP_SIZE in a macro 2014-06-12 17:59:22 +02:00
Steffen Jaeckel
86e7c59ff4 trim trailing spaces/clean-up 2014-06-12 17:35:54 +02:00
Tom St Denis
da88c2d42f added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00