1# $FreeBSD: stable/11/usr.sbin/wpa/Makefile.crypto 346981 2019-05-01 01:43:17Z cy $
2
3.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
4SRCS+=	crypto_openssl.c random.c sha1-prf.c sha256-prf.c sha256-tlsprf.c \
5	sha512.c
6LIBADD+=	ssl crypto
7CFLAGS+= -DCONFIG_SHA256
8.else
9CFLAGS+=-DCONFIG_CRYPTO_INTERNAL
10SRCS+=	crypto_internal.c random.c
11CONFIG_INTERNAL_AES=y
12CONFIG_INTERNAL_DES=y
13CONFIG_INTERNAL_MD4=y
14CONFIG_INTERNAL_MD5=y
15CONFIG_INTERNAL_RC4=y
16CONFIG_INTERNAL_SHA1=y
17NEED_SHA256=y
18CONFIG_INTERNAL_SHA256=y
19CONFIG_INTERNAL_TLS=y
20CONFIG_INTERNAL_DH5=y
21CONFIG_INTERNAL_DH=y
22NEED_AES_ENC=true
23NEED_AES_CBC=true
24.endif
25NEED_AES_OMAC1=true
26
27.if defined(TLS_FUNCS)
28NEED_TLS_PRF=y
29.if defined(CONFIG_INTERNAL_TLS)
30CFLAGS+=-DCONFIG_INTERNAL_LIBTOMMATH \
31	-DCONFIG_TLS_INTERNAL_CLIENT
32SRCS+=	asn1.c \
33	bignum.c \
34	crypto_internal-cipher.c \
35	crypto_internal-modexp.c \
36	crypto_internal-rsa.c \
37	pkcs1.c \
38	pkcs5.c \
39	pkcs8.c \
40	rsa.c \
41	tls_internal.c \
42	tlsv1_common.c \
43	tlsv1_record.c \
44	tlsv1_cred.c \
45	tlsv1_client.c \
46	tlsv1_client_write.c \
47	tlsv1_client_read.c \
48	x509v3.c
49NEED_DES=y
50NEED_MD4=y
51NEED_RC4=y
52.else
53CFLAGS+=-DEAP_TLS_OPENSSL
54SRCS+=	tls_openssl.c tls_openssl_ocsp.c
55.endif
56.endif
57
58.if defined(CONFIG_INTERNAL_AES)
59SRCS+=	aes-unwrap.c aes-wrap.c \
60	aes-internal.c \
61	aes-internal-dec.c \
62	aes-internal-enc.c
63.endif
64
65.if defined(NEED_AES_CBC)
66SRCS+=	aes-cbc.c
67.endif
68
69.if defined(NEED_AES_EAX)
70SRCS+=	aes-eax.c
71NEED_AES_CTR=y
72.endif
73
74.if defined(NEED_AES_CTR)
75SRCS+=	aes-ctr.c
76.endif
77
78.if defined(NEED_AES_ENCBLOCK)
79SRCS+=	aes-encblock.c
80.endif
81
82.if defined(NEED_AES_OMAC1)
83SRCS+=	aes-omac1.c
84.endif
85
86.if defined(NEED_DES)
87.if defined(CONFIG_INTERNAL_DES)
88SRCS+=	des-internal.c
89.endif
90.endif
91
92.if defined(NEED_MD4)
93.if defined(CONFIG_INTERNAL_MD4)
94SRCS+=	md4-internal.c
95.endif
96.endif
97
98.if defined(CONFIG_INTERNAL_MD5)
99SRCS+=	md5.c md5-internal.c
100.endif
101
102.if defined(NEED_FIPS186_2_PRF)
103.if defined(CONFIG_INTERNAL_SHA1)
104SRCS+=	fips_prf_internal.c
105.else
106SRCS+=	fips_prf_openssl.c
107.endif
108.endif
109
110.if defined(CONFIG_INTERNAL_RC4)
111SRCS+=	rc4.c
112.endif
113
114.if defined(CONFIG_INTERNAL_SHA1)
115SRCS+=	sha1-internal.c sha1-pbkdf2.c sha1.c sha1-prf.c
116.endif
117
118.if defined(NEED_SHA256)
119CFLAGS+=-DCONFIG_SHA256
120SRCS+=	sha256.c
121.if defined(CONFIG_INTERNAL_SHA256)
122SRCS+=	sha256-internal.c sha256-prf.c
123.endif
124.endif
125
126.if defined(NEED_TLS_PRF)
127SRCS+=	sha1-tlsprf.c
128.endif
129
130.if defined(CONFIG_INTERNAL_DH5)
131SRCS+=	dh_group5.c
132.endif
133
134.if defined(CONFIG_INTERNAL_DH)
135SRCS+=	dh_groups.c
136.endif
137