Lines Matching refs:ctx

313 static uint32_t F(BLOWFISH_CTX *ctx, uint32_t x) {  in F()  argument
324 y = ctx->S[0][a] + ctx->S[1][b]; in F()
325 y = y ^ ctx->S[2][c]; in F()
326 y = y + ctx->S[3][d]; in F()
332 static void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uint32_t *xl, uint32_t *xr){ in Blowfish_Encrypt() argument
342 Xl = Xl ^ ctx->P[i]; in Blowfish_Encrypt()
343 Xr = F(ctx, Xl) ^ Xr; in Blowfish_Encrypt()
354 Xr = Xr ^ ctx->P[N]; in Blowfish_Encrypt()
355 Xl = Xl ^ ctx->P[N + 1]; in Blowfish_Encrypt()
362 static void Blowfish_Decrypt(BLOWFISH_CTX *ctx, uint32_t *xl, uint32_t *xr){ in Blowfish_Decrypt() argument
372 Xl = Xl ^ ctx->P[i]; in Blowfish_Decrypt()
373 Xr = F(ctx, Xl) ^ Xr; in Blowfish_Decrypt()
386 Xr = Xr ^ ctx->P[1]; in Blowfish_Decrypt()
387 Xl = Xl ^ ctx->P[0]; in Blowfish_Decrypt()
393 static void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen) { in Blowfish_Init() argument
399 ctx->S[i][j] = ORIG_S[i][j]; in Blowfish_Init()
411 ctx->P[i] = ORIG_P[i] ^ data; in Blowfish_Init()
418 Blowfish_Encrypt(ctx, &datal, &datar); in Blowfish_Init()
419 ctx->P[i] = datal; in Blowfish_Init()
420 ctx->P[i + 1] = datar; in Blowfish_Init()
425 Blowfish_Encrypt(ctx, &datal, &datar); in Blowfish_Init()
426 ctx->S[i][j] = datal; in Blowfish_Init()
427 ctx->S[i][j + 1] = datar; in Blowfish_Init()
435 BLOWFISH_CTX ctx; in blowfish_test() local
436 Blowfish_Init(&ctx, (unsigned char*)"TESTKEY", 7); in blowfish_test()
437 Blowfish_Encrypt(&ctx, &L, &R); in blowfish_test()
438 Blowfish_Decrypt(&ctx, &L, &R); in blowfish_test()