summaryrefslogtreecommitdiffstats
path: root/src/crypto/modes/CMakeLists.txt
blob: ffb29b627433e681ae2d91d6222435dad1b5530d (plain)
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
include_directories(. .. ../../include)

if (${ARCH} STREQUAL "x86_64")
  set(
    MODES_ARCH_SOURCES

    aesni-gcm-x86_64.${ASM_EXT}
    ghash-x86_64.${ASM_EXT}
  )
endif()

if (${ARCH} STREQUAL "x86")
  set(
    MODES_ARCH_SOURCES

    ghash-x86.${ASM_EXT}
  )
endif()

if (${ARCH} STREQUAL "arm")
  set(
    MODES_ARCH_SOURCES

    ghash-armv4.${ASM_EXT}
    ghashv8-armx.${ASM_EXT}
  )
endif()

if (${ARCH} STREQUAL "aarch64")
  set(
    MODES_ARCH_SOURCES

    ghashv8-armx.${ASM_EXT}
  )
endif()

add_library(
  modes

  OBJECT

  cbc.c
  ctr.c
  ofb.c
  cfb.c
  gcm.c

  ${MODES_ARCH_SOURCES}
)

perlasm(aesni-gcm-x86_64.${ASM_EXT} asm/aesni-gcm-x86_64.pl)
perlasm(ghash-x86_64.${ASM_EXT} asm/ghash-x86_64.pl)
perlasm(ghash-x86.${ASM_EXT} asm/ghash-x86.pl)
perlasm(ghash-armv4.${ASM_EXT} asm/ghash-armv4.pl)
perlasm(ghashv8-armx.${ASM_EXT} asm/ghashv8-armx.pl)

add_executable(
  gcm_test

  gcm_test.c

  $<TARGET_OBJECTS:test_support>
)

target_link_libraries(gcm_test crypto)