platform/core/security/yaca.git
8 years agoUnify key and IV naming and length unit. 48/85248/4
Dariusz Michaluk [Wed, 24 Aug 2016 08:38:58 +0000 (10:38 +0200)]
Unify key and IV naming and length unit.

Change-Id: Iff2bab3a9b7a59c224cff6007a6edda9e30c2d71

8 years agoRemoved rsa padding TODO 16/84416/4
Krzysztof Jackiewicz [Thu, 18 Aug 2016 06:29:39 +0000 (08:29 +0200)]
Removed rsa padding TODO

RSA_NO_PADDING can be used when message length exactly matches the length of
the asymmetric key. As for now no digest can produce matching output so only
plain asymmetric operation without digest supports it. RSA_SSLV23_PADDING can
be used in asymmetric encryption only.

Change-Id: I9f4b84086bf150994f5eb5cc270203cf8834b683

8 years agoAdd GCM tag length verification 53/84453/2
Krzysztof Jackiewicz [Thu, 18 Aug 2016 14:27:52 +0000 (16:27 +0200)]
Add GCM tag length verification

Change-Id: If3b1c5e33d9a93a2120e8aeddfca024f05355321

8 years agoAdd missing ERROR_DUMP() for EVP_PKEY_size() 40/84240/1
Krzysztof Jackiewicz [Wed, 17 Aug 2016 12:29:47 +0000 (14:29 +0200)]
Add missing ERROR_DUMP() for EVP_PKEY_size()

Change-Id: Ie03a37e9ad91cc4b3876d177b1a45593598f645b

8 years agoHandle encryption API call order 06/83506/4
Krzysztof Jackiewicz [Wed, 10 Aug 2016 08:44:44 +0000 (10:44 +0200)]
Handle encryption API call order

Encryption, decryption, seal & open API functions have to be called in specific
order. This commit introduces state change matrices that are used to verify the
correct call order.

Change-Id: I99029d55bb26af9ec34d7297548c331fbbc41522

8 years agoRemove debug function from examples. 83/83883/4
Dariusz Michaluk [Fri, 12 Aug 2016 12:51:55 +0000 (14:51 +0200)]
Remove debug function from examples.

Remove outdated TODO.

Change-Id: I9cc610efec27fd84a95c1bade1b7b59892e781aa

8 years agoFix: Simple API doesn't support GCM and CCM. 74/83874/4
Dariusz Michaluk [Fri, 12 Aug 2016 10:14:40 +0000 (12:14 +0200)]
Fix: Simple API doesn't support GCM and CCM.

Change-Id: Ief86239a05aacb5671354f3bb11208afea562c80

8 years agoFix: seal/open sym_key_bit_len must be dividable by 8 69/83669/5
Dariusz Michaluk [Thu, 11 Aug 2016 14:31:01 +0000 (16:31 +0200)]
Fix: seal/open sym_key_bit_len must be dividable by 8

Fix documentation.

Change-Id: I8a4ad8bb9bcd91f17c8318cb5a0db744cbed1c34

8 years agoReorganize API order in header files. 37/83537/3
Dariusz Michaluk [Thu, 11 Aug 2016 12:21:41 +0000 (14:21 +0200)]
Reorganize API order in header files.

Change-Id: I07bc47cfc3b08e157fe9200e2815957aec14713a

8 years agoEC keys can be used for sign/verify now, update docs 76/83876/2
Lukasz Pawelczyk [Fri, 12 Aug 2016 12:07:31 +0000 (14:07 +0200)]
EC keys can be used for sign/verify now, update docs

Change-Id: Ic2893d9274bcaca4a2bcd681000b398b2d1a7360

8 years agoUse PKCS5 v2 in PKCS8 encrypted export 64/83564/2
Lukasz Pawelczyk [Thu, 11 Aug 2016 15:10:49 +0000 (17:10 +0200)]
Use PKCS5 v2 in PKCS8 encrypted export

Change-Id: Ia8f28768aca7b669e44b8b61c84625e5c811c033

8 years agoAdd missing 'library' in function description 22/83522/1
Krzysztof Jackiewicz [Thu, 11 Aug 2016 10:35:56 +0000 (12:35 +0200)]
Add missing 'library' in function description

