Whitespace fixes only according our coding-style. --- libnm-core/crypto_openssl.c | 94 ++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 47 deletions(-)
diff --git a/libnm-core/crypto_openssl.c b/libnm-core/crypto_openssl.c index 2952abb..bbd0c1b 100644 --- a/libnm-core/crypto_openssl.c +++ b/libnm-core/crypto_openssl.c @@ -41,9 +41,9 @@ crypto_init (GError **error) if (initialized) return TRUE; - CRYPTO_malloc_init(); - OpenSSL_add_all_algorithms(); - ENGINE_load_builtin_engines(); + CRYPTO_malloc_init (); + OpenSSL_add_all_algorithms (); + ENGINE_load_builtin_engines (); initialized = TRUE; return TRUE; @@ -54,11 +54,11 @@ get_cipher (const char *cipher, GError **error) { if (strcmp (cipher, CIPHER_DES_EDE3_CBC) == 0) - return EVP_des_ede3_cbc(); + return EVP_des_ede3_cbc (); else if (strcmp (cipher, CIPHER_DES_CBC) == 0) - return EVP_des_cbc(); + return EVP_des_cbc (); else if (strcmp (cipher, CIPHER_AES_CBC) == 0) - return EVP_aes_128_cbc(); + return EVP_aes_128_cbc (); else { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_UNKNOWN_CIPHER, @@ -87,20 +87,20 @@ crypto_decrypt (const char *cipher, gsize real_iv_len = 0; int initial_len = 0, final_len = 0; - if (!(evp_cipher = get_cipher(cipher, error))) + if (!(evp_cipher = get_cipher (cipher, error))) return NULL; - real_iv_len = EVP_CIPHER_iv_length(evp_cipher); + real_iv_len = EVP_CIPHER_iv_length (evp_cipher); if (iv_len < real_iv_len) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_INVALID_DATA, - _("Invalid IV length (must be at least %zd)."), + _ ("Invalid IV length (must be at least %zd)."), real_iv_len); return NULL; } - EVP_CIPHER_CTX_init(&ctx); - if (!EVP_DecryptInit_ex(&ctx, evp_cipher, NULL, (const unsigned char*)key, (const unsigned char*)iv)) { + EVP_CIPHER_CTX_init (&ctx); + if (!EVP_DecryptInit_ex (&ctx, evp_cipher, NULL, (const unsigned char*)key, (const unsigned char*)iv)) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_DECRYPTION_FAILED, _("Failed to initialize the decryption cipher context.")); @@ -109,7 +109,7 @@ crypto_decrypt (const char *cipher, output = g_malloc0 (data_len); - if (!EVP_DecryptUpdate(&ctx, (unsigned char*)output, &initial_len, data, data_len)) { + if (!EVP_DecryptUpdate (&ctx, (unsigned char*)output, &initial_len, data, data_len)) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_DECRYPTION_FAILED, _("Failed to decrypt the private key.")); @@ -117,7 +117,7 @@ crypto_decrypt (const char *cipher, } /* Finalise decryption, and check the padding */ - if (!EVP_DecryptFinal_ex(&ctx, (unsigned char*)output + initial_len, &final_len)) { + if (!EVP_DecryptFinal_ex (&ctx, (unsigned char*)output + initial_len, &final_len)) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_DECRYPTION_FAILED, _("Failed to finalize decryption of the private key.")); @@ -134,7 +134,7 @@ out: g_free (output); output = NULL; } - EVP_CIPHER_CTX_cleanup(&ctx); + EVP_CIPHER_CTX_cleanup (&ctx); return output; } @@ -156,7 +156,7 @@ crypto_encrypt (const char *cipher, gsize pad_len, output_len; int initial_len = 0, final_len = 0; - if (!(evp_cipher = get_cipher(cipher, error))) + if (!(evp_cipher = get_cipher (cipher, error))) return NULL; /* If data_len % ivlen == 0, then we add another complete block @@ -164,17 +164,17 @@ crypto_encrypt (const char *cipher, */ pad_len = iv_len - (data_len % iv_len); output_len = data_len + pad_len; - output = g_malloc0(output_len); + output = g_malloc0 (output_len); - EVP_CIPHER_CTX_init(&ctx); - if (!EVP_EncryptInit_ex(&ctx, evp_cipher, NULL, (const unsigned char*)key, (const unsigned char*)iv)) { + EVP_CIPHER_CTX_init (&ctx); + if (!EVP_EncryptInit_ex (&ctx, evp_cipher, NULL, (const unsigned char*)key, (const unsigned char*)iv)) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_DECRYPTION_FAILED, _("Failed to initialize the encryption cipher context.")); goto out; } - if (!EVP_EncryptUpdate(&ctx, (unsigned char*)output, &initial_len, data, data_len)) { + if (!EVP_EncryptUpdate (&ctx, (unsigned char*)output, &initial_len, data, data_len)) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_DECRYPTION_FAILED, _("Failed to encrypt the private key.")); @@ -182,7 +182,7 @@ crypto_encrypt (const char *cipher, } /* Finalise encryption, and add the padding */ - if (!EVP_EncryptFinal_ex(&ctx, (unsigned char*)output + initial_len, &final_len)) { + if (!EVP_EncryptFinal_ex (&ctx, (unsigned char*)output + initial_len, &final_len)) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_DECRYPTION_FAILED, _("Failed to finalize encryption of the private key.")); @@ -199,7 +199,7 @@ out: g_free (output); output = NULL; } - EVP_CIPHER_CTX_cleanup(&ctx); + EVP_CIPHER_CTX_cleanup (&ctx); return output; } @@ -212,18 +212,18 @@ crypto_verify_cert (const unsigned char *data, X509 *x = NULL; /* Try PEM */ - in = BIO_new_mem_buf((void*)data, len); - x = PEM_read_bio_X509_AUX(in, NULL, NULL, NULL); - BIO_free(in); - X509_free(x); + in = BIO_new_mem_buf ((void*) data, len); + x = PEM_read_bio_X509_AUX (in, NULL, NULL, NULL); + BIO_free (in); + X509_free (x); if (x) return NM_CRYPTO_FILE_FORMAT_X509; /* Try DER */ - in = BIO_new_mem_buf((void*)data, len); - x = d2i_X509_bio(in, NULL); - BIO_free(in); - X509_free(x); + in = BIO_new_mem_buf ((void*)data, len); + x = d2i_X509_bio (in, NULL); + BIO_free (in); + X509_free (x); if (x) return NM_CRYPTO_FILE_FORMAT_X509; @@ -245,9 +245,9 @@ crypto_verify_pkcs12 (const guint8 *data, g_return_val_if_fail (data != NULL, FALSE); - in = BIO_new_mem_buf((void*)data, data_len); - p12 = d2i_PKCS12_bio(in, NULL); - BIO_free(in); + in = BIO_new_mem_buf ((void*)data, data_len); + p12 = d2i_PKCS12_bio (in, NULL); + BIO_free (in); if (!p12) { /* Currently only DER format PKCS12 files are supported. */ @@ -258,7 +258,7 @@ crypto_verify_pkcs12 (const guint8 *data, } if (password) { - if (!(success = PKCS12_verify_mac(p12, password, -1))) + if (!(success = PKCS12_verify_mac (p12, password, -1))) g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERROR_DECRYPTION_FAILED, _("Couldn't verify PKCS#12 file.")); @@ -267,7 +267,7 @@ crypto_verify_pkcs12 (const guint8 *data, out: if (p12) - PKCS12_free(p12); + PKCS12_free (p12); return success; } @@ -285,30 +285,30 @@ crypto_verify_pkcs8 (const guint8 *data, g_return_val_if_fail (data != NULL, FALSE); if (is_encrypted) { - in = BIO_new_mem_buf((void*)data, data_len); - p8 = d2i_PKCS8_bio(in, NULL); - BIO_free(in); + in = BIO_new_mem_buf ((void*)data, data_len); + p8 = d2i_PKCS8_bio (in, NULL); + BIO_free (in); if (p8) { - X509_SIG_free(p8); + X509_SIG_free (p8); return TRUE; } else { g_set_error (error, NM_CRYPTO_ERROR, - NM_CRYPTO_ERROR_INVALID_DATA, - _("Couldn't decode PKCS#8 file")); + NM_CRYPTO_ERROR_INVALID_DATA, + _("Couldn't decode PKCS#8 file")); } } else { - in = BIO_new_mem_buf((void*)data, data_len); - p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL); - BIO_free(in); + in = BIO_new_mem_buf ((void*)data, data_len); + p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio (in, NULL); + BIO_free (in); if (p8inf) { - PKCS8_PRIV_KEY_INFO_free(p8inf); + PKCS8_PRIV_KEY_INFO_free (p8inf); return p8inf->broken == 0; } else { g_set_error (error, NM_CRYPTO_ERROR, - NM_CRYPTO_ERROR_INVALID_DATA, - _("Couldn't decode PKCS#8 file")); + NM_CRYPTO_ERROR_INVALID_DATA, + _("Couldn't decode PKCS#8 file")); } } @@ -318,7 +318,7 @@ crypto_verify_pkcs8 (const guint8 *data, gboolean crypto_randomize (void *buffer, gsize buffer_len, GError **error) { - RAND_bytes(buffer, buffer_len); + RAND_bytes (buffer, buffer_len); buffer_len = (buffer_len > 16) ? 16 : buffer_len; return TRUE; } -- 2.5.0 _______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list