platform/core/security/yaca.git
8 years agoUpdate error translation function 92/74292/3
Krzysztof Jackiewicz [Mon, 13 Jun 2016 13:16:34 +0000 (15:16 +0200)]
Update error translation function

Use macro for error translation. Don't return NULL. Update usage in
error_dump().

Change-Id: I4e6368732a89f5710c2354e704dd073512a6b2f1

8 years agoACR: Initialize and cleanup per thread. 08/73708/7
Krzysztof Jackiewicz [Thu, 9 Jun 2016 08:16:03 +0000 (10:16 +0200)]
ACR: Initialize and cleanup per thread.

yaca_initialize() and yaca_cleanup() should be called once per each thread that
uses yaca.

Change-Id: I098b7562712193aa5e1eb9475b106255c664de62

8 years agoACR: Update documentation. 54/74054/4
Dariusz Michaluk [Fri, 10 Jun 2016 12:58:52 +0000 (14:58 +0200)]
ACR: Update documentation.

Change-Id: I971dcdc742373385c11e9e908b561ac0caf8702f

8 years agoAdd more usage examples of seal/open. 35/73835/4
Dariusz Michaluk [Thu, 9 Jun 2016 15:07:37 +0000 (17:07 +0200)]
Add more usage examples of seal/open.

Change-Id: Icd89007c56fa6775c381874df4dd08fa1c5ba1e2

8 years agoMerge encrypt/decrypt and seal/open common code. 34/73834/5
Dariusz Michaluk [Thu, 9 Jun 2016 15:03:50 +0000 (17:03 +0200)]
Merge encrypt/decrypt and seal/open common code.

Change-Id: Ic9f1b7a527ce111f099459ee66eb4032d462c40e

8 years agoSilently export error translation function 02/74202/1
Krzysztof Jackiewicz [Mon, 13 Jun 2016 07:27:56 +0000 (09:27 +0200)]
Silently export error translation function

Change-Id: I4cc7e8b2219b8c30f8a2895c91e2a2e5338232d5

8 years agoACR: Cleanup TODO's and descriptions in API headers. 58/73558/4
Dariusz Michaluk [Wed, 8 Jun 2016 12:50:16 +0000 (14:50 +0200)]
ACR: Cleanup TODO's and descriptions in API headers.

Change-Id: I48fd3df7fa2a530dab80a7037e4a4d6087b7e949

8 years agoUse ERROR_HANDLE() to check for invalid passwords 84/73584/3
Lukasz Pawelczyk [Wed, 8 Jun 2016 16:03:32 +0000 (18:03 +0200)]
Use ERROR_HANDLE() to check for invalid passwords

Change-Id: I3d0449474e5b9240dedb7fe784a507541e705c2a

8 years agoCheck for known errors first 83/73583/2
Lukasz Pawelczyk [Wed, 8 Jun 2016 16:02:22 +0000 (18:02 +0200)]
Check for known errors first

Known errors can be marked as fatal at the same time, but we still want
to know a specific error code in such case. Check for them first. If
they are not specific, only then check for generic fatal codes.

Change-Id: I16ddcb201fdbb91daf1ef61590d949d7be847927

8 years agoACR: Seal/open sym_key_bits parameter should be size_t. 24/73524/3
Dariusz Michaluk [Wed, 8 Jun 2016 11:03:39 +0000 (13:03 +0200)]
ACR: Seal/open sym_key_bits parameter should be size_t.

Change-Id: I18de46fcd5991cc0e18f8e292c3d95e72c3a611c

8 years agoUpdate readme.txt after API changes. 12/73512/6
Dariusz Michaluk [Wed, 8 Jun 2016 09:58:03 +0000 (11:58 +0200)]
Update readme.txt after API changes.

Change-Id: Icc18e8370c02e8d9aba507924b4f39bf45dad7f7

8 years agoRemove no-unused-parameter compilation flag. Fix some errors. 02/73502/6
Dariusz Michaluk [Wed, 8 Jun 2016 09:18:18 +0000 (11:18 +0200)]
Remove no-unused-parameter compilation flag. Fix some errors.

Change-Id: Ic091bff6f4936608cfb6d9a32b20e93fc59849b8

8 years agoUse C89 style for comments. 99/73499/7
Dariusz Michaluk [Wed, 8 Jun 2016 09:05:59 +0000 (11:05 +0200)]
Use C89 style for comments.

Minor codestyle and comments cleanup.

Change-Id: I014b52d96ddc10ba9186ac0bd692b112ba10aefe

8 years agoACR: extend parameter names a little in specific cases 18/73518/2
Lukasz Pawelczyk [Wed, 8 Jun 2016 10:44:59 +0000 (12:44 +0200)]
ACR: extend parameter names a little in specific cases