Change-Id: Ic4d7da6a0201e4cc131737b56d5903abb9fb137a

8 years agoMerge 'acr2' into 'tizen' 05/83505/1
Krzysztof Jackiewicz [Thu, 11 Aug 2016 09:02:08 +0000 (11:02 +0200)]
Merge 'acr2' into 'tizen'

Change-Id: I054b8cecd5ad74381df6d184b2592e3b7e52b037

8 years agoStatic encrypt/digest algo list 07/83007/5 acr2
Lukasz Pawelczyk [Mon, 8 Aug 2016 13:01:15 +0000 (15:01 +0200)]
Static encrypt/digest algo list

Change-Id: I81e416d21ab22d119c6ec6ad9f79834ef151b2a2

8 years agoChange yaca_key_derive_kdf() API 31/83231/4
Dariusz Michaluk [Tue, 9 Aug 2016 12:57:50 +0000 (14:57 +0200)]
Change yaca_key_derive_kdf() API

Key material length should be in bytes.
Fix key exchange example.

Change-Id: I6b408a45d963d806f9abbb50056ed08da3a979fc

8 years agoFix: yaca_key_derive_dh() different parameters error 51/82951/3
Dariusz Michaluk [Mon, 8 Aug 2016 08:45:19 +0000 (10:45 +0200)]
Fix: yaca_key_derive_dh() different parameters error

Change-Id: Ia13fae08c15aa134c1fd84e3ae33e9a7f89d421c

8 years agoFix documentation: Tag length is not set in decrypt / open 75/83175/5
Mateusz Forc [Tue, 9 Aug 2016 09:27:36 +0000 (11:27 +0200)]
Fix documentation: Tag length is not set in decrypt / open

Change-Id: I3d9c65847b82011d9ec48d3324aec0944d79c80a

8 years agoSupport EC keys for sign/verify operations 40/83240/2
Lukasz Pawelczyk [Tue, 9 Aug 2016 15:36:24 +0000 (17:36 +0200)]
Support EC keys for sign/verify operations

Change-Id: I78bf6112e31de78aacb6902d3bd5c9e978cfcd32

8 years agoFix codestyle 85/82785/1
Dariusz Michaluk [Fri, 5 Aug 2016 15:35:13 +0000 (17:35 +0200)]
Fix codestyle

Change-Id: I1d34fa7eedc8c8de720245f0a70b0926df24c0a9

8 years agoMerge branch 'tizen' into acr2 62/82762/1
Dariusz Michaluk [Fri, 5 Aug 2016 13:01:19 +0000 (15:01 +0200)]
Merge branch 'tizen' into acr2

Conflicts:
api/yaca/yaca_types.h
src/encrypt.c

Change-Id: I37798f950774aebc56c8bc7f7e6479e5887b13d4

8 years agoFix documentation: RC4 doesn't use IV 12/82612/2 accepted/tizen/common/20160810.161523 accepted/tizen/ivi/20160809.233029 accepted/tizen/mobile/20160809.233056 accepted/tizen/tv/20160809.233004 accepted/tizen/wearable/20160809.233047 submit/tizen/20160809.225820
Dariusz Michaluk [Thu, 4 Aug 2016 11:43:48 +0000 (13:43 +0200)]
Fix documentation: RC4 doesn't use IV

Change-Id: I9ab587999821709d02e4d9928ffb64a1fffa7ec4

8 years agoFix for bug in OpenSSL's 3DES CFB1 implementation 33/82733/2
Krzysztof Jackiewicz [Fri, 5 Aug 2016 10:08:23 +0000 (12:08 +0200)]
Fix for bug in OpenSSL's 3DES CFB1 implementation

OpenSSL 3DES CFB1 implementation assumes that the size of input data is in
bits. It is indeed possible to use bits instead of bytes by setting an
EVP_CIPHER_CTX flag EVP_CIPH_FLAG_LENGTH_BITS. However, this flag is not being
checked in the implementation. The fix has been already applied to OpenSSL but
not yet released.

