platform/core/security/yaca.git
8 years agoReplace YACA_ERROR_TOO_BIG_ARGUMENT with YACA_ERROR_INVALID_ARGUMENT 25/71925/3
Krzysztof Jackiewicz [Fri, 27 May 2016 13:47:45 +0000 (15:47 +0200)]
Replace YACA_ERROR_TOO_BIG_ARGUMENT with YACA_ERROR_INVALID_ARGUMENT

Change-Id: Iadf4d6a6044e6bc68389897f369064ec61ca309f

8 years agoRemove not implemented Skipjack algorithm. 23/71923/2
Dariusz Michaluk [Fri, 27 May 2016 13:37:13 +0000 (15:37 +0200)]
Remove not implemented Skipjack algorithm.

Change-Id: Ibc5a55bef78165344f839113361aa252749deacf

8 years agoRemove YACA_ERROR_NOT_IMPLEMENTED 21/71921/2
Dariusz Michaluk [Fri, 27 May 2016 13:27:46 +0000 (15:27 +0200)]
Remove YACA_ERROR_NOT_IMPLEMENTED

Change-Id: If8361e25c012984d3ebfaf7ae03df5964140f230

8 years agoAdd yaca_error_e typedef. 04/71904/2
Dariusz Michaluk [Fri, 27 May 2016 11:45:33 +0000 (13:45 +0200)]
Add yaca_error_e typedef.

Change-Id: I5bf5e9ad7cc91df53cbb437044d31dd8a7e1efad

8 years agoIntroduce YACA_ERROR_NONE according to ACR. 00/71900/2
Dariusz Michaluk [Fri, 27 May 2016 11:33:07 +0000 (13:33 +0200)]
Introduce YACA_ERROR_NONE according to ACR.

Change-Id: Id1f479603c7c54b9e5d5f187dd632470553aac10

8 years agoModify header names according to ACR 67/71867/4
Krzysztof Jackiewicz [Fri, 27 May 2016 10:43:54 +0000 (12:43 +0200)]
Modify header names according to ACR

Change-Id: I0bf4ad69d5f2c5796d26e2970ab4ef9d9583b91c

8 years agoAdd support for multiple threads 77/71477/8
Krzysztof Jackiewicz [Wed, 25 May 2016 12:04:35 +0000 (14:04 +0200)]
Add support for multiple threads

Change-Id: I76451bc5ea76fd2277eb62f79aa435f4b4fbe64d

8 years agokey import/export password handling example 04/70804/5
Lukasz Pawelczyk [Fri, 20 May 2016 16:08:26 +0000 (18:08 +0200)]
key import/export password handling example

Change-Id: I2b6da9307025e41e53dfa208c86c83bfc85ac22c

8 years agoyaca_key_export() implementation of password handling 03/70803/5
Lukasz Pawelczyk [Fri, 20 May 2016 15:16:57 +0000 (17:16 +0200)]
yaca_key_export() implementation of password handling

Change-Id: I17767807733346d6c6384d6fbf0bf2ffc8f076ab

8 years agoyaca_key_import() implementation of password handling 02/70802/5
Lukasz Pawelczyk [Wed, 18 May 2016 12:43:21 +0000 (14:43 +0200)]
yaca_key_import() implementation of password handling

Change-Id: I3586b8038a711942d0998cd7130509cbbc6388ff

8 years agoread_stdin_line() - misc function in examples 01/70801/3
Lukasz Pawelczyk [Wed, 18 May 2016 12:06:55 +0000 (14:06 +0200)]
read_stdin_line() - misc function in examples

Useful e.g. to read passwords for the purpose of examples.

Change-Id: I75ba71667625ca9ffeae5ee288ac3b5c74053879

8 years agoAdd emacs support file to git ignore 66/71466/3
Lukasz Pawelczyk [Wed, 25 May 2016 11:32:42 +0000 (13:32 +0200)]
Add emacs support file to git ignore

Change-Id: I4034f227914f8ebcda4c2cb79d4da722f804a8ab

8 years agoAdd AES CCM example. 89/70789/8
Dariusz Michaluk [Fri, 20 May 2016 10:22:30 +0000 (12:22 +0200)]
Add AES CCM example.

Change-Id: I1dbb4d481f6ab0c1b373698ae1d6b827b9b6ab82

