Smart tabs and comments consistency 16/73116/1
authorLukasz Pawelczyk <l.pawelczyk@samsung.com>
Mon, 6 Jun 2016 14:14:10 +0000 (16:14 +0200)
committerLukasz Pawelczyk <l.pawelczyk@samsung.com>
Mon, 6 Jun 2016 14:17:17 +0000 (16:17 +0200)
Change-Id: I83da9ab1b9f40da3471fb3aec1805131d03c28ba

examples/digest.c
examples/lorem.h
examples/misc.h
src/crypto.c
src/encrypt.c
src/internal.h
src/simple.c

index 8a77fe4..404e5e9 100644 (file)
@@ -37,8 +37,8 @@ void digest_simple(void)
        size_t digest_len;
 
        ret = yaca_digest_calc(YACA_DIGEST_SHA256,
-                              lorem1024,
-                              1024, &digest, &digest_len);
+                              lorem1024,
+                              1024, &digest, &digest_len);
        if (ret != YACA_ERROR_NONE)
                return;
 
index 1b02d19..8d1ad45 100644 (file)
@@ -27,7 +27,7 @@
 #include <stddef.h>
 
 /**
-  Test strings, sizes include null-termination
* Test strings, sizes include null-termination
  */
 extern const char lorem8[];
 extern const char lorem16[];
index e59b382..b2e1cbd 100644 (file)
@@ -32,8 +32,8 @@
 // Dumps dump_size of buf.
 // As a "heading" displays fmt message (formatted like printf)
 void dump_hex(const char *buf,
-             size_t dump_size,
-             const char *fmt, ...);
+              size_t dump_size,
+              const char *fmt, ...);
 
 void debug_func(const char *buf);
 
index a907b6a..b2649d3 100644 (file)
@@ -124,11 +124,11 @@ API int yaca_init(void)
        }
 
        /*
-         TODO:
-               We should also decide on Openssl config.
-               Here's a good tutorial for initalization and cleanup: https://wiki.openssl.org/index.php/Library_Initialization
-               We should also initialize the entropy for random number generator: https://wiki.openssl.org/index.php/Random_Numbers#Initialization
-       */
+        * TODO:
+        * - We should also decide on Openssl config.
+        * - Here's a good tutorial for initalization and cleanup: https://wiki.openssl.org/index.php/Library_Initialization
+        * - We should also initialize the entropy for random number generator: https://wiki.openssl.org/index.php/Random_Numbers#Initialization
+        */
 
        return YACA_ERROR_NONE;
 }
