diff options
author | Simon Warta <[email protected]> | 2015-08-13 21:53:37 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-08-14 19:01:07 +0200 |
commit | b4c59752c1ffd6e7217573e9a290276d92bd6235 (patch) | |
tree | 4e5f99989cfbc3999d7f84607804f0a82e72804f /src | |
parent | b9c0077022400abc38d33ca3dfcfe32b9cf503e3 (diff) |
Remove 'extern "C"' from src/lib/math/mp
C functions must not throw but Botan::bigint_divop throws (MSVC: warning
C4297: 'Botan::bigint_divop' : function assumed not to throw an
exception but does)
* Move bigint_mul -> Botan::bigint_sqr
* Move bigint_sqr -> Botan::bigint_sqr
* Variable in unnamed namespace supersedes "static" keyword
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/math/mp/mp_asm.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_comba.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_core.h | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_generic/mp_asmi.h | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_generic/mp_madd.h | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_karat.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_misc.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_monty.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_mulop.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_shift.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_x86_32/mp_asmi.h | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_x86_32/mp_madd.h | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_x86_32_msvc/mp_asmi.h | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_x86_64/mp_asmi.h | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_x86_64/mp_madd.h | 4 | ||||
-rwxr-xr-x | src/scripts/comba.py | 4 |
16 files changed, 3 insertions, 61 deletions
diff --git a/src/lib/math/mp/mp_asm.cpp b/src/lib/math/mp/mp_asm.cpp index 6941a22e9..cc573a792 100644 --- a/src/lib/math/mp/mp_asm.cpp +++ b/src/lib/math/mp/mp_asm.cpp @@ -14,8 +14,6 @@ namespace Botan { -extern "C" { - /* * Two Operand Addition, No Carry */ @@ -185,5 +183,3 @@ void bigint_linmul3(word z[], const word x[], size_t x_size, word y) } } - -} diff --git a/src/lib/math/mp/mp_comba.cpp b/src/lib/math/mp/mp_comba.cpp index a21b25ed6..0170c9fcd 100644 --- a/src/lib/math/mp/mp_comba.cpp +++ b/src/lib/math/mp/mp_comba.cpp @@ -10,8 +10,6 @@ namespace Botan { -extern "C" { - /* * Comba 4x4 Squaring */ @@ -1128,5 +1126,3 @@ void bigint_comba_mul16(word z[32], const word x[16], const word y[16]) } } - -} diff --git a/src/lib/math/mp/mp_core.h b/src/lib/math/mp/mp_core.h index 06f1d4a2d..b97384d18 100644 --- a/src/lib/math/mp/mp_core.h +++ b/src/lib/math/mp/mp_core.h @@ -18,8 +18,6 @@ namespace Botan { */ const size_t MP_WORD_BITS = BOTAN_MP_WORD_BITS; -extern "C" { - /** * Two operand addition * @param x the first operand (and output) @@ -160,8 +158,6 @@ void bigint_comba_sqr8(word out[16], const word in[8]); void bigint_comba_sqr9(word out[18], const word in[9]); void bigint_comba_sqr16(word out[32], const word in[16]); -} - /* * High Level Multiplication/Squaring Interfaces */ diff --git a/src/lib/math/mp/mp_generic/mp_asmi.h b/src/lib/math/mp/mp_generic/mp_asmi.h index c094436f6..708afdfa0 100644 --- a/src/lib/math/mp/mp_generic/mp_asmi.h +++ b/src/lib/math/mp/mp_generic/mp_asmi.h @@ -13,8 +13,6 @@ namespace Botan { -extern "C" { - /* * Word Addition */ @@ -202,6 +200,4 @@ inline void word3_muladd_2(word* w2, word* w1, word* w0, word a, word b) } -} - #endif diff --git a/src/lib/math/mp/mp_generic/mp_madd.h b/src/lib/math/mp/mp_generic/mp_madd.h index d0d56c23f..292c23e97 100644 --- a/src/lib/math/mp/mp_generic/mp_madd.h +++ b/src/lib/math/mp/mp_generic/mp_madd.h @@ -13,8 +13,6 @@ namespace Botan { -extern "C" { - /* * Word Multiply/Add */ @@ -68,6 +66,4 @@ inline word word_madd3(word a, word b, word c, word* d) } -} - #endif diff --git a/src/lib/math/mp/mp_karat.cpp b/src/lib/math/mp/mp_karat.cpp index faa91040c..96d9adae2 100644 --- a/src/lib/math/mp/mp_karat.cpp +++ b/src/lib/math/mp/mp_karat.cpp @@ -13,8 +13,8 @@ namespace Botan { namespace { -static const size_t KARATSUBA_MULTIPLY_THRESHOLD = 32; -static const size_t KARATSUBA_SQUARE_THRESHOLD = 32; +const size_t KARATSUBA_MULTIPLY_THRESHOLD = 32; +const size_t KARATSUBA_SQUARE_THRESHOLD = 32; /* * Karatsuba Multiplication Operation diff --git a/src/lib/math/mp/mp_misc.cpp b/src/lib/math/mp/mp_misc.cpp index bd04818e5..542b0509e 100644 --- a/src/lib/math/mp/mp_misc.cpp +++ b/src/lib/math/mp/mp_misc.cpp @@ -11,8 +11,6 @@ namespace Botan { -extern "C" { - /* * Compare two MP integers */ @@ -79,5 +77,3 @@ word bigint_modop(word n1, word n0, word d) } } - -} diff --git a/src/lib/math/mp/mp_monty.cpp b/src/lib/math/mp/mp_monty.cpp index ffceaab9b..820f41e6c 100644 --- a/src/lib/math/mp/mp_monty.cpp +++ b/src/lib/math/mp/mp_monty.cpp @@ -13,8 +13,6 @@ namespace Botan { -extern "C" { - /* * Montgomery Reduction Algorithm */ @@ -112,5 +110,3 @@ void bigint_monty_sqr(word z[], size_t z_size, } } - -} diff --git a/src/lib/math/mp/mp_mulop.cpp b/src/lib/math/mp/mp_mulop.cpp index 95a0e015e..432c7ef53 100644 --- a/src/lib/math/mp/mp_mulop.cpp +++ b/src/lib/math/mp/mp_mulop.cpp @@ -12,8 +12,6 @@ namespace Botan { -extern "C" { - /* * Simple O(N^2) Multiplication */ @@ -73,5 +71,3 @@ void bigint_simple_sqr(word z[], const word x[], size_t x_size) } } - -} diff --git a/src/lib/math/mp/mp_shift.cpp b/src/lib/math/mp/mp_shift.cpp index d58a0c809..1850888a0 100644 --- a/src/lib/math/mp/mp_shift.cpp +++ b/src/lib/math/mp/mp_shift.cpp @@ -10,8 +10,6 @@ namespace Botan { -extern "C" { - /* * Single Operand Left Shift */ @@ -133,5 +131,3 @@ void bigint_shr2(word y[], const word x[], size_t x_size, } } - -} diff --git a/src/lib/math/mp/mp_x86_32/mp_asmi.h b/src/lib/math/mp/mp_x86_32/mp_asmi.h index 49ca428d6..95af89fc0 100644 --- a/src/lib/math/mp/mp_x86_32/mp_asmi.h +++ b/src/lib/math/mp/mp_x86_32/mp_asmi.h @@ -13,8 +13,6 @@ namespace Botan { -extern "C" { - /* * Helper Macros for x86 Assembly */ @@ -235,6 +233,4 @@ inline void word3_muladd_2(word* w2, word* w1, word* w0, word x, word y) } -} - #endif diff --git a/src/lib/math/mp/mp_x86_32/mp_madd.h b/src/lib/math/mp/mp_x86_32/mp_madd.h index b6a60aecd..9c0990398 100644 --- a/src/lib/math/mp/mp_x86_32/mp_madd.h +++ b/src/lib/math/mp/mp_x86_32/mp_madd.h @@ -17,8 +17,6 @@ namespace Botan { -extern "C" { - /* * Helper Macros for x86 Assembly */ @@ -62,6 +60,4 @@ inline word word_madd3(word a, word b, word c, word* d) } -} - #endif diff --git a/src/lib/math/mp/mp_x86_32_msvc/mp_asmi.h b/src/lib/math/mp/mp_x86_32_msvc/mp_asmi.h index b4a9af1e3..1887e57ce 100644 --- a/src/lib/math/mp/mp_x86_32_msvc/mp_asmi.h +++ b/src/lib/math/mp/mp_x86_32_msvc/mp_asmi.h @@ -13,8 +13,6 @@ namespace Botan { -extern "C" { - /* * Word Addition */ @@ -537,6 +535,4 @@ inline void word3_muladd_2(word* w2, word* w1, word* w0, word a, word b) } -} - #endif diff --git a/src/lib/math/mp/mp_x86_64/mp_asmi.h b/src/lib/math/mp/mp_x86_64/mp_asmi.h index 2c7683650..cd5884867 100644 --- a/src/lib/math/mp/mp_x86_64/mp_asmi.h +++ b/src/lib/math/mp/mp_x86_64/mp_asmi.h @@ -13,8 +13,6 @@ namespace Botan { -extern "C" { - /* * Helper Macros for x86-64 Assembly */ @@ -233,7 +231,6 @@ inline void word3_muladd_2(word* w2, word* w1, word* w0, word x, word y) : "cc"); } - #undef ASM #undef DO_8_TIMES #undef ADD_OR_SUBTRACT @@ -244,5 +241,4 @@ inline void word3_muladd_2(word* w2, word* w1, word* w0, word x, word y) } -} #endif diff --git a/src/lib/math/mp/mp_x86_64/mp_madd.h b/src/lib/math/mp/mp_x86_64/mp_madd.h index 25f791da4..6f9185dc0 100644 --- a/src/lib/math/mp/mp_x86_64/mp_madd.h +++ b/src/lib/math/mp/mp_x86_64/mp_madd.h @@ -17,8 +17,6 @@ namespace Botan { -extern "C" { - /* * Helper Macros for x86-64 Assembly */ @@ -64,6 +62,4 @@ inline word word_madd3(word a, word b, word c, word* d) } -} - #endif diff --git a/src/scripts/comba.py b/src/scripts/comba.py index fe588f7bc..dcac14657 100755 --- a/src/scripts/comba.py +++ b/src/scripts/comba.py @@ -87,8 +87,6 @@ def main(args = None): #include <botan/internal/mp_asmi.h> namespace Botan { - -extern "C" { """ for n in [4,6,8,9,16]: @@ -110,7 +108,7 @@ extern "C" { print " }\n" - print "}\n\n}" + print "}" if __name__ == '__main__': sys.exit(main()) |