8 years agoRework AES GCM example. 67/69767/10
Dariusz Michaluk [Fri, 13 May 2016 10:54:13 +0000 (12:54 +0200)]
Rework AES GCM example.

Change-Id: I7c068de59f18496a34a7a7a31f5258e34445764d

8 years agoAdd support to AES GCM/CCM. Update documentation. 66/69766/10
Dariusz Michaluk [Mon, 16 May 2016 12:54:35 +0000 (14:54 +0200)]
Add support to AES GCM/CCM. Update documentation.

Change-Id: Ifecf73fe15061afe8ad28a9ad20abc79f518f387

8 years agoRemove some TODO's. 43/71843/1
Dariusz Michaluk [Fri, 27 May 2016 09:44:27 +0000 (11:44 +0200)]
Remove some TODO's.

Change-Id: Ic92d916f018078d1539132e0e44bd07de3e0d00c

8 years agoCleanup #include statements. 20/71520/2
Dariusz Michaluk [Wed, 25 May 2016 15:52:09 +0000 (17:52 +0200)]
Cleanup #include statements.

Change-Id: I45d1600e7606915ac1408abe956e6b85d26bd5c9

8 years agoFix code formatting in sign.c 37/70937/8
Krzysztof Jackiewicz [Mon, 23 May 2016 09:58:31 +0000 (11:58 +0200)]
Fix code formatting in sign.c

Change-Id: I767a1b32cf64ecae3f625c40c6ea83ec57368c37

8 years agoSimple signature API example 26/70926/7
Krzysztof Jackiewicz [Mon, 23 May 2016 08:47:53 +0000 (10:47 +0200)]
Simple signature API example

Change-Id: Iad04bc78c1d394bbf4c7f1e9215efb01ad365c65

8 years agoSimple API for signatures - implementation 92/70192/14
Krzysztof Jackiewicz [Wed, 18 May 2016 13:35:39 +0000 (15:35 +0200)]
Simple API for signatures - implementation

Change-Id: I0beab0dd414d2c12e08a262b5c2750acbc711763

8 years agoadd @since_tizen 3.0 in yaca api header files 89/71289/16
sangsu [Wed, 25 May 2016 02:36:27 +0000 (11:36 +0900)]
add @since_tizen 3.0 in yaca api header files

Change-Id: I77736606ae86c6180e4eb0221610e03cc9abb9e5
Signed-off-by: sangsu <sangsu.choi@samsung.com>
8 years agoCleanup boilerplate notices. 98/71498/2
Dariusz Michaluk [Wed, 25 May 2016 13:48:23 +0000 (15:48 +0200)]
Cleanup boilerplate notices.

Change-Id: I162fe9cdfa095a4aefe0d14e83b55fd2a786c4d3

8 years agoUse new HMAC API in example 55/70155/9
Krzysztof Jackiewicz [Wed, 18 May 2016 10:19:48 +0000 (12:19 +0200)]
Use new HMAC API in example

Change-Id: I4479c5ff16deda4741dd3164c49e3bd2a5ba5551

8 years agoDon't dump error in case of verification failure 13/70913/3
Krzysztof Jackiewicz [Mon, 23 May 2016 08:11:51 +0000 (10:11 +0200)]
Don't dump error in case of verification failure

Change-Id: I65ea82e48c2bc6ba3fcfc4d63125c50dfa4b63b6

8 years agoUpdate openssl error handling. 01/71501/5
Krzysztof Jackiewicz [Fri, 27 May 2016 06:55:01 +0000 (08:55 +0200)]
Update openssl error handling.

ERROR_DUMP always clears the error queue. ERROR_CLEAR clears the queue
silently. One of them has to be called after an openssl error. ERROR_DUMP
should be called for errors that we do not recognize. ERROR_CLEAR for other
errors.

Change-Id: I90844271378a87f4897f66c9664edf60bcb1e218

8 years agoMove HMAC to a separate function. 54/70154/8
Krzysztof Jackiewicz [Mon, 23 May 2016 08:02:33 +0000 (10:02 +0200)]
Move HMAC to a separate function.

Change-Id: I3f3aaa475d6617d9d1356433e0b0b4adaeaef388

