Skip to content

Commit

Permalink
Bug 1236720 - clang-format, a=bustage
Browse files Browse the repository at this point in the history
--HG--
extra : amend_source : a8944af4ce334689016062d7ed26cf9a42c203c4
  • Loading branch information
martinthomson committed Nov 2, 2017
1 parent a10504d commit 04d67f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
20 changes: 7 additions & 13 deletions gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc
Expand Up @@ -20,19 +20,18 @@ namespace nss_test {
static const uint8_t kIv[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77};
static const uint8_t kInput[] = {0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00};
static const uint8_t kInput[] = {
0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00, 0xff, 0xee, 0xdd, 0xcc,
0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00};

class EncryptDeriveTest
: public ::testing::Test,
public ::testing::WithParamInterface<CK_MECHANISM_TYPE> {

public:
void TestEncryptDerive() {
ScopedPK11SymKey derived_key(PK11_Derive(key_.get(), derive_mech(),
derive_param(), encrypt_mech(),
CKA_DECRYPT, keysize()));
derive_param(), encrypt_mech(),
CKA_DECRYPT, keysize()));
ASSERT_TRUE(derived_key);

uint8_t derived_key_data[MAX_KEY_SIZE];
Expand All @@ -57,7 +56,6 @@ class EncryptDeriveTest
unsigned int keysize() const { return 16; }

private:

CK_MECHANISM_TYPE encrypt_mech() const { return GetParam(); }

CK_MECHANISM_TYPE derive_mech() const {
Expand Down Expand Up @@ -185,9 +183,7 @@ class EncryptDeriveTest
ScopedPK11SymKey key_;
};

TEST_P(EncryptDeriveTest, Test) {
TestEncryptDerive();
}
TEST_P(EncryptDeriveTest, Test) { TestEncryptDerive(); }

static const CK_MECHANISM_TYPE kEncryptDeriveMechanisms[] = {
CKM_DES3_ECB, CKM_DES3_CBC, CKM_AES_ECB, CKM_AES_ECB, CKM_AES_CBC,
Expand All @@ -203,9 +199,7 @@ class EncryptDerive3Test : public EncryptDeriveTest {
unsigned int keysize() const { return 24; }
};

TEST_P(EncryptDerive3Test, Test) {
TestEncryptDerive();
}
TEST_P(EncryptDerive3Test, Test) { TestEncryptDerive(); }

static const CK_MECHANISM_TYPE kDES3EncryptDeriveMechanisms[] = {CKM_DES3_ECB,
CKM_DES3_CBC};
Expand Down
5 changes: 2 additions & 3 deletions lib/softoken/pkcs11c.c
Expand Up @@ -1524,8 +1524,7 @@ NSC_DecryptUpdate(CK_SESSION_HANDLE hSession,
maxout -= padoutlen;
}
/* now save the final block for the next decrypt or the final */
PORT_Memcpy(context->padBuf, &pEncryptedPart[ulEncryptedPartLen -
context->blockSize],
PORT_Memcpy(context->padBuf, &pEncryptedPart[ulEncryptedPartLen - context->blockSize],
context->blockSize);
context->padDataLength = context->blockSize;
ulEncryptedPartLen -= context->padDataLength;
Expand Down Expand Up @@ -7001,7 +7000,7 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession,
len = stringPtr->ulLen;
} else {
aesEncryptPtr =
(CK_AES_CBC_ENCRYPT_DATA_PARAMS *) pMechanism->pParameter;
(CK_AES_CBC_ENCRYPT_DATA_PARAMS *)pMechanism->pParameter;
mode = NSS_AES_CBC;
iv = aesEncryptPtr->iv;
data = aesEncryptPtr->pData;
Expand Down

0 comments on commit 04d67f8

Please sign in to comment.