File: _cpyrit_cuda.h

package info (click to toggle)
pyrit 0.5.1%2Bgit20180801-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,596 kB
  • sloc: python: 4,667; ansic: 3,352; cpp: 1,490; asm: 394; lisp: 192; makefile: 15; sed: 7; sh: 6
file content (79 lines) | stat: -rw-r--r-- 2,108 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
#
#    Copyright 2008-2011, Lukas Lueg, lukas.lueg@gmail.com
#
#    This file is part of Pyrit.
#
#    Pyrit is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Pyrit is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Pyrit.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdint.h>
#include <cuda.h>

#ifndef CPYRIT_CUDA
#define CPYRIT_CUDA

#define THREADS_PER_BLOCK 64

#define GET_BE(n,b,i)                            \
{                                                \
    (n) = ( (uint32_t) (b)[(i)    ] << 24 )      \
        | ( (uint32_t) (b)[(i) + 1] << 16 )      \
        | ( (uint32_t) (b)[(i) + 2] <<  8 )      \
        | ( (uint32_t) (b)[(i) + 3]       );     \
}

#define PUT_BE(n,b,i)                             \
{                                                 \
    (b)[(i)    ] = (unsigned char) ( (n) >> 24 ); \
    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 ); \
    (b)[(i) + 3] = (unsigned char) ( (n)       ); \
}

typedef struct {
    uint32_t h0,h1,h2,h3,h4;
} SHA_DEV_CTX;

#define CPY_DEVCTX(src, dst) \
{ \
    dst.h0 = src.h0; dst.h1 = src.h1; \
    dst.h2 = src.h2; dst.h3 = src.h3; \
    dst.h4 = src.h4; \
}

#define CUSAFECALL(cmd) \
{ \
    ret = (cmd); \
    if (ret != CUDA_SUCCESS) \
        goto errout; \
}

#define ALIGN_UP(offset, alignment) \
    (offset) = ((offset) + (alignment) - 1) & ~((alignment) - 1)

typedef struct {
    SHA_DEV_CTX ctx_ipad;
    SHA_DEV_CTX ctx_opad;
    SHA_DEV_CTX e1;
    SHA_DEV_CTX e2;
} gpu_inbuffer;

typedef struct {
    SHA_DEV_CTX pmk1;
    SHA_DEV_CTX pmk2;
} gpu_outbuffer;

#endif