This commit causes EVP_CIPH_FLAG_LENGTH_BITS flag to be set always when 3DES
CFB1 is used. It also performes conversion between bit and byte units if
needed. It's a temporary fix and should also work with fixed OpenSSL. Anyway,
as soon as the fix in OpenSSL is released this commit should be reverted.

Change-Id: I97807f0afeecace86adb974e08e6f00fa66f22de

8 years agoAdd possibility to disabling encrypt/decrypt padding. 01/82201/5
Dariusz Michaluk [Mon, 1 Aug 2016 12:35:06 +0000 (14:35 +0200)]
Add possibility to disabling encrypt/decrypt padding.

Change-Id: I42bbd36013b6d39917f6946f35d533dc4f0dbd8e

8 years agoAdd yaca_key_derive_kdf(), define yaca_kdf_e enum 00/82100/6
Dariusz Michaluk [Thu, 28 Jul 2016 08:57:55 +0000 (10:57 +0200)]
Add yaca_key_derive_kdf(), define yaca_kdf_e enum

yaca_key_derive_kdf() implementation/example

Change-Id: Id24036599a71a14c239725a45b51301024365a0b

8 years agoRework key derivation example 13/80813/7
Dariusz Michaluk [Thu, 28 Jul 2016 08:53:10 +0000 (10:53 +0200)]
Rework key derivation example

Change-Id: I2beb8f49298b87dd9b0917d2d9fbb1b98619bb6e

8 years agoChange yaca_key_derive_dh() API 91/81791/7
Dariusz Michaluk [Wed, 20 Jul 2016 10:07:36 +0000 (12:07 +0200)]
Change yaca_key_derive_dh() API

Return buffer with shared secret instead of yaca_key_h.
Shared secret should not be used as a key.

Change-Id: I55de2b330deb06dd6b15902bf5f4ea9fe45e4359

8 years agoKey wrapping implementation/example 58/81658/6
Dariusz Michaluk [Fri, 15 Jul 2016 16:09:25 +0000 (18:09 +0200)]
Key wrapping implementation/example

Change-Id: Ifedb332212bffa4c0934f57d9d51b12537fe1d1f

8 years agoFIX: Correct IV length for Block Cipher Modes in doc 15/81915/2
Mateusz Forc [Fri, 29 Jul 2016 08:13:57 +0000 (10:13 +0200)]
FIX: Correct IV length for Block Cipher Modes in doc

Change-Id: Id05bb379c27ffc6d37e3911e2b21bd621aa137c6

8 years agoFIX: Add key type check for encrypt, move key_len check 24/81824/3
Mateusz Forc [Thu, 28 Jul 2016 12:52:11 +0000 (14:52 +0200)]
FIX: Add key type check for encrypt, move key_len check

Change-Id: Ic0bc79c5cce1acc9a39d38ebeecf6ebb5c788232

8 years agoFix and simplify output parameter usage. 57/81657/1
Dariusz Michaluk [Wed, 27 Jul 2016 12:13:33 +0000 (14:13 +0200)]
Fix and simplify output parameter usage.

Change-Id: I04d97b11fafe428f6c48c394539cb6e10f45f725

8 years agoMerge branch 'tizen' into acr2 54/81654/1
Lukasz Pawelczyk [Wed, 27 Jul 2016 11:59:46 +0000 (13:59 +0200)]
Merge branch 'tizen' into acr2

Change-Id: Ia478aa4239140e591b05cf58d261bee4a716d6dc

8 years agoClarify yaca_get_output_length usage 28/81628/3
Lukasz Pawelczyk [Wed, 27 Jul 2016 09:58:43 +0000 (11:58 +0200)]
Clarify yaca_get_output_length usage

Change-Id: If029e693155009b15b33b9c7ca1006867fea383b

8 years agoFIX: Add key length check for all algorithms 32/80232/14
Mateusz Forc [Fri, 15 Jul 2016 10:00:14 +0000 (12:00 +0200)]
FIX: Add key length check for all algorithms

Change-Id: I322438cf5a5bea84e3e258f0f1f6011dd0616428

