Commit Graph

156 Commits

Author SHA1 Message Date
James Muir
d5db9f1548 Add new utf8 test-vector, update comments explaining utf8 decoding
Description:
Minor changes to help test and clarify the way utf8 strings are
decoded.  This originated from my misunderstanding of the fix for
issue #507.  The new test-vector uses two bytes to encode each
wide-char.

The utf8 format is described here:

  https://tools.ietf.org/html/rfc3629#section-3

Testing:

  $ make clean
  $ make CFLAGS="-DUSE_LTM -DLTM_DESC -I../libtommath" EXTRALIBS="../libtommath/libtommath.a" test
  $ ./test

You can confirm that the new utf8 test data is correct using python:

  >>> s="\xD7\xA9\xD7\x9C\xD7\x95\xD7\x9D"
  >>> s.decode("utf-8")
  u'\u05e9\u05dc\u05d5\u05dd'
2024-02-18 17:02:06 +00:00
Steffen Jaeckel
c5d7bfb2cc manually fix the remaining leading _'s 2020-07-16 10:38:33 +02:00
Steffen Jaeckel
9824af8e3b update header 2020-07-14 18:41:30 +02:00
Steffen Jaeckel
24765c30c5 remove footer 2020-07-14 18:41:29 +02:00
Steffen Jaeckel
cac400cf79 really implement DER decoding resursion limit
PR #373 did not really fix the issue of preventing a potential stack
overflow in case a lot of nested sequences have to be decoded.
Instead it only threw an error after successfully decoding all the nested
sequences.
This change fixes this and prevents the decoding.
2020-06-20 12:28:22 +02:00
Steffen Jaeckel
334876db78 rename x25519_set_key to x25519_import_raw 2019-10-19 16:30:18 +02:00
Steffen Jaeckel
44a18342ba rename ed25519_set_key to ed25519_import_raw 2019-10-19 16:30:18 +02:00
Steffen Jaeckel
3540fd713c fixup x25519_import()
bring x25519_import() in line with its ed25519 counterpart
2019-10-19 16:30:05 +02:00
Steffen Jaeckel
4e28b922a9 add rsa_shrink_key() 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
68cc580602 use macros in more tests 2019-10-17 12:49:20 +02:00
Steffen Jaeckel
ef55d1335e fix some MSVC compiler warnings 2019-10-17 10:29:27 +02:00
Steffen Jaeckel
2a63adc1ab add XSTRLEN 2019-10-17 10:29:27 +02:00
Steffen Jaeckel
9b6bf32f88 use unsigned long for the length of a string 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
27ec31d4f3 improve SSH decoding & doc 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
58254f76e8 fix SSH string implementation 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
f89909bd6c use macros in ssh_test() 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
8b5ce8ba7e add ENSURE() macro 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
9423f3b26d add bcrypt 2019-10-12 14:31:38 +02:00
Steffen Jaeckel
d2027d60eb add testcase for issue #507 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
eaf2c7b6b9 fix build for msvc 2019-09-24 14:09:35 +02:00
Steffen Jaeckel
0b06979b10 prefix tweetnacl crypto_ API 2019-06-10 12:48:16 +02:00
Steffen Jaeckel
0392867678 use shared {ed,x}25519_export() implementation 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
819656a12f add ed25519_make_key() testcase 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
e3766e16ca add real pkcs#8 import of Curve25519 private keys 2019-06-09 22:46:57 +02:00
Steffen Jaeckel
8ea0fb1195 rename x25519_set_ku() to x25519_set_key() 2019-06-09 22:46:57 +02:00
Steffen Jaeckel
94b894fda9 update tests 2019-06-09 20:41:04 +02:00
Steffen Jaeckel
54d7c6782b clean-up macros
no need to enable them separately now
2019-06-09 20:41:04 +02:00
Steffen Jaeckel
233f8af490 draft-ietf-curdle-pkix is meanwhile rfc8410 2019-06-09 20:41:02 +02:00
Steffen Jaeckel
52a24ca3a3 add Curve25519 API 2019-06-09 20:40:40 +02:00
Steffen Jaeckel
5ed32b73e6 improve ecc_test() output 2019-04-10 11:26:32 +02:00
Steffen Jaeckel
ee13f6ffec let ssh_test() NOP silently 2018-12-31 17:22:28 +01:00
Steffen Jaeckel
b7874c5864 fix warnings when using other ARGTYPE's 2018-12-29 22:37:09 +01:00
Steffen Jaeckel
f95be00582 unconditonally create ssh_test() 2018-12-29 18:08:31 +01:00
Steffen Jaeckel
f6f70aa2ec fix ssh tests when compiled w/o MPI provider 2018-12-29 18:08:07 +01:00
Karel Miko
ae2ab2083b ecc_test cleanup 2018-11-07 09:25:08 +01:00
Karel Miko
dee704d063 padding_depad + PKCS7 - reject invalid pad 0 2018-10-29 07:26:40 +01:00
Karel Miko
2adc261612 wycheproof failing PKCS7 depadding test 2018-10-29 07:26:40 +01:00
Karel Miko
c2cdaaab4d make LTC_ECCSIG_RFC7518 strict (again) 2018-10-13 18:48:49 +02:00
Russ Williams
b4b50cc0c6 Initial commit of SSH+ECDSA signature format
Wrap signature format in #ifdef LTC_SSH
Update docs
Code review fixes
Replace strcmp/memcmp with XSTRCMP/XMEMCMP for check-source
Fix for check-defines
XSTRCMP/XMEMCMP != 0
GCC7.3 wants only literal strings for sprintf format
Code review changes
Rework SSH decoding and tests
Fix encoding and tests
COMPARE_TESTVECTOR macro
Single return point in ssh_decode_sequence_multi
Actually use XSTRNCPY rather than just defining it
More code review fixes
Code review tweaks
Ensure it's not possible to read past buffer end
Keep track of size remaining, not end pointer
2018-10-12 10:22:10 +01:00
Steffen Jaeckel
f81bdc46e7 add more rsa-pkcs8 PBES2-RC2 test-files 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
c96639bef6 add rsa-pkcs8 PBES2 AES and SHA512-224/256 test-files 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
cbe65fe59a add rsa-pkcs8 PBE-SHA1-3DES test-file 2018-10-06 23:04:51 +02:00
Karel Miko
8349eda5a5 fix LTC_EASY test failure 2018-10-06 23:04:51 +02:00
Karel Miko
e5a2683f5b RSA - pkcs8 test keys 2018-10-06 23:04:51 +02:00
Karel Miko
2dd8bcdfe9 rsa_import_pkcs8 tests 2018-10-06 23:04:51 +02:00
Karel Miko
bf04bf18a4 add ecc_import_pkcs8 2018-10-06 23:04:51 +02:00
Karel Miko
59bc3b5885 make ecc_verify_hash_ex less strict (as it was before ecc_recover_key addition) 2018-10-05 07:44:15 +02:00
Karel Miko
ef20f2e656 remove unused macros 2018-10-04 23:29:12 +02:00
Russ Williams
88d9b6db26 Make ECC signature format explicit
Optionally return recovery ID from ecc_sign_hash()