Change-Id: I8cbad0e2dce8552fb72e901a5b139ec727083bba

8 years agoACR: Consistency for the get_output_length() function 40/73340/3
Lukasz Pawelczyk [Tue, 7 Jun 2016 15:39:53 +0000 (17:39 +0200)]
ACR: Consistency for the get_output_length() function

Removed the macros, get_output_length function renamed to include
"context". Documentation updated.

Change-Id: I6f8857b25e43dfb80a258bdb857097a79e443889

8 years agoACR: fixes for function and enumeration names/values 18/73118/6
Lukasz Pawelczyk [Mon, 6 Jun 2016 14:11:16 +0000 (16:11 +0200)]
ACR: fixes for function and enumeration names/values

This commit extends the names of functions, enumeration and enumeration
values to be longer, more descriptive and not use abbreviation.

Function parameters will be covered in a separate commit.

Change-Id: I4d08291fb667a5740320a23dbe0c24f656405a2c

8 years agoFix comment placement 04/73304/1
Lukasz Pawelczyk [Tue, 7 Jun 2016 11:15:38 +0000 (13:15 +0200)]
Fix comment placement

Change-Id: I559f16f3e845e3cad4ca8f12c4bbcb952f90d071

8 years agoSmart tabs and comments consistency 16/73116/1
Lukasz Pawelczyk [Mon, 6 Jun 2016 14:14:10 +0000 (16:14 +0200)]
Smart tabs and comments consistency

Change-Id: I83da9ab1b9f40da3471fb3aec1805131d03c28ba

8 years agoMake sure yaca_*alloc() is not called with 0 size 06/73006/3
Krzysztof Jackiewicz [Fri, 3 Jun 2016 12:45:49 +0000 (14:45 +0200)]
Make sure yaca_*alloc() is not called with 0 size

- Add asserts
- Don't install static locks if CRYPTO_num_locks == 0
- Treat 0 output length as YACA_ERROR_INTERNAL:
  - If client provided a 0-length key we should detect it in yaca_sign_*init()
    and prevent him from using it. If it has 0 length in
    get_sign_output_length() it's an internal error.

Change-Id: I5d2d4063c568f76a25ee616b40c99abd5cc4dfa9

8 years agoACR: Each paragraph needs a separate @remarks command 92/72992/3
Krzysztof Jackiewicz [Fri, 3 Jun 2016 11:24:32 +0000 (13:24 +0200)]
ACR: Each paragraph needs a separate @remarks command

Change-Id: I05ee6ceef9db355a8e6fc01f1b9c801518a7f343

8 years agoSimplify memory allocation in read_file 91/72991/2
Krzysztof Jackiewicz [Fri, 3 Jun 2016 11:14:56 +0000 (13:14 +0200)]
Simplify memory allocation in read_file

Change-Id: Ia3cc7dd2d04fb4279ec3cc60c5858f84ace20daa

8 years agoACR: Return error codes from all API functions 89/72989/4
Krzysztof Jackiewicz [Fri, 3 Jun 2016 11:06:47 +0000 (13:06 +0200)]
ACR: Return error codes from all API functions

According to HQ Tizen API development Team all API functions must return error
codes. Code adjusted.

Change-Id: Ie6e80480cad0cf32094e78898575fa6c4af91a5e

8 years agoACR: Apply changes from API review part 1 70/72770/5
Krzysztof Jackiewicz [Thu, 2 Jun 2016 07:29:49 +0000 (09:29 +0200)]
ACR: Apply changes from API review part 1

- "bogus" -> "incorrect"
- Add missing @see entries for mentioned functions
- "recomend" -> "recommend"
- Remove EC key type from documentation

Change-Id: I311ccb00a099c5c156c97b5821782a57c14e2c98

8 years agoACR: Apply changes from API review part 2 03/72803/5
Dariusz Michaluk [Thu, 2 Jun 2016 11:26:40 +0000 (13:26 +0200)]
ACR: Apply changes from API review part 2

Change-Id: I13a1a8e49eef233bf748ea0c871e872f67708ea5

8 years agoACR: Fix notation for pointer variables. 73/72773/3
Dariusz Michaluk [Thu, 2 Jun 2016 10:26:03 +0000 (12:26 +0200)]
ACR: Fix notation for pointer variables.

Change-Id: I6060a5a0d632ad3d647059cd08efce65fed57f30

8 years agoFix seal/open, ECB mode does not use an IV. 80/72580/7
Dariusz Michaluk [Wed, 1 Jun 2016 14:19:43 +0000 (16:19 +0200)]
Fix seal/open, ECB mode does not use an IV.

