Commit Graph

413 Commits

Author SHA1 Message Date
Steffen Jaeckel
0b6915740c saferp: enclose macros in do{}while(0) loop 2015-01-20 22:36:07 +01:00
Steffen Jaeckel
9782c09a3a use XMEM{CMP, CPY, SET} macros instead of standard versions 2015-01-20 22:36:06 +01:00
Steffen Jaeckel
b8bf2f13b8 Merge branch 'feature/const_memcmp' into develop
This closes #57
2015-01-20 22:35:44 +01:00
Steffen Jaeckel
46c038f7d4 adapt rsa_test() to modified pkcs#1 decoding routines 2014-11-13 22:30:07 +01:00
Steffen Jaeckel
1e9e98aa0d make pkcs#1 decode functions constant-time
as proposed in RFC 3447 only one error return code is used when there are
errors while decoding the pkcs#1 format.
also, all steps are executed and only the "output" is skipped if something
went wrong.

Sorry this could break backwards compatibility, since there's no more
BUFFER_OVERFLOW messaging.
Former error-handling code could also be affected because now there's only
OK as return code in cases where "res" is also set to '1'.
2014-11-13 22:26:59 +01:00
Steffen Jaeckel
e57c92fd23 replace calls to standard memcmp with constant memcmp where necessary 2014-11-13 22:09:45 +01:00
Steffen Jaeckel
d54425adb4 update makefiles 2014-11-13 22:09:20 +01:00
Steffen Jaeckel
26c5d54e5c add constant-time memcmp()
[skip ci]
2014-11-12 23:59:27 +01:00
Steffen Jaeckel
ddca3d6422 Merge branch 'pascal-brand-st-dev/ccm' into develop
This closes #55
2014-11-02 17:02:21 +01:00
Steffen Jaeckel
f2f8342c43 ccm test: add missing AAD 2014-11-02 17:01:56 +01:00
Steffen Jaeckel
943a858d6c also run testvectors on new CCM API
[skip ci]
2014-10-31 19:41:14 +01:00
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