platform/core/security/yaca.git
8 years agoLower the key bit_len in sign/verify example 85/69985/2
Lukasz Pawelczyk [Tue, 17 May 2016 12:19:11 +0000 (14:19 +0200)]
Lower the key bit_len in sign/verify example

It takes too long to run the example with 4k key for our purposes.

Change-Id: I331782d9cf90f621cf2b009ad4751a952157341f

8 years agoFix assert vs error codes usage in get_sign_output_length() 84/69984/2
Lukasz Pawelczyk [Tue, 17 May 2016 13:07:18 +0000 (15:07 +0200)]
Fix assert vs error codes usage in get_sign_output_length()

Change-Id: Ieca2200d6f844590ed16b0dc314e56a4572c5dfa

8 years agoGet rid of few TODOs that no longer apply 33/69533/4
Lukasz Pawelczyk [Fri, 13 May 2016 15:51:07 +0000 (17:51 +0200)]
Get rid of few TODOs that no longer apply

Change-Id: I0763fba2200770137eb73e9a7c4ee4ff4858e35d

8 years agoFix API for get_output_length() 32/69532/5
Lukasz Pawelczyk [Fri, 13 May 2016 14:45:41 +0000 (16:45 +0200)]
Fix API for get_output_length()

Return the value by size_t param instead of signed int return. The
return value is used only for error codes from now on.

Change-Id: I8c4665342316f35d9aea1d2b3605a1248fc31b17

8 years agoAdd support to RC2/RC4 encrypt/decrypt. Update documentation. 99/69099/6
Dariusz Michaluk [Wed, 11 May 2016 09:04:43 +0000 (11:04 +0200)]
Add support to RC2/RC4 encrypt/decrypt. Update documentation.

Change-Id: I57a54e9581af12ffe73a721c7cae8c3880df94ab

8 years ago[FIX] ECB mode does not use an IV, so IV can be YACA_KEY_NULL. 31/69031/5
Dariusz Michaluk [Wed, 11 May 2016 07:31:30 +0000 (09:31 +0200)]
[FIX] ECB mode does not use an IV, so IV can be YACA_KEY_NULL.

Change-Id: I64dbb66346176da764009ffb549451fffa5a5435

8 years agoAdd support to CAST5 encrypt/decrypt. Update documentation. 57/68957/7
Dariusz Michaluk [Tue, 10 May 2016 12:57:30 +0000 (14:57 +0200)]
Add support to CAST5 encrypt/decrypt. Update documentation.

Change-Id: I645018182fc723190223eac627c665d84da41340

8 years agoAdd support to DES encrypt/decrypt. Update documentation. 82/68782/7
Dariusz Michaluk [Mon, 9 May 2016 14:30:23 +0000 (16:30 +0200)]
Add support to DES encrypt/decrypt. Update documentation.

Change-Id: Ide2d1f93cd2deef711a7fdfd2dd922f46f8f3637

8 years agoGenerate/import/export DES key. 81/68781/6
Dariusz Michaluk [Mon, 9 May 2016 14:27:22 +0000 (16:27 +0200)]
Generate/import/export DES key.

Change-Id: Iac23685e9be18204c0d9a317bf4aa17e4539e556

8 years agoAdd prefix to header guards to avoid conflicts. 89/69489/3
Krzysztof Jackiewicz [Fri, 13 May 2016 10:45:55 +0000 (12:45 +0200)]
Add prefix to header guards to avoid conflicts.

Change-Id: I1e96b8ca538d61da8d4ae34ab9ee632472e192ce

8 years agoRemove symbol names from @brief paragraph 77/69477/3
Krzysztof Jackiewicz [Fri, 13 May 2016 10:26:03 +0000 (12:26 +0200)]
Remove symbol names from @brief paragraph

Symbol names are not necessary in @brief paragraph. The symbol names are
produced anyway and there's no point in duplicating them.

Change-Id: I5283771962966cf2ff5ffbf91499f0c2fe8e48cd

8 years agoPrevent use of uninitialized variable in examples 78/69478/1
Krzysztof Jackiewicz [Fri, 13 May 2016 10:31:01 +0000 (12:31 +0200)]
Prevent use of uninitialized variable in examples

Change-Id: I79052b160cd3d009fe89652a33e0450ee1e516d3

8 years agoExample for X509 import 80/68780/4
Lukasz Pawelczyk [Mon, 9 May 2016 13:51:40 +0000 (15:51 +0200)]
Example for X509 import

