libtom / libtomcrypt

LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines.
https://www.libtom.net
Other
1.56k stars 458 forks source link

Failures on aarch64 (and arm) #258

Closed ronaaron closed 7 years ago

ronaaron commented 7 years ago

Hello -

I compiled libtomcrypt 1.17 using tomsfastmath.

Then I compiled 'test' and ran on a RaspberryPi 3 (64-bit OS, Debian)

The results were:

LibTomCrypt 1.17 (Tom St Denis,... LibTomCrypt is public domain software. Built on Aug 6 2017 at 12:23:47 ... Compiler: GCC compiler detected.

Various others: BASE64 BASE64-URL-SAFE DER PKCS#1 PKCS#5 HKDF MPI TRY_URANDOM_FIRST LTC_TEST LTC_SMALL_CODE LTC_PTHREAD TFM_DESC LTC_MECC_ACCEL LTC_ECC_SHAMIR

store_test....passed misc_test.....passed cipher_test...passed mac_test......passed modes_test....passed der_test......DER INTEGER short encoding failed, 3, 3 02 01 7b 02 01 00 failed

This is ancillary to my trying to understand by ecc_verify_hash is not working for me (it works on RPI w/ a 32-bit compiler, also gcc). I suspect the issue may be similar.

On RaspberryPi 2 (32-bit OS) the tests mostly pass, bue 'ecc' gives a segmentation fault.

karel-m commented 7 years ago

Could you please try this branch https://github.com/libtom/libtomcrypt/tree/release/1.18.0 ?

ronaaron commented 7 years ago

On 06/08/2017 16:34, karel-m wrote:

Could you please try this branch https://github.com/libtom/libtomcrypt/tree/release/1.18.0 ?

Yes. Results follow. BTW, when is the release scheduled? I would hate to use code that's going to be quickly superseded.

math provider = tomsfastmath MP_DIGIT_BIT = 64

store_test..........passed 0.001ms rotate_test.........passed 0.000ms misc_test...........passed 0.659ms mpi_test............passed 3.577ms cipher_hash_test....passed 177.029ms mac_test............passed 42.346ms modes_test..........passed 9.758ms der_test............passed 486.407ms pkcs_1_test.........passed 6.014ms pkcs_1_pss_test.....passed 47.197ms pkcs_1_oaep_test....passed 46.794ms pkcs_1_emsa_test....passed 61.293ms pkcs_1_eme_test.....passed 61.064ms rsa_test............passed 3835.988ms dh_test.............passed 1133.410ms ecc_tests...........passed 46242.505ms dsa_test............passed 543.609ms katja_test..........nop file_test...........failed 0.031ms multi_test..........passed 0.250ms prng_test...........passed 5.769ms

Ron Aaron | CTO Aaron High-Tech, Ltd https://8th-dev.com | +1 425.296.0766 / +972 52.652.5543 | GnuPG Key: 91F92EB8 https://pgp.mit.edu/pks/lookup?op=get&search=0xC90C1BD191F92EB8

rofl0r commented 7 years ago

there's already a release candidate 2 tarball which you could use

ronaaron commented 7 years ago

OK, that's a good start I suppose. Is there any ETA for final release?

On 06/08/2017 18:26, rofl0r wrote:

there's already a release candidate 2 tarball which you could use

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libtom/libtomcrypt/issues/258#issuecomment-320513652, or mute the thread https://github.com/notifications/unsubscribe-auth/AQVKhj020DVPthEymL99Gr-EVYD-j5Olks5sVdsTgaJpZM4OuslW.

Ron Aaron | CTO Aaron High-Tech, Ltd https://8th-dev.com | +1 425.296.0766 / +972 52.652.5543 | GnuPG Key: 91F92EB8 https://pgp.mit.edu/pks/lookup?op=get&search=0xC90C1BD191F92EB8

karel-m commented 7 years ago

ETA is IMO in coming weeks.

Are there more messages related to file_test...........failed? If not please rebuild the library with -DLTC_TEST_DBG and run again ./test file_test.

ronaaron commented 7 years ago
body p { margin-bottom: 0cm; margin-top: 0pt; } 

I'm sorry, but LTC_TEST_DBG gives no particularly useful
  information.  I will point out this is running on a Raspberry Pi
  3, which is running from an SD-card... so perhaps that's
  interfering with the test.

The complete output:
pi@raspberrypi:~$ ./test file_test
build == git-v1.18.0-rc2-18-gb2448c5-dirty
LibTomCrypt 1.18.0-rc2 (www.libtom.net)
LibTomCrypt is public domain software.

Endianness: little (64-bit words)
Clean stack: disabled
Ciphers built-in:
   Blowfish
   RC2
   RC5
   RC6
   Safer+
   Safer
   Rijndael
   XTEA
   Twofish (tables)
   DES
   CAST5
   Noekeon
   Skipjack
   Khazad
   Anubis  (tweaked)
   KSEED
   KASUMI
   MULTI2
   Camellia
Stream ciphers built-in:
   ChaCha
   RC4
   SOBER128

Hashes built-in:
   SHA3
   SHA-512
   SHA-384
   SHA-512/256
   SHA-256
   SHA-512/224
   SHA-224
   TIGER
   SHA1
   MD5
   MD4
   MD2
   RIPEMD128
   RIPEMD160
   RIPEMD256
   RIPEMD320
   WHIRLPOOL
   BLAKE2S
   BLAKE2B
   CHC_HASH

Block Chaining Modes:
   CFB
   OFB
   ECB
   CBC
   CTR
   LRW (tables) 
   F8
   XTS

MACs:
   HMAC
   OMAC
   PMAC
   PELICAN
   XCBC
   F9
   POLY1305
   BLAKE2S MAC
   BLAKE2B MAC

ENC + AUTH modes:
   EAX
   OCB
   OCB3
   CCM
   GCM (tables) 
   CHACHA20POLY1305

PRNG:
   Yarrow (LTC_YARROW_AES=2)
   SPRNG
   RC4
   ChaCha20
   Fortuna (LTC_FORTUNA_POOLS=32, LTC_FORTUNA_WD=10)
   SOBER128

PK Algs:
   RSA (with blinding and CRT hardening)
   DH
   ECC (with blinding)
   DSA

MPI (Math):
   LTC_MPI
   TFM_DESC
   LTC_MILLER_RABIN_REPS=35

Compiler:
   GCC compiler 7.1.1 20170510.

Various others:  ARGTYPE=0  ADLER32  BASE64  BASE64-URL-SAFE  CRC32 
DER  LTC_DER_MAX_PUBKEY_SIZE=4096  PKCS#1  PKCS#5  HKDF 
LTC_DEVRANDOM  LTC_TRY_URANDOM_FIRST  LTC_RNG_GET_BYTES 
LTC_RNG_MAKE_PRNG  LTC_HASH_HELPERS  LTC_TEST 
LTC_FILE_READ_BUFSIZE=8192  LTC_MECC_ACCEL  LTC_ECC_SHAMIR 

math provider = tomsfastmath
MP_DIGIT_BIT = 64

file_test...........failed      0.038ms

FAILURE: passed=0 failed=1 nop=0 duration=0.0sec real=0.0sec

On 07/08/2017 0:12, karel-m wrote:

  ETA is IMO in coming weeks.
  Are there more messages related to file_test...........failed?
    If not please rebuild the library with -DLTC_TEST_DBG
    and run again ./test file_test.
  —
    You are receiving this because you authored the thread.
    Reply to this email directly, view
      it on GitHub, or mute
      the thread.

  {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/libtom/libtomcrypt","title":"libtom/libtomcrypt","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/libtom/libtomcrypt"}},"updates":{"snippets":[{"icon":"PERSON","message":"@karel-m in #258: ETA is IMO in coming weeks.\r\n\r\nAre there more messages related to `file_test...........failed`? If not please rebuild the library with `-DLTC_TEST_DBG` and run again `./test file_test`."}],"action":{"name":"View Issue","url":"https://github.com/libtom/libtomcrypt/issues/258#issuecomment-320533058"}}}

      Ron Aaron | 
       CTO  Aaron High-Tech, Ltd |
      +1 425.296.0766 / +972 52.652.5543 |

        GnuPG Key: 91F92EB8
sjaeckel commented 7 years ago

I'm sorry, but LTC_TEST_DBG gives no particularly useful information.  I will point out this is running on a Raspberry Pi 3, which is running from an SD-card... so perhaps that's interfering with the test.

not 100% sure, but it looks like your rebuild didn't succeed...

can you please download this version https://github.com/libtom/libtomcrypt/archive/ac4687d88de01b8bb3fc8e07535dcaf1c2d1542d.zip and then build with your regular build command, but add the make parameter LTC_DEBUG=2

e.g.

make -j9 all CFLAGS="-DUSE_LTM -DLTM_DESC -I../../libtommath" EXTRALIBS="../libtommath/libtommath.a" LTC_DEBUG=2
sjaeckel commented 7 years ago

can you please download this version https://github.com/libtom/libtomcrypt/archive/ac4687d88de01b8bb3fc8e07535dcaf1c2d1542d.zip and then build with...

I forgot, please do a make clean at one point if you're building in the same folder as before

karel-m commented 7 years ago

Just FYI - the failing test in question is: https://github.com/libtom/libtomcrypt/blob/release/1.18.0/tests/file_test.c (I do not see anything that could be RaspberryPi unfriendly)

sjaeckel commented 7 years ago

@ronaaron *ping*