summaryrefslogtreecommitdiffstats
path: root/src/util/crypto/libcrypto/crypto_obfuscate.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-02-12 10:12:04 -0500
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:30:55 +0100
commita3c8390d19593b1e5277d95bfb4ab206d4785150 (patch)
tree2eb4e5432f4f79a75589c03b1513b656879ebf9c /src/util/crypto/libcrypto/crypto_obfuscate.c
parentcc026fd9ba386f2197e3217940d597dcad1a26fe (diff)
downloadsssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.gz
sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.xz
sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.zip
Make DEBUG macro invocations variadic
Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/util/crypto/libcrypto/crypto_obfuscate.c')
-rw-r--r--src/util/crypto/libcrypto/crypto_obfuscate.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/util/crypto/libcrypto/crypto_obfuscate.c b/src/util/crypto/libcrypto/crypto_obfuscate.c
index e303e8c80..50ea469c8 100644
--- a/src/util/crypto/libcrypto/crypto_obfuscate.c
+++ b/src/util/crypto/libcrypto/crypto_obfuscate.c
@@ -60,7 +60,7 @@ static struct crypto_mech_data cmdata[] = {
static struct crypto_mech_data *get_crypto_mech_data(enum obfmethod meth)
{
if (meth >= NUM_OBFMETHODS) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Unsupported cipher type\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "Unsupported cipher type\n");
return NULL;
}
return &cmdata[meth];
@@ -122,20 +122,20 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen,
}
if (!EVP_EncryptInit_ex(&ctx, mech_props->cipher(), 0, keybuf, ivbuf)) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Failure to initialize cipher contex\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "Failure to initialize cipher contex\n");
ret = EIO;
goto done;
}
/* sample data we'll encrypt and decrypt */
if (!EVP_EncryptUpdate(&ctx, cryptotext, &ctlen, (const unsigned char*)password, plen)) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot execute the encryption operation\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "Cannot execute the encryption operation\n");
ret = EIO;
goto done;
}
if(!EVP_EncryptFinal_ex(&ctx, cryptotext+ctlen, &digestlen)) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot finialize the encryption operation\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "Cannot finialize the encryption operation\n");
ret = EIO;
goto done;
}
@@ -160,9 +160,9 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen,
goto done;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("Writing method: %d\n", meth));
+ DEBUG(SSSDBG_TRACE_FUNC, "Writing method: %d\n", meth);
SAFEALIGN_SET_UINT16(&obfbuf[p], meth, &p);
- DEBUG(SSSDBG_TRACE_FUNC, ("Writing bufsize: %d\n", result_len));
+ DEBUG(SSSDBG_TRACE_FUNC, "Writing bufsize: %d\n", result_len);
SAFEALIGN_SET_UINT16(&obfbuf[p], result_len, &p);
safealign_memcpy(&obfbuf[p], keybuf, mech_props->keylen, &p);
safealign_memcpy(&obfbuf[p], ivbuf, mech_props->bsize, &p);
@@ -224,9 +224,9 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded,
/* unpack obfuscation buffer */
SAFEALIGN_COPY_UINT16_CHECK(&meth, obfbuf+p, obflen, &p);
- DEBUG(SSSDBG_TRACE_FUNC, ("Read method: %d\n", meth));
+ DEBUG(SSSDBG_TRACE_FUNC, "Read method: %d\n", meth);
SAFEALIGN_COPY_UINT16_CHECK(&ctsize, obfbuf+p, obflen, &p);
- DEBUG(SSSDBG_TRACE_FUNC, ("Read bufsize: %d\n", ctsize));
+ DEBUG(SSSDBG_TRACE_FUNC, "Read bufsize: %d\n", ctsize);
mech_props = get_crypto_mech_data(meth);
if (mech_props == NULL) {
@@ -239,7 +239,7 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded,
obfbuf + p + mech_props->keylen + mech_props->bsize + ctsize,
OBF_BUFFER_SENTINEL_SIZE);
if (memcmp(sentinel_check, OBF_BUFFER_SENTINEL, OBF_BUFFER_SENTINEL_SIZE) != 0) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Obfuscation buffer seems corrupt, aborting\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "Obfuscation buffer seems corrupt, aborting\n");
ret = EFAULT;
goto done;
}