Commit Graph

452 Commits

Author SHA1 Message Date
Steffen Jaeckel
4efa27ead1 add missing pointer checks 2014-10-31 19:39:03 +01:00
Steffen Jaeckel
53917750d8 trim trailing spaces 2014-10-31 19:38:47 +01:00
Pascal Brand
992506cb49 Add incremental CCM authentication processing
CCM is only meant for packet mode where the length of the input is known in
advance. Since it is a packet mode function, CCM only had one function that
performs the protocol.

However, incremental authentication is usefull in some usecases. It also
ensure some kind of coherencies when processing with a given authentication
mode or another. To achieve this aim, this commit adds the following functions:
    ccm_init()
    ccm_add_aad()
    cm_add_nonce()
    ccm_process()
    ccm_done()
    ccm_reset()
as well as the data structure
    ccm_state

Change-Id: I5225a42bb098708c4af07518b561bb00f85bc243
2014-10-17 09:00:19 +02:00
Steffen Jaeckel
ed28703804 der_decode_sequence_multi: calm coverity 2014-10-10 01:07:58 +02:00
Steffen Jaeckel
e6b1c7101e der test: also run der_length_utf8_string() 2014-10-10 00:56:23 +02:00
Steffen Jaeckel
3ecdd29847 fix coverity script 2014-10-10 00:55:18 +02:00
Steffen Jaeckel
ee1631f8b3 dsa import: no output on stderr please 2014-10-06 19:00:50 +02:00
Steffen Jaeckel
f75b5ec8f4 der tests: improve/implement handling of context-specific data
no more "EOL" in the output as the flexi decoder handles now
context-specific data
2014-10-06 18:59:40 +02:00
Steffen Jaeckel
6da3b856d6 der test: print list-element details on EOL
EOL indicates an unitialized list-element
2014-10-06 18:57:42 +02:00
Steffen Jaeckel
6bd6319fb0 der flexi decoder: implement decoding of context-specific data 2014-10-06 18:57:42 +02:00
Steffen Jaeckel
2d8933e4f1 der: add new enum element for context-specific encodings 2014-10-06 18:57:42 +02:00
Steffen Jaeckel
f0a1235614 der flexi decoder: remove duplicate code 2014-10-06 18:57:41 +02:00
Steffen Jaeckel
3d1231ab15 der flexi decoder: improve CONSTRUCTED type decoding
remove all teh flags
save the entire original identifier
2014-10-06 17:51:25 +02:00
Steffen Jaeckel
2e426e2d57 der test: add example of decoding a X.509 v3 cert with the flexi decoder
you can define "LTC_DER_TESTS_PRINT_FLEXI" at compile time to print
the decoded cert whenn running the test executable...
well not all of it, since some parts of the cert are marked as
"context-specific" so we would need to do some further digging
...these are the parts that are output as "EOL"...
2014-09-30 17:57:53 +02:00
Steffen Jaeckel
c1e81ad469 minor changes
print MP_DIGIT_BIT when running test
der_test: improve error output of 'short integer' test
2014-09-30 13:26:18 +02:00
Steffen Jaeckel
1cc26da35c fix coverity script 2014-09-30 10:53:05 +02:00
Steffen Jaeckel
b1b3d5870f Merge branch 'feature/formatRsaDsa' into develop
This closes #50
2014-09-29 23:45:34 +02:00
Steffen Jaeckel
eea24fe2c0 bring back possibility to import/export old DSA key format 2014-09-29 23:44:47 +02:00
Steffen Jaeckel
f58c87866e add possibility to export RSA public key in SubjectPublicKeyInfo format 2014-09-29 23:44:47 +02:00
Steffen Jaeckel
b1f29539be Revert "removed testing of "stripped" rsa key"
This reverts commit 496453f289.
2014-09-29 23:44:47 +02:00
Steffen Jaeckel
7842e338bf fix API of dynamic language helpers
it is easier to handle 'int' than 'long' in the foreign language
2014-09-29 23:30:02 +02:00
Steffen Jaeckel
b3b93675f5 Merge branch 'feature/sha2t' into develop 2014-09-29 19:57:43 +02:00
Steffen Jaeckel
1924e6fd47 add sha512/224 and sha512/256 to tests and crypt_build_settings 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
06321b8602 update makefiles 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
c58e2cae75 add special build rules for sha512/224 and sha512/256 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
23fb224e19 add sha512/224 and sha512/256 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
5ce0c7f70e Merge branch 'pascal-brand-st/xts' into develop
This closes #52
2014-09-29 19:47:44 +02:00
Steffen Jaeckel
3d905ca178 add testcase for multiple XTS encryption/decryption 2014-09-29 19:47:18 +02:00
Pascal Brand
adc54d08d0 Enable multiple XTS encryption or decryption
multiple xts_encrypt() cannot be performed because the
tweak is not updated. That means that
  xts_encrypt(buffer1, tweak)
  xts_encrypt(buffer2, tweak)
