filename stringlengths 19 182 | omp_pragma_line stringlengths 24 416 | context_chars int64 100 100 | text stringlengths 152 177k |
|---|---|---|---|
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/8/2mm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9) | 100 | ister int lbv, ubv;
/* Start of CLooG code */
if (_PB_NI >= 1) {
lbp=0;
ubp=floord(_PB_NI-1,8);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
if ((_PB_NJ >= 0) && (_PB_NL >= 0)) {
for (t3=0;t3<=floord(_PB_NJ+_PB_NL-1,8);t3++) {
if ((_PB_NJ >= _PB_NL+1) && (t3 <= floord(_PB_NL-1,8)) && (t3 >= ceild(_PB_NL-7,8))) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=_PB_NL-1;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
lbv=_PB_NL;
ubv=min(_PB_NJ-1,8*t3+7);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((_PB_NJ >= _PB_NL+1) && (t3 <= floord(_PB_NL-8,8))) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=8*t3+7;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((_PB_NJ <= _PB_NL-1) && (t3 <= floord(_PB_NJ-1,8)) && (t3 >= ceild(_PB_NJ-7,8))) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=_PB_NJ-1;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
lbv=_PB_NJ;
ubv=min(_PB_NL-1,8*t3+7);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
}
}
}
if ((_PB_NJ <= _PB_NL-1) && (t3 <= floord(_PB_NJ-8,8))) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=8*t3+7;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((_PB_NJ == _PB_NL) && (t3 <= floord(_PB_NJ-1,8))) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=min(_PB_NJ-1,8*t3+7);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((t3 <= floord(_PB_NJ-1,8)) && (t3 >= ceild(_PB_NL,8))) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=min(_PB_NJ-1,8*t3+7);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((t3 <= floord(_PB_NL-1,8)) && (t3 >= ceild(_PB_NJ,8))) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=min(_PB_NL-1,8*t3+7);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
}
}
}
}
}
if (_PB_NL <= -1) {
for (t3=0;t3<=floord(_PB_NJ-1,8);t3++) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=min(_PB_NJ-1,8*t3+7);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
}
if (_PB_NJ <= -1) {
for (t3=0;t3<=floord(_PB_NL-1,8);t3++) {
for (t4=8*t2;t4<=min(_PB_NI-1,8*t2+7);t4++) {
lbv=8*t3;
ubv=min(_PB_NL-1,8*t3+7);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/8/2mm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9) | 100 | }
}
}
}
}
if (_PB_NJ >= 1) {
lbp=0;
ubp=floord(_PB_NI-1,8);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_NJ-1,8);t3++) {
if (_PB_NK >= 1) {
for (t5=0;t5<=floord(_PB_NK-1,8);t5++) {
for (t6=8*t2;t6<=min(_PB_NI-1,8*t2+7);t6++) {
for (t7=8*t3;t7<=min(_PB_NJ-1,8*t3+7);t7++) {
for (t9=8*t5;t9<=min(_PB_NK-1,8*t5+7);t9++) {
tmp[t6][t7] += alpha * A[t6][t9] * B[t9][t7];;
}
}
}
}
}
if (_PB_NL >= 1) {
for (t5=0;t5<=floord(_PB_NL-1,8);t5++) {
for (t6=8*t2;t6<=min(_PB_NI-1,8*t2+7);t6++) {
for (t7=8*t3;t7<=min(_PB_NJ-1,8*t3+7);t7++) {
lbv=8*t5;
ubv=min(_PB_NL-1,8*t5+7);
#pragma ivdep
#pragma vector always
for (t9=lbv;t9<=ubv;t9++) {
D[t6][t9] += tmp[t6][t7] * C[t7][t9];;
}
}
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/trmm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | e */
if ((_PB_M >= 1) && (_PB_N >= 1)) {
if (_PB_M >= 2) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_M-2,32);t3++) {
for (t4=t3;t4<=floord(_PB_M-1,32);t4++) {
for (t5=32*t3;t5<=min(min(_PB_M-2,32*t3+31),32*t4+30);t5++) {
for (t6=max(32*t4,t5+1);t6<=min(_PB_M-1,32*t4+31);t6++) {
lbv=32*t2;
ubv=min(_PB_N-1,32*t2+31);
#pragma ivdep
#pragma vector always
for (t7=lbv;t7<=ubv;t7++) {
B[t5][t7] += A[t6][t5] * B[t6][t7];;
}
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/trmm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | }
}
}
}
}
}
}
lbp=0;
ubp=floord(_PB_M-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_M-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_N-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
B[t4][t5] = alpha * B[t4][t5];;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/gemm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | /* Start of CLooG code */
if ((_PB_NI >= 1) && (_PB_NJ >= 1)) {
lbp=0;
ubp=floord(_PB_NI-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_NJ-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_NJ-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
C[t4][t5] *= beta;;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/gemm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | *= beta;;
}
}
}
}
if (_PB_NK >= 1) {
lbp=0;
ubp=floord(_PB_NI-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_NJ-1,32);t3++) {
for (t4=0;t4<=floord(_PB_NK-1,32);t4++) {
for (t5=32*t2;t5<=min(_PB_NI-1,32*t2+31);t5++) {
for (t6=32*t4;t6<=min(_PB_NK-1,32*t4+31);t6++) {
lbv=32*t3;
ubv=min(_PB_NJ-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t7=lbv;t7<=ubv;t7++) {
C[t5][t7] += alpha * A[t5][t6] * B[t6][t7];;
}
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/mvt.c | #pragma omp parallel for private(lbv,ubv,t2,t3,t4) | 100 | gister int lbv, ubv;
/* Start of CLooG code */
if (_PB_N >= 1) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t1=lbp;t1<=ubp;t1++) {
for (t2=0;t2<=floord(_PB_N-1,32);t2++) {
for (t3=32*t1;t3<=min(_PB_N-1,32*t1+31);t3++) {
for (t4=32*t2;t4<=min(_PB_N-1,32*t2+31);t4++) {
x1[t3] = x1[t3] + A[t3][t4] * y_1[t4];;
x2[t3] = x2[t3] + A[t4][t3] * y_2[t4];;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t2,t3,t4)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/bicg.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | bp, ubp, lb2, ub2;
register int lbv, ubv;
/* Start of CLooG code */
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
lbv=32*t2;
ubv=min(_PB_N-1,32*t2+31);
#pragma ivdep
#pragma vector always
for (t3=lbv;t3<=ubv;t3++) {
q[t3] = SCALAR_VAL(0.0);;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/bicg.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | bv;t3++) {
q[t3] = SCALAR_VAL(0.0);;
}
}
if (_PB_M >= 1) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_M-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_N-1,32*t2+31);t4++) {
for (t5=32*t3;t5<=min(_PB_M-1,32*t3+31);t5++) {
q[t4] = q[t4] + A[t4][t5] * p[t5];;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/bicg.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | q[t4] = q[t4] + A[t4][t5] * p[t5];;
}
}
}
}
}
lbp=0;
ubp=floord(_PB_M-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
lbv=32*t2;
ubv=min(_PB_M-1,32*t2+31);
#pragma ivdep
#pragma vector always
for (t3=lbv;t3<=ubv;t3++) {
s[t3] = 0;;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/bicg.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | (t3=lbv;t3<=ubv;t3++) {
s[t3] = 0;;
}
}
if (_PB_N >= 1) {
lbp=0;
ubp=floord(_PB_M-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
for (t4=32*t3;t4<=min(_PB_N-1,32*t3+31);t4++) {
lbv=32*t2;
ubv=min(_PB_M-1,32*t2+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
s[t5] = s[t5] + r[t4] * A[t4][t5];;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/syr2k.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | gister int lbv, ubv;
/* Start of CLooG code */
if (_PB_N >= 1) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_N-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_N-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
C[t4][t5] *= beta;;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/syr2k.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | 5] *= beta;;
}
}
}
}
if (_PB_M >= 1) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
for (t4=0;t4<=floord(_PB_M-1,32);t4++) {
for (t5=32*t2;t5<=min(_PB_N-1,32*t2+31);t5++) {
for (t6=32*t3;t6<=min(_PB_N-1,32*t3+31);t6++) {
for (t7=32*t4;t7<=min(_PB_M-1,32*t4+31);t7++) {
C[t5][t6] += A[t6][t7] * alpha * B[t5][t7] + B[t6][t7] * alpha * A[t5][t7];;
}
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/gesummv.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | gister int lbv, ubv;
/* Start of CLooG code */
if (_PB_N >= 1) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
lbv=32*t2;
ubv=min(_PB_N-1,32*t2+31);
#pragma ivdep
#pragma vector always
for (t3=lbv;t3<=ubv;t3++) {
y[t3] = SCALAR_VAL(0.0);;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/gesummv.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | t3=lbv;t3<=ubv;t3++) {
y[t3] = SCALAR_VAL(0.0);;
}
}
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_N-1,32*t2+31);t4++) {
for (t5=32*t3;t5<=min(_PB_N-1,32*t3+31);t5++) {
y[t4] = B[t4][t5] * x[t5] + y[t4];;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/gesummv.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | y[t4] = B[t4][t5] * x[t5] + y[t4];;
}
}
}
}
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
lbv=32*t2;
ubv=min(_PB_N-1,32*t2+31);
#pragma ivdep
#pragma vector always
for (t3=lbv;t3<=ubv;t3++) {
tmp[t3] = SCALAR_VAL(0.0);;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/gesummv.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | =lbv;t3<=ubv;t3++) {
tmp[t3] = SCALAR_VAL(0.0);;
}
}
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_N-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_N-1,32*t2+31);t4++) {
for (t5=32*t3;t5<=min(_PB_N-1,32*t3+31);t5++) {
tmp[t4] = A[t4][t5] * x[t5] + tmp[t4];;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/gesummv.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5) | 100 | [t4] = A[t4][t5] * x[t5] + tmp[t4];;
}
}
}
}
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
lbv=32*t2;
ubv=min(_PB_N-1,32*t2+31);
#pragma ivdep
#pragma vector always
for (t3=lbv;t3<=ubv;t3++) {
y[t3] = alpha * tmp[t3] + beta * y[t3];;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/syrk.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | gister int lbv, ubv;
/* Start of CLooG code */
if (_PB_N >= 1) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=t2;t3++) {
for (t4=32*t2;t4<=min(_PB_N-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(t4,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
C[t4][t5] *= beta;;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/syrk.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7) | 100 | 5] *= beta;;
}
}
}
}
if (_PB_M >= 1) {
lbp=0;
ubp=floord(_PB_N-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=t2;t3++) {
for (t4=0;t4<=floord(_PB_M-1,32);t4++) {
for (t5=32*t2;t5<=min(_PB_N-1,32*t2+31);t5++) {
for (t6=32*t3;t6<=min(t5,32*t3+31);t6++) {
for (t7=32*t4;t7<=min(_PB_M-1,32*t4+31);t7++) {
C[t5][t6] += alpha * A[t5][t7] * A[t6][t7];;
}
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/2mm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9) | 100 | ster int lbv, ubv;
/* Start of CLooG code */
if (_PB_NI >= 1) {
lbp=0;
ubp=floord(_PB_NI-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
if ((_PB_NJ >= 0) && (_PB_NL >= 0)) {
for (t3=0;t3<=floord(_PB_NJ+_PB_NL-1,32);t3++) {
if ((_PB_NJ >= _PB_NL+1) && (t3 <= floord(_PB_NL-1,32)) && (t3 >= ceild(_PB_NL-31,32))) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=_PB_NL-1;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
lbv=_PB_NL;
ubv=min(_PB_NJ-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((_PB_NJ >= _PB_NL+1) && (t3 <= floord(_PB_NL-32,32))) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=32*t3+31;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((_PB_NJ <= _PB_NL-1) && (t3 <= floord(_PB_NJ-1,32)) && (t3 >= ceild(_PB_NJ-31,32))) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=_PB_NJ-1;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
lbv=_PB_NJ;
ubv=min(_PB_NL-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
}
}
}
if ((_PB_NJ <= _PB_NL-1) && (t3 <= floord(_PB_NJ-32,32))) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=32*t3+31;
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((_PB_NJ == _PB_NL) && (t3 <= floord(_PB_NJ-1,32))) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_NJ-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((t3 <= floord(_PB_NJ-1,32)) && (t3 >= ceild(_PB_NL,32))) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_NJ-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
if ((t3 <= floord(_PB_NL-1,32)) && (t3 >= ceild(_PB_NJ,32))) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_NL-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
}
}
}
}
}
if (_PB_NL <= -1) {
for (t3=0;t3<=floord(_PB_NJ-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_NJ-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
tmp[t4][t5] = SCALAR_VAL(0.0);;
}
}
}
}
if (_PB_NJ <= -1) {
for (t3=0;t3<=floord(_PB_NL-1,32);t3++) {
for (t4=32*t2;t4<=min(_PB_NI-1,32*t2+31);t4++) {
lbv=32*t3;
ubv=min(_PB_NL-1,32*t3+31);
#pragma ivdep
#pragma vector always
for (t5=lbv;t5<=ubv;t5++) {
D[t4][t5] *= beta;;
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/sfs-tiling/pluto/32/2mm.c | #pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9) | 100 | }
}
}
}
}
if (_PB_NJ >= 1) {
lbp=0;
ubp=floord(_PB_NI-1,32);
<LOOP-START>for (t2=lbp;t2<=ubp;t2++) {
for (t3=0;t3<=floord(_PB_NJ-1,32);t3++) {
if (_PB_NK >= 1) {
for (t5=0;t5<=floord(_PB_NK-1,32);t5++) {
for (t6=32*t2;t6<=min(_PB_NI-1,32*t2+31);t6++) {
for (t7=32*t3;t7<=min(_PB_NJ-1,32*t3+31);t7++) {
for (t9=32*t5;t9<=min(_PB_NK-1,32*t5+31);t9++) {
tmp[t6][t7] += alpha * A[t6][t9] * B[t9][t7];;
}
}
}
}
}
if (_PB_NL >= 1) {
for (t5=0;t5<=floord(_PB_NL-1,32);t5++) {
for (t6=32*t2;t6<=min(_PB_NI-1,32*t2+31);t6++) {
for (t7=32*t3;t7<=min(_PB_NJ-1,32*t3+31);t7++) {
lbv=32*t5;
ubv=min(_PB_NL-1,32*t5+31);
#pragma ivdep
#pragma vector always
for (t9=lbv;t9<=ubv;t9++) {
D[t6][t9] += tmp[t6][t7] * C[t7][t9];;
}
}
}
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for private(lbv,ubv,t3,t4,t5,t6,t7,t8,t9)<OMP-END> |
piotr-skotnicki/tc-optimizer/results/merge-tiling/parameterized/trisolv.c | #pragma omp parallel for | 100 | ) < (y) ? (x) : (y))
#define floord(n,d) (((n)<0) ? -((-(n)+(d)-1)/(d)) : (n)/(d))
#pragma scop
{
<LOOP-START>for (int ii0 = 0; ii0 <= floord(_PB_N - 1, 64); ii0 += 1)
for (int c4 = 64 * ii0; c4 <= min(_PB_N - 1, 64 * ii0 + 63); c4 += 1)
x[c4] = b[c4];
for (int k = 1; k <= (_PB_N + 30) / 32; k += 1)
#pragma omp parallel for
for (int ii0 = k / 2; ii0 <= min(k - 1, (_PB_N - 1) / 64); ii0 += 1) {
if (k >= 2) {
for (int c4 = 64 * ii0; c4 <= min(_PB_N - 1, 64 * ii0 + 63); c4 += 1) {
for (int c6 = 64 * k - 64 * ii0 - 64; c6 < min(64 * k - 64 * ii0, c4); c6 += 1)
x[c4] -= (L[c4][c6] * x[c6]);
if (2 * ii0 + 1 == k)
x[c4] = (x[c4] / L[c4][c4]);
}
} else
for (int c4 = 0; c4 <= min(63, _PB_N - 1); c4 += 1) {
for (int c6 = 0; c6 < c4; c6 += 1)
x[c4] -= (L[c4][c6] * x[c6]);
x[c4] = (x[c4] / L[c4][c4]);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
piotr-skotnicki/tc-optimizer/results/merge-tiling/parameterized/trisolv.c | #pragma omp parallel for | 100 | 64 * ii0 + 63); c4 += 1)
x[c4] = b[c4];
for (int k = 1; k <= (_PB_N + 30) / 32; k += 1)
<LOOP-START>for (int ii0 = k / 2; ii0 <= min(k - 1, (_PB_N - 1) / 64); ii0 += 1) {
if (k >= 2) {
for (int c4 = 64 * ii0; c4 <= min(_PB_N - 1, 64 * ii0 + 63); c4 += 1) {
for (int c6 = 64 * k - 64 * ii0 - 64; c6 < min(64 * k - 64 * ii0, c4); c6 += 1)
x[c4] -= (L[c4][c6] * x[c6]);
if (2 * ii0 + 1 == k)
x[c4] = (x[c4] / L[c4][c4]);
}
} else
for (int c4 = 0; c4 <= min(63, _PB_N - 1); c4 += 1) {
for (int c6 = 0; c6 < c4; c6 += 1)
x[c4] -= (L[c4][c6] * x[c6]);
x[c4] = (x[c4] / L[c4][c4]);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
piotr-skotnicki/tc-optimizer/results/merge-tiling/parameterized/cholesky.c | #pragma omp parallel for | 100 | ))
#pragma scop
{
if (_PB_N >= 65)
for (int k = 0; k <= (3 * _PB_N - 6) / 64; k += 1) {
<LOOP-START>for (int ii0 = max(k - (_PB_N + 29) / 32 + 1, (k + 1) / 3); ii0 <= min(k, (_PB_N - 1) / 64); ii0 += 1) {
if (k >= 1) {
for (int ii2 = -ii0 + (k + ii0 + 1) / 2; ii2 <= min(min(ii0, k - ii0), (_PB_N - 2) / 64); ii2 += 1) {
if (3 * ii0 == k && 3 * ii2 == k) {
A[64 * k / 3][64 * k / 3] = SQRT_FUN(A[64 * k / 3][64 * k / 3]);
if (64 * k + 195 >= 3 * _PB_N) {
A[(64 * k / 3) + 1][64 * k / 3] /= A[64 * k / 3][64 * k / 3];
A[(64 * k / 3) + 1][(64 * k / 3) + 1] -= (A[(64 * k / 3) + 1][64 * k / 3] * A[(64 * k / 3) + 1][64 * k / 3]);
A[(64 * k / 3) + 1][(64 * k / 3) + 1] = SQRT_FUN(A[(64 * k / 3) + 1][(64 * k / 3) + 1]);
} else {
A[(64 * k / 3) + 1][64 * k / 3] /= A[64 * k / 3][64 * k / 3];
A[(64 * k / 3) + 1][(64 * k / 3) + 1] -= (A[(64 * k / 3) + 1][64 * k / 3] * A[(64 * k / 3) + 1][64 * k / 3]);
A[(64 * k / 3) + 1][(64 * k / 3) + 1] = SQRT_FUN(A[(64 * k / 3) + 1][(64 * k / 3) + 1]);
}
}
for (int c6 = max(max(64 * ii0, 32 * k - 32 * ii0 + 2), 64 * ii2 + 1); c6 <= min(_PB_N - 1, 64 * ii0 + 63); c6 += 1) {
for (int c8 = 64 * ii2; c8 <= min(64 * ii2 + 63, c6 - 1); c8 += 1) {
for (int c10 = 64 * k - 64 * ii0 - 64 * ii2; c10 <= min(64 * k - 64 * ii0 - 64 * ii2 + 63, c8 - 1); c10 += 1)
A[c6][c8] -= (A[c6][c10] * A[c8][c10]);
if (ii0 + 2 * ii2 == k)
A[c6][c8] /= A[c8][c8];
}
if (_PB_N >= 64 * ii0 + 2 && ii0 + 2 * ii2 == k) {
for (int c8 = 32 * k - 32 * ii0; c8 <= min(32 * k - 32 * ii0 + 63, c6 - 1); c8 += 1)
A[c6][c6] -= (A[c6][c8] * A[c6][c8]);
if (3 * ii0 == k)
A[c6][c6] = SQRT_FUN(A[c6][c6]);
} else if (3 * _PB_N >= 64 * k + 259 && 64 * ii0 + 1 == _PB_N && _PB_N + 128 * ii2 == 64 * k + 1 && c6 + 1 == _PB_N)
for (int c8 = ((-_PB_N + 1) / 2) + 32 * k; c8 <= ((-_PB_N + 127) / 2) + 32 * k; c8 += 1)
A[_PB_N - 1][_PB_N - 1] -= (A[_PB_N - 1][c8] * A[_PB_N - 1][c8]);
}
}
if (64 * k + 67 == 3 * _PB_N && 64 * ii0 + 1 == _PB_N)
for (int c8 = _PB_N - 65; c8 < _PB_N - 1; c8 += 1)
A[_PB_N - 1][_PB_N - 1] -= (A[_PB_N - 1][c8] * A[_PB_N - 1][c8]);
} else
for (int c6 = 0; c6 <= 63; c6 += 1) {
for (int c8 = 0; c8 < c6; c8 += 1) {
for (int c10 = 0; c10 < c8; c10 += 1)
A[c6][c8] -= (A[c6][c10] * A[c8][c10]);
A[c6][c8] /= A[c8][c8];
}
for (int c8 = 0; c8 < c6; c8 += 1)
A[c6][c6] -= (A[c6][c8] * A[c6][c8]);
A[c6][c6] = SQRT_FUN(A[c6][c6]);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
piotr-skotnicki/tc-optimizer/results/merge-tiling/unparameterized/symm.c | #pragma omp parallel for | 100 | (y))
#define max(x,y) ((x) > (y) ? (x) : (y))
#pragma scop
for (int k = 0; k <= 32; k += 1) {
<LOOP-START>for (int ii1 = 0; ii1 <= 40; ii1 += 1)
for (int ii3 = 0; ii3 < k; ii3 += 1) {
if (k <= 31) {
for (int c6 = max(64 * k - 64, 64 * ii3 + 1); c6 < 64 * k; c6 += 1)
for (int c7 = 64 * ii1; c7 <= min(2599, 64 * ii1 + 63); c7 += 1)
for (int c9 = 64 * ii3; c9 <= min(64 * ii3 + 63, c6 - 1); c9 += 1)
C[c9][c7] += ((alpha * B[c6][c7]) * A[c6][c9]);
} else
for (int c6 = max(1984, 64 * ii3 + 1); c6 <= 1999; c6 += 1) {
if (ii1 <= 39) {
for (int c7 = 64 * ii1; c7 <= 64 * ii1 + 63; c7 += 1)
for (int c9 = 64 * ii3; c9 <= min(64 * ii3 + 63, c6 - 1); c9 += 1)
C[c9][c7] += ((alpha * B[c6][c7]) * A[c6][c9]);
} else
for (int c7 = 2560; c7 <= 2599; c7 += 1)
for (int c9 = 64 * ii3; c9 <= min(64 * ii3 + 63, c6 - 1); c9 += 1)
C[c9][c7] += ((alpha * B[c6][c7]) * A[c6][c9]);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
piotr-skotnicki/tc-optimizer/results/merge-tiling/unparameterized/gramschmidt.c | #pragma omp parallel for | 100 | ne min(x,y) ((x) < (y) ? (x) : (y))
#define max(x,y) ((x) > (y) ? (x) : (y))
#pragma scop
{
<LOOP-START>for (int ii0 = 0; ii0 <= 40; ii0 += 1)
for (int ii2 = ii0; ii2 <= 40; ii2 += 1)
for (int c6 = 64 * ii0; c6 <= min(min(2598, 64 * ii0 + 63), 64 * ii2 + 62); c6 += 1) {
if (ii2 <= 39) {
for (int c8 = max(64 * ii2, c6 + 1); c8 <= 64 * ii2 + 63; c8 += 1)
R[c6][c8] = SCALAR_VAL(0.0);
} else
for (int c8 = max(2560, c6 + 1); c8 <= 2599; c8 += 1)
R[c6][c8] = SCALAR_VAL(0.0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
piotr-skotnicki/tc-optimizer/results/merge-tiling/unparameterized/gramschmidt.c | #pragma omp parallel for | 100 | c6][c8] = SCALAR_VAL(0.0);
}
for (int k = 1; k <= 81; k += 1) {
if (k % 2 == 0) {
<LOOP-START>for (int ii2 = k / 2; ii2 <= 40; ii2 += 1)
for (int c6 = 32 * k - 64; c6 < 32 * k; c6 += 1) {
if (ii2 <= 39) {
for (int c8 = 64 * ii2; c8 <= 64 * ii2 + 63; c8 += 1) {
for (int c10 = 0; c10 <= 1999; c10 += 1)
R[c6][c8] += (Q[c10][c6] * A[c10][c8]);
for (int c10 = 0; c10 <= 1999; c10 += 1)
A[c10][c8] = (A[c10][c8] - (Q[c10][c6] * R[c6][c8]));
}
} else
for (int c8 = 2560; c8 <= 2599; c8 += 1) {
for (int c10 = 0; c10 <= 1999; c10 += 1)
R[c6][c8] += (Q[c10][c6] * A[c10][c8]);
for (int c10 = 0; c10 <= 1999; c10 += 1)
A[c10][c8] = (A[c10][c8] - (Q[c10][c6] * R[c6][c8]));
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
piotr-skotnicki/tc-optimizer/results/merge-tiling/unparameterized/lu.c | #pragma omp parallel for | 100 | (int c9 = 3904; c9 <= 3967; c9 += 1)
A[c6][c8] -= (A[c6][c9] * A[c9][c8]);
} else
<LOOP-START>for (int ii0 = max(0, (k + 1) / 2 - 31); ii0 <= min(62, k); ii0 += 1) {
if (k >= 1) {
if (3 * ii0 >= k) {
for (int ii2 = -ii0 + (k + ii0 + 1) / 2; ii2 <= min(min(61, ii0), k - ii0); ii2 += 1)
for (int c6 = 64 * ii0 + 1; c6 <= min(3999, 64 * ii0 + 64); c6 += 1) {
if (ii0 == 62 && 2 * ii2 + 62 == k) {
A[c6][32 * k - 1984] /= A[32 * k - 1984][32 * k - 1984];
} else if (ii0 + 2 * ii2 == k)
A[c6][32 * k - 32 * ii0] /= A[32 * k - 32 * ii0][32 * k - 32 * ii0];
for (int c8 = max(64 * ii2, 64 * k - 64 * ii0 - 64 * ii2 + 1); c8 <= min(64 * ii2 + 63, c6 - 1); c8 += 1) {
for (int c10 = 64 * k - 64 * ii0 - 64 * ii2; c10 <= min(64 * k - 64 * ii0 - 64 * ii2 + 63, c8 - 1); c10 += 1)
A[c6][c8] -= (A[c6][c10] * A[c10][c8]);
if (ii0 <= 61 && ii0 + 2 * ii2 == k) {
A[c6][c8] /= A[c8][c8];
} else if (ii0 == 62 && 2 * ii2 + 62 == k)
A[c6][c8] /= A[c8][c8];
}
if (3 * ii0 == k && 3 * ii2 == k)
for (int c8 = c6; c8 <= (64 * k / 3) + 63; c8 += 1)
for (int c9 = 64 * k / 3; c9 < c6; c9 += 1)
A[c6][c8] -= (A[c6][c9] * A[c9][c8]);
}
if (k >= 124 && ii0 == 62)
for (int c6 = 3969; c6 <= 3999; c6 += 1)
for (int c8 = 3968; c8 < c6; c8 += 1)
for (int c10 = 64 * k - 7936; c10 < 64 * k - 7872; c10 += 1)
A[c6][c8] -= (A[c6][c10] * A[c10][c8]);
if (k >= 124 && ii0 == 62)
for (int c6 = 3969; c6 <= 3999; c6 += 1)
for (int c8 = c6; c8 <= 3999; c8 += 1)
for (int c9 = 64 * k - 7936; c9 < 64 * k - 7872; c9 += 1)
A[c6][c8] -= (A[c6][c9] * A[c9][c8]);
}
if (ii0 <= 61)
for (int ii2 = max(max(ii0, k - 2 * ii0), -ii0 + (k + ii0) / 2 + 1); ii2 <= min(62, k - ii0); ii2 += 1) {
if (2 * ii0 + ii2 >= k + 1) {
for (int c6 = 64 * ii0 + 1; c6 <= min(64 * ii0 + 64, 64 * ii2 + 63); c6 += 1)
for (int c8 = max(64 * ii2, c6); c8 <= min(3999, 64 * ii2 + 63); c8 += 1)
for (int c9 = 64 * k - 64 * ii0 - 64 * ii2; c9 <= 64 * k - 64 * ii0 - 64 * ii2 + 63; c9 += 1)
A[c6][c8] -= (A[c6][c9] * A[c9][c8]);
} else
for (int c6 = 64 * ii0 + 1; c6 <= 64 * ii0 + 64; c6 += 1)
for (int c8 = 64 * k - 128 * ii0; c8 <= min(3999, 64 * k - 128 * ii0 + 63); c8 += 1)
for (int c9 = 64 * ii0; c9 < c6; c9 += 1)
A[c6][c8] -= (A[c6][c9] * A[c9][c8]);
}
} else
for (int c6 = 1; c6 <= 64; c6 += 1) {
for (int c8 = 0; c8 < c6; c8 += 1) {
for (int c10 = 0; c10 < c8; c10 += 1)
A[c6][c8] -= (A[c6][c10] * A[c10][c8]);
A[c6][c8] /= A[c8][c8];
}
for (int c8 = c6; c8 <= 63; c8 += 1)
for (int c9 = 0; c9 < c6; c9 += 1)
A[c6][c8] -= (A[c6][c9] * A[c9][c8]);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
piotr-skotnicki/tc-optimizer/src/for_decorator.cpp | #pragma omp parallel for"); | 100 | printer = isl_printer_start_line(printer);
printer = isl_printer_print_str(printer, "<LOOP-START>printer = isl_printer_end_line(printer);
}
if (!inline_variables)
{
isl_ast_expr_free(init);
init = isl_ast_expr_from_id(isl_id_alloc(ctx, lb_variable, NULL));
cond = isl_ast_expr_set_op_arg(cond, 1, isl_ast_expr_from_id(isl_id_alloc(ctx, ub_variable, NULL)));
}<LOOP-END> <OMP-START>#pragma omp parallel for");<OMP-END> |
piotr-skotnicki/tc-optimizer/src/for_decorator.cpp | #pragma omp parallel for"); | 100 | printer = isl_printer_start_line(printer);
printer = isl_printer_print_str(printer, "<LOOP-START>printer = isl_printer_end_line(printer);
}
if (!inline_variables)
{
isl_ast_expr_free(init);
init = isl_ast_expr_from_id(isl_id_alloc(ctx, lb_variable, NULL));
cond = isl_ast_expr_set_op_arg(cond, 1, isl_ast_expr_from_id(isl_id_alloc(ctx, ub_variable, NULL)));
}<LOOP-END> <OMP-START>#pragma omp parallel for");<OMP-END> |
openwall/john/src/known_hosts_fmt_plug.c | #pragma omp parallel for | 100 | ypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
SHA_CTX ctx;
memcpy(&ctx, &cur_salt->ipad_ctx, sizeof(ctx));
SHA1_Update(&ctx, saved_key[index], strlen(saved_key[index]));
SHA1_Final((unsigned char*) crypt_out[index], &ctx);
memcpy(&ctx, &cur_salt->opad_ctx, sizeof(ctx));
SHA1_Update(&ctx, crypt_out[index], BINARY_SIZE);
SHA1_Final((unsigned char*) crypt_out[index], &ctx);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/keepass_fmt_plug.c | #pragma omp parallel for | 100 | = 0;
if (any_cracked) {
memset(cracked, 0, cracked_size);
any_cracked = 0;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
unsigned char final_key[32];
unsigned char *decrypted_content;
SHA256_CTX ctx;
unsigned char iv[16];
unsigned char out[32];
int pad_byte;
int datasize;
AES_KEY akey;
Twofish_key tkey;
struct chacha_ctx ckey;
// derive and set decryption key
transform_key(keepass_key[index], cur_salt, final_key);
if (cur_salt->algorithm == 0) {
/* AES decrypt cur_salt->contents with final_key */
memcpy(iv, cur_salt->enc_iv, 16);
AES_set_decrypt_key(final_key, 256, &akey);
} else if (cur_salt->algorithm == 1) {
memcpy(iv, cur_salt->enc_iv, 16);
memset(&tkey, 0, sizeof(Twofish_key));
Twofish_prepare_key(final_key, 32, &tkey);
} else if (cur_salt->algorithm == 2) { // ChaCha20
memcpy(iv, cur_salt->enc_iv, 16);
chacha_keysetup(&ckey, final_key, 256);
chacha_ivsetup(&ckey, iv, NULL, 12);
}
if (cur_salt->version == 1 && cur_salt->algorithm == 0) {
decrypted_content = mem_alloc(cur_salt->contentsize);
AES_cbc_encrypt(cur_salt->contents, decrypted_content,
cur_salt->contentsize, &akey, iv, AES_DECRYPT);
pad_byte = decrypted_content[cur_salt->contentsize - 1];
datasize = cur_salt->contentsize - pad_byte;
SHA256_Init(&ctx);
SHA256_Update(&ctx, decrypted_content, datasize);
SHA256_Final(out, &ctx);
MEM_FREE(decrypted_content);
if (!memcmp(out, cur_salt->contents_hash, 32)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
else if (cur_salt->version == 2 && cur_salt->algorithm == 0) {
unsigned char dec_buf[32];
AES_cbc_encrypt(cur_salt->contents, dec_buf, 32,
&akey, iv, AES_DECRYPT);
if (!memcmp(dec_buf, cur_salt->expected_bytes, 32)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
else if (cur_salt->version == 2 && cur_salt->algorithm == 2) {
unsigned char dec_buf[32];
chacha_decrypt_bytes(&ckey, cur_salt->contents, dec_buf, 32, 20);
if (!memcmp(dec_buf, cur_salt->expected_bytes, 32)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
else if (cur_salt->version == 1 && cur_salt->algorithm == 1) { /* KeePass 1.x with Twofish */
int crypto_size;
decrypted_content = mem_alloc(cur_salt->contentsize);
crypto_size = Twofish_Decrypt(&tkey, cur_salt->contents,
decrypted_content,
cur_salt->contentsize, iv);
datasize = crypto_size; // awesome, right?
if (datasize <= cur_salt->contentsize && datasize > 0) {
SHA256_Init(&ctx);
SHA256_Update(&ctx, decrypted_content, datasize);
SHA256_Final(out, &ctx);
if (!memcmp(out, cur_salt->contents_hash, 32)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
MEM_FREE(decrypted_content);
} else {
// KeePass version 2 with Twofish is TODO. Twofish support under KeePass version 2
// requires a third-party plugin. See http://keepass.info/plugins.html for details.
error_msg("KeePass v2 w/ Twofish not supported yet");
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/django_fmt_plug.c | #pragma omp parallel for | 100 | ypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
#ifdef SIMD_COEF_32
int lens[MIN_KEYS_PER_CRYPT], i;
unsigned char *pin[MIN_KEYS_PER_CRYPT];
union {
uint32_t *pout[MIN_KEYS_PER_CRYPT];
unsigned char *poutc;
} x;
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
lens[i] = strlen(saved_key[i+index]);
pin[i] = (unsigned char*)saved_key[i+index];
x.pout[i] = crypt_out[i+index];
}
pbkdf2_sha256_sse((const unsigned char **)pin, lens, cur_salt->salt.c, strlen((char*)cur_salt->salt.c), cur_salt->iterations, &(x.poutc), 32, 0);
#else
pbkdf2_sha256((unsigned char *)saved_key[index], strlen(saved_key[index]),
cur_salt->salt.c, strlen((char*)cur_salt->salt.c),
cur_salt->iterations, (unsigned char*)crypt_out[index], 32, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/zipmonster_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
unsigned char buffer[BINARY_SIZE];
MD5_CTX ctx;
int n = 49999;
#ifdef SIMD_COEF_32
int j, k;
uint32_t *p, t;
uint8_t ib[64 * SIMD_COEF_32 * SIMD_PARA_MD5 + MEM_ALIGN_SIMD];
uint8_t ob[16 * SIMD_COEF_32 * SIMD_PARA_MD5 + MEM_ALIGN_SIMD];
uint8_t *md5 = mem_align(ib, MEM_ALIGN_SIMD);
uint32_t *crypt_buf = mem_align(ob, MEM_ALIGN_SIMD);
memset(md5, 0, 64 * SIMD_COEF_32 * SIMD_PARA_MD5);
for (j = 0; j < SIMD_COEF_32*SIMD_PARA_MD5; ++j) {
#if ARCH_LITTLE_ENDIAN==1
uint16_t *op = (uint16_t*)&md5[GETPOS(0, j)];
#else
uint16_t *op = (uint16_t*)&md5[GETPOS(3, j)];
MD5_Init(&ctx);
MD5_Update(&ctx, saved_key[index+j], strlen(saved_key[index+j]));
MD5_Final(buffer, &ctx);
for (k = 0; k < 16; ++k) {
#if ARCH_LITTLE_ENDIAN==1
op[0] = itoa16u_w[buffer[k++]];
op[1] = itoa16u_w[buffer[k]];
#else
op[1] = itoa16u_w[buffer[k++]];
op[0] = itoa16u_w[buffer[k]];
op += ((SIMD_COEF_32) << 1);
}
md5[GETPOS(32,j)] = 0x80;
md5[GETPOS(57,j)] = 1;
}
#else
unsigned char hex_buffer[BINARY_SIZE * 2];
MD5_Init(&ctx);
MD5_Update(&ctx, saved_key[index], strlen(saved_key[index]));
MD5_Final(buffer, &ctx);
hex_encode_uppercase(buffer, hex_buffer);
do {
#ifdef SIMD_COEF_32
SIMDmd5body(md5, crypt_buf, NULL, SSEi_MIXED_IN);
// upper case hex encode into the next input buffer.
for (j = 0; j < SIMD_PARA_MD5*SIMD_COEF_32; ++j) {
int i;
#if ARCH_LITTLE_ENDIAN==1
uint16_t *op = (uint16_t*)&md5[GETPOS(0, j)];
#else
uint16_t *op = (uint16_t*)&md5[GETPOS(3, j)];
p = &crypt_buf[(j&(SIMD_COEF_32-1))+(4*SIMD_COEF_32*(j/SIMD_COEF_32))];
for (i = 0; i < 4; ++i) {
t = *p;
p += SIMD_COEF_32;
#if ARCH_LITTLE_ENDIAN==1
op[0] = itoa16u_w[t&0xFF];
op[1] = itoa16u_w[(t>>8)&0xFF];
t >>= 16;
op += ((SIMD_COEF_32) << 1);
op[0] = itoa16u_w[t&0xFF];
op[1] = itoa16u_w[(t>>8)&0xFF];
#else
op[1] = itoa16u_w[t&0xFF];
op[0] = itoa16u_w[(t>>8)&0xFF];
t >>= 16;
op += ((SIMD_COEF_32) << 1);
op[1] = itoa16u_w[t&0xFF];
op[0] = itoa16u_w[(t>>8)&0xFF];
op += ((SIMD_COEF_32) << 1);
}
}
#else
MD5_Init(&ctx);
MD5_Update(&ctx, hex_buffer, BINARY_SIZE * 2);
MD5_Final(buffer, &ctx);
hex_encode_uppercase(buffer, hex_buffer);
--n;
} while (n);
#ifdef SIMD_COEF_32
p = crypt_buf;
for (j = 0; j < SIMD_PARA_MD5*SIMD_COEF_32; j+=SIMD_COEF_32) {
for (k = 0; k < SIMD_COEF_32*4; ++k) {
uint32_t J = j+(k&(SIMD_COEF_32-1)), K = (k/SIMD_COEF_32);
crypt_out[index+J][K] = *p++;
}
}
#else
memcpy((unsigned char*)crypt_out[index], buffer, BINARY_SIZE);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/7z_fmt_plug.c | #pragma omp parallel for | 100 | = index;
}
while (tot_todo % NBKEYS)
indices[tot_todo++] = count;
}
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < tot_todo; index += NBKEYS) {
int j;
if (new_keys)
sevenzip_kdf(index/NBKEYS, indices + index, master[index]);
/* do decryption and checks */
for (j = 0; j < NBKEYS; ++j) {
cracked[indices[index + j]] = sevenzip_decrypt(master[index + j]);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/7z_fmt_plug.c | #pragma omp parallel for | 100 | {
cracked[indices[index + j]] = sevenzip_decrypt(master[index + j]);
}
}
#else
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
/* derive key */
if (new_keys)
sevenzip_kdf(index, master[index]);
/* do decryption and checks */
cracked[index] = sevenzip_decrypt(master[index]);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/truecrypt_fmt_plug.c | #pragma omp parallel for | 100 | #define inner_batch_size 1
#endif
memset(cracked, 0, sizeof(cracked[0]) * count);
#ifdef _OPENMP
<LOOP-START>for (i = 0; i < count; i += inner_batch_size) {
unsigned char keys[INNER_BATCH_MAX_SZ][64];
int lens[INNER_BATCH_MAX_SZ];
int j;
for (j = 0; j < inner_batch_size; ++j) {
lens[j] = strlen((char *)key_buffer[i+j]);
/* zeroing of end by strncpy is important for keyfiles */
strncpy((char*)keys[j], (char*)key_buffer[i+j], 64);
/* process keyfile(s) */
if (psalt->nkeyfiles) {
int t;
/* Apply keyfile pool to passphrase */
for (t = 0; t < KPOOL_SZ; t++)
keys[j][t] += psalt->kpool[t];
lens[j] = 64;
}
}
if (psalt->hash_type == IS_SHA512) {
#if SSE_GROUP_SZ_SHA512
unsigned char *pin[SSE_GROUP_SZ_SHA512];
unsigned char *pout[SSE_GROUP_SZ_SHA512];
for (j = 0; j < SSE_GROUP_SZ_SHA512; ++j) {
pin[j] = keys[j];
pout[j] = keys[j];
}
pbkdf2_sha512_sse((const unsigned char **)pin, lens, psalt->salt, 64, psalt->num_iterations, pout, sizeof(keys[0]), 0);
#else
pbkdf2_sha512((const unsigned char*)keys[0], lens[0], psalt->salt, 64, psalt->num_iterations, keys[0], sizeof(keys[0]), 0);
}
else if (psalt->hash_type == IS_RIPEMD160 || psalt->hash_type == IS_RIPEMD160BOOT)
pbkdf2_ripemd160((const unsigned char*)keys[0], lens[0], psalt->salt, 64, psalt->num_iterations, keys[0], sizeof(keys[0]), 0);
else
pbkdf2_whirlpool((const unsigned char*)keys[0], lens[0], psalt->salt, 64, psalt->num_iterations, keys[0], sizeof(keys[0]), 0);
for (j = 0; j < inner_batch_size; ++j) {
cracked[i+j] = 0;
if (decrypt_and_verify(keys[j], 0) // AES
|| decrypt_and_verify(keys[j], 1) // Twofish
|| decrypt_and_verify(keys[j], 2)) // Serpent
cracked[i+j] = 1;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/encdatavault_pbkdf2_fmt_plug.c | #pragma omp parallel for | 100 | , 0, cracked_size);
any_cracked = 0;
}
nb_keys = 1 << (cur_salt->algo_id - 1);
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_PBKDF2_CRYPT) {
int i, j, key_len;
buffer_128 kdf_out[MIN_KEYS_PER_PBKDF2_CRYPT][ENC_MAX_KEY_NUM];
buffer_128 tmp;
buffer_128 ivs[ENC_MAX_KEY_NUM];
unsigned char result[ENC_KEY_SIZE * ENC_MAX_KEY_NUM] = { 0 };
// Key derviation based on PBKDF2-SHA256.
unsigned char master[MIN_KEYS_PER_PBKDF2_CRYPT][ENC_KEY_SIZE * ENC_MAX_KEY_NUM];
if (cur_salt->version == 1) {
key_len = nb_keys * ENC_KEY_SIZE;
} else {
key_len = ENC_MAX_KEY_NUM * ENC_KEY_SIZE;
}
#ifdef SIMD_COEF_32
int lens[MIN_KEYS_PER_PBKDF2_CRYPT];
unsigned char *pin[MIN_KEYS_PER_PBKDF2_CRYPT], *pout[MIN_KEYS_PER_PBKDF2_CRYPT];
for (i = 0; i < MIN_KEYS_PER_PBKDF2_CRYPT; ++i) {
lens[i] = strlen(saved_key[index + i]);
pin[i] = (unsigned char *)saved_key[index + i];
pout[i] = master[i];
}
pbkdf2_sha256_sse((const unsigned char **)pin, lens, cur_salt->salt, cur_salt->salt_length,
cur_salt->iterations, pout, key_len, 0);
for (i = 0; i < MIN_KEYS_PER_PBKDF2_CRYPT; ++i) {
for (j = 0; j < ENC_MAX_KEY_NUM; j++) {
memcpy(kdf_out[i][j].u8, pout[i] + (j * ENC_KEY_SIZE), ENC_KEY_SIZE);
}
}
#else
for (i = 0; i < MIN_KEYS_PER_PBKDF2_CRYPT; ++i) {
pbkdf2_sha256((unsigned char *)saved_key[index + i], strlen(saved_key[index + i]), cur_salt->salt,
cur_salt->salt_length, cur_salt->iterations, master[i], key_len, 0);
for (j = 0; j < ENC_MAX_KEY_NUM; j++) {
memcpy(kdf_out[i][j].u8, master[i] + (j * ENC_KEY_SIZE), ENC_KEY_SIZE);
}
}
/* AES iterated CTR */
for (i = 0; i < MIN_KEYS_PER_PBKDF2_CRYPT; ++i) {
if (cur_salt->version == 1) {
memcpy(ivs[0].u8, cur_salt->iv, ENC_NONCE_SIZE);
for (j = 1; j < nb_keys; j++) {
memcpy(ivs[j].u8, cur_salt->iv, ENC_NONCE_SIZE);
ivs[j].u64[0] ^= kdf_out[i][j].u64[0];
}
// result buffer is used here to hold the decrypted data.
enc_aes_ctr_iterated(cur_salt->encrypted_data, result, kdf_out[i][0].u8, ivs, AES_BLOCK_SIZE,
nb_keys, 1);
if (!memcmp(result + 4, "\xd2\xc3\xb4\xa1\x00\x00", MIN(cur_salt->encrypted_data_length, ENC_SIG_SIZE - 2))) {
cracked[index + i] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
} else {
// Decrypt keychain
ivs[0].u64[0] = 0;
for (j = 1; j < ENC_MAX_KEY_NUM; j++) {
ivs[j].u64[0] = kdf_out[i][ENC_MAX_KEY_NUM - j].u64[0];
}
// result buffer is used for the decrypted keys from the keychain
enc_aes_ctr_iterated(cur_salt->keychain, result, kdf_out[i][0].u8, ivs, ENC_KEYCHAIN_SIZE,
ENC_MAX_KEY_NUM, 0);
// Decrypt data
memcpy(ivs[0].u8, cur_salt->iv, ENC_NONCE_SIZE);
for (j = 1; j < nb_keys; j++) {
memcpy(ivs[j].u8, cur_salt->iv, ENC_NONCE_SIZE);
memcpy(tmp.u8, result + j * 16, ENC_NONCE_SIZE);
ivs[j].u64[0] ^= tmp.u64[0];
}
// result buffer is reused here to hold the decrypted data.
enc_aes_ctr_iterated(cur_salt->encrypted_data, result, result, ivs, AES_BLOCK_SIZE, nb_keys, 1);
if (!memcmp(result + 4, "\xd2\xc3\xb4\xa1\x00\x00", MIN(cur_salt->encrypted_data_length, ENC_SIG_SIZE - 2))) {
cracked[index + i] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/odf_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
unsigned char key[MIN_KEYS_PER_CRYPT][32];
unsigned char hash[MIN_KEYS_PER_CRYPT][32];
BF_KEY bf_key;
int bf_ivec_pos, i;
unsigned char ivec[8];
unsigned char output[1024];
SHA_CTX ctx;
#ifdef SIMD_COEF_32
int lens[MIN_KEYS_PER_CRYPT];
unsigned char *pin[MIN_KEYS_PER_CRYPT], *pout[MIN_KEYS_PER_CRYPT];
if (cur_salt->checksum_type == 0 && cur_salt->cipher_type == 0) {
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
SHA1_Init(&ctx);
SHA1_Update(&ctx, (unsigned char *)saved_key[index+i], strlen(saved_key[index+i]));
SHA1_Final((unsigned char *)(hash[i]), &ctx);
}
#ifdef SIMD_COEF_32
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
lens[i] = 20;
pin[i] = hash[i];
pout[i] = key[i];
}
pbkdf2_sha1_sse((const unsigned char**)pin, lens, cur_salt->salt,
cur_salt->salt_length,
cur_salt->iterations, pout,
cur_salt->key_size, 0);
#else
pbkdf2_sha1(hash[0], 20, cur_salt->salt,
cur_salt->salt_length,
cur_salt->iterations, key[0],
cur_salt->key_size, 0);
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
unsigned int crypt[5];
bf_ivec_pos = 0;
memcpy(ivec, cur_salt->iv, 8);
BF_set_key(&bf_key, cur_salt->key_size, key[i]);
BF_cfb64_encrypt(cur_salt->content, output, cur_salt->content_length, &bf_key, ivec, &bf_ivec_pos, BF_DECRYPT);
SHA1_Init(&ctx);
SHA1_Update(&ctx, output, cur_salt->original_length);
SHA1_Final((unsigned char*)crypt, &ctx);
crypt_out[index+i][0] = crypt[0];
if (cur_salt->original_length % 64 >= 52 && cur_salt->original_length % 64 <= 55)
SHA1_odf_buggy(output, cur_salt->original_length, crypt);
crypt_out[index+i][1] = crypt[0];
}
}
else {
SHA256_CTX ctx;
AES_KEY akey;
unsigned char iv[16];
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
SHA256_Init(&ctx);
SHA256_Update(&ctx, (unsigned char *)saved_key[index+i], strlen(saved_key[index+i]));
SHA256_Final((unsigned char *)hash[i], &ctx);
}
#ifdef SIMD_COEF_32
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
lens[i] = 32;
pin[i] = hash[i];
pout[i] = key[i];
}
pbkdf2_sha1_sse((const unsigned char**)pin, lens, cur_salt->salt,
cur_salt->salt_length,
cur_salt->iterations, pout,
cur_salt->key_size, 0);
#else
pbkdf2_sha1(hash[0], 32, cur_salt->salt,
cur_salt->salt_length,
cur_salt->iterations, key[0],
cur_salt->key_size, 0);
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
unsigned int crypt[8];
memcpy(iv, cur_salt->iv, 16);
AES_set_decrypt_key(key[i], 256, &akey);
AES_cbc_encrypt(cur_salt->content, output, cur_salt->content_length, &akey, iv, AES_DECRYPT);
SHA256_Init(&ctx);
SHA256_Update(&ctx, output, cur_salt->content_length);
SHA256_Final((unsigned char*)crypt, &ctx);
crypt_out[index+i][0] = crypt[0];
crypt_out[index+i][1] = crypt[0];
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/restic_fmt_plug.c | #pragma omp parallel for default(none) private(index) shared(count, failed, params, max_threads, local, saved_key, cur_salt, crypt_out) | 100 | yescrypt_params_t params = {.N = cur_salt->N, .r = cur_salt->r, .p = cur_salt->p};
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
union {
uint8_t u8[80];
uint64_t u64[10];
} kdf_out;
#ifdef _OPENMP
int t = omp_get_thread_num();
if (t >= max_threads) {
failed = -1;
continue;
}
#else
const int t = 0;
if (yescrypt_kdf(NULL, &local[t], (const uint8_t *)saved_key[index],
strlen(saved_key[index]),
(const uint8_t *)cur_salt->salt, sizeof(cur_salt->salt), ¶ms, kdf_out.u8, 64)) {
failed = errno ? errno : EINVAL;
#ifndef _OPENMP
break;
}
static const union {
uint8_t u8[16];
uint64_t u64[2];
} key_mask = {
.u8 = {
0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f,
0xfc, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x0f
}
};
kdf_out.u64[6] &= key_mask.u64[0];
kdf_out.u64[7] &= key_mask.u64[1];
const uint8_t *poly1305_key = &kdf_out.u8[32];
const unsigned char *nonce = cur_salt->data;
const unsigned char *ciphertext = cur_salt->data + NONCE_SIZE;
AES_KEY aeskey;
AES_set_encrypt_key(poly1305_key, 128, &aeskey);
unsigned char *prepared_key = &kdf_out.u8[48];
AES_ecb_encrypt(nonce, prepared_key + 16, &aeskey, AES_ENCRYPT);
poly1305_auth((unsigned char *)crypt_out[index], ciphertext, 128, prepared_key);
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(index) shared(count, failed, params, max_threads, local, saved_key, cur_salt, crypt_out)<OMP-END> |
openwall/john/src/DOMINOSEC8_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += 3) {
int i, j;
// domino 5 hash - SEC_pwddigest_V1 - -m 8600
if (keys_changed) {
char *k0 = saved_key[index];
char *k1 = saved_key[index + 1];
char *k2 = saved_key[index + 2];
unsigned char digest16[3][16];
domino_big_md_3((unsigned char *)k0, strlen(k0),
(unsigned char *)k1, strlen(k1),
(unsigned char *)k2, strlen(k2),
digest16[0], digest16[1], digest16[2]);
// Not (++i < 16) !
// Domino will do hash of first 34 bytes ignoring The Fact that now
// there is a salt at a beginning of buffer. This means that last 5
// bytes "EEFF)" of password digest are meaningless.
for (i = 0, j = 6; i < 14; i++, j += 2) {
const char *hex2 = hex_table[ARCH_INDEX(digest16[0][i])];
digest34[index][j] = hex2[0];
digest34[index][j + 1] = hex2[1];
hex2 = hex_table[ARCH_INDEX(digest16[1][i])];
digest34[index + 1][j] = hex2[0];
digest34[index + 1][j + 1] = hex2[1];
hex2 = hex_table[ARCH_INDEX(digest16[2][i])];
digest34[index + 2][j] = hex2[0];
digest34[index + 2][j + 1] = hex2[1];
}
}
// domino 6 hash - SEC_pwddigest_V2 - -m 8700
if (salt_changed) {
digest34[index + 2][0] = digest34[index + 1][0] = digest34[index][0] = cur_salt->salt[0];
digest34[index + 2][1] = digest34[index + 1][1] = digest34[index][1] = cur_salt->salt[1];
digest34[index + 2][2] = digest34[index + 1][2] = digest34[index][2] = cur_salt->salt[2];
digest34[index + 2][3] = digest34[index + 1][3] = digest34[index][3] = cur_salt->salt[3];
digest34[index + 2][4] = digest34[index + 1][4] = digest34[index][4] = cur_salt->salt[4];
digest34[index + 2][5] = digest34[index + 1][5] = digest34[index][5] = '(';
}
domino_big_md_3_34(digest34[index], digest34[index + 1],
digest34[index + 2],
(unsigned char *)crypt_out[index],
(unsigned char *)crypt_out[index + 1],
(unsigned char *)crypt_out[index + 2]);
for (i= 0; i < 3; i++) {
// domino 8(.5.x) hash - SEC_pwddigest_V3 - -m 9100
unsigned char buffer[22 + 1] = {0};
unsigned char tmp_hash[22 + 1 + 3 /* "(G)" */] = {0};
memcpy(tmp_hash, cur_salt->salt, 5);
memcpy(tmp_hash + 5, crypt_out[index + i], 16);
domino_encode(tmp_hash, buffer);
sprintf((char*)tmp_hash, "(G%s)", buffer);
pbkdf2_sha1(tmp_hash, 22, cur_salt->salt, 16, cur_salt->iterations, (unsigned char *)crypt_out_real[index+i], 8, 0);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/citrix_ns_fmt_plug.c | #pragma omp parallel for | 100 | nt;
int index;
int loops = (count + MIN_KEYS_PER_CRYPT - 1) / MIN_KEYS_PER_CRYPT;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < loops; ++index) {
#ifdef SIMD_COEF_32
SIMDSHA1body(saved_key[index], (unsigned int*)crypt_key[index], NULL, SSEi_MIXED_IN);
#else
SHA_CTX ctx;
SHA1_Init(&ctx);
SHA1_Update(&ctx, (unsigned char*)saved_salt, SALT_SIZE);
SHA1_Update(&ctx, (unsigned char*)saved_key[index], strlen(saved_key[index]) + 1);
SHA1_Final((unsigned char*)crypt_key[index], &ctx);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/BF_std.c | #pragma omp parallel for | 100 | t, int n)
{
#if BF_mt > 1
int t;
#endif
#if BF_mt > 1 && defined(_OPENMP)
#if defined(WITH_UBSAN)
<LOOP-START>#else
#pragma omp parallel for default(none) private(t) shared(n, BF_init_state, BF_init_key, BF_exp_key, salt, BF_magic_w, BF_out)
for_each_t() {
#if BF_mt > 1
#if BF_X2 == 3
struct BF_ctx BF_current[3];
#elif BF_X2
struct BF_ctx BF_current[2];
#else
struct BF_ctx BF_current;
BF_word L0, R0;
BF_word u1, u2, u3, u4;
#if BF_X2
BF_word L1, R1;
BF_word v1, v2, v3, v4;
#if BF_X2 == 3
BF_word L2, R2;
BF_word w1, w2, w3, w4;
BF_word *ptr;
BF_word count;
#if BF_N > 1
int index;
#if BF_X2 == 3 && BF_mt > 1
int lindex;
for_each_ti() {
int i;
memcpy(BF_current INDEX2.S,
BF_init_state.S, sizeof(BF_current INDEX2.S));
memcpy(BF_current INDEX2.P,
BF_init_key INDEX, sizeof(BF_current INDEX2.P));
L0 = R0 = 0;
for (i = 0; i < BF_ROUNDS + 2; i += 2) {
L0 ^= salt->salt[i & 2];
R0 ^= salt->salt[(i & 2) + 1];
BF_ENCRYPT(BF_current INDEX2, L0, R0);
BF_current INDEX2.P[i] = L0;
BF_current INDEX2.P[i + 1] = R0;
}
ptr = BF_current INDEX2.S[0];
do {
ptr += 4;
L0 ^= salt->salt[(BF_ROUNDS + 2) & 3];
R0 ^= salt->salt[(BF_ROUNDS + 3) & 3];
BF_ENCRYPT(BF_current INDEX2, L0, R0);
*(ptr - 4) = L0;
*(ptr - 3) = R0;
L0 ^= salt->salt[(BF_ROUNDS + 4) & 3];
R0 ^= salt->salt[(BF_ROUNDS + 5) & 3];
BF_ENCRYPT(BF_current INDEX2, L0, R0);
*(ptr - 2) = L0;
*(ptr - 1) = R0;
} while (ptr < &BF_current INDEX2.S[3][0xFF]);
}
count = 1 << salt->rounds;
do {
for_each_ti() {
BF_current INDEX2.P[0] ^= BF_exp_key INDEX[0];
BF_current INDEX2.P[1] ^= BF_exp_key INDEX[1];
BF_current INDEX2.P[2] ^= BF_exp_key INDEX[2];
BF_current INDEX2.P[3] ^= BF_exp_key INDEX[3];
BF_current INDEX2.P[4] ^= BF_exp_key INDEX[4];
BF_current INDEX2.P[5] ^= BF_exp_key INDEX[5];
BF_current INDEX2.P[6] ^= BF_exp_key INDEX[6];
BF_current INDEX2.P[7] ^= BF_exp_key INDEX[7];
BF_current INDEX2.P[8] ^= BF_exp_key INDEX[8];
BF_current INDEX2.P[9] ^= BF_exp_key INDEX[9];
BF_current INDEX2.P[10] ^= BF_exp_key INDEX[10];
BF_current INDEX2.P[11] ^= BF_exp_key INDEX[11];
BF_current INDEX2.P[12] ^= BF_exp_key INDEX[12];
BF_current INDEX2.P[13] ^= BF_exp_key INDEX[13];
BF_current INDEX2.P[14] ^= BF_exp_key INDEX[14];
BF_current INDEX2.P[15] ^= BF_exp_key INDEX[15];
BF_current INDEX2.P[16] ^= BF_exp_key INDEX[16];
BF_current INDEX2.P[17] ^= BF_exp_key INDEX[17];
}
BF_body();
u1 = salt->salt[0];
u2 = salt->salt[1];
u3 = salt->salt[2];
u4 = salt->salt[3];
for_each_ti() {
BF_current INDEX2.P[0] ^= u1;
BF_current INDEX2.P[1] ^= u2;
BF_current INDEX2.P[2] ^= u3;
BF_current INDEX2.P[3] ^= u4;
BF_current INDEX2.P[4] ^= u1;
BF_current INDEX2.P[5] ^= u2;
BF_current INDEX2.P[6] ^= u3;
BF_current INDEX2.P[7] ^= u4;
BF_current INDEX2.P[8] ^= u1;
BF_current INDEX2.P[9] ^= u2;
BF_current INDEX2.P[10] ^= u3;
BF_current INDEX2.P[11] ^= u4;
BF_current INDEX2.P[12] ^= u1;
BF_current INDEX2.P[13] ^= u2;
BF_current INDEX2.P[14] ^= u3;
BF_current INDEX2.P[15] ^= u4;
BF_current INDEX2.P[16] ^= u1;
BF_current INDEX2.P[17] ^= u2;
}
BF_body();
} while (--count);
#if BF_mt == 1
for_each_ti() {
L0 = BF_magic_w[0];
R0 = BF_magic_w[1];
count = 64;
do {
BF_ENCRYPT(BF_current INDEX, L0, R0);
} while (--count);
BF_out INDEX0[0] = L0;
BF_out INDEX0[1] = R0;
}
#else
for_each_ti() {
BF_word L, R;
BF_word u1, u2, u3, u4;
BF_word count;
int i;
memcpy(&BF_out[index], &BF_magic_w,
sizeof(BF_out[index]));
count = 64;
do
for (i = 0; i < 6; i += 2) {
L = BF_out[index][i];
R = BF_out[index][i + 1];
BF_ENCRYPT(BF_current INDEX2, L, R);
BF_out[index][i] = L;
BF_out[index][i + 1] = R;
} while (--count);
/* This has to be bug-compatible with the original implementation :-) */
BF_out[index][5] &= ~(BF_word)0xFF;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/BF_std.c | #pragma omp parallel for default(none) private(t) shared(n, BF_init_state, BF_init_key, BF_exp_key, salt, BF_magic_w, BF_out) | 100 | t;
#endif
#if BF_mt > 1 && defined(_OPENMP)
#if defined(WITH_UBSAN)
#pragma omp parallel for
#else
<LOOP-START>for_each_t() {
#if BF_mt > 1
#if BF_X2 == 3
struct BF_ctx BF_current[3];
#elif BF_X2
struct BF_ctx BF_current[2];
#else
struct BF_ctx BF_current;
BF_word L0, R0;
BF_word u1, u2, u3, u4;
#if BF_X2
BF_word L1, R1;
BF_word v1, v2, v3, v4;
#if BF_X2 == 3
BF_word L2, R2;
BF_word w1, w2, w3, w4;
BF_word *ptr;
BF_word count;
#if BF_N > 1
int index;
#if BF_X2 == 3 && BF_mt > 1
int lindex;
for_each_ti() {
int i;
memcpy(BF_current INDEX2.S,
BF_init_state.S, sizeof(BF_current INDEX2.S));
memcpy(BF_current INDEX2.P,
BF_init_key INDEX, sizeof(BF_current INDEX2.P));
L0 = R0 = 0;
for (i = 0; i < BF_ROUNDS + 2; i += 2) {
L0 ^= salt->salt[i & 2];
R0 ^= salt->salt[(i & 2) + 1];
BF_ENCRYPT(BF_current INDEX2, L0, R0);
BF_current INDEX2.P[i] = L0;
BF_current INDEX2.P[i + 1] = R0;
}
ptr = BF_current INDEX2.S[0];
do {
ptr += 4;
L0 ^= salt->salt[(BF_ROUNDS + 2) & 3];
R0 ^= salt->salt[(BF_ROUNDS + 3) & 3];
BF_ENCRYPT(BF_current INDEX2, L0, R0);
*(ptr - 4) = L0;
*(ptr - 3) = R0;
L0 ^= salt->salt[(BF_ROUNDS + 4) & 3];
R0 ^= salt->salt[(BF_ROUNDS + 5) & 3];
BF_ENCRYPT(BF_current INDEX2, L0, R0);
*(ptr - 2) = L0;
*(ptr - 1) = R0;
} while (ptr < &BF_current INDEX2.S[3][0xFF]);
}
count = 1 << salt->rounds;
do {
for_each_ti() {
BF_current INDEX2.P[0] ^= BF_exp_key INDEX[0];
BF_current INDEX2.P[1] ^= BF_exp_key INDEX[1];
BF_current INDEX2.P[2] ^= BF_exp_key INDEX[2];
BF_current INDEX2.P[3] ^= BF_exp_key INDEX[3];
BF_current INDEX2.P[4] ^= BF_exp_key INDEX[4];
BF_current INDEX2.P[5] ^= BF_exp_key INDEX[5];
BF_current INDEX2.P[6] ^= BF_exp_key INDEX[6];
BF_current INDEX2.P[7] ^= BF_exp_key INDEX[7];
BF_current INDEX2.P[8] ^= BF_exp_key INDEX[8];
BF_current INDEX2.P[9] ^= BF_exp_key INDEX[9];
BF_current INDEX2.P[10] ^= BF_exp_key INDEX[10];
BF_current INDEX2.P[11] ^= BF_exp_key INDEX[11];
BF_current INDEX2.P[12] ^= BF_exp_key INDEX[12];
BF_current INDEX2.P[13] ^= BF_exp_key INDEX[13];
BF_current INDEX2.P[14] ^= BF_exp_key INDEX[14];
BF_current INDEX2.P[15] ^= BF_exp_key INDEX[15];
BF_current INDEX2.P[16] ^= BF_exp_key INDEX[16];
BF_current INDEX2.P[17] ^= BF_exp_key INDEX[17];
}
BF_body();
u1 = salt->salt[0];
u2 = salt->salt[1];
u3 = salt->salt[2];
u4 = salt->salt[3];
for_each_ti() {
BF_current INDEX2.P[0] ^= u1;
BF_current INDEX2.P[1] ^= u2;
BF_current INDEX2.P[2] ^= u3;
BF_current INDEX2.P[3] ^= u4;
BF_current INDEX2.P[4] ^= u1;
BF_current INDEX2.P[5] ^= u2;
BF_current INDEX2.P[6] ^= u3;
BF_current INDEX2.P[7] ^= u4;
BF_current INDEX2.P[8] ^= u1;
BF_current INDEX2.P[9] ^= u2;
BF_current INDEX2.P[10] ^= u3;
BF_current INDEX2.P[11] ^= u4;
BF_current INDEX2.P[12] ^= u1;
BF_current INDEX2.P[13] ^= u2;
BF_current INDEX2.P[14] ^= u3;
BF_current INDEX2.P[15] ^= u4;
BF_current INDEX2.P[16] ^= u1;
BF_current INDEX2.P[17] ^= u2;
}
BF_body();
} while (--count);
#if BF_mt == 1
for_each_ti() {
L0 = BF_magic_w[0];
R0 = BF_magic_w[1];
count = 64;
do {
BF_ENCRYPT(BF_current INDEX, L0, R0);
} while (--count);
BF_out INDEX0[0] = L0;
BF_out INDEX0[1] = R0;
}
#else
for_each_ti() {
BF_word L, R;
BF_word u1, u2, u3, u4;
BF_word count;
int i;
memcpy(&BF_out[index], &BF_magic_w,
sizeof(BF_out[index]));
count = 64;
do
for (i = 0; i < 6; i += 2) {
L = BF_out[index][i];
R = BF_out[index][i + 1];
BF_ENCRYPT(BF_current INDEX2, L, R);
BF_out[index][i] = L;
BF_out[index][i + 1] = R;
} while (--count);
/* This has to be bug-compatible with the original implementation :-) */
BF_out[index][5] &= ~(BF_word)0xFF;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(t) shared(n, BF_init_state, BF_init_key, BF_exp_key, salt, BF_magic_w, BF_out)<OMP-END> |
openwall/john/src/keyring_fmt_plug.c | #pragma omp parallel for | 100 | = 0;
if (any_cracked) {
memset(cracked, 0, cracked_size);
any_cracked = 0;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index+=MIN_KEYS_PER_CRYPT)
{
int i;
unsigned char (*buffers)[sizeof(cur_salt->ct)];
// This is too big to be on stack. See #1292.
buffers = mem_alloc(MIN_KEYS_PER_CRYPT * sizeof(*buffers));
decrypt_buffer(buffers, index);
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
if (verify_decrypted_buffer(buffers[i], cur_salt->crypto_size)) {
cracked[index+i] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
MEM_FREE(buffers);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/office_fmt_plug.c | #pragma omp parallel for | 100 | inc =
(cur_salt->version == 2013) ? SHA512_LOOP_CNT : SHA1_LOOP_CNT;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += inc) {
if (cur_salt->version == 2007)
GeneratePasswordHashUsingSHA1(index, &encryptionKey[index]);
else if (cur_salt->version == 2010)
GenerateAgileEncryptionKey(index, &verifierKeys1[index]);
else //if (cur_salt->version == 2013)
GenerateAgileEncryptionKey512(index, &verifierKeys512[index]);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/office_fmt_plug.c | #pragma omp parallel for | 100 | int count)
{
ms_office_binary_blob *blob = ((fmt_data*)binary)->blob;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
if (cur_salt->version == 2007)
cracked[index] = PasswordVerifier(blob, encryptionKey[index]);
else if (cur_salt->version == 2010) {
uint8_t decryptedVerifierHashInputBytes[16];
uint8_t decryptedVerifierHashBytes[32];
uint8_t hash[20];
SHA_CTX ctx;
DecryptUsingSymmetricKeyAlgorithm(cur_salt, verifierKeys1[index],
blob->encryptedVerifier,
decryptedVerifierHashInputBytes,
16);
DecryptUsingSymmetricKeyAlgorithm(cur_salt,
&verifierKeys1[index][32],
blob->encryptedVerifierHash,
decryptedVerifierHashBytes, 32);
SHA1_Init(&ctx);
SHA1_Update(&ctx, decryptedVerifierHashInputBytes, 16);
SHA1_Final(hash, &ctx);
cracked[index] = !memcmp(hash, decryptedVerifierHashBytes, 20);
}
else /* if (cur_salt->version == 2013) */ {
uint8_t decryptedVerifierHashInputBytes[16];
uint8_t decryptedVerifierHashBytes[32];
uint8_t hash[64];
SHA512_CTX ctx;
DecryptUsingSymmetricKeyAlgorithm(cur_salt, verifierKeys512[index],
blob->encryptedVerifier,
decryptedVerifierHashInputBytes,
16);
DecryptUsingSymmetricKeyAlgorithm(cur_salt,
&verifierKeys512[index][64],
blob->encryptedVerifierHash,
decryptedVerifierHashBytes, 32);
SHA512_Init(&ctx);
SHA512_Update(&ctx, decryptedVerifierHashInputBytes, 16);
SHA512_Final(hash, &ctx);
cracked[index] = !memcmp(hash, decryptedVerifierHashBytes, 20);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/wpapsk_fmt_plug.c | #pragma omp parallel for default(none) private(j) shared(count, salt, in, out) | 100 | (int count,
wpapsk_password *in, wpapsk_hash *out, wpapsk_salt *salt)
{
int j;
#ifdef _OPENMP
<LOOP-START>for (j = 0; j < count; j++) {
pbkdf2_sha1((const unsigned char*)(in[j].v),
in[j].length,
salt->essid, salt->length,
4096, (unsigned char*)&out[j],
32, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(j) shared(count, salt, in, out)<OMP-END> |
openwall/john/src/wpapsk_fmt_plug.c | #pragma omp parallel for default(none) private(t) shared(count, salt, in, out, loops) | 100 | papsk_salt *salt)
{
int t; // thread count
int loops = (count+NBKEYS-1) / NBKEYS;
#ifdef _OPENMP
<LOOP-START>for (t = 0; t < loops; t++) {
int lens[NBKEYS], i;
unsigned char *pin[NBKEYS];
union {
uint32_t *pout[NBKEYS];
unsigned char *poutc;
} x;
for (i = 0; i < NBKEYS; ++i) {
lens[i] = in[t*NBKEYS+i].length;
pin[i] = (unsigned char*)in[t*NBKEYS+i].v;
x.pout[i] = &out[t*NBKEYS+i].v[0];
}
pbkdf2_sha1_sse((const unsigned char **)pin, lens,
salt->essid, salt->length,
4096, &(x.poutc),
32, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(t) shared(count, salt, in, out, loops)<OMP-END> |
openwall/john/src/oracle12c_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
int index;
const int count = *pcount;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
SHA512_CTX ctx;
int i = 0;
#if SIMD_COEF_64
int lens[SSE_GROUP_SZ_SHA512];
unsigned char *pin[SSE_GROUP_SZ_SHA512];
union {
uint32_t *pout[SSE_GROUP_SZ_SHA512];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_SHA512; ++i) {
lens[i] = strlen(saved_key[index+i]);
pin[i] = (unsigned char*)saved_key[index+i];
x.pout[i] = (uint32_t*)(crypt_out[index+i]);
}
pbkdf2_sha512_sse((const unsigned char **)pin, lens, cur_salt->salt,
cur_salt->saltlen, 4096, &(x.poutc), BINARY_SIZE, 0);
#else
pbkdf2_sha512((const unsigned char*)saved_key[index],
strlen(saved_key[index]), cur_salt->salt,
cur_salt->saltlen, 4096,
(unsigned char*)crypt_out[index], BINARY_SIZE, 0);
for (i = 0; i < MIN_KEYS_PER_CRYPT; i++) {
SHA512_Init(&ctx);
SHA512_Update(&ctx, (unsigned char*)crypt_out[index + i], BINARY_SIZE);
SHA512_Update(&ctx, cur_salt->salt, 16); // AUTH_VFR_DATA first 16 bytes
SHA512_Final((unsigned char*)crypt_out[index + i], &ctx);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/sha1crypt_fmt_plug.c | #pragma omp parallel for | 100 | ll(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index = 0;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
#ifdef SSE_GROUP_SZ_SHA1
int lens[SSE_GROUP_SZ_SHA1], i;
unsigned char *pin[SSE_GROUP_SZ_SHA1];
union {
uint32_t *pout[SSE_GROUP_SZ_SHA1];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_SHA1; ++i) {
lens[i] = strlen(saved_key[index+i]);
pin[i] = (unsigned char*)saved_key[index+i];
x.pout[i] = crypt_out[index+i];
}
pbkdf1_sha1_sse((const unsigned char **)pin, lens,
cur_salt->salt, cur_salt->length,
cur_salt->rounds, &(x.poutc),
BINARY_SIZE, 0);
#else
pbkdf1_sha1((const unsigned char*)(saved_key[index]),
strlen(saved_key[index]),
cur_salt->salt, cur_salt->length,
cur_salt->rounds, (unsigned char*)crypt_out[index],
BINARY_SIZE, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/rawBLAKE2_512_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
(void)blake2b((uint8_t *)crypt_out[index], saved_key[index], NULL, 64, saved_len[index], 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/as400_des_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
DES_cblock des_key;
DES_key_schedule schedule;
int i;
int saved_key_length = strlen(saved_key[index]);
if (saved_key_length <= 8) {
/* process key */
for (i = 0; saved_key[index][i]; i++)
des_key[i] = a2e_precomputed[ARCH_INDEX(saved_key[index][i])];
/* replace missing characters in password by (EBCDIC space (0x40) XOR 0x55) << 1 */
while(i < 8)
des_key[i++] = 0x2a;
DES_set_key_unchecked(&des_key, &schedule);
/* do encryption */
DES_ecb_encrypt((const_DES_cblock*)cur_salt->userid, (DES_cblock*)crypt_out[index], &schedule, DES_ENCRYPT);
}
else {
DES_cblock des_key1, des_key2;
DES_key_schedule schedule1, schedule2;
DES_cblock hash_1, hash_2;
unsigned char output[8];
/* process key */
for (i = 0; i < 8; i++)
des_key1[i] = a2e_precomputed[ARCH_INDEX(saved_key[index][i])];
for (i = 0; i < saved_key_length-8; i++)
des_key2[i] = a2e_precomputed[ARCH_INDEX(saved_key[index][8+i])];
/* replace missing characters in password by (EBCDIC space (0x40) XOR 0x55) << 1 */
while(i < 8)
des_key2[i++] = 0x2a;
DES_set_key_unchecked(&des_key1, &schedule1);
DES_ecb_encrypt((const_DES_cblock*)cur_salt->userid, &hash_1, &schedule1, DES_ENCRYPT);
DES_set_key_unchecked(&des_key2, &schedule2);
DES_ecb_encrypt((const_DES_cblock*)cur_salt->userid, &hash_2, &schedule2, DES_ENCRYPT);
for (i = 0; i < 8; i++) {
output[i] = hash_1[i] ^ hash_2[i];
}
memcpy((unsigned char*)crypt_out[index], output, 8);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/money_fmt_plug.c | #pragma omp parallel for | 100 | *pcount;
int index = 0;
memset(cracked, 0, sizeof(cracked[0]) * cracked_count);
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
unsigned char key[24];
unsigned char out[32];
if (cur_salt->type == 0) {
MD5_CTX mctx;
MD5_Init(&mctx);
MD5_Update(&mctx, saved_key[index], PASSWORD_LENGTH);
MD5_Final(key, &mctx);
} else if (cur_salt->type == 1) {
SHA_CTX sctx;
SHA1_Init(&sctx);
SHA1_Update(&sctx, saved_key[index], PASSWORD_LENGTH);
SHA1_Final(key, &sctx);
}
// combine key[:16] + salt into a key
memcpy(key + PASSWORD_DIGEST_LENGTH, cur_salt->salt, 8);
RC4_single(key, 24, cur_salt->encrypted_bytes, 4, out);
if (memcmp(out, cur_salt->salt, 4) == 0)
cracked[index] = 1;
else
cracked[index] = 0;
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/ssha512_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index+=MIN_KEYS_PER_CRYPT) {
#ifndef SIMD_COEF_64
SHA512_CTX ctx;
SHA512_Init(&ctx);
SHA512_Update(&ctx, saved_key[index], saved_len[index]);
SHA512_Update(&ctx, saved_salt->data.c, saved_salt->len);
SHA512_Final((unsigned char*)crypt_out[index], &ctx);
#else
// We have to append salt (and re-clean buffer if it is dirty),
// then append final length of password.salt
int i, j;
unsigned char *sk = (unsigned char*)saved_key;
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
int idx = i+index;
int x = saved_len[idx];
for (j = 0; j < saved_salt->len; ++j)
sk[GETPOS(x+j,idx)] = saved_salt->data.c[j];
x += j;
sk[GETPOS(x,idx)] = 0x80;
++x;
while (sk[GETPOS(x,idx)]) {
sk[GETPOS(x,idx)] = 0;
++x;
}
*(len_ptr64[idx]) = (saved_len[idx]+saved_salt->len)<<3;
}
SIMDSHA512body(&saved_key[index/SIMD_COEF_64], crypt_out[index/SIMD_COEF_64], NULL, SSEi_MIXED_IN);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/hmacSHA512_fmt_plug.c | #pragma omp parallel for | 100 | EX_FLAGS
#else
const int B_LEN
#endif
)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
#ifdef SIMD_COEF_64
unsigned int i;
if (new_keys) {
SIMDSHA512body(&ipad[index * PAD_SIZE],
(uint64_t*)&prep_ipad[index * BINARY_SIZE],
NULL, SSEi_MIXED_IN|EX_FLAGS);
SIMDSHA512body(&opad[index * PAD_SIZE],
(uint64_t*)&prep_opad[index * BINARY_SIZE],
NULL, SSEi_MIXED_IN|EX_FLAGS);
}
SIMDSHA512body(cur_salt->salt[0],
(uint64_t*)&crypt_key[index * PAD_SIZE],
(uint64_t*)&prep_ipad[index * BINARY_SIZE],
SSEi_MIXED_IN|SSEi_RELOAD|SSEi_OUTPUT_AS_INP_FMT|EX_FLAGS);
for (i = 1; i <= (cur_salt->salt_len + 16) / PAD_SIZE; i++)
SIMDSHA512body(cur_salt->salt[i],
(uint64_t*)&crypt_key[index * PAD_SIZE],
(uint64_t*)&crypt_key[index * PAD_SIZE],
SSEi_MIXED_IN|SSEi_RELOAD_INP_FMT|SSEi_OUTPUT_AS_INP_FMT|EX_FLAGS);
if (EX_FLAGS) {
// NOTE, SSESHA384 will output 64 bytes. We need the first 48 (plus the 0x80 padding).
// so we are forced to 'clean' this crap up, before using the crypt as the input.
uint64_t *pclear = (uint64_t*)&crypt_key[index/SIMD_COEF_64*PAD_SIZE_W*SIMD_COEF_64*8];
for (i = 0; i < MIN_KEYS_PER_CRYPT; i++) {
pclear[48/8*SIMD_COEF_64+(i&(SIMD_COEF_64-1))+i/SIMD_COEF_64*PAD_SIZE_W*SIMD_COEF_64] = 0x8000000000000000ULL;
pclear[48/8*SIMD_COEF_64+(i&(SIMD_COEF_64-1))+i/SIMD_COEF_64*PAD_SIZE_W*SIMD_COEF_64+SIMD_COEF_64] = 0;
}
}
SIMDSHA512body(&crypt_key[index * PAD_SIZE],
(uint64_t*)&crypt_key[index * PAD_SIZE],
(uint64_t*)&prep_opad[index * BINARY_SIZE],
SSEi_MIXED_IN|SSEi_RELOAD|SSEi_OUTPUT_AS_INP_FMT|EX_FLAGS);
#else
SHA512_CTX ctx;
// Note, for oSSL, we really only need SHA512_Init and SHA384_Init. From that point
// on, SHA512_Update/SHA512_Final can be used. Also, jtr internal sha2.c file works
// like that. BUT I am not sure every hash engine works that way, so we are keeping
// the 'full' block.
if (B_LEN == BINARY_SIZE) {
if (new_keys) {
SHA512_Init(&ipad_ctx[index]);
SHA512_Update(&ipad_ctx[index], ipad[index], PAD_SIZE);
SHA512_Init(&opad_ctx[index]);
SHA512_Update(&opad_ctx[index], opad[index], PAD_SIZE);
}
memcpy(&ctx, &ipad_ctx[index], sizeof(ctx));
SHA512_Update( &ctx, cur_salt, strlen( (char*) cur_salt) );
SHA512_Final( (unsigned char*) crypt_key[index], &ctx);
memcpy(&ctx, &opad_ctx[index], sizeof(ctx));
SHA512_Update( &ctx, crypt_key[index], B_LEN);
SHA512_Final( (unsigned char*) crypt_key[index], &ctx);
} else {
if (new_keys) {
SHA384_Init(&ipad_ctx[index]);
SHA384_Update(&ipad_ctx[index], ipad[index], PAD_SIZE);
SHA384_Init(&opad_ctx[index]);
SHA384_Update(&opad_ctx[index], opad[index], PAD_SIZE);
}
memcpy(&ctx, &ipad_ctx[index], sizeof(ctx));
SHA384_Update( &ctx, cur_salt, strlen( (char*) cur_salt) );
SHA384_Final( (unsigned char*) crypt_key[index], &ctx);
memcpy(&ctx, &opad_ctx[index], sizeof(ctx));
SHA384_Update( &ctx, crypt_key[index], B_LEN);
SHA384_Final( (unsigned char*) crypt_key[index], &ctx);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/BFEgg_fmt_plug.c | #pragma omp parallel for | 100 | ypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
if (saved_key[index][0] != 0)
blowfish_encrypt_pass(saved_key[index],
(char*)crypt_out[index]);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/bestcrypt_ve_fmt_plug.c | #pragma omp parallel for | 100 | = 0;
}
static const yescrypt_params_t params = { .N = 0x8000, .r = 16, .p = 1 };
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
unsigned char kdf_out[32];
/* BestCrypt uses CBC mode with a null IV */
unsigned char iv[16] = {0};
unsigned char out[sizeof(cur_salt->encrypted_data)];
SHA256_CTX ctx;
unsigned char sha256_hash[32];
#ifdef _OPENMP
int t = omp_get_thread_num();
if (t >= max_threads) {
failed = -1;
continue;
}
#else
const int t = 0;
if (yescrypt_kdf(NULL, &local[t],
(const uint8_t *)saved_key[index],
strlen(saved_key[index]),
(const uint8_t *)cur_salt->salt,
sizeof(cur_salt->salt),
¶ms,
kdf_out, sizeof(kdf_out))){
failed = errno ? errno : EINVAL;
#ifndef _OPENMP
break;
}
/*
we will now use output of scrypt as key for desired encryption
algorithm in CBC mode
*/
if (cur_salt->enc_algoID == aesId) {
AES_KEY aes_key;
AES_set_decrypt_key(kdf_out, 256, &aes_key);
AES_cbc_encrypt(cur_salt->encrypted_data,
out,
sizeof(cur_salt->encrypted_data),
&aes_key,
iv,
AES_DECRYPT);
} else if(cur_salt->enc_algoID == twofishId) {
Twofish_key tkey;
Twofish_prepare_key(kdf_out, sizeof(kdf_out), &tkey);
Twofish_Decrypt_no_padding(&tkey,
cur_salt->encrypted_data,
out,
sizeof(cur_salt->encrypted_data),
iv);
} else if(cur_salt->enc_algoID == serpentId) {
uint8_t ks[SERPENT_KS];
serpent_set_key(kdf_out, ks);
serpent_cbc_decrypt(cur_salt->encrypted_data,
out,
sizeof(cur_salt->encrypted_data),
ks,
iv);
} else if(cur_salt->enc_algoID == camelliaId) {
CAMELLIA_KEY ck;
Camellia_set_key(kdf_out, 256, &ck);
Camellia_cbc_encrypt(cur_salt->encrypted_data,
out,
sizeof(cur_salt->encrypted_data),
&ck,
iv,
CAMELLIA_DECRYPT);
} /* else if(cur_salt->enc_algoID == rc6Id) {
TODO
}
*/
/* we now compute sha256(decrypted_content[0:0x40]) and
compare it with decrypted_content[0x40:0x60] */
SHA256_Init(&ctx);
SHA256_Update(&ctx, out, 0x40);
SHA256_Final(sha256_hash, &ctx);
cracked[index] = (0 == memcmp(sha256_hash, out + 0x40, 0x20));
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/pbkdf2-hmac-md5_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
#if SIMD_COEF_32
int lens[SSE_GROUP_SZ_MD5], i;
unsigned char *pin[SSE_GROUP_SZ_MD5];
union {
uint32_t *pout[SSE_GROUP_SZ_MD5];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_MD5; ++i) {
lens[i] = strlen(saved_key[index+i]);
pin[i] = (unsigned char*)saved_key[index+i];
x.pout[i] = crypt_out[index+i];
}
pbkdf2_md5_sse((const unsigned char **)pin, lens,
(unsigned char*)cur_salt->salt, cur_salt->length,
cur_salt->rounds, &(x.poutc),
PBKDF2_MDx_BINARY_SIZE, 0);
#else
pbkdf2_md5((unsigned char*)(saved_key[index]),
strlen(saved_key[index]),
(unsigned char*)cur_salt->salt, cur_salt->length,
cur_salt->rounds, (unsigned char*)crypt_out[index],
PBKDF2_MDx_BINARY_SIZE, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/SybaseASE_fmt_plug.c | #pragma omp parallel for | 100 | , struct db_salt *salt)
{
int count = *pcount;
int index;
#ifdef _OPENMP
#if defined(WITH_UBSAN)
<LOOP-START>#else
#ifndef SIMD_COEF_32
#pragma omp parallel for default(none) private(index) shared(dirty, prep_ctx, count, crypt_out, prep_key)
#else
#pragma omp parallel for default(none) private(index) shared(dirty, count, crypt_cache, crypt_out, prep_key, NULL_LIMB)
for (index = 0; index < count; index += MAX_KEYS_PER_CRYPT) {
#ifndef SIMD_COEF_32
SHA256_CTX ctx;
if (dirty) {
SHA256_Init(&prep_ctx[index]);
SHA256_Update(&prep_ctx[index], prep_key[index], 510);
}
memcpy(&ctx, &prep_ctx[index], sizeof(ctx));
SHA256_Update(&ctx, prep_key[index] + 510/2, 8);
SHA256_Final((unsigned char *)crypt_out[index], &ctx);
#else
unsigned char _OBuf[32*MAX_KEYS_PER_CRYPT+MEM_ALIGN_CACHE], *crypt;
uint32_t *crypt32;
crypt = (unsigned char*)mem_align(_OBuf, MEM_ALIGN_CACHE);
crypt32 = (uint32_t*)crypt;
if (dirty) {
SIMDSHA256body(prep_key[index/MAX_KEYS_PER_CRYPT], crypt_cache[index], NULL, SSEi_FLAT_IN|SSEi_FLAT_RELOAD_SWAPLAST);
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][1]), crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_RELOAD_SWAPLAST);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
}
memcpy(crypt32, crypt_cache[index], 32*MAX_KEYS_PER_CRYPT);
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][2]), crypt32, crypt32, SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_RELOAD_SWAPLAST);
// Last one with FLAT_OUT
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][3]), crypt_out[index], crypt32, SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_OUT);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/SybaseASE_fmt_plug.c | #pragma omp parallel for default(none) private(index) shared(dirty, prep_ctx, count, crypt_out, prep_key) | 100 | index;
#ifdef _OPENMP
#if defined(WITH_UBSAN)
#pragma omp parallel for
#else
#ifndef SIMD_COEF_32
<LOOP-START>#else
#pragma omp parallel for default(none) private(index) shared(dirty, count, crypt_cache, crypt_out, prep_key, NULL_LIMB)
for (index = 0; index < count; index += MAX_KEYS_PER_CRYPT) {
#ifndef SIMD_COEF_32
SHA256_CTX ctx;
if (dirty) {
SHA256_Init(&prep_ctx[index]);
SHA256_Update(&prep_ctx[index], prep_key[index], 510);
}
memcpy(&ctx, &prep_ctx[index], sizeof(ctx));
SHA256_Update(&ctx, prep_key[index] + 510/2, 8);
SHA256_Final((unsigned char *)crypt_out[index], &ctx);
#else
unsigned char _OBuf[32*MAX_KEYS_PER_CRYPT+MEM_ALIGN_CACHE], *crypt;
uint32_t *crypt32;
crypt = (unsigned char*)mem_align(_OBuf, MEM_ALIGN_CACHE);
crypt32 = (uint32_t*)crypt;
if (dirty) {
SIMDSHA256body(prep_key[index/MAX_KEYS_PER_CRYPT], crypt_cache[index], NULL, SSEi_FLAT_IN|SSEi_FLAT_RELOAD_SWAPLAST);
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][1]), crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_RELOAD_SWAPLAST);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
}
memcpy(crypt32, crypt_cache[index], 32*MAX_KEYS_PER_CRYPT);
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][2]), crypt32, crypt32, SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_RELOAD_SWAPLAST);
// Last one with FLAT_OUT
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][3]), crypt_out[index], crypt32, SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_OUT);
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(index) shared(dirty, prep_ctx, count, crypt_out, prep_key)<OMP-END> |
openwall/john/src/SybaseASE_fmt_plug.c | #pragma omp parallel for default(none) private(index) shared(dirty, count, crypt_cache, crypt_out, prep_key, NULL_LIMB) | 100 | parallel for default(none) private(index) shared(dirty, prep_ctx, count, crypt_out, prep_key)
#else
<LOOP-START>for (index = 0; index < count; index += MAX_KEYS_PER_CRYPT) {
#ifndef SIMD_COEF_32
SHA256_CTX ctx;
if (dirty) {
SHA256_Init(&prep_ctx[index]);
SHA256_Update(&prep_ctx[index], prep_key[index], 510);
}
memcpy(&ctx, &prep_ctx[index], sizeof(ctx));
SHA256_Update(&ctx, prep_key[index] + 510/2, 8);
SHA256_Final((unsigned char *)crypt_out[index], &ctx);
#else
unsigned char _OBuf[32*MAX_KEYS_PER_CRYPT+MEM_ALIGN_CACHE], *crypt;
uint32_t *crypt32;
crypt = (unsigned char*)mem_align(_OBuf, MEM_ALIGN_CACHE);
crypt32 = (uint32_t*)crypt;
if (dirty) {
SIMDSHA256body(prep_key[index/MAX_KEYS_PER_CRYPT], crypt_cache[index], NULL, SSEi_FLAT_IN|SSEi_FLAT_RELOAD_SWAPLAST);
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][1]), crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_RELOAD_SWAPLAST);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
SIMDSHA256body(NULL_LIMB, crypt_cache[index], crypt_cache[index], SSEi_FLAT_IN|SSEi_RELOAD);
}
memcpy(crypt32, crypt_cache[index], 32*MAX_KEYS_PER_CRYPT);
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][2]), crypt32, crypt32, SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_RELOAD_SWAPLAST);
// Last one with FLAT_OUT
SIMDSHA256body(&(prep_key[index/MAX_KEYS_PER_CRYPT][3]), crypt_out[index], crypt32, SSEi_FLAT_IN|SSEi_RELOAD|SSEi_FLAT_OUT);
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(index) shared(dirty, count, crypt_cache, crypt_out, prep_key, NULL_LIMB)<OMP-END> |
openwall/john/src/bitlocker_fmt_plug.c | #pragma omp parallel for | 100 | = *pcount;
int index = 0;
memset(cracked, 0, sizeof(cracked[0])*cracked_count);
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MAX_KEYS_PER_CRYPT) {
unsigned char *passwordBuf;
int passwordBufSize, i;
unsigned char out[MAX_KEYS_PER_CRYPT][32];
SHA256_CTX ctx;
unsigned char output[256] = { 0 };
uint32_t data_size = 0;
uint32_t version = 0;
unsigned char *vmk_blob = NULL; // contains volume master key
unsigned char v1, v2;
for (i = 0; i < MAX_KEYS_PER_CRYPT; ++i) {
// do double-sha256 of password encoded in "utf-16-le"
passwordBuf = (unsigned char*)saved_key[index+i];
passwordBufSize = strlen16((UTF16*)passwordBuf) * 2;
SHA256_Init(&ctx);
SHA256_Update(&ctx, passwordBuf, passwordBufSize);
SHA256_Final(out[i], &ctx);
SHA256_Init(&ctx);
SHA256_Update(&ctx, out[i], 32);
SHA256_Final(out[i], &ctx);
// run bitlocker kdf
bitlocker_kdf(out[i], out[i]);
libcaes_crypt_ccm(out[i], 256, 0, cur_salt->iv, IVLEN, // 0 -> decrypt mode
cur_salt->data, cur_salt->data_size,
output, cur_salt->data_size);
// do known plaintext attack (kpa), version and
// data_size checks come from libbde, v1 and v2 (vmk_blob)
// checks come from e-ago
version = output[20] | (output[21] << 8);
data_size = output[16] | (output[17] << 8);
vmk_blob = &output[16]; // the actual volume master key is at offset 28
v1 = vmk_blob[8];
v2 = vmk_blob[9];
if (version == 1 && data_size == 0x2c && v1 <= 0x05 && v2 == 0x20)
cracked[index+i] = 1;
else {
cracked[index+i] = 0;
#ifdef BITLOCKER_DEBUG
print_hex(output, cur_salt->data_size);
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/rawKeccak_512_fmt_plug.c | #pragma omp parallel for | 100 | ypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
Keccak_HashInstance hash;
Keccak_HashInitialize(&hash, 576, 1024, 512, 0x01);
Keccak_HashUpdate(&hash, (unsigned char*)saved_key[index], saved_len[index] * 8);
Keccak_HashFinal(&hash, (unsigned char*)crypt_out[index]);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/AzureAD_fmt_plug.c | #pragma omp parallel for | 100 | ypt_all(int *pcount, struct db_salt *salt) {
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
// * PBKDF2(UTF-16(uc(hex(MD4(UTF-16(password))))), rnd_salt(10), 100, HMAC-SHA256, 32)
// Trivial for now. Can optimized later.
UTF16 Buf[PLAINTEXT_LENGTH+1];
unsigned char hash[16], hex[33];
int len, cnt, i;
MD4_CTX ctx;
#ifdef SIMD_COEF_32
int lens[NBKEYS];
unsigned char *pin[NBKEYS];
union {
uint32_t *pout[NBKEYS];
unsigned char *poutc;
} x;
cnt = NBKEYS;
#else
cnt = 1;
if (dirty)
for (i = 0; i < cnt; ++i) {
len = enc_to_utf16(Buf, PLAINTEXT_LENGTH, (UTF8*)saved_key[index+i], strlen(saved_key[index+i]));
if (len < 0) len = 0;
MD4_Init(&ctx);
MD4_Update(&ctx, Buf, len*2);
MD4_Final(hash, &ctx);
base64_convert(hash, e_b64_raw, 16, hex, e_b64_hex, sizeof(hex), flg_Base64_HEX_UPCASE, 0);
for (len = 0; len < 32; ++len)
saved_nt[index+i][len<<1] = hex[len];
}
#ifdef SIMD_COEF_32
for (i = 0; i < NBKEYS; ++i) {
lens[i] = 64;
pin[i] = (unsigned char*)saved_nt[i+index];
x.pout[i] = crypt_out[i+index];
}
pbkdf2_sha256_sse((const unsigned char **)pin, lens, AzureAD_cur_salt->salt, AzureAD_cur_salt->salt_len, AzureAD_cur_salt->iterations, &(x.poutc), 32, 0);
#else
pbkdf2_sha256((unsigned char *)saved_nt[index], 64,
AzureAD_cur_salt->salt, AzureAD_cur_salt->salt_len,
AzureAD_cur_salt->iterations, (unsigned char*)crypt_out[index], 32, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/adxcrypt_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
adxcrypt(saved_key[index], (unsigned char*)crypt_out[index], strlen(saved_key[index]));
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/vtp_fmt_plug.c | #pragma omp parallel for | 100 | ypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
MD5_CTX ctx;
// space for (secret + SUMMARY ADVERTISEMENT + VLANS DATA + secret)
// derive and append "secret", but do it only the FIRST time for a password (not for extra salts).
if (dirty)
vtp_secret_derive(saved_key[index], saved_len[index], secret[index]);
MD5_Init(&ctx);
MD5_Update(&ctx, secret[index], 16);
// append vtp_summary_packet
MD5_Update(&ctx, &cur_salt->vsp, sizeof(vtp_summary_packet));
// add trailing bytes (for VTP version >= 2)
if (cur_salt->version != 1)
MD5_Update(&ctx, cur_salt->trailer_data, cur_salt->trailer_length);
// append vlans_data
MD5_Update(&ctx, cur_salt->vlans_data, cur_salt->vlans_data_length);
// append "secret" again
MD5_Update(&ctx, secret[index], 16);
MD5_Final((unsigned char*)crypt_out[index], &ctx);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/net_sha1_fmt_plug.c | #pragma omp parallel for | 100 | ur_salt->magic != MAGIC) {
return pDynamicFmt->methods.crypt_all(pcount, salt);
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
SHA_CTX ctx;
SHA1_Init(&ctx);
SHA1_Update(&ctx, cur_salt->salt, cur_salt->length);
SHA1_Update(&ctx, saved_key[index], PLAINTEXT_LENGTH);
SHA1_Final((unsigned char*)crypt_out[index], &ctx);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/pbkdf2-hmac-md4_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
#if SIMD_COEF_32
int lens[SSE_GROUP_SZ_MD4], i;
unsigned char *pin[SSE_GROUP_SZ_MD4];
union {
uint32_t *pout[SSE_GROUP_SZ_MD4];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_MD4; ++i) {
lens[i] = strlen(saved_key[index+i]);
pin[i] = (unsigned char*)saved_key[index+i];
x.pout[i] = crypt_out[index+i];
}
pbkdf2_md4_sse((const unsigned char **)pin, lens,
(unsigned char*)cur_salt->salt, cur_salt->length,
cur_salt->rounds, &(x.poutc),
PBKDF2_MDx_BINARY_SIZE, 0);
#else
pbkdf2_md4((unsigned char*)(saved_key[index]),
strlen(saved_key[index]),
(unsigned char*)cur_salt->salt, cur_salt->length,
cur_salt->rounds, (unsigned char*)crypt_out[index],
PBKDF2_MDx_BINARY_SIZE, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/dmg_fmt_plug.c | #pragma omp parallel for | 100 | ount = *pcount;
int index;
memset(cracked, 0, sizeof(cracked[0])*cracked_count);
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MAX_KEYS_PER_CRYPT)
{
hash_plugin_check_hash(index);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/opencl_DES_bs_h_plug.c | #pragma omp parallel for | 100 | ng %d per-salt kernels, one dot per three salts done: ", num_salts);
#if _OPENMP && PARALLEL_BUILD
<LOOP-START>for (i = 0; i < num_salts; i++) {
init_kernel(salt_list[i], gpu_id, 1, 0, forced_global_keys ? 0 :local_work_size);
#if _OPENMP && PARALLEL_BUILD
if (omp_get_thread_num() == 0)
{
opencl_process_event();
}
if (num_salts > 10 && (i % 3) == 2 && !ocl_any_test_running && john_main_process)
fprintf(stderr, ".");
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/krb5_tgs_fmt_plug.c | #pragma omp parallel for | 100 | dex;
if (any_cracked) {
memset(cracked, 0, cracked_size);
any_cracked = 0;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
unsigned char K3[16];
#ifdef _MSC_VER
unsigned char ddata[65536];
#else
unsigned char ddata[cur_salt->edata2len + 1];
unsigned char checksum[16];
RC4_KEY rckey;
if (new_keys) {
const unsigned char data[4] = {2, 0, 0, 0};
MD4_CTX ctx;
unsigned char key[16];
UTF16 wkey[PLAINTEXT_LENGTH + 1];
int len;
len = enc_to_utf16(wkey, PLAINTEXT_LENGTH,
(UTF8*)saved_key[index],
strlen(saved_key[index]));
if (len <= 0) {
saved_key[index][-len] = 0;
len = strlen16(wkey);
}
MD4_Init(&ctx);
MD4_Update(&ctx, (char*)wkey, 2 * len);
MD4_Final(key, &ctx);
hmac_md5(key, data, 4, saved_K1[index]);
}
hmac_md5(saved_K1[index], cur_salt->edata1, 16, K3);
RC4_set_key(&rckey, 16, K3);
RC4(&rckey, 32, cur_salt->edata2, ddata);
/*
8 first bytes are nonce, then ASN1 structures
(DER encoding: type-length-data)
if length >= 128 bytes:
length is on 2 bytes and type is
\x63\x82 (encode_krb5_enc_tkt_part)
and data is an ASN1 sequence \x30\x82
else:
length is on 1 byte and type is \x63\x81
and data is an ASN1 sequence \x30\x81
next headers follow the same ASN1 "type-length-data" scheme
*/
if (((!memcmp(ddata + 8, "\x63\x82", 2)) && (!memcmp(ddata + 16, "\xA0\x07\x03\x05", 4)))
||
((!memcmp(ddata + 8, "\x63\x81", 2)) && (!memcmp(ddata + 16, "\x03\x05\x00", 3)))) {
/* Early-reject passed, verify checksum */
RC4(&rckey, cur_salt->edata2len - 32, cur_salt->edata2 + 32, ddata + 32);
hmac_md5(saved_K1[index], ddata, cur_salt->edata2len, checksum);
if (!memcmp(checksum, cur_salt->edata1, 16)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/pbkdf2-hmac-sha512_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
#ifdef SSE_GROUP_SZ_SHA512
int lens[SSE_GROUP_SZ_SHA512], i;
unsigned char *pin[SSE_GROUP_SZ_SHA512];
union {
uint32_t *pout[SSE_GROUP_SZ_SHA512];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_SHA512; ++i) {
lens[i] = strlen(saved_key[index+i]);
pin[i] = (unsigned char*)saved_key[index+i];
x.pout[i] = crypt_out[index+i];
}
pbkdf2_sha512_sse((const unsigned char **)pin, lens, cur_salt->salt, cur_salt->length, cur_salt->rounds, &(x.poutc), PBKDF2_SHA512_BINARY_SIZE, 0);
#else
pbkdf2_sha512((const unsigned char*)(saved_key[index]), strlen(saved_key[index]),
cur_salt->salt, cur_salt->length,
cur_salt->rounds, (unsigned char*)crypt_out[index], PBKDF2_SHA512_BINARY_SIZE, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/FG2_fmt_plug.c | #pragma omp parallel for default(none) private(i) shared(ctx_salt, count, saved_key, saved_key_len, crypt_key, cp) | 100 | ruct db_salt *salt)
{
int count = *pcount;
int i = 0;
char *cp = FORTINET_MAGIC;
#ifdef _OPENMP
<LOOP-START>for (i = 0; i < count; i++) {
SHA256_CTX ctx;
memcpy(&ctx, &ctx_salt, sizeof(ctx));
SHA256_Update(&ctx, saved_key[i], saved_key_len[i]);
SHA256_Update(&ctx, cp, FORTINET_MAGIC_LENGTH);
SHA256_Final((unsigned char*)crypt_key[i], &ctx);
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(i) shared(ctx_salt, count, saved_key, saved_key_len, crypt_key, cp)<OMP-END> |
openwall/john/src/opencl_rar_fmt_plug.c | #pragma omp parallel for | 100 | LERROR(clFinish(queue[gpu_id]), "failed in clFinish");
WAIT_UPDATE
WAIT_DONE
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
if (output[index].key.w[4])
check_rar(file, index, output[index].key.c, output[index].iv);
else
cracked[index] = 0;
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/sunmd5_fmt_plug.c | #pragma omp parallel for | 100 | "const int count" we'd work around by
* simply dropping the const from there.)
*/
#ifdef _OPENMP
<LOOP-START>for (group_idx = 0; group_idx < ngroups; ++group_idx) {
int roundasciilen;
int round, maxrounds = BASIC_ROUND_COUNT + getrounds(saved_salt);
char roundascii[8];
int idx_begin = group_idx * group_sz;
int idx_end = idx_begin + group_sz > count ?
count : idx_begin + group_sz;
#ifdef SIMD_COEF_32
int i, j, zs, zb, zs0, zb0;
int bigs[MAX_KEYS_PER_CRYPT], smalls[MAX_KEYS_PER_CRYPT];
int nbig, nsmall;
// int zb2; // used in debugging
memset(input_buf[group_idx], 0, BLK_CNT*MD5_CBLOCK);
/*
* now to delay high-speed md5 implementations that have stuff
* like code inlining, loops unrolled and table lookup
*/
/* this is the 'first' sprintf(roundascii,"%d",round); The rest are at the bottom of the loop */
/* some compilers dont allow strcpy inside OMP block with default(none) used */
//strcpy(roundascii, "0");
roundascii[0] = '0';
roundascii[1] = 0;
roundasciilen=1;
for (round = 0; round < maxrounds; round++) {
#ifdef SIMD_COEF_32
nbig = nsmall = 0;
/*
* now this is computed at bottom of loop (we start properly set at "0", len==1)
* ** code replaced**
* roundasciilen = sprintf(roundascii, "%d", round);
*/
unsigned int idx;
for (idx = idx_begin; idx < idx_end; ++idx) {
pConx px = &data[idx];
int indirect_a =
md5bit((unsigned char*)px->digest, round) ?
coin_step((unsigned char*)px->digest, 1, 4, 0) |
coin_step((unsigned char*)px->digest, 2, 5, 1) |
coin_step((unsigned char*)px->digest, 3, 6, 2) |
coin_step((unsigned char*)px->digest, 4, 7, 3) |
coin_step((unsigned char*)px->digest, 5, 8, 4) |
coin_step((unsigned char*)px->digest, 6, 9, 5) |
coin_step((unsigned char*)px->digest, 7, 10, 6)
:
coin_step((unsigned char*)px->digest, 0, 3, 0) |
coin_step((unsigned char*)px->digest, 1, 4, 1) |
coin_step((unsigned char*)px->digest, 2, 5, 2) |
coin_step((unsigned char*)px->digest, 3, 6, 3) |
coin_step((unsigned char*)px->digest, 4, 7, 4) |
coin_step((unsigned char*)px->digest, 5, 8, 5) |
coin_step((unsigned char*)px->digest, 6, 9, 6);
int indirect_b =
md5bit((unsigned char*)px->digest, round + 64) ?
coin_step((unsigned char*)px->digest, 9, 12, 0) |
coin_step((unsigned char*)px->digest, 10, 13, 1) |
coin_step((unsigned char*)px->digest, 11, 14, 2) |
coin_step((unsigned char*)px->digest, 12, 15, 3) |
coin_step((unsigned char*)px->digest, 13, 0, 4) |
coin_step((unsigned char*)px->digest, 14, 1, 5) |
coin_step((unsigned char*)px->digest, 15, 2, 6)
:
coin_step((unsigned char*)px->digest, 8, 11, 0) |
coin_step((unsigned char*)px->digest, 9, 12, 1) |
coin_step((unsigned char*)px->digest, 10, 13, 2) |
coin_step((unsigned char*)px->digest, 11, 14, 3) |
coin_step((unsigned char*)px->digest, 12, 15, 4) |
coin_step((unsigned char*)px->digest, 13, 0, 5) |
coin_step((unsigned char*)px->digest, 14, 1, 6);
int bit = md5bit((unsigned char*)px->digest, indirect_a) ^ md5bit((unsigned char*)px->digest, indirect_b);
/* xor a coin-toss; if true, mix-in the constant phrase */
#ifndef SIMD_COEF_32
/*
* This is the real 'crypt'. Pretty trival, but there are 2 possible sizes
* there is a 1 block crypte, and a 25 block crypt. They are chosen based
* upon the 'long' coin flip algorithm above.
*/
/* re-initialise the context */
MD5_Init(&px->context);
/* update with the previous digest */
MD5_Update(&px->context, (unsigned char*)px->digest, sizeof(px->digest));
/* optional, add a constant string. This is what makes the 'long' crypt loops */
if (bit)
MD5_Update(&px->context, (unsigned char*)constant_phrase, constant_phrase_size);
/* Add a decimal current roundcount */
MD5_Update(&px->context, (unsigned char*)roundascii, roundasciilen);
MD5_Final((unsigned char*)px->digest, &px->context);
#else
/*
* we do not actually perform the work here. We run through all of the
* keys we are working on, and figure out which ones need 'small' buffers
* and which ones need large buffers. Then we can group them SIMD_COEF_32*SIMD_PARA_MD5
* at a time, later in the process.
*/
if (bit)
bigs[nbig++] = idx;
else
smalls[nsmall++] = idx;
}
#ifdef SIMD_COEF_32
/*
* ok, at this time we know what group each element is in. Either a large
* crypt, or small one. Now group our crypts up based upon the crypt size
* doing COEF*PARA at a time, until we have 2 'partial' buffers left. We
* 'waste' some CPU in them, but that is what happens. If there is only 1 or
* or 2, we may even drop back and use oSSL, it may be faster than an entire
* SSE crypt. We will have to time test, and find where the cut over point is
* but likely it will NOT be 0. The cuttover appears to be 1, meaning that 0,
* only a 1 limb PARA buffer will not be done (and will fall back to oSSL). This
* was for PARA==3 on 32 bit. A much BIGGER difference was in the MAX_KEYS_PER_CRYPT
* increasing this does make for more speed, HOWEVER, it also makes for more lost time
* if the run is stopped, since ALL of the words in the keys buffer would have to be
* redone again (hopefully only redone over the candidates left to test in the input file).
* The choice to use 512 MAX_KEYS seems about right.
*/
/********************************************/
/* get the little ones out of the way first */
/********************************************/
/* first, put the length text, 0x80, and buffer length into the buffer 1 time, not in the loop */
for (j = 0; j < BLK_CNT; ++j) {
unsigned char *cpo = &((unsigned char*)input_buf[group_idx])[PARAGETPOS(0, j)];
int k;
for (k = 0; k < roundasciilen; ++k) {
cpo[GETPOS0(k+16)] = roundascii[k];
}
cpo[GETPOS0(k+16)] = 0x80;
((uint32_t*)cpo)[14 * SIMD_COEF_32]=((16+roundasciilen)<<3);
}
/* now do the 'loop' for the small 1-limb blocks. */
zs = zs0 = zb = zb0 = 0;
// zb2 = 0; /* for debugging */
for (i = 0; i < nsmall-MIN_DROP_BACK; i += BLK_CNT) {
for (j = 0; j < BLK_CNT && zs < nsmall; ++j) {
pConx px = &data[smalls[zs++]];
uint32_t *pi = px->digest;
uint32_t *po = (uint32_t*)&((unsigned char*)input_buf[group_idx])[PARAGETPOS(0, j)];
/*
* digest is flat, input buf is SSE_COEF.
* input_buf is po (output) here, we are writing to it.
*/
po[0] = pi[0];
po[COEF] = pi[1];
po[COEF+COEF] = pi[2];
po[COEF+COEF+COEF] = pi[3];
}
SIMDmd5body(input_buf[group_idx], out_buf[group_idx], NULL, SSEi_MIXED_IN);
/*
* we convert from COEF back to flat. since this data will later be used
* in non linear order, there is no gain trying to keep it in COEF order
*/
for (j = 0; j < BLK_CNT && zs0 < nsmall; ++j) {
uint32_t *pi, *po;
pConx px = &data[smalls[zs0++]];
pi = (uint32_t*)&((unsigned char*)out_buf[group_idx])[PARAGETOUTPOS(0, j)];
po = px->digest;
po[0] = pi[0];
po[1] = pi[COEF];
po[2] = pi[COEF+COEF];
po[3] = pi[COEF+COEF+COEF];
}
}
/* this catches any left over small's, and simply uses oSSL */
while (zs < nsmall) {
pConx px = &data[smalls[zs++]];
MD5_Init(&px->context);
MD5_Update(&px->context, (unsigned char*)px->digest, sizeof(px->digest));
MD5_Update(&px->context, (unsigned char*)roundascii, roundasciilen);
MD5_Final((unsigned char*)px->digest, &px->context);
}
/*****************************************************************************
* Now do the big ones. These are more complex that the little ones
* (much more complex actually). Here, we have to insert the prior crypt
* into the first 16 bytes (just like in the little ones, but then we have
* our buffer 'pre-loaded' with a 1517 byte string. we append the text number
* after the null byte of that 1517 byte string, then put on the 0x80, and
* then put the bit length. NOTE, that this actually is an array of 25
* SSE_PARA buffer blocks, so there is quite a bit more manipluation of where
* in the buffer to write this. This is most noted in the text number, where
* it spills over from buffer 24 to 25.
*****************************************************************************/
/* first, put the length text, 0x80, and buffer length into the buffer 1 time, not in the loop */
for (j = 0; j < BLK_CNT; ++j) {
unsigned char *cpo23 = &((unsigned char*)input_buf_big[group_idx][23])[PARAGETPOS(0, j)];
unsigned char *cpo24 = &((unsigned char*)input_buf_big[group_idx][24])[PARAGETPOS(0, j)];
uint32_t *po24 = (uint32_t*)cpo24;
*po24 = 0; /* key clean */
cpo23[GETPOS0(61)] = roundascii[0];
switch(roundasciilen) {
case 1:
cpo23[GETPOS0(62)] = 0x80;
cpo23[GETPOS0(63)] = 0; /* key clean. */
break;
case 2:
cpo23[GETPOS0(62)] = roundascii[1];
cpo23[GETPOS0(63)] = 0x80;
break;
case 3:
cpo23[GETPOS0(62)] = roundascii[1];
cpo23[GETPOS0(63)] = roundascii[2];
cpo24[0] = 0x80;
break;
case 4:
cpo23[GETPOS0(62)] = roundascii[1];
cpo23[GETPOS0(63)] = roundascii[2];
cpo24[0] = roundascii[3];
cpo24[1] = 0x80;
break;
case 5:
cpo23[GETPOS0(62)] = roundascii[1];
cpo23[GETPOS0(63)] = roundascii[2];
cpo24[0] = roundascii[3];
cpo24[1] = roundascii[4];
cpo24[2] = 0x80;
break;
case 6:
cpo23[GETPOS0(62)] = roundascii[1];
cpo23[GETPOS0(63)] = roundascii[2];
cpo24[0] = roundascii[3];
cpo24[1] = roundascii[4];
cpo24[2] = roundascii[5];
cpo24[3] = 0x80;
break;
}
po24[14*SIMD_COEF_32]=((16+constant_phrase_size+roundasciilen)<<3);
}
for (i = 0; i < nbig-MIN_DROP_BACK; i += BLK_CNT) {
for (j = 0; j < BLK_CNT && zb < nbig; ++j) {
pConx px = &data[bigs[zb++]];
uint32_t *pi = px->digest;
uint32_t *po = (uint32_t*)&((unsigned char*)input_buf_big[group_idx][0])[PARAGETPOS(0, j)];
/*
* digest is flat, input buf is SSE_COEF.
* input_buf is po (output) here, we are writing to it.
*/
po[0] = pi[0];
po[COEF] = pi[1];
po[COEF+COEF] = pi[2];
po[COEF+COEF+COEF] = pi[3];
}
SIMDmd5body(input_buf_big[group_idx][0], out_buf[group_idx], NULL, SSEi_MIXED_IN);
for (j = 1; j < 25; ++j)
SIMDmd5body(input_buf_big[group_idx][j], out_buf[group_idx], out_buf[group_idx], SSEi_RELOAD|SSEi_MIXED_IN);
for (j = 0; j < BLK_CNT && zb0 < nbig; ++j) {
uint32_t *pi, *po;
pConx px = &data[bigs[zb0++]];
pi = (uint32_t*)&((unsigned char*)out_buf[group_idx])[PARAGETOUTPOS(0, j)];
po = px->digest;
po[0] = pi[0];
po[1] = pi[COEF];
po[2] = pi[COEF+COEF];
po[3] = pi[COEF+COEF+COEF];
}
}
/* this catches any left overs, and simply uses oSSL */
while (zb < nbig) {
pConx px = &data[bigs[zb++]];
MD5_Init(&px->context);
MD5_Update(&px->context, (unsigned char*)px->digest, sizeof(px->digest));
MD5_Update(&px->context, (unsigned char*)constant_phrase, constant_phrase_size);
MD5_Update(&px->context, (unsigned char*)roundascii, roundasciilen);
MD5_Final((unsigned char*)px->digest, &px->context);
}
/*
* this is the equivalent of the original code:
* roundasciilen = sprintf(roundascii, "%d", round);
* that was at the top of this rounds loop. We have moved
* it to the bottom. It does compute one 'extra' value that
* is never used (5001), but it is faster, and that one
* extra value causes no harm.
* we do call the sprintf a few times (at 10, 100, 1000, etc)
* but we only call it there.
*/
if (++roundascii[roundasciilen-1] == '9'+1) {
int j = roundasciilen-1;
if (j > 0) {
do {
roundascii[j] = '0';
++roundascii[--j];
} while (j > 0 && roundascii[j] == '9'+1);
}
if (!j && roundascii[0] == '9'+1) {
/* some compilers dont allow sprintf inside OMP block */
//roundasciilen = sprintf(roundascii, "%d", round+1);
roundascii[0] = '1';
roundascii[roundasciilen++] = '0';
roundascii[roundasciilen] = 0;
}
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/rvary_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
if (dirty) {
DES_cblock des_key;
int i;
/* process key */
for (i = 0; saved_key[index][i]; i++)
des_key[i] = a2e_precomputed[ARCH_INDEX(saved_key[index][i])];
/* replace missing characters in userid by (EBCDIC space (0x40) XOR 0x55) << 1 */
while (i < 8)
des_key[i++] = 0x2a;
DES_set_key_unchecked(&des_key, &schedules[index]);
}
/* DES encrypt the password with the password itself by using the key as salt */
char key[10];
strnzcpy(key, saved_key[index], 9);
ascii2ebcdic((unsigned char *)key);
ebcdic_padding((unsigned char *)key);
DES_ecb_encrypt((const_DES_cblock*)key, (DES_cblock*)crypt_out[index], &schedules[index], DES_ENCRYPT);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/encfs_fmt_plug.c | #pragma omp parallel for | 100 | = 0;
if (any_cracked) {
memset(cracked, 0, cracked_size);
any_cracked = 0;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
int i, j;
unsigned char master[MIN_KEYS_PER_CRYPT][MAX_KEYLENGTH + MAX_IVLENGTH];
unsigned char tmpBuf[sizeof(cur_salt->data)];
unsigned int checksum = 0;
unsigned int checksum2 = 0;
unsigned char out[MIN_KEYS_PER_CRYPT][MAX_KEYLENGTH + MAX_IVLENGTH];
#ifdef SIMD_COEF_32
int len[MIN_KEYS_PER_CRYPT];
unsigned char *pin[MIN_KEYS_PER_CRYPT], *pout[MIN_KEYS_PER_CRYPT];
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
len[i] = strlen(saved_key[i+index]);
pin[i] = (unsigned char*)saved_key[i+index];
pout[i] = out[i];
}
pbkdf2_sha1_sse((const unsigned char **)pin, len, cur_salt->salt, cur_salt->saltLen, cur_salt->iterations, pout, cur_salt->keySize + cur_salt->ivLength, 0);
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i)
memcpy(master[i], out[i], cur_salt->keySize + cur_salt->ivLength);
#else
pbkdf2_sha1((const unsigned char *)saved_key[index], strlen(saved_key[index]), cur_salt->salt, cur_salt->saltLen, cur_salt->iterations, out[0], cur_salt->keySize + cur_salt->ivLength, 0);
memcpy(master[0], out[0], cur_salt->keySize + cur_salt->ivLength);
for (j = 0; j < MIN_KEYS_PER_CRYPT; ++j) {
// First N bytes are checksum bytes.
for (i=0; i<KEY_CHECKSUM_BYTES; ++i)
checksum = (checksum << 8) | (unsigned int)cur_salt->data[i];
memcpy( tmpBuf, cur_salt->data+KEY_CHECKSUM_BYTES, cur_salt->keySize + cur_salt->ivLength );
encfs_common_streamDecode(cur_salt, tmpBuf, cur_salt->keySize + cur_salt->ivLength ,checksum, master[j]);
checksum2 = encfs_common_MAC_32(cur_salt, tmpBuf, cur_salt->keySize + cur_salt->ivLength, master[j]);
if (checksum2 == checksum) {
cracked[index+j] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/opencl_dashlane_fmt_plug.c | #pragma omp parallel for | 100 | NULL, multi_profilingEvent[4]), "Copy result back");
if (!ocl_autotune_running) {
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
if (dashlane_verify(cur_salt, (unsigned char*)output[index].dk)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/opencl_7z_fmt_plug.c | #pragma omp parallel for | 100 | ULL, multi_profilingEvent[5]),
"Copy result back");
if (!ocl_autotune_running) {
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
sevenzip_hash *derived = (sevenzip_hash*)&outbuffer[index];
if (derived->reject && (sevenzip_trust_padding || sevenzip_salt->type == 0x80))
continue;
/* decrypt and check */
if ((cracked[index] = sevenzip_decrypt((uint8_t*)derived->key)))
{
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/sap_pse_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
unsigned char key[MIN_KEYS_PER_CRYPT][24];
unsigned char iv[MIN_KEYS_PER_CRYPT][8];
int i;
#ifdef SIMD_COEF_32
size_t lens[MIN_KEYS_PER_CRYPT];
size_t clens[MIN_KEYS_PER_CRYPT];
unsigned char *pin[MIN_KEYS_PER_CRYPT], *pout[MIN_KEYS_PER_CRYPT], *iout[MIN_KEYS_PER_CRYPT];
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
lens[i] = saved_len[i+index];
clens[i] = saved_len[i+index];
pin[i] = (unsigned char*)saved_key[i+index];
pout[i] = key[i];
iout[i] = iv[i];
}
pkcs12_pbe_derive_key_simd_sha1(
cur_salt->iterations,
MBEDTLS_PKCS12_DERIVE_KEY, (const unsigned char **)pin, lens,
cur_salt->salt, cur_salt->salt_size, pout, 24);
pkcs12_pbe_derive_key_simd_sha1(
cur_salt->iterations,
MBEDTLS_PKCS12_DERIVE_IV, (const unsigned char **)pin, clens,
cur_salt->salt, cur_salt->salt_size, iout, 8);
#else
for (i = 0; i < MIN_KEYS_PER_CRYPT; i++) {
// derive key
pkcs12_pbe_derive_key(1, cur_salt->iterations,
MBEDTLS_PKCS12_DERIVE_KEY,
(unsigned char*)saved_key[index+i],
saved_len[index+i], cur_salt->salt,
cur_salt->salt_size, key[i], 24);
// derive iv
pkcs12_pbe_derive_key(1, cur_salt->iterations,
MBEDTLS_PKCS12_DERIVE_IV,
(unsigned char*)saved_key[index+i],
saved_len[index+i], cur_salt->salt,
cur_salt->salt_size, iv[i], 8);
}
for (i = 0; i < MIN_KEYS_PER_CRYPT; i++) {
unsigned char out[16];
unsigned char input[PLAINTEXT_LENGTH + 8];
int padbyte;
DES_cblock ivec;
DES_key_schedule ks1, ks2, ks3;
// pin encryption
DES_set_key_unchecked((DES_cblock *) key[i], &ks1);
DES_set_key_unchecked((DES_cblock *) (key[i]+8), &ks2);
DES_set_key_unchecked((DES_cblock *) (key[i]+16), &ks3);
memcpy(ivec, iv[i], 8);
memcpy(input, saved_key[index+i], saved_len[index+i]);
padbyte = 8 - (saved_len[index+i] % 8);
if (padbyte < 8 && padbyte > 0)
memset(input + saved_len[index+i], padbyte, padbyte);
DES_ede3_cbc_encrypt(input, out, 8, &ks1, &ks2, &ks3, &ivec, DES_ENCRYPT); // is a 8 bytes verifier enough?
cracked[index+i] = !memcmp(out, cur_salt->encrypted_pin, 8);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/mongodb_scram_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
int index;
const int count = *pcount;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
#if !defined (SIMD_COEF_32)
SHA_CTX ctx;
MD5_CTX mctx;
unsigned char hexhash[32];
unsigned char hash[16];
unsigned char out[BINARY_SIZE];
MD5_Init(&mctx);
MD5_Update(&mctx, cur_salt->username, strlen((char*)cur_salt->username));
MD5_Update(&mctx, ":mongo:", 7);
MD5_Update(&mctx, saved_key[index], strlen(saved_key[index]));
MD5_Final(hash, &mctx);
hex_encode(hash, 16, hexhash);
pbkdf2_sha1(hexhash, 32, cur_salt->salt, 16,
cur_salt->iterations, out, BINARY_SIZE, 0);
hmac_sha1(out, BINARY_SIZE, (unsigned char*)"Client Key", 10, out, BINARY_SIZE);
SHA1_Init(&ctx);
SHA1_Update(&ctx, out, BINARY_SIZE);
SHA1_Final((unsigned char*)crypt_out[index], &ctx);
#else
SHA_CTX ctx;
MD5_CTX mctx;
int i;
unsigned char hexhash_[SIMD_KEYS][32], *hexhash[SIMD_KEYS];
unsigned char hash[16];
int lens[SIMD_KEYS];
unsigned char out_[SIMD_KEYS][BINARY_SIZE], *out[SIMD_KEYS];
for (i = 0; i < SIMD_KEYS; ++i) {
MD5_Init(&mctx);
MD5_Update(&mctx, cur_salt->username, strlen((char*)cur_salt->username));
MD5_Update(&mctx, ":mongo:", 7);
MD5_Update(&mctx, saved_key[index+i], strlen(saved_key[index+i]));
MD5_Final(hash, &mctx);
hexhash[i] = hexhash_[i];
hex_encode(hash, 16, hexhash[i]);
lens[i] = 32;
out[i] = out_[i];
}
pbkdf2_sha1_sse((const unsigned char **)hexhash, lens, cur_salt->salt, 16,
cur_salt->iterations, out, BINARY_SIZE, 0);
for (i = 0; i < SIMD_KEYS; ++i) {
hmac_sha1(out[i], BINARY_SIZE, (unsigned char*)"Client Key", 10, out[i], BINARY_SIZE);
SHA1_Init(&ctx);
SHA1_Update(&ctx, out[i], BINARY_SIZE);
SHA1_Final((unsigned char*)crypt_out[index+i], &ctx);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/vms_fmt_plug.c | #pragma omp parallel for | 100 | VMS_std_crypt(int *pcount, struct db_salt *salt)
{
int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
uaf_test_password (cur_salt, saved_key[index], 0, crypt_out[index]);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/nt2_fmt_plug.c | #pragma omp parallel for | 100 | nst unsigned int count =
(*pcount + MIN_KEYS_PER_CRYPT - 1) / MIN_KEYS_PER_CRYPT;
#ifdef _OPENMP
<LOOP-START>for (i = 0; i < count; i++) {
#ifdef SIMD_COEF_32
SIMDmd4body(&saved_key[i*NBKEYS*64], (unsigned int*)&crypt_key[i*NBKEYS*DIGEST_SIZE], NULL, SSEi_REVERSE_STEPS | SSEi_MIXED_IN);
#else
MD4_CTX ctx;
MD4_Init( &ctx );
MD4_Update(&ctx, (unsigned char*)saved_key[i], saved_len[i]);
MD4_Final((unsigned char*) crypt_key[i], &ctx);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/keystore_fmt_plug.c | #pragma omp parallel for | 100 | x = 0; index < count; ++index)
MixOrder[index] = index;
tot_todo = count;
#endif
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < tot_todo; index += MIN_KEYS_PER_CRYPT) {
SHA_CTX ctx;
#ifdef SIMD_COEF_32
int x, tid=0, len, idx;
char tmp_sse_out[20*MIN_KEYS_PER_CRYPT+MEM_ALIGN_SIMD];
uint32_t *sse_out;
sse_out = (uint32_t *)mem_align(tmp_sse_out, MEM_ALIGN_SIMD);
#ifdef _OPENMP
tid = omp_get_thread_num();
len = saved_len[MixOrder[index]];
if (len >= 4 && len <= 24) {
unsigned char *po;
po = (unsigned char*)cursimd->first_blk[tid][len-4];
for (x = 0; x < MIN_KEYS_PER_CRYPT; ++x) {
int j;
unsigned char *p;
idx = MixOrder[index+x];
p = (unsigned char*)saved_key[idx];
for (j = 0; j < len; ++j)
po[GETPOS(j*2+1,x)] = p[j];
}
SIMDSHA1body(po, sse_out, NULL, SSEi_MIXED_IN);
po = (unsigned char*)cursimd->ex_data[len-4];
for (x = 0; x < cursimd->n_ex[len-4]; ++x) {
SIMDSHA1body(po, sse_out, sse_out, SSEi_MIXED_IN|SSEi_RELOAD);
po += 64*MIN_KEYS_PER_CRYPT;
}
#ifdef SIMD_COEF_32
// we have to 'marshal' the data back into the SIMD output buf.
// but we only marshal the first 4 bytes.
for (x = 0; x < MIN_KEYS_PER_CRYPT; ++x) {
idx = MixOrder[index+x];
if (idx < count)
#if ARCH_LITTLE_ENDIAN==1
crypt_out[idx][0] = JOHNSWAP(sse_out[5*SIMD_COEF_32*(x/SIMD_COEF_32)+x%SIMD_COEF_32]);
#else
crypt_out[idx][0] = sse_out[5*SIMD_COEF_32*(x/SIMD_COEF_32)+x%SIMD_COEF_32];
}
// we do NOT want to fall through. We handled this
// SIMD block of data already.
continue;
}
if (dirty)
getPreKeyedHash(MixOrder[index]);
if (saved_len[MixOrder[index]] == 0)
memcpy(crypt_out[MixOrder[index]], keystore_cur_salt->data_hash, 20);
else {
memcpy(&ctx, &saved_ctx[MixOrder[index]], sizeof(ctx));
SHA1_Update(&ctx, keystore_cur_salt->data, keystore_cur_salt->data_length);
SHA1_Final((unsigned char*)crypt_out[MixOrder[index]], &ctx);
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/monero_fmt_plug.c | #pragma omp parallel for | 100 | ndex;
if (any_cracked) {
memset(cracked, 0, cracked_size);
any_cracked = 0;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
unsigned char km[64];
unsigned char out[32];
unsigned char iv[IVLEN];
struct chacha_ctx ckey;
// 1
memcpy(iv, cur_salt->ct, IVLEN);
cn_slow_hash(saved_key[index], saved_len[index], (char *)km);
chacha_keysetup(&ckey, km, 256);
chacha_ivsetup(&ckey, iv, NULL, IVLEN);
chacha_decrypt_bytes(&ckey, cur_salt->ct + IVLEN + 2, out, 32, 20);
if (memmem(out, 32, (void*)"key_data", 8) || memmem(out, 32, (void*)"m_creation_timestamp", 20)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
continue;
}
// 2
memcpy(iv, cur_salt->ct, IVLEN);
chacha_keysetup(&ckey, km, 256);
chacha_ivsetup(&ckey, iv, NULL, IVLEN);
chacha_decrypt_bytes(&ckey, cur_salt->ct + IVLEN + 2, out, 32, 8);
if (memmem(out, 32, (void*)"key_data", 8) || memmem(out, 32, (void*)"m_creation_timestamp", 20)) {
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/signal_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
unsigned char key[16];
int keylen = 16;
unsigned char hash[20];
pkcs12_pbe_derive_key(1, cur_salt->iterations,
MBEDTLS_PKCS12_DERIVE_KEY,
(unsigned char*)saved_key[index],
saved_len[index], cur_salt->mac_salt,
cur_salt->mac_salt_size, key, keylen);
hmac_sha1(key, keylen, cur_salt->master_secret, cur_salt->master_secret_size - 20, hash, 20);
cracked[index] = !memcmp(hash, cur_salt->master_secret + cur_salt->master_secret_size - 20, 20);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/dahua_fmt_plug.c | #pragma omp parallel for | 100 | ypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
// hash is compressor(md5(password))
MD5_CTX ctx;
unsigned char *out = (unsigned char*)crypt_out[index];
unsigned char hash[16];
MD5_Init(&ctx);
MD5_Update(&ctx, saved_key[index], saved_len[index]);
MD5_Final(hash, &ctx);
compressor(hash, out);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/putty_fmt_plug.c | #pragma omp parallel for | 100 | = 0;
if (any_cracked) {
memset(cracked, 0, cracked_size);
any_cracked = 0;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
cracked[index] = LAME_ssh2_load_userkey(saved_key[index]);
if (cracked[index])
#ifdef _OPENMP
#pragma omp atomic
any_cracked |= 1;
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/rar_fmt_plug.c | #pragma omp parallel for | 100 | todo++] = index;
}
while (tot_todo % NBKEYS)
indices[tot_todo++] = count;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < tot_todo; index += NBKEYS) {
unsigned int i, j, k;
uint8_t (*RawPsw)[NBKEYS*64] = vec_in[index/NBKEYS];
uint32_t *digest = vec_out[index/NBKEYS];
// all passwords in one batch has the same length
int pw_len = saved_len[indices[index]];
int RawLength = pw_len + 8 + 3;
int cur_len = 0;
int fst_blk = 1;
int cur_buf = 0;
unsigned char tmp1 = 0, tmp2 = 0;
for (i = 0; i < ROUNDS; ++i) {
// copy passwords to vector buffer
for (j = 0; j < NBKEYS; ++j) {
int idx = indices[index + j];
int len = cur_len;
for (k = 0; k < pw_len; ++k) {
RawPsw[(len & 64)>>6][GETPOS(len%64, j)] =
saved_key[UNICODE_LENGTH*idx + k];
len++;
}
for (k = 0; k < 8; ++k) {
RawPsw[(len & 64)>>6][GETPOS(len%64, j)] = saved_salt[k];
len++;
}
RawPsw[(len & 64)>>6][GETPOS(len%64, j)] = (unsigned char)i;
len++;
if ( ((unsigned char) i) == 0) {
tmp1 = (unsigned char)(i >> 8);
tmp2 = (unsigned char)(i >> 16);
}
RawPsw[(len & 64)>>6][GETPOS(len%64, j)] = tmp1;
len++;
RawPsw[(len & 64)>>6][GETPOS(len%64, j)] = tmp2;
}
cur_len += RawLength;
if (i % (ROUNDS / 16) == 0) {
uint8_t *tempin = tmp_in[index/NBKEYS];
uint32_t *tempout = tmp_out[index/NBKEYS];
memcpy(tempin, RawPsw[cur_buf], NBKEYS*64);
for (j = 0; j < NBKEYS; ++j) { // padding
uint32_t *tail;
for (k = RawLength; k < 64; ++k)
tempin[GETPOS(k, j)] = 0;
tempin[GETPOS(RawLength, j)] = 0x80;
#if ARCH_LITTLE_ENDIAN==1
tail = (uint32_t*)&tempin[GETPOS(64 - 1, j)];
#else
tail = (uint32_t*)&tempin[GETPOS(64 - 1 - 3, j)];
*tail = cur_len*8;
}
if (i == 0)
SIMDSHA1body(tempin, tempout, NULL, SSEi_MIXED_IN);
else
SIMDSHA1body(tempin, tempout, digest,
SSEi_MIXED_IN | SSEi_RELOAD);
for (j = 0; j < NBKEYS; ++j) {
int idx = indices[index + j];
aes_iv[idx*16 + i/(ROUNDS/16)] =
(uint8_t)tempout[HASH_IDX(j) + 4*SIMD_COEF_32];
}
}
// swap out and compute digests on the filled buffer
if ((cur_len & 64) != (cur_buf << 6)) {
if (fst_blk)
SIMDSHA1body(RawPsw[cur_buf], digest, NULL, SSEi_MIXED_IN);
else
SIMDSHA1body(RawPsw[cur_buf], digest, digest,
SSEi_MIXED_IN | SSEi_RELOAD);
fst_blk = 0;
cur_buf = 1 - cur_buf;
}
}
// padding
memset(RawPsw[0], 0, sizeof(RawPsw[0]));
for (j = 0; j < NBKEYS; ++j) {
uint32_t *tail;
RawPsw[0][GETPOS(0, j)] = 0x80;
#if ARCH_LITTLE_ENDIAN==1
tail = (uint32_t*)&RawPsw[0][GETPOS(64 - 1, j)];
#else
tail = (uint32_t*)&RawPsw[0][GETPOS(64 - 1 - 3, j)];
*tail = cur_len*8;
}
SIMDSHA1body(RawPsw[0], digest, digest, SSEi_MIXED_IN | SSEi_RELOAD);
for (j = 0; j < NBKEYS; ++j) {
for (i = 0; i < 4; ++i) {
int idx = indices[index + j];
uint32_t *dst = (uint32_t*)&aes_key[idx*16];
#if ARCH_LITTLE_ENDIAN==1
dst[i] = digest[HASH_IDX(j) + i*SIMD_COEF_32];
#else
dst[i] = JOHNSWAP(digest[HASH_IDX(j) + i*SIMD_COEF_32]);
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/rar_fmt_plug.c | #pragma omp parallel for | 100 | (digest[HASH_IDX(j) + i*SIMD_COEF_32]);
#endif
}
}
}
MEM_FREE(indices);
#else
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
int i16 = index*16;
unsigned int i;
unsigned char RawPsw[UNICODE_LENGTH + 8 + 3];
int RawLength;
SHA_CTX ctx, tempctx;
unsigned int digest[5];
unsigned char *PswNum, tempout[20];
RawLength = saved_len[index] + 8 + 3;
PswNum = (unsigned char*) &RawPsw[saved_len[index] + 8];
PswNum[1] = PswNum[2] = 0;
/* derive IV and key for AES from saved_key and
saved_salt, this code block is based on unrarhp's
and unrar's sources */
memcpy(RawPsw, &saved_key[UNICODE_LENGTH * index], saved_len[index]);
memcpy(RawPsw + saved_len[index], saved_salt, 8);
SHA1_Init(&ctx);
for (i = 0; i < ROUNDS; i++) {
PswNum[0] = (unsigned char) i;
if ( ((unsigned char) i) == 0) {
PswNum[1] = (unsigned char) (i >> 8);
PswNum[2] = (unsigned char) (i >> 16);
}
SHA1_Update(&ctx, RawPsw, RawLength);
if (i % (ROUNDS / 16) == 0) {
tempctx = ctx;
SHA1_Final(tempout, &tempctx);
aes_iv[i16 + i / (ROUNDS / 16)] = tempout[19];
}
}
SHA1_Final((unsigned char*)digest, &ctx);
for (i = 0; i < 4; i++) /* reverse byte order */
digest[i] = JOHNSWAP(digest[i]);
memcpy(&aes_key[i16], (unsigned char*)digest, 16);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/rar_fmt_plug.c | #pragma omp parallel for | 100 | ine static void check_all_rar(rar_file *cur_file, int count)
{
unsigned int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++)
check_rar(cur_file, index, &aes_key[index * 16], &aes_iv[index * 16]);
}
static int cmp_all(void *binary, int count)
{
fmt_data *blob = binary;
rar_file *cur_file = blob->blob;
int index;
check_all_rar(cur_file, count);
for (index = 0; index < count; index++)
if (cracked[index])
return 1;
return 0;
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/NETLMv2_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int i = 0;
#ifdef _OPENMP
<LOOP-START>for (i = 0; i < count; i++) {
unsigned char ntlm_v2_hash[16];
HMACMD5Context ctx; // can't be moved above the OMP pragma
if (!keys_prepared) {
int len;
unsigned char ntlm[16];
/* Generate 16-byte NTLM hash */
len = E_md4hash(saved_plain[i], saved_len[i], ntlm);
// We do key setup of the next HMAC_MD5 here (once per salt)
hmac_md5_init_K16(ntlm, &saved_ctx[i]);
if (len <= 0)
saved_plain[i][-len] = 0; // match truncation
}
/* HMAC-MD5(Username + Domain, NTLM Hash) */
memcpy(&ctx, &saved_ctx[i], sizeof(ctx));
hmac_md5_update(&challenge[17], (int)challenge[16], &ctx);
hmac_md5_final(ntlm_v2_hash, &ctx);
/* Generate 16-byte non-client nonce portion of LMv2 Response */
/* HMAC-MD5(Challenge + Nonce, NTLMv2 Hash) + Nonce */
hmac_md5(ntlm_v2_hash, challenge, 16, (unsigned char*)output[i]);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/cardano_fmt_plug.c | #pragma omp parallel for | 100 | _len = sizeof(kdf_salt);
// ChaCha20 params
static const int chacha_rounds = 20;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += MIN_KEYS_PER_CRYPT) {
int i;
unsigned char kdf_out[MIN_KEYS_PER_CRYPT][BUF_SIZE];
unsigned char blake_out[MIN_KEYS_PER_CRYPT][PWD_HASH_LEN];
#if SIMD_COEF_64
int lens[MIN_KEYS_PER_CRYPT];
unsigned char *pin[MIN_KEYS_PER_CRYPT]; // blake2b_256 hashed password
unsigned char *pout[MIN_KEYS_PER_CRYPT]; // 40-byte length KDF
for (i = 0; i < MIN_KEYS_PER_CRYPT; ++i) {
// blake2b_256 hash of the password.
blake2b(blake_out[i], (unsigned char *)saved_key[index + i], NULL, PWD_HASH_LEN,
strlen(saved_key[index + i]), 0);
#if SIMD_COEF_64
lens[i] = PWD_HASH_LEN;
pin[i] = (unsigned char *)blake_out[i];
pout[i] = (unsigned char *)kdf_out[i];
}
pbkdf2_sha512_sse((const unsigned char **)pin, lens, (unsigned char *)kdf_salt, kdf_salt_len, kdf_rounds, pout, BUF_SIZE, 0);
#else
pbkdf2_sha512(blake_out[i], PWD_HASH_LEN,
(unsigned char *)kdf_salt, kdf_salt_len, kdf_rounds, kdf_out[i], BUF_SIZE, 0);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/NETLM_fmt_plug.c | #pragma omp parallel for default(none) private(i, ks) shared(count, output, challenge, saved_key) | 100 | pcount, struct db_salt *salt)
{
int count = *pcount;
DES_key_schedule ks;
int i;
#ifdef _OPENMP
<LOOP-START>for (i = 0; i < count; i++) {
/* Just do a partial binary, the first DES operation */
setup_des_key(saved_key[i], &ks);
DES_ecb_encrypt((DES_cblock*)challenge, (DES_cblock*)output[i],
&ks, DES_ENCRYPT);
}<LOOP-END> <OMP-START>#pragma omp parallel for default(none) private(i, ks) shared(count, output, challenge, saved_key)<OMP-END> |
openwall/john/src/crc32_fmt_plug.c | #pragma omp parallel for private(i) | 100 | db_salt *salt)
{
const int count = *pcount;
int i;
switch (crctype) {
case 0:
#ifdef _OPENMP
<LOOP-START>for (i = 0; i < count; ++i) {
CRC32_t crc = crcsalt;
unsigned char *p = (unsigned char*)saved_key[i];
while (*p)
crc = jtr_crc32(crc, *p++);
crcs[i] = crc;
//printf("%s() In: '%s' Out: %08x\n", __FUNCTION__, saved_key[i], ~crc);
}<LOOP-END> <OMP-START>#pragma omp parallel for private(i)<OMP-END> |
openwall/john/src/crc32_fmt_plug.c | #pragma omp parallel for private(i) | 100 | s() In: '%s' Out: %08x\n", __FUNCTION__, saved_key[i], ~crc);
}
break;
case 1:
#ifdef _OPENMP
<LOOP-START>for (i = 0; i < count; ++i) {
CRC32_t crc = crcsalt;
unsigned char *p = (unsigned char*)saved_key[i];
while (*p)
crc = jtr_crc32c(crc, *p++);
crcs[i] = crc;
//printf("%s() In: '%s' Out: %08x\n", __FUNCTION__, saved_key[i], ~crc);
}<LOOP-END> <OMP-START>#pragma omp parallel for private(i)<OMP-END> |
openwall/john/src/aix_ssha_fmt_plug.c | #pragma omp parallel for | 100 | default:
#ifdef SSE_GROUP_SZ_SHA512
inc = SSE_GROUP_SZ_SHA512;
#endif
break;
}
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index += inc)
{
int j = index;
while (j < index + inc) {
if (cur_salt->type == 1) {
#ifdef SSE_GROUP_SZ_SHA1
int lens[SSE_GROUP_SZ_SHA1], i;
unsigned char *pin[SSE_GROUP_SZ_SHA1];
union {
uint32_t *pout[SSE_GROUP_SZ_SHA1];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_SHA1; ++i) {
lens[i] = strlen(saved_key[j]);
pin[i] = (unsigned char*)(saved_key[j]);
x.pout[i] = crypt_out[j];
++j;
}
pbkdf2_sha1_sse((const unsigned char **)pin, lens, cur_salt->salt, strlen((char*)cur_salt->salt), cur_salt->iterations, &(x.poutc), BINARY_SIZE, 0);
#else
pbkdf2_sha1((const unsigned char*)(saved_key[j]), strlen(saved_key[j]),
cur_salt->salt, strlen((char*)cur_salt->salt),
cur_salt->iterations, (unsigned char*)crypt_out[j], BINARY_SIZE, 0);
++j;
}
else if (cur_salt->type == 256) {
#ifdef SSE_GROUP_SZ_SHA256
int lens[SSE_GROUP_SZ_SHA256], i;
unsigned char *pin[SSE_GROUP_SZ_SHA256];
union {
uint32_t *pout[SSE_GROUP_SZ_SHA256];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_SHA256; ++i) {
lens[i] = strlen(saved_key[j]);
pin[i] = (unsigned char*)saved_key[j];
x.pout[i] = crypt_out[j];
++j;
}
pbkdf2_sha256_sse((const unsigned char **)pin, lens, cur_salt->salt, strlen((char*)cur_salt->salt), cur_salt->iterations, &(x.poutc), BINARY_SIZE, 0);
#else
pbkdf2_sha256((const unsigned char*)(saved_key[j]), strlen(saved_key[j]),
cur_salt->salt, strlen((char*)cur_salt->salt),
cur_salt->iterations, (unsigned char*)crypt_out[j], BINARY_SIZE, 0);
++j;
}
else {
#ifdef SSE_GROUP_SZ_SHA512
int lens[SSE_GROUP_SZ_SHA512], i;
unsigned char *pin[SSE_GROUP_SZ_SHA512];
union {
uint32_t *pout[SSE_GROUP_SZ_SHA512];
unsigned char *poutc;
} x;
for (i = 0; i < SSE_GROUP_SZ_SHA512; ++i) {
lens[i] = strlen(saved_key[j]);
pin[i] = (unsigned char*)saved_key[j];
x.pout[i] = crypt_out[j];
++j;
}
pbkdf2_sha512_sse((const unsigned char **)pin, lens, cur_salt->salt, strlen((char*)cur_salt->salt), cur_salt->iterations, &(x.poutc), BINARY_SIZE, 0);
#else
pbkdf2_sha512((const unsigned char*)(saved_key[j]), strlen(saved_key[j]),
cur_salt->salt, strlen((char*)cur_salt->salt),
cur_salt->iterations, (unsigned char*)crypt_out[j], BINARY_SIZE, 0);
++j;
}
}
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
openwall/john/src/DMD5_fmt_plug.c | #pragma omp parallel for | 100 | pt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
#ifdef _OPENMP
<LOOP-START>for (index = 0; index < count; index++) {
unsigned char hash[16];
unsigned char hex_hash[MD5_HEX_SIZE];
unsigned char *ptr_src, *ptr_dst;
MD5_CTX ctx;
int i;
MD5_Init(&ctx);
// "username:realm"
MD5_Update(&ctx, cur_salt->login_id, cur_salt->login_id_len);
// "password"
MD5_Update(&ctx, saved_key[index], strlen(saved_key[index]));
MD5_Final(hash, &ctx);
MD5_Init(&ctx);
// previous result
MD5_Update(&ctx, hash, BINARY_SIZE);
// ":nonce:cnonce[:authzid]"
MD5_Update(&ctx, cur_salt->nonces, cur_salt->nonces_len);
MD5_Final(hash, &ctx);
// hexify
ptr_src = hash;
ptr_dst = hex_hash;
for (i = 0; i < BINARY_SIZE; ++i) {
unsigned char v = *ptr_src++;
*ptr_dst++ = itoa16_shr_04[ARCH_INDEX(v)];
*ptr_dst++ = itoa16_and_0f[ARCH_INDEX(v)];
}
MD5_Init(&ctx);
// previous result, in hex
MD5_Update(&ctx, hex_hash, MD5_HEX_SIZE);
// ":nonce:nc:cnonce:qop:hex_A2_hash
MD5_Update(&ctx, cur_salt->prehash_KD, cur_salt->prehash_KD_len);
MD5_Final((unsigned char*)crypt_key[index], &ctx);
}<LOOP-END> <OMP-START>#pragma omp parallel for<OMP-END> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.