Change-Id: I953bf874f2bb760d129e90dac3246c9f24e0c5ec

8 years agoError handling refactoring. 53/72553/8
Dariusz Michaluk [Wed, 1 Jun 2016 10:00:24 +0000 (12:00 +0200)]
Error handling refactoring.

Multiple goto labels replaced with single 'free' label.

Change-Id: I4936f2ef178c9b6fbf58a38beda7d21a700232a9

8 years agoFix key generation error handling 48/72348/4
Krzysztof Jackiewicz [Tue, 31 May 2016 13:18:06 +0000 (15:18 +0200)]
Fix key generation error handling

- Check allowed RSA/DSA key lengths
- Translate known openssl errors
- Fix SIZE_MAX checks
- Update doxygen

Change-Id: If230518bb4a4d490cffde61fb2930ee7200fa083

8 years agoAdd common error handling function 87/72587/3
Krzysztof Jackiewicz [Wed, 1 Jun 2016 15:02:22 +0000 (17:02 +0200)]
Add common error handling function

The function tries to convert openssl errors to yaca ones. If it succeeds it
removes the remaining errors from the queue. Otherwise it dumps them. It should
be called after each openssl failure.

Change-Id: I88c557e8d42f9ea70d5a8b25f2bd3181534e4ff8

8 years agoSimplify yaca_key_gen() a little 85/72585/3
Lukasz Pawelczyk [Wed, 1 Jun 2016 15:04:13 +0000 (17:04 +0200)]
Simplify yaca_key_gen() a little

Change-Id: Ie755fb94ca9519681904df81049e984b0abe0827

8 years agoDon't clear errors after error strings initialization 86/72586/1
Krzysztof Jackiewicz [Wed, 1 Jun 2016 15:01:08 +0000 (17:01 +0200)]
Don't clear errors after error strings initialization

Change-Id: Idc58cbd7e83916ba5298d366a8be1bffbe2761c2

8 years agoACR: Remove unimplemented features 65/72565/1
Krzysztof Jackiewicz [Wed, 1 Jun 2016 12:27:51 +0000 (14:27 +0200)]
ACR: Remove unimplemented features

Remove elliptic curves, ECDH and DH.

Change-Id: Ib61efb39e07cfe81a27f265a76103b7347397e8c

8 years agoFix unix modes (dirs 755, files 644) 39/72539/2
Lukasz Pawelczyk [Wed, 1 Jun 2016 10:41:18 +0000 (12:41 +0200)]
Fix unix modes (dirs 755, files 644)

Change-Id: I12bd0ac68a613ef4641ca3d7b535eedd3a596c98

8 years agoMake sure we have enough entropy on start, bail if we don't 85/72385/4
Lukasz Pawelczyk [Tue, 31 May 2016 16:31:54 +0000 (18:31 +0200)]
Make sure we have enough entropy on start, bail if we don't

Change-Id: I4095c95aac3644db62bec902320cd10f59322e3f

8 years agoMore readable error codes in dump (strings or hex) 84/72384/2
Lukasz Pawelczyk [Tue, 31 May 2016 15:22:09 +0000 (17:22 +0200)]
More readable error codes in dump (strings or hex)

Change-Id: I89be3a82842f5586ee552a5fa9b2d7be9d49e38c

8 years agoPassword example extended to include PKCS8 58/72358/2
Lukasz Pawelczyk [Tue, 31 May 2016 13:06:36 +0000 (15:06 +0200)]
Password example extended to include PKCS8

Change-Id: I507ae76e16bfcc2a276e8d681e5a511da623daa4

8 years agoyaca_key_import() support for PKCS8 57/72357/2
Lukasz Pawelczyk [Tue, 31 May 2016 12:43:26 +0000 (14:43 +0200)]
yaca_key_import() support for PKCS8

Change-Id: I96c07efd6a86f61522871179d29e38abf6fe60ef

8 years agoyaca_key_export() support for PKCS8 56/72356/2
Lukasz Pawelczyk [Tue, 31 May 2016 12:25:47 +0000 (14:25 +0200)]
yaca_key_export() support for PKCS8

Change-Id: I8933caec09ccdcbaea19a197d04cbf136cfd6e4e

8 years agoACR: Fix code formatting. 94/72294/3
Dariusz Michaluk [Tue, 31 May 2016 09:45:06 +0000 (11:45 +0200)]
ACR: Fix code formatting.

Change-Id: I139f83922a3a1407b2188fb7025637834aa414a8

8 years agoACR: Minor fixes in documentation 97/72297/1
Krzysztof Jackiewicz [Tue, 31 May 2016 09:58:40 +0000 (11:58 +0200)]
ACR: Minor fixes in documentation