8 years agoUse "!= 0" instead of "< 0" when handling yaca errors 51/70951/2
Krzysztof Jackiewicz [Mon, 23 May 2016 10:33:52 +0000 (12:33 +0200)]
Use "!= 0" instead of "< 0" when handling yaca errors

Change-Id: I8b298d9125d84b85c36cbde9ada9dc48af4e9402

8 years agoCMAC example 50/70150/10
Krzysztof Jackiewicz [Wed, 18 May 2016 09:33:33 +0000 (11:33 +0200)]
CMAC example

Change-Id: I2b17f9375e3cfd14048bb639b84f3627a13bb73f

8 years agoCMAC implementation 49/70149/11
Krzysztof Jackiewicz [Wed, 18 May 2016 07:33:14 +0000 (09:33 +0200)]
CMAC implementation

Change-Id: Ie6c0f5a83db902cddcb029d9140c12351b17d4e6

8 years agoFix sign ctx cleanup 12/70912/1
Krzysztof Jackiewicz [Mon, 23 May 2016 08:00:17 +0000 (10:00 +0200)]
Fix sign ctx cleanup

Change-Id: I791a1be4e2d5a32bcc2f11c24ebd19d5ba32fcc8

8 years agoRemove unnecessary test example. 74/70574/1
Dariusz Michaluk [Thu, 19 May 2016 13:42:26 +0000 (15:42 +0200)]
Remove unnecessary test example.

Change-Id: Iba5d726cda3dfb74e91463a565938b43b5a1d53b

8 years agoRemove TODOs that no longer apply. 53/70553/4
Dariusz Michaluk [Thu, 19 May 2016 11:18:48 +0000 (13:18 +0200)]
Remove TODOs that no longer apply.

Change-Id: Ibb4990346808a1934a549703122c704d15935794

8 years agoJoin ECDSA and ECDH key to EC type. 52/70552/5
Dariusz Michaluk [Thu, 19 May 2016 11:03:35 +0000 (13:03 +0200)]
Join ECDSA and ECDH key to EC type.

Change-Id: I8817ce9a9e08283af3c25d5c3a133a4212b3dd60

8 years agoRemove RC2 effective key bits param. 35/70535/2
Dariusz Michaluk [Thu, 19 May 2016 10:00:18 +0000 (12:00 +0200)]
Remove RC2 effective key bits param.

Only default 128b is supported at the moment.

Change-Id: I5908983614bfda58ed7466980734a110b504eb48

8 years agoSimple API for signatures, verification & MACs 99/69999/8
Krzysztof Jackiewicz [Tue, 17 May 2016 14:26:42 +0000 (16:26 +0200)]
Simple API for signatures, verification & MACs

Change-Id: I3bb49a82f2778e1c81ad64c8d8268d9181cbc51b

8 years agoRemove CMAC from digest algorithms. 59/69459/9
Krzysztof Jackiewicz [Fri, 13 May 2016 07:37:10 +0000 (09:37 +0200)]
Remove CMAC from digest algorithms.

Change-Id: I3bb2ddd69b3f7d052cf2fbaea5feaf1b88be9795

8 years agoAdd separate API function stubs for HMAC/CMAC context initialization. 47/69447/9
Krzysztof Jackiewicz [Tue, 17 May 2016 09:57:12 +0000 (11:57 +0200)]
Add separate API function stubs for HMAC/CMAC context initialization.

MACs are symmetric equivalent for asymmetric signatures. For asymmetric
signatures the signing algorithm can be easily deduced from the key. This is
not the case for MAC's where plain symmetric key tells us nothing about the MAC
algorithm we want to use. Considered solutions:

1. Introducing new key types for MACs. Cons:
 - unclear how to handle plain symmetric keys,
 - introduces an artificial division in symmetric keys,
 - new enum values,
 - CMAC cipher has to be set via ctx params.

2. Deducing MAC algorithm from digest algorithm. Digest->HMAC, no digest->CMAC.
   Cons:
 - unclear which algorithm will be used,
 - adding new MAC algorithm may require a significant API change,
 - CMAC cipher has to be set via ctx params.

3. Leaving CMAC as a digest algorithm. Cons:
 - CMAC is not a digest algorithm. It's an equivalent of HMAC, RSA, DSA,...etc,
 - CMAC can't be used for calculating message digest alone,
 - CMAC can't be used as a digest algorithm for HMAC
 - CMAC cipher has to be set via ctx params.

