diff options
Diffstat (limited to 'src/util/crypto')
-rw-r--r-- | src/util/crypto/libcrypto/crypto_base64.c | 2 | ||||
-rw-r--r-- | src/util/crypto/libcrypto/crypto_obfuscate.c | 18 | ||||
-rw-r--r-- | src/util/crypto/nss/nss_obfuscate.c | 66 | ||||
-rw-r--r-- | src/util/crypto/nss/nss_util.c | 8 |
4 files changed, 47 insertions, 47 deletions
diff --git a/src/util/crypto/libcrypto/crypto_base64.c b/src/util/crypto/libcrypto/crypto_base64.c index 15734a00d..11a064827 100644 --- a/src/util/crypto/libcrypto/crypto_base64.c +++ b/src/util/crypto/libcrypto/crypto_base64.c @@ -122,7 +122,7 @@ unsigned char *sss_base64_decode(TALLOC_CTX *mem_ctx, *outsize = size; } else { - DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot get decoded data\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Cannot get decoded data\n"); } BIO_free_all(b64); BIO_free(bmem_out); 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; } diff --git a/src/util/crypto/nss/nss_obfuscate.c b/src/util/crypto/nss/nss_obfuscate.c index 842b58d1c..ebe87be4c 100644 --- a/src/util/crypto/nss/nss_obfuscate.c +++ b/src/util/crypto/nss/nss_obfuscate.c @@ -77,7 +77,7 @@ static struct crypto_mech_data cmdata[] = { static struct crypto_mech_data *get_crypto_mech_data(enum obfmethod meth) { if (meth >= NUM_OBFMETHODS) { - DEBUG(1, ("Unsupported cipher type\n")); + DEBUG(1, "Unsupported cipher type\n"); return NULL; } return &cmdata[meth]; @@ -97,24 +97,24 @@ static int generate_random_key(TALLOC_CTX *mem_ctx, randkey = PK11_KeyGen(slot, mech_props->cipher, NULL, mech_props->keylen, NULL); if (randkey == NULL) { - DEBUG(1, ("Failure to generate key (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to generate key (err %d)\n", + PR_GetError()); ret = EIO; goto done; } sret = PK11_ExtractKeyValue(randkey); if (sret != SECSuccess) { - DEBUG(1, ("Failure to extract key value (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to extract key value (err %d)\n", + PR_GetError()); ret = EIO; goto done; } randkeydata = PK11_GetKeyData(randkey); if (randkeydata == NULL) { - DEBUG(1, ("Failure to get key data (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to get key data (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -168,8 +168,8 @@ static int nss_ctx_init(TALLOC_CTX *mem_ctx, cctx->slot = PK11_GetBestSlot(mech_props->cipher, NULL); if (cctx->slot == NULL) { - DEBUG(1, ("Unable to find security device (err %d)\n", - PR_GetError())); + DEBUG(1, "Unable to find security device (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -194,8 +194,8 @@ static int nss_encrypt_decrypt_init(struct crypto_mech_data *mech_props, cctx->keyobj = PK11_ImportSymKey(cctx->slot, mech_props->cipher, PK11_OriginUnwrap, op, cctx->key, NULL); if (cctx->keyobj == NULL) { - DEBUG(1, ("Failure to import key into NSS (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to import key into NSS (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -203,8 +203,8 @@ static int nss_encrypt_decrypt_init(struct crypto_mech_data *mech_props, /* turn the raw IV into a initialization vector object */ cctx->sparam = PK11_ParamFromIV(mech_props->cipher, cctx->iv); if (cctx->sparam == NULL) { - DEBUG(1, ("Failure to set up PKCS11 param (err %d)\n", - PR_GetError())); + DEBUG(1, "Failure to set up PKCS11 param (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -213,8 +213,8 @@ static int nss_encrypt_decrypt_init(struct crypto_mech_data *mech_props, cctx->ectx = PK11_CreateContextBySymKey(mech_props->cipher, op, cctx->keyobj, cctx->sparam); if (cctx->ectx == NULL) { - DEBUG(1, ("Cannot create cipher context (err %d)\n", - PORT_GetError())); + DEBUG(1, "Cannot create cipher context (err %d)\n", + PORT_GetError()); ret = EIO; goto done; } @@ -265,26 +265,26 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, ret = nss_ctx_init(tmp_ctx, mech_props, &cctx); if (ret) { - DEBUG(1, ("Cannot initialize NSS context\n")); + DEBUG(1, "Cannot initialize NSS context\n"); goto done; } /* generate random encryption and IV key */ ret = generate_random_key(cctx, cctx->slot, mech_props, &cctx->key); if (ret != EOK) { - DEBUG(1, ("Could not generate encryption key\n")); + DEBUG(1, "Could not generate encryption key\n"); goto done; } ret = generate_random_key(cctx, cctx->slot, mech_props, &cctx->iv); if (ret != EOK) { - DEBUG(1, ("Could not generate initialization vector\n")); + DEBUG(1, "Could not generate initialization vector\n"); goto done; } ret = nss_encrypt_decrypt_init(mech_props, true, cctx); if (ret) { - DEBUG(1, ("Cannot initialize NSS context properties\n")); + DEBUG(1, "Cannot initialize NSS context properties\n"); goto done; } @@ -306,8 +306,8 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, sret = PK11_CipherOp(cctx->ectx, cryptotext, &ctlen, ct_maxsize, plaintext, plen); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the encryption operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the encryption operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -315,8 +315,8 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, sret = PK11_DigestFinal(cctx->ectx, cryptotext+ctlen, &digestlen, ct_maxsize-ctlen); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the digest operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the digest operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -340,9 +340,9 @@ int sss_password_encrypt(TALLOC_CTX *mem_ctx, const char *password, int plen, goto done; } - DEBUG(8, ("Writing method: %d\n", meth)); + DEBUG(8, "Writing method: %d\n", meth); SAFEALIGN_SET_UINT16(&obfbuf[p], meth, &p); - DEBUG(8, ("Writing bufsize: %d\n", result_len)); + DEBUG(8, "Writing bufsize: %d\n", result_len); SAFEALIGN_SET_UINT16(&obfbuf[p], result_len, &p); safealign_memcpy(&obfbuf[p], cctx->key->data, mech_props->keylen, &p); safealign_memcpy(&obfbuf[p], cctx->iv->data, mech_props->bsize, &p); @@ -409,9 +409,9 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, /* unpack obfuscation buffer */ SAFEALIGN_COPY_UINT16_CHECK(&meth, obfbuf+p, obflen, &p); - DEBUG(8, ("Read method: %d\n", meth)); + DEBUG(8, "Read method: %d\n", meth); SAFEALIGN_COPY_UINT16_CHECK(&ctsize, obfbuf+p, obflen, &p); - DEBUG(8, ("Read bufsize: %d\n", ctsize)); + DEBUG(8, "Read bufsize: %d\n", ctsize); mech_props = get_crypto_mech_data(meth); if (mech_props == NULL) { @@ -424,7 +424,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(0, ("Obfuscation buffer seems corrupt, aborting\n")); + DEBUG(0, "Obfuscation buffer seems corrupt, aborting\n"); ret = EFAULT; goto done; } @@ -453,7 +453,7 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, ret = nss_ctx_init(tmp_ctx, mech_props, &cctx); if (ret) { - DEBUG(1, ("Cannot initialize NSS context\n")); + DEBUG(1, "Cannot initialize NSS context\n"); goto done; } @@ -481,8 +481,8 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, sret = PK11_CipherOp(cctx->ectx, (unsigned char *) pwdbuf, &plainlen, ctsize, cryptotext, ctsize); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the encryption operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the encryption operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } @@ -490,8 +490,8 @@ int sss_password_decrypt(TALLOC_CTX *mem_ctx, char *b64encoded, sret = PK11_DigestFinal(cctx->ectx, (unsigned char *) pwdbuf+plainlen, &digestlen, ctsize - plainlen); if (sret != SECSuccess) { - DEBUG(1, ("Cannot execute the encryption operation (err %d)\n", - PR_GetError())); + DEBUG(1, "Cannot execute the encryption operation (err %d)\n", + PR_GetError()); ret = EIO; goto done; } diff --git a/src/util/crypto/nss/nss_util.c b/src/util/crypto/nss/nss_util.c index 9a272ca92..e93bf206d 100644 --- a/src/util/crypto/nss/nss_util.c +++ b/src/util/crypto/nss/nss_util.c @@ -46,8 +46,8 @@ int nspr_nss_init(void) sret = NSS_NoDB_Init(NULL); if (sret != SECSuccess) { - DEBUG(1, ("Error initializing connection to NSS [%d]\n", - PR_GetError())); + DEBUG(1, "Error initializing connection to NSS [%d]\n", + PR_GetError()); return EIO; } @@ -64,8 +64,8 @@ int nspr_nss_cleanup(void) sret = NSS_Shutdown(); if (sret != SECSuccess) { - DEBUG(1, ("Error shutting down connection to NSS [%d]\n", - PR_GetError())); + DEBUG(1, "Error shutting down connection to NSS [%d]\n", + PR_GetError()); return EIO; } |