| Index: net/http/des.cc
|
| diff --git a/net/http/des.cc b/net/http/des.cc
|
| index 79240cff72a6f2f0897879743fa774040e5483f2..1e928f315a2ceb35e744a7064c5254d0e82e837d 100644
|
| --- a/net/http/des.cc
|
| +++ b/net/http/des.cc
|
| @@ -64,9 +64,9 @@
|
|
|
| // Set odd parity bit (in least significant bit position).
|
| static uint8 DESSetKeyParity(uint8 x) {
|
| - if ((((x >> 7) ^ (x >> 6) ^ (x >> 5) ^
|
| - (x >> 4) ^ (x >> 3) ^ (x >> 2) ^
|
| - (x >> 1)) & 0x01) == 0) {
|
| + if ((((x >> 7) ^ (x >> 6) ^ (x >> 5) ^ (x >> 4) ^ (x >> 3) ^ (x >> 2) ^
|
| + (x >> 1)) &
|
| + 0x01) == 0) {
|
| x |= 0x01;
|
| } else {
|
| x &= 0xfe;
|
| @@ -97,7 +97,9 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
| reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(key)), &ks);
|
|
|
| DES_ecb_encrypt(reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(src)),
|
| - reinterpret_cast<DES_cblock*>(hash), &ks, DES_ENCRYPT);
|
| + reinterpret_cast<DES_cblock*>(hash),
|
| + &ks,
|
| + DES_ENCRYPT);
|
| }
|
|
|
| #elif defined(USE_NSS)
|
| @@ -120,9 +122,8 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
|
|
| key_item.data = const_cast<uint8*>(key);
|
| key_item.len = 8;
|
| - symkey = PK11_ImportSymKey(slot, cipher_mech,
|
| - PK11_OriginUnwrap, CKA_ENCRYPT,
|
| - &key_item, NULL);
|
| + symkey = PK11_ImportSymKey(
|
| + slot, cipher_mech, PK11_OriginUnwrap, CKA_ENCRYPT, &key_item, NULL);
|
| if (!symkey)
|
| goto done;
|
|
|
| @@ -131,22 +132,21 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
| if (!param)
|
| goto done;
|
|
|
| - ctxt = PK11_CreateContextBySymKey(cipher_mech, CKA_ENCRYPT,
|
| - symkey, param);
|
| + ctxt = PK11_CreateContextBySymKey(cipher_mech, CKA_ENCRYPT, symkey, param);
|
| if (!ctxt)
|
| goto done;
|
|
|
| - rv = PK11_CipherOp(ctxt, hash, reinterpret_cast<int*>(&n), 8,
|
| - const_cast<uint8*>(src), 8);
|
| + rv = PK11_CipherOp(
|
| + ctxt, hash, reinterpret_cast<int*>(&n), 8, const_cast<uint8*>(src), 8);
|
| if (rv != SECSuccess)
|
| goto done;
|
|
|
| // TODO(wtc): Should this be PK11_Finalize?
|
| - rv = PK11_DigestFinal(ctxt, hash+8, &n, 0);
|
| + rv = PK11_DigestFinal(ctxt, hash + 8, &n, 0);
|
| if (rv != SECSuccess)
|
| goto done;
|
|
|
| - done:
|
| +done:
|
| if (ctxt)
|
| PK11_DestroyContext(ctxt, PR_TRUE);
|
| if (symkey)
|
| @@ -162,8 +162,17 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
| void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
| CCCryptorStatus status;
|
| size_t data_out_moved = 0;
|
| - status = CCCrypt(kCCEncrypt, kCCAlgorithmDES, kCCOptionECBMode,
|
| - key, 8, NULL, src, 8, hash, 8, &data_out_moved);
|
| + status = CCCrypt(kCCEncrypt,
|
| + kCCAlgorithmDES,
|
| + kCCOptionECBMode,
|
| + key,
|
| + 8,
|
| + NULL,
|
| + src,
|
| + 8,
|
| + hash,
|
| + 8,
|
| + &data_out_moved);
|
| DCHECK(status == kCCSuccess);
|
| DCHECK(data_out_moved == 8);
|
| }
|
| @@ -172,8 +181,8 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
|
|
| void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
| crypto::ScopedHCRYPTPROV provider;
|
| - if (!CryptAcquireContext(provider.receive(), NULL, NULL, PROV_RSA_FULL,
|
| - CRYPT_VERIFYCONTEXT))
|
| + if (!CryptAcquireContext(
|
| + provider.receive(), NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
| return;
|
|
|
| {
|
| @@ -194,7 +203,10 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
| crypto::ScopedHCRYPTKEY key;
|
| BOOL import_ok = CryptImportKey(provider,
|
| reinterpret_cast<BYTE*>(&key_blob),
|
| - sizeof key_blob, 0, 0, key.receive());
|
| + sizeof key_blob,
|
| + 0,
|
| + 0,
|
| + key.receive());
|
| // Destroy the copy of the key.
|
| SecureZeroMemory(key_blob.key_data, sizeof key_blob.key_data);
|
| if (!import_ok)
|
| @@ -202,8 +214,8 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
|
|
|
| // No initialization vector required.
|
| DWORD cipher_mode = CRYPT_MODE_ECB;
|
| - if (!CryptSetKeyParam(key, KP_MODE, reinterpret_cast<BYTE*>(&cipher_mode),
|
| - 0))
|
| + if (!CryptSetKeyParam(
|
| + key, KP_MODE, reinterpret_cast<BYTE*>(&cipher_mode), 0))
|
| return;
|
|
|
| // CryptoAPI requires us to copy the plaintext to the output buffer first.
|
|
|