4. Adding new API for CMAC and HMAC context creation. Cons:
 - 1 new functions per MAC algo for context initalization,
 - 1 function for signature comparison
 - low API flexibility

This is an initial commit for solution 4.

Change-Id: I745854fd7b7d87f2c114475b709566ec512d7bbd

8 years agoHide debug function 21/69521/8
Krzysztof Jackiewicz [Fri, 13 May 2016 13:15:36 +0000 (15:15 +0200)]
Hide debug function

Debug function is exported but the header is kept private.

Change-Id: I399bc52688c126a061dc29d66029bfe66d993c47

8 years agoRemove CTR bits param. 08/69908/4
Dariusz Michaluk [Tue, 17 May 2016 09:11:18 +0000 (11:11 +0200)]
Remove CTR bits param.

Only default 128b is supported by openssl at the moment.

Change-Id: Id5f70b196940172e567e7e357269babeae714a29

8 years agoRemove OCB block cipher mode. 06/69906/4
Dariusz Michaluk [Tue, 17 May 2016 08:59:43 +0000 (10:59 +0200)]
Remove OCB block cipher mode.

Change-Id: I676b80d4491ad70b6bbc0ef4ade80a3df8ca649b

8 years agoAdd CFB1 and CFB8 chaining modes. 68/69468/6
Dariusz Michaluk [Thu, 12 May 2016 15:24:26 +0000 (17:24 +0200)]
Add CFB1 and CFB8 chaining modes.

Change-Id: Ia464613fd38ec14f3d32905966eefe7ead430444

8 years agoUpdate AES description. 67/69467/6
Dariusz Michaluk [Thu, 12 May 2016 14:46:09 +0000 (16:46 +0200)]
Update AES description.

Change-Id: I4172389ae79b2c1028f3035d051f69db0a90804a

8 years agoRework symmetric encrypt/decrypt example. 84/68784/13
Dariusz Michaluk [Mon, 9 May 2016 14:25:03 +0000 (16:25 +0200)]
Rework symmetric encrypt/decrypt example.

Change-Id: If8427b9a1374169f28541bc2435ffb0ce4e20cd4

8 years agoAPI update: add YACA_ERROR_NONE enum value 09/70209/1
Lukasz Pawelczyk [Wed, 18 May 2016 15:13:07 +0000 (17:13 +0200)]
API update: add YACA_ERROR_NONE enum value

Change-Id: I88b5786a375a7c5c0bda47266ea332a09fb73ae5

8 years agoAPI changes around key getters. 90/70190/2
Lukasz Pawelczyk [Wed, 18 May 2016 13:41:11 +0000 (15:41 +0200)]
API changes around key getters.

yaca_key_get_bits() - return bits by size_t typed output param
yaca_key_get_type() - new getter to get the type of the key

Change-Id: I255f3bf3056a50602c1c2bd0a25c177ecf88ee07

8 years agoyaca_key import/export API change - passwords 78/70178/2
Lukasz Pawelczyk [Tue, 17 May 2016 16:48:31 +0000 (18:48 +0200)]
yaca_key import/export API change - passwords

Change-Id: Ifcc7c3eca1323cb4418190867bedf1a197b08f73

8 years agoFix API for yaca_get_iv_bits(). 39/70139/2
Dariusz Michaluk [Wed, 18 May 2016 08:28:59 +0000 (10:28 +0200)]
Fix API for yaca_get_iv_bits().

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: I90afedcffeb37ab315b4f4681323f3d64b7bc9ec

8 years agoFIX: SIZE_MAX undeclared. 19/70119/1
Dariusz Michaluk [Wed, 18 May 2016 07:30:36 +0000 (09:30 +0200)]
FIX: SIZE_MAX undeclared.

Change-Id: I282d74613fc8f1617575597ae3a26ee4eef385f0

8 years agoget/set_ctx_param for sign/verify (RSA padding only) 26/69726/3
Lukasz Pawelczyk [Fri, 13 May 2016 17:16:25 +0000 (19:16 +0200)]
get/set_ctx_param for sign/verify (RSA padding only)

Change-Id: I9ce5bde7a43bae619546c9cc5b3e54c4388ca755

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