@@ -216,7 +216,7 @@ API int yaca_rand_bytes(char *data, size_t data_len)
 }
 
 API int yaca_ctx_set_param(yaca_ctx_h ctx, yaca_ex_param_e param,
-                          const void *value, size_t value_len)
+                           const void *value, size_t value_len)
 {
        if (ctx == YACA_CTX_NULL || ctx->set_param == NULL)
                return YACA_ERROR_INVALID_ARGUMENT;
@@ -225,7 +225,7 @@ API int yaca_ctx_set_param(yaca_ctx_h ctx, yaca_ex_param_e param,
 }
 
 API int yaca_ctx_get_param(const yaca_ctx_h ctx, yaca_ex_param_e param,
-                          void **value, size_t *value_len)
+                           void **value, size_t *value_len)
 {
        if (ctx == YACA_CTX_NULL || ctx->get_param == NULL)
                return YACA_ERROR_INVALID_ARGUMENT;
index 6d7b34e..b4503ac 100644 (file)
@@ -249,9 +249,9 @@ static const char *bcm_to_str(yaca_block_cipher_mode_e bcm)
 }
 
 int encrypt_get_algorithm(yaca_enc_algo_e algo,
-                         yaca_block_cipher_mode_e bcm,
-                         size_t key_bits,
-                         const EVP_CIPHER **cipher)
+                          yaca_block_cipher_mode_e bcm,
+                          size_t key_bits,
+                          const EVP_CIPHER **cipher)
 {
        char cipher_name[32];
        const char *algo_name = encrypt_algo_to_str(algo);
@@ -306,11 +306,11 @@ int encrypt_get_algorithm(yaca_enc_algo_e algo,
 }
 
 static int encrypt_init(yaca_ctx_h *ctx,
-                       yaca_enc_algo_e algo,
-                       yaca_block_cipher_mode_e bcm,
-                       const yaca_key_h sym_key,
-                       const yaca_key_h iv,
-                       enum encrypt_op_type op_type)
+                        yaca_enc_algo_e algo,
+                        yaca_block_cipher_mode_e bcm,
+                        const yaca_key_h sym_key,
+                        const yaca_key_h iv,
+                        enum encrypt_op_type op_type)
 {
        const struct yaca_key_simple_s *lkey;
        const struct yaca_key_simple_s *liv;
@@ -466,11 +466,11 @@ exit:
 }
 
 static int encrypt_update(yaca_ctx_h ctx,
-                         const unsigned char *input,
-                         size_t input_len,
-                         unsigned char *output,
-                         size_t *output_len,
-                         enum encrypt_op_type op_type)
+                          const unsigned char *input,
+                          size_t input_len,
+                          unsigned char *output,
+                          size_t *output_len,
+                          enum encrypt_op_type op_type)
 {
        struct yaca_encrypt_ctx_s *c = get_encrypt_ctx(ctx);
        int ret;
@@ -484,11 +484,11 @@ static int encrypt_update(yaca_ctx_h ctx,
        switch (op_type) {
        case OP_ENCRYPT:
                ret = EVP_EncryptUpdate(c->cipher_ctx, output, &loutput_len,
-                                       input, input_len);
+                                       input, input_len);
                break;
        case OP_DECRYPT:
                ret = EVP_DecryptUpdate(c->cipher_ctx, output, &loutput_len,
-                                       input, input_len);
+                                       input, input_len);
                break;
        default:
                return YACA_ERROR_INVALID_ARGUMENT;
@@ -505,9 +505,9 @@ static int encrypt_update(yaca_ctx_h ctx,
 }
 
 static int encrypt_final(yaca_ctx_h ctx,
-                        unsigned char *output,
-                        size_t *output_len,
-                        enum encrypt_op_type op_type)
+                         unsigned char *output,
+                         size_t *output_len,
+                         enum encrypt_op_type op_type)
 {
        struct yaca_encrypt_ctx_s *c = get_encrypt_ctx(ctx);
        int ret;
@@ -563,55 +563,55 @@ API int yaca_get_iv_bits(yaca_enc_algo_e algo,
 }
 
 API int yaca_encrypt_init(yaca_ctx_h *ctx,
-                         yaca_enc_algo_e algo,
-                         yaca_block_cipher_mode_e bcm,
-                         const yaca_key_h sym_key,
-                         const yaca_key_h iv)
+                          yaca_enc_algo_e algo,
+                          yaca_block_cipher_mode_e bcm,
+                          const yaca_key_h sym_key,
+                          const yaca_key_h iv)
 {
        return encrypt_init(ctx, algo, bcm, sym_key, iv, OP_ENCRYPT);
 }
 
 API int yaca_encrypt_update(yaca_ctx_h ctx,
-                           const char *plain,
-                           size_t plain_len,
-                           char *cipher,
-                           size_t *cipher_len)
+                            const char *plain,
+                            size_t plain_len,
+                            char *cipher,
+                            size_t *cipher_len)
 {
        return encrypt_update(ctx, (const unsigned char*)plain, plain_len,
-                             (unsigned char*)cipher, cipher_len, OP_ENCRYPT);
+                             (unsigned char*)cipher, cipher_len, OP_ENCRYPT);
 }
 
 API int yaca_encrypt_final(yaca_ctx_h ctx,
-                          char *cipher,
-                          size_t *cipher_len)
+                           char *cipher,
+                           size_t *cipher_len)
 {
        return encrypt_final(ctx, (unsigned char*)cipher,
-                            cipher_len, OP_ENCRYPT);
+                            cipher_len, OP_ENCRYPT);
 }
 
 API int yaca_decrypt_init(yaca_ctx_h *ctx,
-                         yaca_enc_algo_e algo,
-                         yaca_block_cipher_mode_e bcm,
-                         const yaca_key_h sym_key,
-                         const yaca_key_h iv)
+                          yaca_enc_algo_e algo,
+                          yaca_block_cipher_mode_e bcm,
+                          const yaca_key_h sym_key,
+                          const yaca_key_h iv)
 {
        return encrypt_init(ctx, algo, bcm, sym_key, iv, OP_DECRYPT);
 }
 
 API int yaca_decrypt_update(yaca_ctx_h ctx,
-                           const char *cipher,
-                           size_t cipher_len,
-                           char *plain,
-                           size_t *plain_len)
+                            const char *cipher,
+                            size_t cipher_len,
+                            char *plain,
+                            size_t *plain_len)
 {
        return encrypt_update(ctx, (const unsigned char*)cipher, cipher_len,
-                             (unsigned char*)plain, plain_len, OP_DECRYPT);
+                             (unsigned char*)plain, plain_len, OP_DECRYPT);
 }
 
 API int yaca_decrypt_final(yaca_ctx_h ctx,
-                          char *plain,
-                          size_t *plain_len)
+                           char *plain,
+                           size_t *plain_len)
 {
        return encrypt_final(ctx, (unsigned char*)plain, plain_len,
-                            OP_DECRYPT);
+                            OP_DECRYPT);
 }