8 years agoAdd static to all functions in key.c that can be static 98/80898/3
Lukasz Pawelczyk [Wed, 20 Jul 2016 16:02:18 +0000 (18:02 +0200)]
Add static to all functions in key.c that can be static

Change-Id: Iaa4b8515b1b70226e3ccb00e692c3752884535ee

8 years agoSupport getting key_bit_length for params 97/80897/3
Lukasz Pawelczyk [Wed, 20 Jul 2016 14:25:23 +0000 (16:25 +0200)]
Support getting key_bit_length for params

Change-Id: I7900e34ad990aeeb3e5b43d1c5a539db38bc302a

8 years agoExample for key generate 88/80888/3
Lukasz Pawelczyk [Wed, 20 Jul 2016 12:20:22 +0000 (14:20 +0200)]
Example for key generate

Change-Id: I9230fdc86b738e7ba6c5d7e9ff000bfae1fe830e

8 years agoyaca_extract_parameters() implementation 53/80553/4
Lukasz Pawelczyk [Mon, 18 Jul 2016 14:36:54 +0000 (16:36 +0200)]
yaca_extract_parameters() implementation

Also yaca_extract_public() rework to be on par with the above.

Change-Id: Iab7d9975809b421d09fe024740d7f29b30b8c82a

8 years agoImport/export for EC, DH and all parameter types 52/80552/4
Lukasz Pawelczyk [Mon, 18 Jul 2016 14:11:08 +0000 (16:11 +0200)]
Import/export for EC, DH and all parameter types

Change-Id: I4cd1c7c58a64ca78f7fe6c5ce3977c662e69b017

8 years agoKey generation re-work to handle parameters and 2 stage keygen 51/80551/4
Lukasz Pawelczyk [Fri, 15 Jul 2016 12:37:51 +0000 (14:37 +0200)]
Key generation re-work to handle parameters and 2 stage keygen

Change-Id: Ia427b82a5d6d7ded59144b0638a866ae13d2fa21

8 years agoAPI change/extension for key handling (parameters and DH RFC5114) 29/80129/4
Lukasz Pawelczyk [Thu, 14 Jul 2016 15:59:16 +0000 (17:59 +0200)]
API change/extension for key handling (parameters and DH RFC5114)

New functions:
- yaca_key_generate_from_parameters()
- yaca_key_extract_parameters()

New functionality:
- yaca_key_generate()
- yaca_key_import()
- yaca_key_export()

New defines/enums:
- YACA_KEY_TYPE_*_PARAMS
- YACA_KEY_LENGTH_DH_GENERATOR_*
- yaca_key_bit_length_dh_rfc_e;
- yaca_key_bit_length_ec_e;

Change-Id: I4fd4a0fa00c7f340a1dcf37fbe39b6f80d95484c

8 years agoACR: Remove unnecessary iv length values 06/80706/3
Krzysztof Jackiewicz [Tue, 19 Jul 2016 15:13:41 +0000 (17:13 +0200)]
ACR: Remove unnecessary iv length values

Change-Id: I23a889eef85a3617cb0d53f45b0cb3bb1983c6cf

8 years agoACR: Describe finalize-without-update cases 05/80705/3
Krzysztof Jackiewicz [Tue, 19 Jul 2016 15:11:47 +0000 (17:11 +0200)]
ACR: Describe finalize-without-update cases

Change-Id: I4164b05325472f32de426db21b6924b3acfb8583

8 years agoAdd custom tag length support in CCM 45/77945/27
Krzysztof Jackiewicz [Tue, 12 Jul 2016 11:05:17 +0000 (13:05 +0200)]
Add custom tag length support in CCM

Change-Id: Iff8432d47b371ded3e95927fd90c5800be038597

8 years agoCheck BCM in property handlers. Use EVP_Cipher* where possible. 40/77940/18
Krzysztof Jackiewicz [Mon, 11 Jul 2016 15:00:57 +0000 (17:00 +0200)]
Check BCM in property handlers. Use EVP_Cipher* where possible.

Change-Id: I8dfd918aa3ea4aa6f55fa973ff6cdba88955f60e

