summaryrefslogtreecommitdiffstats
path: root/src/crypto/bn/CMakeLists.txt
blob: 25663afd73ece108fd546c8be9d415a21f873137 (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
66
67
68
69
70
71
72
73
74
75
include_directories(. .. ../../include)

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

    asm/x86_64-gcc.c
    x86_64-mont.${ASM_EXT}
    x86_64-mont5.${ASM_EXT}
    rsaz-x86_64.${ASM_EXT}
    rsaz-avx2.${ASM_EXT}

    rsaz_exp.c
  )
endif()

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

    bn-586.${ASM_EXT}
    co-586.${ASM_EXT}
    x86-mont.${ASM_EXT}
  )
endif()

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

    armv4-mont.${ASM_EXT}
  )
endif()

add_library(
  bn

  OBJECT

  add.c
  bn.c
  cmp.c
  convert.c
  ctx.c
  div.c
  exponentiation.c
  generic.c
  gcd.c
  kronecker.c
  montgomery.c
  mul.c
  prime.c
  random.c
  shift.c
  sqrt.c

  ${BN_ARCH_SOURCES}
)

perlasm(x86_64-mont.${ASM_EXT} asm/x86_64-mont.pl)
perlasm(x86_64-mont5.${ASM_EXT} asm/x86_64-mont5.pl)
perlasm(rsaz-x86_64.${ASM_EXT} asm/rsaz-x86_64.pl)
perlasm(rsaz-avx2.${ASM_EXT} asm/rsaz-avx2.pl)
perlasm(bn-586.${ASM_EXT} asm/bn-586.pl)
perlasm(co-586.${ASM_EXT} asm/co-586.pl)
perlasm(x86-mont.${ASM_EXT} asm/x86-mont.pl)
perlasm(armv4-mont.${ASM_EXT} asm/armv4-mont.pl)

add_executable(
  bn_test

  bn_test.cc
)

target_link_libraries(bn_test crypto)