Update documentation

Update tests for ECC recovery

Fix (v,r,s) signature format, regenerate recovery test

Fix over-freeing of private key

Code review fixes to docs

Rename LTC_ECCSIG_BLOCKCHAIN to LTC_ECCSIG_ETH to reflect original definition

Rename to LTC_ECCSIG_ETH27 to make clear it's using the Ethereum +27 convention

Code review changes - calculate recovery ID only if needed, type safety on signature format enum

Use enum for sigformat in docs, and add explanatory note for recid<0

Range checks on v, check RFC7518 signatures' length based on size of key. Fix for when order>prime.

Limit LET_ECCSIG_ETH27 to secp256k1 curve only
2018-09-29 21:07:41 +01:00
Russ Williams
76190521e3 Implementation of ecc_recover_key to obtain public key from hash+signature
Workaround for TFM missing sqrtmod_prime

Fix unused variable warnings with USE_TFM, make TomsFastMath a runtime check

Disable ecc_recover_key if no ecc_mul2add available

Wrap ecc_recover_key and its test in #ifdef LTC_ECC_SHAMIR

Fix unused variables when built without LTC_ECC_SHAMIR

Code review tweaks

Code review tweaks - remove sigformat, tidy up (de)allocation

Code review tweaks
2018-09-23 09:03:30 +01:00