Change-Id: I698b81ff87ca4f2579447a8085a2a2ba2f0cb3ee

8 years agoAdd support for importing public keys from X509 certificate 79/68779/4
Lukasz Pawelczyk [Mon, 9 May 2016 13:50:58 +0000 (15:50 +0200)]
Add support for importing public keys from X509 certificate

Fix a bug with X509 not being freed and pkey not being freed in case of
an error.

Change-Id: I063f606b928c679c452347cc18db793fc066c509

8 years agoUse specific RSA/DSA export variants 61/68761/5
Lukasz Pawelczyk [Mon, 9 May 2016 12:08:35 +0000 (14:08 +0200)]
Use specific RSA/DSA export variants

The reason is, that the output of a PEM is different in the case of
PrivateKey variant and DSAPrivateKey and RSAPrivateKey
variants. According to the manual they should behave the same way. They
don't. They seem to be in a different ASN1 format. This change is to be
consistent with the default behaviour of the command line tool.

This problem does not seem to appear on DER keys, but just for
consistency and to be safe do the same there.

Change-Id: I6a765e831515e9aac0353595132a139aec7b38d2

8 years agoDSA sign/verify example 60/68760/5
Lukasz Pawelczyk [Mon, 9 May 2016 11:29:05 +0000 (13:29 +0200)]
DSA sign/verify example

Change-Id: I29208ed486b03f40af4a1ddd52f999b3c6d25a99

8 years agoDSA sign/verify support 59/68759/5
Lukasz Pawelczyk [Mon, 9 May 2016 11:27:08 +0000 (13:27 +0200)]
DSA sign/verify support

The previous implementation was generic enough to handle DSA as well.

Change-Id: I0c952e340cae3fabb05aa0e10fa5f0947319e4f8

8 years agoAdd DSA to import/export example 58/68758/5
Lukasz Pawelczyk [Mon, 9 May 2016 11:20:54 +0000 (13:20 +0200)]
Add DSA to import/export example

Improved printing a little. This example can serve partially as a
test. It has been written this way as a verification tool as we don't
have proper tests yet.

Change-Id: Ifbda0f17e2e8fc0b734d34d49668a4a7662c337d

8 years agoyaca_key_import()/yaca_key_export() for DSA 57/68757/5
Lukasz Pawelczyk [Mon, 9 May 2016 10:42:54 +0000 (12:42 +0200)]
yaca_key_import()/yaca_key_export() for DSA

It seems that my previous import/export commit was generic enough to
handle DSA as well. Only minor change was required to enable DSA. That's
why this commit is so short.

Change-Id: I0627c10a723b0011dde705d74d290caa36533a9d

8 years agoyaca_key_gen() and yaca_key_extract_public() for DSA 56/68756/5
Lukasz Pawelczyk [Fri, 6 May 2016 16:44:56 +0000 (18:44 +0200)]
yaca_key_gen() and yaca_key_extract_public() for DSA

There is no dedicated method to extract public key for DSA, only
export/import (to temporary memory). As the latter method also works for
RSA and I predict it will work for ECDSA I use it exclusively.

Change-Id: Idf25df43da571cfb3d67192b5263e4a4c260feeb

8 years agoAdd GNU global files to .gitignore 72/68572/6
Lukasz Pawelczyk [Fri, 6 May 2016 14:18:53 +0000 (16:18 +0200)]
Add GNU global files to .gitignore

Change-Id: I6e7160af73a35b33bdcf76059c3a99be8f29c0db

8 years agoAdd missing example comments 61/68561/7
Lukasz Pawelczyk [Fri, 6 May 2016 09:49:23 +0000 (11:49 +0200)]
Add missing example comments

Change-Id: Ie67851cf21395a72519ff2d2e79973184572749c

8 years agoRemoval of yaca_key_gen_pair() and its enum values 64/68464/16
Lukasz Pawelczyk [Wed, 4 May 2016 11:36:27 +0000 (13:36 +0200)]
Removal of yaca_key_gen_pair() and its enum values

You can achieve the same now with yaca_key_gen() and
yaca_key_extract_public() if/when the latter is needed.

Change-Id: I5f47ed118e283b4d868f000108900f377b1260df

8 years agoMake it possible to generate private keys with yaca_key_gen() 63/68463/16
Lukasz Pawelczyk [Mon, 2 May 2016 15:48:47 +0000 (17:48 +0200)]
Make it possible to generate private keys with yaca_key_gen()

Change-Id: I7d4928ab27dad85cd52f3cff60ff9a9e61ae261f