8 years agoChange module names and add line feeds in some API descriptions 33/80633/1
Dongsun Lee [Tue, 19 Jul 2016 07:45:40 +0000 (16:45 +0900)]
Change module names and add line feeds in some API descriptions

Change-Id: Ib0b6630226bc250c189dbe0498d17ffe2b2d86cc
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoClear the memory before freeing a symmetric key 63/79963/2
Krzysztof Jackiewicz [Wed, 13 Jul 2016 15:10:21 +0000 (17:10 +0200)]
Clear the memory before freeing a symmetric key

Change-Id: Iaffaf927709dfcfb831d7973d87d5a2ee5194bf0

8 years agoFix error: 'static’ is not at beginning of declaration 74/80474/1
Dariusz Michaluk [Mon, 18 Jul 2016 08:07:43 +0000 (10:07 +0200)]
Fix error: 'static’ is not at beginning of declaration

Change-Id: Ia49af914337e6fb2eef507ac8f906184092839a5

8 years agoAdded manifest file to label library to floor 51/80251/2
Dongsun Lee [Fri, 15 Jul 2016 11:11:48 +0000 (20:11 +0900)]
Added manifest file to label library to floor

- Currently, libyaca.so.0 is labelled as "System",
  so applications cannot access on it.

Change-Id: I9c3db2708388508572c5e3d7bd920f4128a9f53f
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoEC key generation, extract public and get_bit_length 19/80119/1
Lukasz Pawelczyk [Mon, 11 Jul 2016 10:29:12 +0000 (12:29 +0200)]
EC key generation, extract public and get_bit_length

Change-Id: I55f22032778eaf6eaeb5d598eec1fe94fe684765

8 years agoMerged several generate_evp_* functions into one 18/80118/1
Lukasz Pawelczyk [Fri, 8 Jul 2016 15:21:15 +0000 (17:21 +0200)]
Merged several generate_evp_* functions into one

Change-Id: I74321e421dc0c36d84f337ea4727b7467b9f4431

8 years agoAdd DH private key generate/public key extract. 14/80114/1
Dariusz Michaluk [Fri, 8 Jul 2016 15:21:21 +0000 (17:21 +0200)]
Add DH private key generate/public key extract.

Change-Id: Ie1797d335edce2b84b1910c677aa2d70d8a2500f

8 years agoAdd yaca_key_derive_dh() implementation. 13/80113/1
Dariusz Michaluk [Mon, 11 Jul 2016 10:30:52 +0000 (12:30 +0200)]
Add yaca_key_derive_dh() implementation.

Change-Id: I8b71e7f1a75a83aa48af5e5c46088e831400b571

8 years agoAdd yaca_key_derive_dh(), define proper key types and lengths 12/80112/1
Dariusz Michaluk [Fri, 8 Jul 2016 12:04:05 +0000 (14:04 +0200)]
Add yaca_key_derive_dh(), define proper key types and lengths

Restore YACA_KEY_TYPE_EC* defines.

Change-Id: Iff2413253134d945cf0de405f5b90e159e7664ae

8 years agoFIX: Unhandled OpenSSL error, when using invalid imported key
Mateusz Forc [Thu, 14 Jul 2016 10:26:40 +0000 (12:26 +0200)]
FIX: Unhandled OpenSSL error, when using invalid imported key

Change-Id: I5982553ae96bd9cde491bc9ccf79ff643303cb25

8 years agoFix: RC4 doesn't support block cipher modes
Dariusz Michaluk [Thu, 14 Jul 2016 08:48:11 +0000 (10:48 +0200)]
Fix: RC4 doesn't support block cipher modes

Change-Id: Iab022f1791712e0670a02ab2262e03fc0b79c365

8 years agoFix formatting in yaca_debug_translate_error 35/79935/1
Lukasz Pawelczyk [Wed, 13 Jul 2016 12:32:04 +0000 (14:32 +0200)]
Fix formatting in yaca_debug_translate_error

Change-Id: I125b51f447e74a79b0134192400bbc5af386419b

8 years agoConvert CRLF to LF in doc/ directory 66/79466/4
Lukasz Pawelczyk [Mon, 11 Jul 2016 11:27:10 +0000 (13:27 +0200)]
Convert CRLF to LF in doc/ directory

