Skip to content

Commit

Permalink
Bug 1566124 - Clang format run. r=beurdouche
Browse files Browse the repository at this point in the history
  • Loading branch information
beurdouche committed May 5, 2021
1 parent b79f0a5 commit 75dbd61
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 66 deletions.
68 changes: 34 additions & 34 deletions lib/freebl/ppc-gcm-wrap.c
Expand Up @@ -38,14 +38,14 @@ struct ppc_AES_GCMContextStr {
};

SECStatus ppc_aes_gcmInitCounter(ppc_AES_GCMContext *gcm,
const unsigned char *iv,
unsigned long ivLen, unsigned long tagBits,
const unsigned char *aad, unsigned long aadLen);
const unsigned char *iv,
unsigned long ivLen, unsigned long tagBits,
const unsigned char *aad, unsigned long aadLen);

ppc_AES_GCMContext *
ppc_AES_GCM_CreateContext(void *context,
freeblCipherFunc cipher,
const unsigned char *params)
freeblCipherFunc cipher,
const unsigned char *params)
{
ppc_AES_GCMContext *gcm = NULL;
AESContext *aes = (AESContext *)context;
Expand Down Expand Up @@ -79,8 +79,8 @@ ppc_AES_GCM_CreateContext(void *context,
}

rv = ppc_aes_gcmInitCounter(gcm, gcmParams->pIv,
gcmParams->ulIvLen, gcmParams->ulTagBits,
gcmParams->pAAD, gcmParams->ulAADLen);
gcmParams->ulIvLen, gcmParams->ulTagBits,
gcmParams->pAAD, gcmParams->ulAADLen);
if (rv != SECSuccess) {
PORT_Free(gcm);
return NULL;
Expand All @@ -92,9 +92,9 @@ ppc_AES_GCM_CreateContext(void *context,

SECStatus
ppc_aes_gcmInitCounter(ppc_AES_GCMContext *gcm,
const unsigned char *iv, unsigned long ivLen,
unsigned long tagBits,
const unsigned char *aad, unsigned long aadLen)
const unsigned char *iv, unsigned long ivLen,
unsigned long tagBits,
const unsigned char *aad, unsigned long aadLen)
{
unsigned int j;
SECStatus rv;
Expand Down Expand Up @@ -177,10 +177,10 @@ ppc_AES_GCM_DestroyContext(ppc_AES_GCMContext *gcm, PRBool freeit)

SECStatus
ppc_AES_GCM_EncryptUpdate(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
unsigned int blocksize)
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
unsigned int blocksize)
{
unsigned int tagBytes;
unsigned char T[AES_BLOCK_SIZE];
Expand Down Expand Up @@ -243,10 +243,10 @@ ppc_AES_GCM_EncryptUpdate(ppc_AES_GCMContext *gcm,

SECStatus
ppc_AES_GCM_DecryptUpdate(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
unsigned int blocksize)
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
unsigned int blocksize)
{
unsigned int tagBytes;
unsigned char T[AES_BLOCK_SIZE];
Expand Down Expand Up @@ -318,12 +318,12 @@ ppc_AES_GCM_DecryptUpdate(ppc_AES_GCMContext *gcm,

SECStatus
ppc_AES_GCM_EncryptAEAD(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize)
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize)
{
unsigned int tagBytes;
unsigned char T[AES_BLOCK_SIZE];
Expand Down Expand Up @@ -365,15 +365,15 @@ ppc_AES_GCM_EncryptAEAD(ppc_AES_GCMContext *gcm,
}

rv = ppc_aes_gcmInitCounter(gcm, gcmParams->pIv, gcmParams->ulIvLen,
gcmParams->ulTagBits, aad, aadLen);
gcmParams->ulTagBits, aad, aadLen);
if (rv != SECSuccess) {
return SECFailure;
}

tagBytes = (gcm->tagBits + (PR_BITS_PER_BYTE - 1)) / PR_BITS_PER_BYTE;

ppc_aes_gcmCRYPT(inbuf, outbuf, inlen, gcm->CTR, gcm->aes_context->k.expandedKey,
gcm->aes_context->Nr);
gcm->aes_context->Nr);
ppc_aes_gcmHASH(gcm->Htbl, outbuf, inlen, gcm->T);

gcm->Mlen += inlen;
Expand All @@ -387,12 +387,12 @@ ppc_AES_GCM_EncryptAEAD(ppc_AES_GCMContext *gcm,

SECStatus
ppc_AES_GCM_DecryptAEAD(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize)
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize)
{
unsigned int tagBytes;
unsigned char T[AES_BLOCK_SIZE];
Expand Down Expand Up @@ -429,7 +429,7 @@ ppc_AES_GCM_DecryptAEAD(ppc_AES_GCMContext *gcm,
}

rv = ppc_aes_gcmInitCounter(gcm, gcmParams->pIv, gcmParams->ulIvLen,
gcmParams->ulTagBits, aad, aadLen);
gcmParams->ulTagBits, aad, aadLen);
if (rv != SECSuccess) {
return SECFailure;
}
Expand All @@ -440,7 +440,7 @@ ppc_AES_GCM_DecryptAEAD(ppc_AES_GCMContext *gcm,

ppc_aes_gcmHASH(gcm->Htbl, inbuf, inlen, gcm->T);
ppc_aes_gcmCRYPT(inbuf, outbuf, inlen, gcm->CTR, gcm->aes_context->k.expandedKey,
gcm->aes_context->Nr);
gcm->aes_context->Nr);

gcm->Mlen += inlen;
ppc_aes_gcmTAG(gcm->Htbl, gcm->T, gcm->Mlen, gcm->Alen, gcm->X0, T);
Expand Down
64 changes: 32 additions & 32 deletions lib/freebl/ppc-gcm.h
Expand Up @@ -13,64 +13,64 @@
typedef struct ppc_AES_GCMContextStr ppc_AES_GCMContext;

ppc_AES_GCMContext *ppc_AES_GCM_CreateContext(void *context, freeblCipherFunc cipher,
const unsigned char *params);
const unsigned char *params);

void ppc_AES_GCM_DestroyContext(ppc_AES_GCMContext *gcm, PRBool freeit);

SECStatus ppc_AES_GCM_EncryptUpdate(ppc_AES_GCMContext *gcm, unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
unsigned int blocksize);

SECStatus ppc_AES_GCM_DecryptUpdate(ppc_AES_GCMContext *gcm, unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
unsigned int blocksize);
SECStatus ppc_AES_GCM_EncryptAEAD(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize);
SECStatus ppc_AES_GCM_DecryptAEAD(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,

SECStatus ppc_AES_GCM_DecryptUpdate(ppc_AES_GCMContext *gcm, unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize);
SECStatus ppc_AES_GCM_EncryptAEAD(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize);
SECStatus ppc_AES_GCM_DecryptAEAD(ppc_AES_GCMContext *gcm,
unsigned char *outbuf,
unsigned int *outlen, unsigned int maxout,
const unsigned char *inbuf, unsigned int inlen,
void *params, unsigned int paramLen,
const unsigned char *aad, unsigned int aadLen,
unsigned int blocksize);

/* Prototypes of the functions defined in the assembler file. */

/* Prepares the constants used in the aggregated reduction method */
void ppc_aes_gcmINIT(unsigned char Htbl[8 * 16],
PRUint32 *KS,
int NR);
PRUint32 *KS,
int NR);

/* Produces the final GHASH value */
void ppc_aes_gcmTAG(unsigned char Htbl[8 * 16],
unsigned char *Tp,
unsigned long Mlen,
unsigned long Alen,
unsigned char *X0,
unsigned char *TAG);
unsigned char *Tp,
unsigned long Mlen,
unsigned long Alen,
unsigned char *X0,
unsigned char *TAG);

/* Hashes the Additional Authenticated Data, should be used before enc/dec.
Operates on any length of data. Partial block is padded internally. */
void ppc_aes_gcmHASH(unsigned char Htbl[8 * 16],
const unsigned char *AAD,
unsigned long Alen,
unsigned char *Tp);
const unsigned char *AAD,
unsigned long Alen,
unsigned char *Tp);

/* Crypt only, used in combination with ppc_aes_gcmAAD().
Operates on any length of data, however partial block should only be encrypted
at the last call, otherwise the result will be incorrect. */
void ppc_aes_gcmCRYPT(const unsigned char *PT,
unsigned char *CT,
unsigned long len,
unsigned char *CTRP,
PRUint32 *KS,
int NR);
unsigned char *CT,
unsigned long len,
unsigned char *CTRP,
PRUint32 *KS,
int NR);

#endif

0 comments on commit 75dbd61

Please sign in to comment.