8 years agoyaca_key_extract_public() public function 62/68462/16
Lukasz Pawelczyk [Mon, 2 May 2016 11:50:46 +0000 (13:50 +0200)]
yaca_key_extract_public() public function

The idea is to remove yaca_key_gen_pair() and always generate using
yaca_key_gen(). The latter will always generate private keys for
asymmetric types. Public key will be extracted (if needed) using the
function implemented here.

This approach has an advantage that we can extract public keys for
private keys imported from external sources. Previously this was
impossible.

Change-Id: I081c81eb37ed3267518aac21a9bf36063ef0e901

8 years agoIncorporate sanity checks into key_get_* functions 72/69072/2
Lukasz Pawelczyk [Wed, 11 May 2016 10:19:41 +0000 (12:19 +0200)]
Incorporate sanity checks into key_get_* functions

Change-Id: I2d13b621b202c6c5800b745fe5b9f48d5a88aac8

8 years agowrite_file()/read_file() functions added 78/68778/4
Lukasz Pawelczyk [Mon, 9 May 2016 13:55:29 +0000 (15:55 +0200)]
write_file()/read_file() functions added

They are not used now, but they are very helpful for debugging and they
will be used in future examples.

Change-Id: Ia3cee5a67013543096cef45b04b649ce5faaf9e8

8 years agoRemove YACA_ERROR_NOT_SUPPORTED 67/68567/2
Dariusz Michaluk [Fri, 6 May 2016 13:14:22 +0000 (15:14 +0200)]
Remove YACA_ERROR_NOT_SUPPORTED

Change-Id: I3f6b9cf907fc4fb4e0dd6dd84452f1448e223e65

8 years agoMake yaca GCC 5 compatibile 06/68506/2
Krzysztof Jackiewicz [Thu, 5 May 2016 09:45:46 +0000 (11:45 +0200)]
Make yaca GCC 5 compatibile

GCC 5 issues a warning for __FUNCTION__. Use __func__ instead.

Change-Id: I3d37621c8384e4f229140bfc3af8c92f81058ff5

8 years agokey_import/key_export example 10/68010/10
Lukasz Pawelczyk [Tue, 26 Apr 2016 13:04:30 +0000 (15:04 +0200)]
key_import/key_export example

Change-Id: Ia638fdc60c88684163dc6afe3aa3e83d65684950

8 years agoyaca_key_import() basic implementation (symmetrical and RSA) 09/68009/10
Lukasz Pawelczyk [Thu, 28 Apr 2016 16:30:29 +0000 (18:30 +0200)]
yaca_key_import() basic implementation (symmetrical and RSA)

Change-Id: I8a90a06326fabbbd8b013452c1d0797635451464

8 years agoyaca_key_export() implementation for YACA_KEY_FORMAT_DEFAULT 08/68008/9
Lukasz Pawelczyk [Mon, 25 Apr 2016 16:33:26 +0000 (18:33 +0200)]
yaca_key_export() implementation for YACA_KEY_FORMAT_DEFAULT

Change-Id: I946b1f862dd7f75d93372cea00deb6487ae35fb7

8 years agoSome TODOs added for things noticed 07/68007/8
Lukasz Pawelczyk [Thu, 28 Apr 2016 11:55:04 +0000 (13:55 +0200)]
Some TODOs added for things noticed

Change-Id: I8683a77c3e50dea327cb5c10973d1fe310765470

8 years agoSmall fixes in key.c
Lukasz Pawelczyk [Thu, 28 Apr 2016 11:39:06 +0000 (13:39 +0200)]
Small fixes in key.c

Check for key length (non zero and dividable by 8).
Asymmetric keys in the current state are INVALID_ARGUMENT.

Change-Id: Ic7dd64fa86a485f11e52b83b2b82f710c4d55c80

8 years agoAPI changes around key_import and key_export
Lukasz Pawelczyk [Wed, 20 Apr 2016 14:35:44 +0000 (16:35 +0200)]
API changes around key_import and key_export

key_import will autodetect key_format and key_file_format. Only the
expected key_type is required.
key_export needs to have key_format and key_file_format explicitly
given (obviously). It will get the key_type from the key.

Change-Id: I6a8e04c886f6acd95dc124918606fbad992108c2

8 years agoAdd info about yaca tests. Remove unnecessary test dir. 12/68512/2
Dariusz Michaluk [Thu, 5 May 2016 10:39:23 +0000 (12:39 +0200)]
Add info about yaca tests. Remove unnecessary test dir.