Change-Id: I5359ecb036ef7174e2232954f8aca95ec4d2f335

8 years agoACR: Succesful -> Successful 85/72285/2
Krzysztof Jackiewicz [Tue, 31 May 2016 09:31:52 +0000 (11:31 +0200)]
ACR: Succesful -> Successful

Change-Id: I6859b868fd2a62d12215e7071c3e8c3bae5897b4

8 years agoACR: yaca_types.h doxygen fixes 08/72108/1
Dariusz Michaluk [Mon, 30 May 2016 14:36:44 +0000 (16:36 +0200)]
ACR: yaca_types.h doxygen fixes

Change-Id: If9e7de66bfe29861a90bd68369b5f671534a64ec

8 years agoACR: yaca_simple.h doxygen fixes 01/72101/2
Lukasz Pawelczyk [Mon, 30 May 2016 12:43:16 +0000 (14:43 +0200)]
ACR: yaca_simple.h doxygen fixes

Change-Id: I0fd4c1d626275ae690b0a25e022687583f838445

8 years agoACR: yaca_sign.h doxygen fixes 00/72100/2
Lukasz Pawelczyk [Mon, 30 May 2016 12:39:33 +0000 (14:39 +0200)]
ACR: yaca_sign.h doxygen fixes

Change-Id: I1570a1201b59ced862e3ce580f7563420eca5eab

8 years agoACR: change the ordering of key related functions (out last) 32/71932/3
Lukasz Pawelczyk [Fri, 27 May 2016 15:15:53 +0000 (17:15 +0200)]
ACR: change the ordering of key related functions (out last)

Change-Id: I4a2df099c1dc594dd0fc08aa7146110ba723c861

8 years agoACR: yaca_key.h doxygen fixes 31/71931/3
Lukasz Pawelczyk [Fri, 27 May 2016 14:08:33 +0000 (16:08 +0200)]
ACR: yaca_key.h doxygen fixes

@return statements cleaned up
Added @retval statements
Removed dot at the end of some statements

Change-Id: If0495e03f6bf0fc24341f217c94dbbf68550a72e

8 years agoACR: remove key derive dh/kea 30/71930/2
Lukasz Pawelczyk [Fri, 27 May 2016 12:07:02 +0000 (14:07 +0200)]
ACR: remove key derive dh/kea

Change-Id: I0008dd2179597bb54e4ca3e8da8a0bb862d4fce9

8 years agoACR: yaca_error.h doxygen fixes 03/72103/2
Dariusz Michaluk [Mon, 30 May 2016 13:16:38 +0000 (15:16 +0200)]
ACR: yaca_error.h doxygen fixes

Change-Id: I2555c31e6890d2d184c2bc1e454f18271f26db6b

8 years agoACR: yaca_crypto.h doxygen fixes 99/72099/3
Dariusz Michaluk [Mon, 30 May 2016 12:32:44 +0000 (14:32 +0200)]
ACR: yaca_crypto.h doxygen fixes

Change-Id: I421e3095f70efe3264461fbd364d813eb999d93e

8 years agoACR: yaca_digest.h doxygen fixes 78/72078/2
Dariusz Michaluk [Mon, 30 May 2016 11:27:44 +0000 (13:27 +0200)]
ACR: yaca_digest.h doxygen fixes

Change-Id: Ia6f8d263b7c31b22fe7d97c4bedd3754b3ae00dc

8 years agoACR: yaca_encrypt.h doxygen fixes 62/72062/2
Dariusz Michaluk [Mon, 30 May 2016 10:53:53 +0000 (12:53 +0200)]
ACR: yaca_encrypt.h doxygen fixes

Change-Id: Id2603e9f858894eafc19e850909685d9801a5081

8 years agoACR: yaca_seal.h doxygen fixes 52/72052/2
Dariusz Michaluk [Mon, 30 May 2016 10:16:17 +0000 (12:16 +0200)]
ACR: yaca_seal.h doxygen fixes

Change-Id: Ia0956240a40fb5a4ac39a1cdee1aeaa93699c578

8 years agoDo not enumerate all related modules with only one @see tag. 11/71911/3
Dariusz Michaluk [Fri, 27 May 2016 12:34:51 +0000 (14:34 +0200)]
Do not enumerate all related modules with only one @see tag.

Change-Id: I5b7e3856794f099e7f2f65dde3e67bc35a81625a

8 years agoModify error codes according to ACR 22/71922/4
Krzysztof Jackiewicz [Fri, 27 May 2016 13:28:34 +0000 (15:28 +0200)]
Modify error codes according to ACR

Change-Id: I9e41174c1a38811dd3d5d85b66513bd271cfdd0b

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