Change-Id: I299418907c312731706a7d30e73fbbe679202ecc

8 years agoVarious fixes in Doxygen comments 65/79465/3
Lukasz Pawelczyk [Mon, 11 Jul 2016 11:09:21 +0000 (13:09 +0200)]
Various fixes in Doxygen comments

- don't include source/example directories, they only cause confusion.
- don't add empty doxygen comment before a regular one. Move those
  comments to @file.
- minor changes in the doc/ directory.

Change-Id: Ie1e5e8b01cacc6a74c7201cd2652b0752091e455

8 years agoAdd nullptr check and return invalid param 46/79146/12
Mateusz Forc [Fri, 8 Jul 2016 10:38:21 +0000 (12:38 +0200)]
Add nullptr check and return invalid param

Add nullptr check for *iv_bit_len in yaca_encrypt_get_iv_bit_length().

Change return from YACA_ERROR_INTERNAL to YACA_INVALID_PARAMETER
in encrypt_get_algorithm for invalid param case

Change-Id: I804ca0af5d733aec2097566411e54b224391df5b

8 years agoerror fix in API description doxygen 68/77168/13
Dongsun Lee [Wed, 29 Jun 2016 02:48:06 +0000 (11:48 +0900)]
error fix in API description doxygen

- fix typos(mangement, createing, verifing)
- too short description(Context, key)
- the third person singular should be used in @brief
- remove unnecessary blanks and unexpected capital
- fix wrong description(If @a *memory is -> If @a memory is)

Change-Id: I9185ad0aca7ea8bac460fbc7e6bf406ac66870af
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
8 years agoadd @addtogroup 06/72606/12
sangsu [Wed, 1 Jun 2016 22:27:46 +0000 (07:27 +0900)]
add @addtogroup

Change-Id: I7bf0f7a94540d46edf5a7953d55d6a13f385946b
Signed-off-by: sangsu <sangsu.choi@samsung.com>
8 years agoACR:add doc document headers 05/72605/10
sangsu [Wed, 1 Jun 2016 22:21:24 +0000 (07:21 +0900)]
ACR:add doc document headers

Change-Id: Iafad752ca1980993c706434f34e136f44ffe3a91
Signed-off-by: sangsu <sangsu.choi@samsung.com>
8 years agoUpdate GCM/CCM examples 25/77925/12
Krzysztof Jackiewicz [Fri, 1 Jul 2016 13:44:57 +0000 (15:44 +0200)]
Update GCM/CCM examples

Use nonstandard tag. Fix formatting. Add missing cleanup.

Change-Id: Iec6f358ff3d05ae17ab072a72ef95401c777eb5a

8 years agoSpecify property type for tag lengths 14/77914/12
Krzysztof Jackiewicz [Tue, 5 Jul 2016 07:24:23 +0000 (09:24 +0200)]
Specify property type for tag lengths

Change-Id: I3fa756c74bd0797d070913020fd0f38588fe7403

8 years agoAllow NULL input/output only in CCM mode. 86/78986/2
Dariusz Michaluk [Thu, 7 Jul 2016 14:27:30 +0000 (16:27 +0200)]
Allow NULL input/output only in CCM mode.

Change-Id: I0758a1f2d8fa7accf8517aec6c93f79cf5f369d5

8 years agoMerge "Adjust naming convention to API." into tizen
Krzysztof Jackiewicz [Fri, 8 Jul 2016 13:45:00 +0000 (06:45 -0700)]
Merge "Adjust naming convention to API." into tizen

8 years agoAdjust naming convention to API. 01/76301/16
Krzysztof Jackiewicz [Tue, 5 Jul 2016 07:20:41 +0000 (09:20 +0200)]
Adjust naming convention to API.

Change-Id: I096c1df2007832e52bc797de88df3dd8c46e67aa

8 years agoChange ERROR_NONE to 0 where we don't check yaca function 63/78963/1
Lukasz Pawelczyk [Thu, 7 Jul 2016 12:33:25 +0000 (14:33 +0200)]
Change ERROR_NONE to 0 where we don't check yaca function