Change-Id: Icb519091c09c426993c50f5fac8ef6d9c1c8c874

8 years agoRename key_fmt to key_file_fmt type and introduce a real key_fmt enum. 04/68004/4
Lukasz Pawelczyk [Wed, 20 Apr 2016 13:19:50 +0000 (15:19 +0200)]
Rename key_fmt to key_file_fmt type and introduce a real key_fmt enum.

key_file_fmt is a format of the file (PEM, DER, RAW, BASE64).
Newly added key_fmt is a format of a key within file format (PKCS#X, etc).

E.g. we can have PKCS#1 encoded as PEM or DER and PKCS#8 encoded again
as PEM or DER. Those two format types are independent of each other.

Change-Id: I38b9106c619a5b45c09be48d95f9278f43b79dd4

8 years agoSwitch to smart-tabs in key.c and key.h 03/68003/2
Lukasz Pawelczyk [Mon, 25 Apr 2016 13:31:22 +0000 (15:31 +0200)]
Switch to smart-tabs in key.c and key.h

Change-Id: I8d6186819fe1edb3cea5a58124e06e4b1fbbbac9

8 years agoReplace YACA_ERROR_OPENSSL_FAILURE with YACA_ERROR_INTERNAL 29/67829/3
Dariusz Michaluk [Thu, 28 Apr 2016 12:01:30 +0000 (14:01 +0200)]
Replace YACA_ERROR_OPENSSL_FAILURE with YACA_ERROR_INTERNAL

Change-Id: Ibb6ffca3dc778479556ba7412b46b3f9c542c424

8 years agoCleanup API documentation. 23/67823/4
Dariusz Michaluk [Thu, 28 Apr 2016 11:07:47 +0000 (13:07 +0200)]
Cleanup API documentation.

Change-Id: I4e4e1ce027d9672adb1bf92eebfc8e8696f90cb5

8 years agoReview and simplify Seal/Open example. 73/66873/6
Dariusz Michaluk [Thu, 21 Apr 2016 11:06:31 +0000 (13:06 +0200)]
Review and simplify Seal/Open example.

Change-Id: I3d41c8de8edf79237027162f654af65952a5d9d3

8 years agoSeal/Open implementation. 72/66872/9
Dariusz Michaluk [Thu, 21 Apr 2016 11:09:18 +0000 (13:09 +0200)]
Seal/Open implementation.

Change-Id: I8c89eb8117158440fb6bd5ab8a6875ca29755093

8 years agoyaca_open_init() needs key length to generate EVP_CIPHER 71/66871/4
Dariusz Michaluk [Thu, 21 Apr 2016 14:06:38 +0000 (16:06 +0200)]
yaca_open_init() needs key length to generate EVP_CIPHER

Change-Id: I5d12ca2ac41c54a6a73844033c9ab6a0118b954f

8 years agoChange spaces to tab in CMakeLists 96/67096/2
Dariusz Michaluk [Tue, 12 Apr 2016 13:48:14 +0000 (15:48 +0200)]
Change spaces to tab in CMakeLists

Change-Id: I721359eaade46100c96d6a9fd9ed3e24293868d6

8 years agoSet debug function in examples 54/66854/5
Krzysztof Jackiewicz [Thu, 21 Apr 2016 11:06:40 +0000 (13:06 +0200)]
Set debug function in examples

Change-Id: Ia4e65acbad056d988b7ceffa3f9190f40b35270a

8 years agoDump openssl errors after each failure 53/66853/6
Krzysztof Jackiewicz [Thu, 21 Apr 2016 10:51:54 +0000 (12:51 +0200)]
Dump openssl errors after each failure

Change-Id: Ie665574073d00e29a451fcd799488efa35023bbb

8 years agoAdd helper functions for openssl error handling 52/66852/6
Krzysztof Jackiewicz [Thu, 21 Apr 2016 11:15:53 +0000 (13:15 +0200)]
Add helper functions for openssl error handling

Change-Id: Ibc20d9e37bc2d90a92646e1115d9a1b63f5342e6

8 years agoBugfix: yaca_encrypt_final used in decryption 29/66829/1
Dariusz Michaluk [Thu, 21 Apr 2016 09:45:31 +0000 (11:45 +0200)]
Bugfix: yaca_encrypt_final used in decryption

Change-Id: I26f60bc9adfd8e55390a1522c6d36197cccc46b5

8 years agoExamples reviewed and simplified after RSA/HMAC sign implementation. 81/66181/5
Lukasz Pawelczyk [Thu, 14 Apr 2016 14:56:31 +0000 (16:56 +0200)]
Examples reviewed and simplified after RSA/HMAC sign implementation.

Change-Id: I4b771695346d77ff0a133a6907e701de6fcfe856

8 years agoSign/verify initial implementation. Examples to follow. 44/65844/7
Lukasz Pawelczyk [Tue, 12 Apr 2016 11:42:52 +0000 (13:42 +0200)]
Sign/verify initial implementation. Examples to follow.

Change-Id: I31205fdbb897011b2cf5cbff02acbae396e95205

8 years agoSplit ECC key types into ECDSA and ECDH 38/66738/1
Lukasz Pawelczyk [Wed, 20 Apr 2016 13:28:15 +0000 (15:28 +0200)]
Split ECC key types into ECDSA and ECDH

Change-Id: I58b90609886d529cc1b387c56dd544977e5b6803

8 years agoAdd a line break before printing out formatted data bytes. 80/66180/4
Lukasz Pawelczyk [Fri, 15 Apr 2016 14:07:12 +0000 (16:07 +0200)]
Add a line break before printing out formatted data bytes.

Change-Id: Iadd01247f0cba4190f99990bdf48e38351580a56

8 years agoAdd a TODO about get_output length signature. 64/66164/3
Lukasz Pawelczyk [Thu, 14 Apr 2016 14:56:09 +0000 (16:56 +0200)]
Add a TODO about get_output length signature.

Change-Id: I33b588ab52da7e1efb05e48c73f5335f02b55fb8

8 years agoyaca_seal_init() needs key length to generate EVP_CIPHER 01/66401/2
Dariusz Michaluk [Mon, 18 Apr 2016 14:56:42 +0000 (16:56 +0200)]
yaca_seal_init() needs key length to generate EVP_CIPHER

Change-Id: I65f40910983d5d8928174807dbdc7c622eee70d8

8 years agoSplit symmetric/asymmetric encryption 29/66329/3
Dariusz Michaluk [Mon, 18 Apr 2016 10:35:32 +0000 (12:35 +0200)]
Split symmetric/asymmetric encryption

Change-Id: Iab1755771de9cdb8d2b2902cf6b6a1adcb343ade

8 years agoNullify destroyed pointer. 63/66163/1
Lukasz Pawelczyk [Thu, 14 Apr 2016 14:52:58 +0000 (16:52 +0200)]
Nullify destroyed pointer.

Change-Id: I40384227010a733499b05bf6b587a1ec125505df

8 years agoyaca_ctx_free: Cause exception on missing destructor. 05/65605/8
Mateusz Kulikowski [Mon, 11 Apr 2016 13:52:33 +0000 (15:52 +0200)]
yaca_ctx_free: Cause exception on missing destructor.

ctx->ctx_destriy is mandatory for all contexts.
Add assert to verify that.

Change-Id: I1a1b5b5c7eb50eb5cea440ad74d410aeb2cdda59
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoAdd yaca_ctx_get|set_param prototypes. 04/65604/8
Mateusz Kulikowski [Mon, 11 Apr 2016 13:51:51 +0000 (15:51 +0200)]
Add yaca_ctx_get|set_param prototypes.

Change-Id: I714a47663e742bc8c3eeb446483eee0a58a8a056
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoUse crypto_zalloc for internal structure allocations. 03/65603/8
Mateusz Kulikowski [Mon, 11 Apr 2016 13:50:50 +0000 (15:50 +0200)]
Use crypto_zalloc for internal structure allocations.

Change-Id: I3a3f738cf238c362ac33e3aa01c3a37d263140f9
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoyaca: add yaca_zalloc 02/65602/8
Mateusz Kulikowski [Mon, 11 Apr 2016 13:46:33 +0000 (15:46 +0200)]
yaca: add yaca_zalloc

This allocator will be mostly used to allocate contexts/keys.

Change-Id: I5c3a5efcda5a243503ac80502c221157e18eaa2a
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoImplement limited symmetric cipher support 01/65601/8
Mateusz Kulikowski [Mon, 11 Apr 2016 13:35:20 +0000 (15:35 +0200)]
Implement limited symmetric cipher support

Change-Id: I5b130e3e1d41cfcce1f730f3d1b316c088432677
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoAdd package with examples. 92/65592/8
Dariusz Michaluk [Mon, 11 Apr 2016 13:10:17 +0000 (15:10 +0200)]
Add package with examples.

Change-Id: Idd9fee1bdc3588721fb74f1dca3ff570e827a757

8 years agoImplement yaca_get_iv_bits() 00/65600/6
Mateusz Kulikowski [Mon, 11 Apr 2016 13:33:39 +0000 (15:33 +0200)]
Implement yaca_get_iv_bits()

Move code to encrypt* as it's encryption related.

Change-Id: Id9b5072e3fb220aaffcc0f1aad5f2b0893fa06ed
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoencrypt: add get_symmetric_algorithm 99/65599/7
Mateusz Kulikowski [Mon, 11 Apr 2016 13:31:50 +0000 (15:31 +0200)]
encrypt: add get_symmetric_algorithm

Implement function to map yaca algorithm enums to EVP_CIPHER.

It is currently not very fast, and doesn't handle all algorithms/modes
supported by yaca.

Change-Id: I34c9a78044561b7fdcdc9e23632e45ff745e7f34
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agointernal.h: add YACA_CTX_ENCRYPT 98/65598/6
Mateusz Kulikowski [Mon, 11 Apr 2016 13:27:21 +0000 (15:27 +0200)]
internal.h: add YACA_CTX_ENCRYPT

It is context for encryption

Change-Id: Icb8ebbb9804edca48cab3d6523a9e27c3ab30fe1
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agosimple: Handle encrypt/decrypt block sizes properly 95/65595/5
Mateusz Kulikowski [Mon, 11 Apr 2016 10:40:18 +0000 (12:40 +0200)]
simple: Handle encrypt/decrypt block sizes properly

- Calculate output block sizes properly
- Resize output allocations to size output

Change-Id: I58cc4530f9b832375c20c79c9883910adaaccc67
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoEncrypt example update 94/65594/7
Mateusz Kulikowski [Mon, 11 Apr 2016 09:58:52 +0000 (11:58 +0200)]
Encrypt example update

- Handle outputs allocation properly
- Calculate IV lengths
- Generate IV properly

Change-Id: I3ae9c15dac9fa36bb308846fc4c33c61296ca819
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agocrypto.h: rename yaca_get_iv_length() to yaca_get_iv_bits() 66/65866/2
Mateusz Kulikowski [Wed, 13 Apr 2016 12:45:16 +0000 (14:45 +0200)]
crypto.h: rename yaca_get_iv_length() to yaca_get_iv_bits()

Function returns IV length in bits - rename it to avoid confusion.

Change-Id: I58f565e1ca96321856f099d55ec456f23be1dbe0
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoexamples: Add LOREM*_SIZE 65/65865/1
Mateusz Kulikowski [Wed, 13 Apr 2016 12:44:40 +0000 (14:44 +0200)]
examples: Add LOREM*_SIZE

Add macros containing sizes of lorem* strings.

Change-Id: I2514f9fc03d55561530fac9ec856f404f9aa987b
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoAdd SIGN context to context types. 81/65781/4
Lukasz Pawelczyk [Tue, 12 Apr 2016 11:42:30 +0000 (13:42 +0200)]
Add SIGN context to context types.

Change-Id: If61017092a29d5b50c6036b825492a7760e87cd6

8 years agoRemove unused function pointer, no need to do that for keys. 97/65797/3
Lukasz Pawelczyk [Tue, 12 Apr 2016 12:54:01 +0000 (14:54 +0200)]
Remove unused function pointer, no need to do that for keys.

Change-Id: I1b856243bc42a09783cadfe42b402f9c8dc144f0

8 years agoImplement getting the bits of an evp type key. 80/65780/4
Lukasz Pawelczyk [Tue, 12 Apr 2016 11:34:44 +0000 (13:34 +0200)]
Implement getting the bits of an evp type key.

Change-Id: Ibbd62e146bcfc7ecaa999a694416db2488e14052

8 years agoSmall cosmetic change in digest.c to line it up with the style of the rest of the... 79/65779/2
Lukasz Pawelczyk [Tue, 12 Apr 2016 11:34:04 +0000 (13:34 +0200)]
Small cosmetic change in digest.c to line it up with the style of the rest of the code.

Change-Id: Ib22750311254ffaaa0f241191f9a9fdeed1a00b7

8 years agoGet rid of EVP_MD from digest struct, it's redudant. 78/65778/2
Lukasz Pawelczyk [Tue, 12 Apr 2016 11:33:19 +0000 (13:33 +0200)]
Get rid of EVP_MD from digest struct, it's redudant.

Change-Id: I52d84125d4b0f2ab1face439477efcc82ee0a0fe

8 years agoAdd todo.txt file for global TODOs. 77/65777/2
Lukasz Pawelczyk [Tue, 12 Apr 2016 11:30:44 +0000 (13:30 +0200)]
Add todo.txt file for global TODOs.

Change-Id: I79d942960fa25b44095b6ea150d5bd1f408c8343

8 years agoAdd YACA_ERROR_SIGNATURE_INVALID error code. Mentioned in the doxygen. 76/65776/2
Lukasz Pawelczyk [Tue, 12 Apr 2016 11:30:02 +0000 (13:30 +0200)]
Add YACA_ERROR_SIGNATURE_INVALID error code. Mentioned in the doxygen.

Change-Id: Ieff9d6a8408c878b7ff9656f637382abab23f742

8 years agoEnable extra compilation flags. 91/65591/3
Dariusz Michaluk [Mon, 11 Apr 2016 12:24:27 +0000 (14:24 +0200)]
Enable extra compilation flags.

Change-Id: I689300d8176eacdad75ddf19bb1b3f91510e872d

8 years agoFix compilation with Clang. 56/65356/2
Lukasz Pawelczyk [Fri, 8 Apr 2016 14:26:48 +0000 (16:26 +0200)]
Fix compilation with Clang.

Some bugs in the code fixed, caught by Clang warnings/errors.

Change-Id: If6b2b617222ea8d07d5d3af4202a4dae3b7ebebe
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
8 years agoyaca_ctx_free: NULL context handling 93/65593/1
Mateusz Kulikowski [Mon, 11 Apr 2016 09:43:04 +0000 (11:43 +0200)]
yaca_ctx_free: NULL context handling

Ignore null contexts.

Change-Id: I7ecac9603519d91d5708f4eed11af0a9f8a4ce17
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoRename get_digest_algorithm -> digest_get_algorithm
Mateusz Kulikowski [Fri, 8 Apr 2016 10:49:31 +0000 (12:49 +0200)]
Rename get_digest_algorithm -> digest_get_algorithm

Use common naming for internal API

Change-Id: Ie6dce91fca60d099249e32938b9ebc5dd8a1a6d2
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoMove key structures to internal API header, expose getters
Mateusz Kulikowski [Fri, 8 Apr 2016 10:48:07 +0000 (12:48 +0200)]
Move key structures to internal API header, expose getters

- Rename get_evp|simple_key to key_get_evp|simple and expose as internal API
- Move key structures to internal API header

Change-Id: I192d456b90043446e93b788fab5c9e5625dfd3f6
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoConvert all key lengths to bits
Mateusz Kulikowski [Fri, 8 Apr 2016 10:25:37 +0000 (12:25 +0200)]
Convert all key lengths to bits

- Rename API parameters to avoid confusion (key_len -> key_bits)
- Rename internal key length to key_bits
- Fix key length handling where it was done incorrectly

Change-Id: If3dcf8ad87246a144019d3fc93c6251c3529d881
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agokey: Cleanups
Mateusz Kulikowski [Wed, 6 Apr 2016 13:33:39 +0000 (15:33 +0200)]
key: Cleanups

- Clean import for symmetric keys
- Clean generation of "simple/single" keys
- Return proper error from yaca_key_gen (key not supported vs invalid type)

Change-Id: Ia993ad1b1908dd9c5babc31b687e2e9b9bc07eba
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agokey: Check for key_len overflows
Mateusz Kulikowski [Wed, 6 Apr 2016 13:32:10 +0000 (15:32 +0200)]
key: Check for key_len overflows

Affected functions:
- key_import
- key_gen

Change-Id: I1b2898b03d3bf950706c21671afe9d6a89311255
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agokey: implement pbkdf2
Mateusz Kulikowski [Wed, 6 Apr 2016 13:31:22 +0000 (15:31 +0200)]
key: implement pbkdf2

- Fixup key_len - it is now size_t
- Add maximum password length

Change-Id: Ic5bc6de538f305020c52219793e2dc440de47eb3
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agodigest: Add get_digest_algorithm
Mateusz Kulikowski [Mon, 4 Apr 2016 13:23:38 +0000 (15:23 +0200)]
digest: Add get_digest_algorithm

Add API to translate yaca_digest_algo_e to EVP_MD.

It is needed by other modules (like pbkdf2, message sign/verify etc.).

Change-Id: I0b73eb51e076e443ebc269f96772c438479c81f5
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoRemove private headers (*_p.h)
Mateusz Kulikowski [Thu, 7 Apr 2016 14:37:21 +0000 (16:37 +0200)]
Remove private headers (*_p.h)

Merge all internal defines / macros / declarations into internal.h

This file may be later split, but for now it's small enough.

Change-Id: I5f00c856fd7daa0773fd6ccdb175312df1e06818
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agocompilation: use c11 instead of c99
Mateusz Kulikowski [Mon, 4 Apr 2016 13:20:29 +0000 (15:20 +0200)]
compilation: use c11 instead of c99

Change-Id: I1cea470f7ee346bf9cd38899c592fbc973568e83
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoAdd coding rules document
Mateusz Kulikowski [Wed, 6 Apr 2016 11:27:33 +0000 (13:27 +0200)]
Add coding rules document

Based on internal discussions and tizen rules.

Change-Id: Ibf4a65635bfd6adbc3259a28b948591e30d3f9c6
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoWith cmake we should not allow the main git directory to be polluted.
Lukasz Pawelczyk [Wed, 6 Apr 2016 12:34:03 +0000 (14:34 +0200)]
With cmake we should not allow the main git directory to be polluted.

Change-Id: I24e334e7296af32c6e5de81cefb1ff8ece7305d2

8 years agoFix a SIGSEGV in key-exchange example. It's still not implemented though.
Lukasz Pawelczyk [Wed, 6 Apr 2016 12:33:39 +0000 (14:33 +0200)]
Fix a SIGSEGV in key-exchange example. It's still not implemented though.

Change-Id: I2ea56f1109d799d77c1a322567250afca68da13b

8 years agoSome minor digest changes.
Lukasz Pawelczyk [Wed, 6 Apr 2016 12:32:14 +0000 (14:32 +0200)]
Some minor digest changes.

- code style to make it more similar to the recent key changes
- digest_ctx_free()

Change-Id: Icf11abc94fb4811edfb6a9350905aed7f29e8e78

8 years agoPartially implement a new key type (evp) and yaca_key_gen_pair()
Lukasz Pawelczyk [Wed, 6 Apr 2016 12:31:21 +0000 (14:31 +0200)]
Partially implement a new key type (evp) and yaca_key_gen_pair()

Change-Id: I7c0d41d734284544585a173f2c64c5b6e77f4b24

8 years agoRename owl -> yaca
Mateusz Kulikowski [Wed, 6 Apr 2016 09:06:39 +0000 (11:06 +0200)]
Rename owl -> yaca

Use official project name - YACA (Yet Another Crypto API)

Change-Id: Ib226ee33efafe79663017cedcbf589137c2799fb
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>
8 years agoMake binary install dir configurable
Krzysztof Jackiewicz [Tue, 5 Apr 2016 11:55:23 +0000 (13:55 +0200)]
Make binary install dir configurable

Change-Id: I83eab84f09e81ee871a5dae56f2061f9899f6a32

8 years agoRe-indent the definitions after adding the API prefix.
Lukasz Pawelczyk [Tue, 5 Apr 2016 10:35:39 +0000 (12:35 +0200)]
Re-indent the definitions after adding the API prefix.

Change-Id: Ic887def78ea211b6fbf0e1670e9b4c623884e71a

8 years agoAdd cmake scripts for example compilation
Krzysztof Jackiewicz [Mon, 4 Apr 2016 09:09:29 +0000 (11:09 +0200)]
Add cmake scripts for example compilation

Change-Id: I0eaf20b6e20bf0285e50b066572d53cc93074efe

8 years agoFix digest ctx initalization
Krzysztof Jackiewicz [Mon, 4 Apr 2016 09:42:55 +0000 (11:42 +0200)]
Fix digest ctx initalization

Change-Id: I65dfef2680303ff51106ad86d739f07c763646ec

8 years agoRename 'crypto' to 'owl' in include directives
Krzysztof Jackiewicz [Mon, 4 Apr 2016 09:08:53 +0000 (11:08 +0200)]
Rename 'crypto' to 'owl' in include directives

Change-Id: Ia568b1f875eee4059cfb9cf3c9342c1d04515ca0

8 years agoAdd build/packaging system
Dariusz Michaluk [Thu, 31 Mar 2016 09:45:10 +0000 (11:45 +0200)]
Add build/packaging system

Change-Id: I218be0c159121689213dbfb3b8a1407a9405890e
Signed-off-by: Mateusz Kulikowski <m.kulikowski@samsung.com>