xref: /optee_os/core/lib/libtomcrypt/sub.mk (revision 8411e6ad673d20c4742ed30c785e3f5cdea54dfa)
1b0104773SPascal Brandglobal-incdirs-y += include
25a913ee7SJerome Forissierglobal-incdirs-y += src/headers
35a913ee7SJerome Forissier
45e2cacd0SJens Wiklandercflags-lib-y += -Wno-declaration-after-statement
55e2cacd0SJens Wiklander
65a913ee7SJerome Forissiercppflags-lib-y += -DARGTYPE=4  # Make LTC_ARGCHK() return on error
7*8411e6adSJerome Forissiercppflags-lib-y += -DLTC_NO_TEST -DLTC_NO_PROTOTYPES
85a913ee7SJerome Forissiercppflags-lib-y += -DLTC_NO_TABLES -DLTC_HASH_HELPERS
9*8411e6adSJerome Forissiercppflags-lib-y += -DLTC_NO_MISC
10*8411e6adSJerome Forissiercppflags-lib-y += -DLTC_HMAC
115a913ee7SJerome Forissiercppflags-lib-$(_CFG_CORE_LTC_SIZE_OPTIMIZATION) += -DLTC_SMALL_CODE
125a913ee7SJerome Forissier
135a913ee7SJerome Forissiercppflags-lib-y += -DLTC_NO_CIPHERS
145a913ee7SJerome Forissier
154576dbb3SJens Wiklanderifeq ($(_CFG_CORE_LTC_AES_DESC),y)
165a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_RIJNDAEL
175a913ee7SJerome Forissierendif
185a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_DES),y)
195a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_DES
205a913ee7SJerome Forissierendif
215a913ee7SJerome Forissier
225a913ee7SJerome Forissiercppflags-lib-y += -DLTC_NO_MODES
235a913ee7SJerome Forissier
245a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_ECB),y)
255a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_ECB_MODE
265a913ee7SJerome Forissierendif
275a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_CBC),y)
285a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_CBC_MODE
295a913ee7SJerome Forissierendif
305a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_CTR),y)
315a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_CTR_MODE
325a913ee7SJerome Forissierendif
335a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_XTS),y)
345a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_XTS_MODE
355a913ee7SJerome Forissierendif
365a913ee7SJerome Forissier
375a913ee7SJerome Forissiercppflags-lib-y += -DLTC_NO_HASHES
385a913ee7SJerome Forissier
395a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_MD5),y)
405a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_MD5
415a913ee7SJerome Forissierendif
425a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_SHA1),y)
435a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_SHA1
445a913ee7SJerome Forissierendif
455a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_SHA224),y)
465a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_SHA224
475a913ee7SJerome Forissierendif
484576dbb3SJens Wiklanderifeq ($(_CFG_CORE_LTC_SHA256_DESC),y)
495a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_SHA256
505a913ee7SJerome Forissierendif
514576dbb3SJens Wiklanderifeq ($(_CFG_CORE_LTC_SHA384_DESC),y)
525a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_SHA384
535a913ee7SJerome Forissierendif
544576dbb3SJens Wiklanderifeq ($(_CFG_CORE_LTC_SHA512_DESC),y)
555a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_SHA512
565a913ee7SJerome Forissierendif
575a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_SHA512_256),y)
585a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_SHA512_256
595a913ee7SJerome Forissierendif
605a913ee7SJerome Forissier
615a913ee7SJerome Forissiercppflags-lib-y += -DLTC_NO_MACS
625a913ee7SJerome Forissier
635a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_HMAC),y)
645a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_HMAC
655a913ee7SJerome Forissierendif
665a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_CMAC),y)
675a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_OMAC
685a913ee7SJerome Forissierendif
695a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_CCM),y)
705a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_CCM_MODE
715a913ee7SJerome Forissierendif
725a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_GCM),y)
735a913ee7SJerome Forissier	cppflags-lib-y += -DLTC_GCM_MODE
745a913ee7SJerome Forissierendif
755a913ee7SJerome Forissier
765a913ee7SJerome Forissiercppflags-lib-y += -DLTC_NO_PK
775a913ee7SJerome Forissier
785a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_RSA),y)
795a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_MRSA
805a913ee7SJerome Forissierendif
815a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_DSA),y)
825a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_MDSA
835a913ee7SJerome Forissierendif
845a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_DH),y)
855a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_MDH
865a913ee7SJerome Forissierendif
875a913ee7SJerome Forissierifeq ($(_CFG_CORE_LTC_ECC),y)
885a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_MECC
895a913ee7SJerome Forissier
905a913ee7SJerome Forissier   # use Shamir's trick for point mul (speeds up signature verification)
915a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_ECC_SHAMIR
925a913ee7SJerome Forissier
935a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_ECC192
945a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_ECC224
955a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_ECC256
965a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_ECC384
975a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_ECC521
985a913ee7SJerome Forissier
995a913ee7SJerome Forissier   # ECC 521 bits is the max supported key size
1005a913ee7SJerome Forissier   cppflags-lib-y += -DLTC_MAX_ECC=521
1015a913ee7SJerome Forissierendif
10272d11d95SJerome Forissierifneq (,$(filter y,$(_CFG_CORE_LTC_SM2_DSA) $(_CFG_CORE_LTC_SM2_PKE)))
103f9a78287SJerome Forissier   cppflags-lib-y += -DLTC_ECC_SM2
104f9a78287SJerome Forissierendif
1055a913ee7SJerome Forissier
10615cb2782SSohaib ul Hassancppflags-lib-$(_CFG_CORE_LTC_X25519) += -DLTC_CURVE25519
10715cb2782SSohaib ul Hassan
1085a913ee7SJerome Forissiercppflags-lib-y += -DLTC_NO_PRNGS -DLTC_FORTUNA
1095a913ee7SJerome Forissier
1105a913ee7SJerome Forissiercflags-lib-$(_CFG_CORE_LTC_SIZE_OPTIMIZATION) += -Os
111b0104773SPascal Brand
112b0104773SPascal Brandsubdirs-y += src
1136648f482SJens Wiklander
114a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_HASH) += hash.c
115a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_HMAC) += hmac.c
116a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_CMAC) += cmac.c
117a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_ECB) += ecb.c
118a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_CBC) += cbc.c
119a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_CTR) += ctr.c
120a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_XTS) += xts.c
121a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_CCM) += ccm.c
122a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_GCM) += gcm.c
123a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_DSA) += dsa.c
124a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_ECC) += ecc.c
125a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_RSA) += rsa.c
126a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_DH) += dh.c
127a1cbb728SJens Wiklandersrcs-$(_CFG_CORE_LTC_AES) += aes.c
128f9429266SJens Wiklandersrcs-$(_CFG_CORE_LTC_AES_ACCEL) += aes_accel.c
1292b49b295SJens Wiklandersrcs-$(_CFG_CORE_LTC_SHA1_ACCEL) += sha1_accel.c
130a828d70fSJens Wiklanderifeq ($(_CFG_CORE_LTC_SHA256_DESC),y)
131a828d70fSJens Wiklandersrcs-$(_CFG_CORE_LTC_SHA256_ACCEL) += sha256_accel.c
132a828d70fSJens Wiklanderendif
13376c7ba4bSJerome Forissiersrcs-$(_CFG_CORE_LTC_SM2_DSA) += sm2-dsa.c
134f9a78287SJerome Forissiersrcs-$(_CFG_CORE_LTC_SM2_PKE) += sm2-pke.c
135c2c877dbSJerome Forissiersrcs-$(_CFG_CORE_LTC_SM2_KEP) += sm2-kep.c
13615cb2782SSohaib ul Hassansrcs-$(_CFG_CORE_LTC_X25519) += x25519.c
1379e8c816aSJerome Forissierifeq ($(_CFG_CORE_LTC_ACIPHER),y)
13878887e60SJens Wiklandersrcs-y += mpi_desc.c
13978887e60SJens Wiklanderendif
14078887e60SJens Wiklander
14178887e60SJens Wiklandersrcs-y += tomcrypt.c
14278887e60SJens Wiklander
143