is not the same as
  xts_encrypt(concat(buffer1, buffer2), tweak)

Current patch enables such functionalities by
updating the tweak as output of the encryption.
Note that the tweak is no more constant.

The very same modification is performed
on xts_decrypt()

Signed-off-by: Pascal Brand <pascal.brand@st.com>
2014-09-28 22:55:02 +02:00
Steffen Jaeckel
824c7bf16a Merge branch 'pascal-brand-st/rsa' into develop
This closes #53
2014-09-28 22:53:22 +02:00
Steffen Jaeckel
94363b601c add testcase to verify that this patch is working 2014-09-28 22:52:32 +02:00
Pascal Brand
a6e89d58d4 RSA in CRT optimization parameters are empty 2014-09-28 22:48:21 +02:00
Pascal Brand
2bb3f0246f RSA in case CRT optimization parameters are not populated
rsa_exptmod(), ran on the private key, makes use of CRT optimization
parameters. In some use-cases, the given key does not include the
optimization parameters.

This patch allows rsa_exptmod() to run without the CRT parameters,
using directly mp_exptmod().

Signed-off-by: Pascal Brand <pascal.brand@st.com>
2014-09-28 22:45:46 +02:00
Steffen Jaeckel
cb2322f8de Merge branch 'fix/x32' into develop
This closes #51
2014-09-28 22:43:58 +02:00
Steffen Jaeckel
afaef3993c fix compiler warning when compiling with GMP_DESC 2014-09-10 16:16:46 +02:00
Steffen Jaeckel
f597f29ece math: change get_digit() return value
unsigned long is 32bit wide when compiling with the compiler flag "-mx32"
but the digit size of the math libraries is still 64 bit which lead to
the buggy ecc code.

Therefore define a new type ltc_mp_digit with the correct width and use
that as return value of get_digit()

Has been tested with all three math providers
2014-09-10 16:15:35 +02:00
Steffen Jaeckel
1793072c67 fix CC parameter given to make in testprof folder 2014-09-10 16:08:49 +02:00
Steffen Jaeckel
67b9cd8a95 trim trailing spaces 2014-09-02 02:17:43 +02:00
Steffen Jaeckel
e8d4598616 Merge branch 'fix/mingw64' into develop 2014-09-01 19:29:44 +02:00
Steffen Jaeckel
fff4fd15c4 build.sh: improve diff parameters 2014-08-31 18:47:21 +02:00
Steffen Jaeckel
ee4c00b753 some more ASN.1 fixes
these should have been in #49
2014-08-31 18:26:14 +02:00
Steffen Jaeckel
c342cb5a21 Merge branch 'fix/asn1' into develop
This closes #49

[skip ci]
2014-08-31 18:02:52 +02:00
Steffen Jaeckel
e5fb4d5ebe use DO() macro when calling API functions in tests 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
7a5ea10e60 add missing ASN1 types in der_encode_set() 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
ddede01d16 trim trailing spaces 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
b06270645e add missing check of the OID 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
6bba3a2a70 change the ASN1 type to be a typedef
replace all 'default' cases in the switch statements
2014-08-28 14:02:57 +02:00
Steffen Jaeckel
00c111b1c8 add missing types to decode routines 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
800182338e unwind conditional expressions
I prefer readability
2014-08-28 14:02:57 +02:00
Christopher Brown
3cdb64eca6 bypass constructed type identification for sets / sequences 2014-08-28 14:02:56 +02:00