Browse Source

Merge pull request #172 from libtom/test_tfm

Run tests for tomsfastmath

[skip ci]
Steffen Jaeckel 8 years ago
parent
commit
caa05540b7
4 changed files with 18 additions and 9 deletions
  1. 5 3
      .travis.yml
  2. 5 0
      coverage.sh
  3. 0 5
      src/headers/tomcrypt_custom.h
  4. 8 1
      src/math/tfm_desc.c

+ 5 - 3
.travis.yml

@@ -12,6 +12,8 @@ before_script:
   - gem install coveralls-lcov
   - gem install coveralls-lcov
   - curl http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz | tar xz
   - curl http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz | tar xz
   - export PATH=$PATH:`pwd`/lcov-1.11/bin
   - export PATH=$PATH:`pwd`/lcov-1.11/bin
+  - curl -s https://packagecloud.io/install/repositories/libtom/tomsfastmath/script.deb.sh | sudo bash
+  - sudo apt-get install libtfm-dev=0.13-5
 
 
 matrix:
 matrix:
   fast_finish: true
   fast_finish: true
@@ -22,9 +24,9 @@ branches:
 compiler:
 compiler:
   - gcc
   - gcc
   - clang
   - clang
-
-script: bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile V=1" "-DUSE_LTM -DLTM_DESC -I/usr/include" "/usr/lib/x86_64-linux-gnu/libtommath.a"
-
+script:
+  - bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile V=1"        "-DUSE_LTM -DLTM_DESC" "/usr/lib/x86_64-linux-gnu/libtommath.a"
+  - bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile.shared V=1" "-DUSE_TFM -DTFM_DESC" "-ltfm"
 env:
 env:
   - |
   - |
     BUILDSCRIPT="check_source.sh"
     BUILDSCRIPT="check_source.sh"

+ 5 - 0
coverage.sh

@@ -17,6 +17,11 @@ if [ -z "$(echo $CC | grep "gcc")" ]; then
     exit 0
     exit 0
 fi
 fi
 
 
+if [ "$(echo $2 | grep -v 'makefile[.]')" == "" ]; then
+    echo "only run coverage for the regular makefile, early exit success"
+    exit 0
+fi
+
 # output version
 # output version
 bash printinfo.sh
 bash printinfo.sh
 
 

+ 0 - 5
src/headers/tomcrypt_custom.h

@@ -492,11 +492,6 @@
    #define LTC_PKCS_1
    #define LTC_PKCS_1
 #endif
 #endif
 
 
-#if defined(TFM_DESC) && defined(LTC_RSA_BLINDING)
-    #warning RSA blinding currently not supported in combination with TFM
-    #undef LTC_RSA_BLINDING
-#endif
-
 #if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL)
 #if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL)
    #error Pelican-MAC requires LTC_RIJNDAEL
    #error Pelican-MAC requires LTC_RIJNDAEL
 #endif
 #endif

+ 8 - 1
src/math/tfm_desc.c

@@ -699,6 +699,13 @@ static int tfm_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R
 
 
 #endif
 #endif
 
 
+static int set_rand(void *a, int size)
+{
+   LTC_ARGCHK(a != NULL);
+   fp_rand(a, size);
+   return CRYPT_OK;
+}
+
 const ltc_math_descriptor tfm_desc = {
 const ltc_math_descriptor tfm_desc = {
 
 
    "TomsFastMath",
    "TomsFastMath",
@@ -788,7 +795,7 @@ const ltc_math_descriptor tfm_desc = {
    &addmod,
    &addmod,
    &submod,
    &submod,
 
 
-   NULL,
+   set_rand,
 
 
 };
 };