Change-Id: Id1e4a26365610e1e26d1f95b67834e2ad1d0e4df

8 years agoAdd a comment describing padding usage 87/78487/3
Lukasz Pawelczyk [Tue, 5 Jul 2016 16:49:22 +0000 (18:49 +0200)]
Add a comment describing padding usage

Change-Id: I915d829086b10a1718f5499f56dfc604a8e5e525

8 years agoMake yaca_cleanup return void 22/78922/1
Krzysztof Jackiewicz [Thu, 7 Jul 2016 10:36:38 +0000 (12:36 +0200)]
Make yaca_cleanup return void

Change-Id: I325703541385d064f9f3ba36fc9aeebb1e0e7bde

8 years agoAllow NULL value_len in yaca_context_get_property(). Fix documentation. 01/77701/4
Krzysztof Jackiewicz [Thu, 30 Jun 2016 13:10:17 +0000 (15:10 +0200)]
Allow NULL value_len in yaca_context_get_property(). Fix documentation.

In cases where a property is a single object of a known type theres no point in
passing value_len to yaca_context_get_property().

The documentation related to property getting/setting has been updated.

Change-Id: Idf908e87b87b5fe5239f651fe8546a7bd5a89850

8 years agoKey copying function 00/77700/4
Krzysztof Jackiewicz [Thu, 30 Jun 2016 10:25:09 +0000 (12:25 +0200)]
Key copying function

Change-Id: I372b7fd9c01f4eb104fc953c7995fa63dba0cba6

8 years agoUse size_t for PBKDF2 iterations param 14/78414/3
Lukasz Pawelczyk [Tue, 5 Jul 2016 11:08:10 +0000 (13:08 +0200)]
Use size_t for PBKDF2 iterations param

Also fix salt invalid param check.

Change-Id: Ib756041545a3aa606f9f44dc256a0ad70824ba3b

8 years agoMake it possible to import DER based X509 certificates 50/77950/4
Lukasz Pawelczyk [Fri, 1 Jul 2016 17:35:58 +0000 (19:35 +0200)]
Make it possible to import DER based X509 certificates

Change-Id: I86442c8faa6244d2d71ed1e0396464c580844166

8 years agoReworked password handling for import/export 48/77948/6
Lukasz Pawelczyk [Thu, 30 Jun 2016 14:32:22 +0000 (16:32 +0200)]
Reworked password handling for import/export

- Always use callback.
- Return INVALID_PASSWORD for combinations that do support password,
  it was not required for import but was given in params.
- Return INVALID_PARAM for combinations that do not support password
  while it was given in params. For both, import and export.
- PKCS8 always requires a password.
- Added few special cases to differentiate INV_PARAM and INV_PASSWORD.

Change-Id: I171e89125600151e33178eadc3df6b6004987f3c

8 years agoChanged return type to void 28/78228/3
Mateusz Forc [Mon, 4 Jul 2016 14:54:19 +0000 (16:54 +0200)]
Changed return type to void

Changed yaca_free, yaca_key_destroy, yaca_context_destroy ret type:
int->void and respectievely doxygen comments

Change-Id: Idfe8e1a17574c66990d81e95c3caed3799595b3f

8 years agoMissing const in write_file() 49/77949/1
Lukasz Pawelczyk [Fri, 1 Jul 2016 16:41:25 +0000 (18:41 +0200)]
Missing const in write_file()

Change-Id: I31ee04a3643fb85627e533807d6780a86f24447c

8 years agoHandle invalid params properly for simple sign/verify/cmac/hmac 60/77360/3
Lukasz Pawelczyk [Wed, 29 Jun 2016 11:43:09 +0000 (13:43 +0200)]
Handle invalid params properly for simple sign/verify/cmac/hmac

Change-Id: I86f0c4d3d1e7766b064fdba3822432569db1283c

8 years agoDrop reusability of digest context 24/77024/2
Lukasz Pawelczyk [Tue, 28 Jun 2016 09:33:57 +0000 (11:33 +0200)]
Drop reusability of digest context