index c22c2ef..6a1af1d 100644 (file)
@@ -48,9 +48,9 @@ struct yaca_ctx_s {
        void (*ctx_destroy)(const yaca_ctx_h ctx);
        int (*get_output_length)(const yaca_ctx_h ctx, size_t input_len, size_t *output_len);
        int (*set_param)(yaca_ctx_h ctx, yaca_ex_param_e param,
-                        const void *value, size_t value_len);
+                        const void *value, size_t value_len);
        int (*get_param)(const yaca_ctx_h ctx, yaca_ex_param_e param,
-                        void **value, size_t *value_len);
+                        void **value, size_t *value_len);
 };
 
 
index 53a34fd..52be84d 100644 (file)
 #include "internal.h"
 
 API int yaca_digest_calc(yaca_digest_algo_e algo,
-                        const char *data,
-                        size_t data_len,
-                        char **digest,
-                        size_t *digest_len)
+                         const char *data,
+                         size_t data_len,
+                         char **digest,
+                         size_t *digest_len)
 {
        yaca_ctx_h ctx;
        int ret;
@@ -81,13 +81,13 @@ exit:
 }
 
 API int yaca_encrypt(yaca_enc_algo_e algo,
-                    yaca_block_cipher_mode_e bcm,
-                    const yaca_key_h sym_key,
-                    const yaca_key_h iv,
-                    const char *plain,
-                    size_t plain_len,
-                    char **cipher,
-                    size_t *cipher_len)
+                     yaca_block_cipher_mode_e bcm,
+                     const yaca_key_h sym_key,
+                     const yaca_key_h iv,
+                     const char *plain,
+                     size_t plain_len,
+                     char **cipher,
+                     size_t *cipher_len)
 {
        yaca_ctx_h ctx;
        int ret;
@@ -156,13 +156,13 @@ exit:
 }
 
 API int yaca_decrypt(yaca_enc_algo_e algo,
-                    yaca_block_cipher_mode_e bcm,
-                    const yaca_key_h sym_key,
-                    const yaca_key_h iv,
-                    const char *cipher,
-                    size_t cipher_len,
-                    char **plain,
-                    size_t *plain_len)
+                     yaca_block_cipher_mode_e bcm,
+                     const yaca_key_h sym_key,
+                     const yaca_key_h iv,
+                     const char *cipher,
+                     size_t cipher_len,
+                     char **plain,
+                     size_t *plain_len)
 {
        yaca_ctx_h ctx;
        int ret;