Adding reusability to sign/encrypt contexts proved to be too difficult
and prone to errors for the feature to be worth altogether.

Change-Id: I5aaf1db54c482950cb00079e488433c35b5e1b1b

8 years agoEnforce NULL data for empty digest input 52/76352/1
Krzysztof Jackiewicz [Thu, 23 Jun 2016 12:15:36 +0000 (14:15 +0200)]
Enforce NULL data for empty digest input

Change-Id: I7fbd82b9aea2c9c2b712d72e09ac014d2dcf6a2f

8 years agoMake sure there are no OpenSSL errors logged for key_import() autodetect 20/75820/2
Lukasz Pawelczyk [Tue, 21 Jun 2016 13:57:21 +0000 (15:57 +0200)]
Make sure there are no OpenSSL errors logged for key_import() autodetect

Change-Id: I850db9d0316bbd5883797195c8358e6aef91297c

8 years agoUpdate digest API description 13/75813/2
Krzysztof Jackiewicz [Tue, 21 Jun 2016 13:14:13 +0000 (15:14 +0200)]
Update digest API description

-Add empty message digest remark
-Add context reuse remark

Change-Id: I255dc403f3f82d4359e56e632607b4d93e811b2f

8 years agoAllow empty input for yaca_simple_caclulate_digest 22/75822/2
Krzysztof Jackiewicz [Tue, 21 Jun 2016 14:18:41 +0000 (16:18 +0200)]
Allow empty input for yaca_simple_caclulate_digest

Change-Id: Ibaed61aec9e5370c4521139629a9ac108a6aa3ca

8 years agoACR: Modify remarks related to pointer/handle cleanup 28/75128/3
Krzysztof Jackiewicz [Fri, 17 Jun 2016 10:48:23 +0000 (12:48 +0200)]
ACR: Modify remarks related to pointer/handle cleanup

Change-Id: Id2e9136a8d896ff8036a9aa5096b617454b5c609

8 years agoMake digest context reusable after finish 46/75046/2
Krzysztof Jackiewicz [Thu, 16 Jun 2016 10:41:02 +0000 (12:41 +0200)]
Make digest context reusable after finish

Change-Id: Iecb125820264470a25fe42e0449c991d7ad3c5bc

8 years agoFor get_output_length in digest and sign require input_len == 0 54/75054/3
Lukasz Pawelczyk [Thu, 16 Jun 2016 10:55:25 +0000 (12:55 +0200)]
For get_output_length in digest and sign require input_len == 0

Change-Id: If195121b6c56fcd91c6d88d469d213b13b88dcc9

8 years agoDo not segfault on contexts without get_output_length (e.g. verify) 20/75020/2
Lukasz Pawelczyk [Thu, 16 Jun 2016 09:46:08 +0000 (11:46 +0200)]
Do not segfault on contexts without get_output_length (e.g. verify)

Change-Id: I0541f8f685b5d02370e67cabf3ea89f5794f0ee5

8 years agoMake sure output length argument is not NULL 21/74821/1
Krzysztof Jackiewicz [Wed, 15 Jun 2016 15:32:31 +0000 (17:32 +0200)]
Make sure output length argument is not NULL

Change-Id: I2ed584063314213efba934b282f603ce49f69899

8 years agoACR: Describe yaca_key_bit_length_e values 91/74691/1
Krzysztof Jackiewicz [Wed, 15 Jun 2016 08:18:12 +0000 (10:18 +0200)]
ACR: Describe yaca_key_bit_length_e values

Change-Id: Id51e3f99f9ece8279c338896d66020687ec4fb65

8 years agoMake sure library errors are not treated as fatal 19/74419/3
Krzysztof Jackiewicz [Mon, 13 Jun 2016 14:29:43 +0000 (16:29 +0200)]
Make sure library errors are not treated as fatal

Openssl defines a bit flag ERR_R_FATAL = 64 which may be used with common error
reasons (ERR_R_...). However, it's possible that library specific error reasons
(>99) have the bit set as well. ERR_FATAL_ERROR macro doesn't check it. Check
added.

Change-Id: I92b8b1011d0d22b84ec7e43f53bc60431cfe17fd

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