opensc/src/libopensc/Makefile.mak

65 lines
2.8 KiB
Makefile
Raw Normal View History

TOPDIR = ..\..
TARGET = opensc.dll opensc_a.lib
OBJECTS = \
sc.obj ctx.obj log.obj errors.obj \
asn1.obj base64.obj sec.obj card.obj iso7816.obj dir.obj ef-atr.obj \
ef-gdo.obj padding.obj apdu.obj simpletlv.obj gp.obj \
\
pkcs15.obj pkcs15-cert.obj pkcs15-data.obj pkcs15-pin.obj \
pkcs15-prkey.obj pkcs15-pubkey.obj pkcs15-skey.obj \
pkcs15-sec.obj pkcs15-algo.obj pkcs15-cache.obj pkcs15-syn.obj \
\
muscle.obj muscle-filesystem.obj \
\
ctbcs.obj reader-ctapi.obj reader-pcsc.obj reader-openct.obj reader-tr03119.obj \
\
card-setcos.obj card-miocos.obj card-flex.obj card-gpk.obj \
card-cardos.obj card-tcos.obj card-default.obj \
card-mcrd.obj card-starcos.obj card-openpgp.obj card-jcop.obj \
card-oberthur.obj card-belpic.obj card-atrust-acos.obj \
card-entersafe.obj card-epass2003.obj card-coolkey.obj \
card-incrypto34.obj card-cac.obj card-cac1.obj card-cac-common.obj \
card-piv.obj card-muscle.obj \
Attached are the latest mode to OpenSC svn 3462 to use the Makefile.mak files to build on Windows. I got rutoken to compile, and took out the #ifdef's I had in last week. The rutoken programmer declared some variables in the middle of a block rather then having all the declare statements at the beginning of a block as is normally done in C. The Microsoft compile treats this as an error. (Actual many errors.) The makedef.pl is no longer needed, as the exports files can be used. Note that in the original Makefile.mak files only opensc.def and pkcs15init.def were created. winconfig.h has a number of changes. As discussed last week this could be created by autoconf. I also noted that the Active State Perl that was required for the makedef.pl has a psed command that could be used like sed to update winconfig.h. I did not attempt to do this. win32/Make.rules.mak - Use ENABLE_OPENSSL and ENABLE_ZLIB src/tools/Makefile.mak - add the rutoken.tool.exe src/tools/eidenv.c - use PACKAGE_VERSION src/pkcs11/Makefile.mak - reorder the objest to match the list in the Makefile.am. Makes it easier to read. src/include/winconfig.h - The windows version of the config.h Changes based on discussions on the list last week. src/common/Makefile.mak - renamed modules. src/pkcs15init/Makefile.mak - reordered, and added back the rutoken modules replaced the use of makdef.pl to sue the exports file. src/scconf/Makefile.mak - reordered objects. src/libopensc/card-rutoken.c - error. Moved the declares to the beginning of blocks. src/libopensc/Makefile.mak - reorder names, and add rutoken. Use the libopensc.exports file. src/libopensc/pkcs15-prkey-rutoken.c - more moving of declare statements. By Douglas E. Engert http://www.opensc-project.org/pipermail/opensc-devel/2008-April/011011.html git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3464 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-07 19:42:43 +00:00
card-asepcos.obj card-akis.obj card-gemsafeV1.obj card-rutoken.obj \
card-rtecp.obj card-westcos.obj card-myeid.obj \
card-itacns.obj card-authentic.obj \
2013-06-13 15:12:07 +00:00
card-iasecc.obj iasecc-sdo.obj iasecc-sm.obj cwa-dnie.obj cwa14890.obj \
card-sc-hsm.obj card-dnie.obj card-isoApplet.obj pkcs15-coolkey.obj \
card-masktech.obj card-gids.obj card-jpki.obj \
card-npa.obj card-esteid2018.obj card-idprime.obj \
card-edo.obj \
\
Various CardOS V5_* improvements Treat CardOS V5_0 and V5_3 cards differently then older versions: Use card->dvr_data as a pointer to cardos_data_t to store private driver data to pass internally, especially between set security environment and the crypto operations. Sc_get_encoding_flags sets sec_flags from algo_info->flags in pkcs15-sec.c and it passed to decipher. Some cards when doing a decipher may drop leading 00 byte when returning data from RSA_RAW decipher. Add leading byte(s) as needed. Get Cryptographic Mechanism Reference from Key Reference: Key reference byte appears to be a 4 bit Cryptographic Mechanism Reference and a 4 bit key reference. This is only done if key reference & 0xF0 != 0 i.e. default Cryptographic mechanism reference is 0. which appears to be the case for RSA RAW. PKCS1 appears to be 0x10 and ECDSA 0x30 See iso 7816-4 table 55 for DST: 84 Reference of a private key 95 Usage qualifier byte - Table 57 - 40 looks OK 80 Cryptographic mechanism reference and referes to section 9.2 The 4 bit key reference limits card to 16 keys. In future this may not work, but we can derive a Cryptographic Mechanism Reference from what OpenSC thinks the card needs to do. Only know RSA RAW, PKCS1 and ECDSA. ECDSA code has not been tested, but expected to work. Allow setting CardOS type and flags from opensc.conf using card_atr stanza This is a fallback if newer cards are added or older cards have problems giving us time to make need changes in next release. It will help in identifying what flags are needed for each card. As user can report what combination of flags work for them. They do this by adding to opensc.conf with something like this. (Change the ATR to your card's ATR): card_atr 3b:d2:18:00:81:31:fe:58:c9:03:16 { driver = "cardos"; # type is decimal from cards.h: # SC_CARD_TYPE_CARDOS_V5_0 is 1009 # SC_CARD_TYPE_CARDOS_V5_3 is 1010 type = 1010; # flags is hex from opensc.h: #define SC_ALGORITHM_ONBOARD_KEY_GEN 0x80000000 #define SC_ALGORITHM_NEED_USAGE 0x40000000 #define SC_ALGORITHM_RSA_RAW 0x00000001 /* RSA_RAW is PAD_NONE */ #define SC_ALGORITHM_RSA_PAD_NONE 0x00000001 #define SC_ALGORITHM_RSA_PAD_PKCS1 0x00000002 /* PKCS#1 v1.5 padding */ #define SC_ALGORITHM_RSA_PAD_ANSI 0x00000004 #define SC_ALGORITHM_RSA_PAD_ISO9796 0x00000008 #define SC_ALGORITHM_RSA_PAD_PSS 0x00000010 /* PKCS#1 v2.0 PSS */ #define SC_ALGORITHM_RSA_PAD_OAEP 0x00000020 /* PKCS#1 v2.0 OAEP */ #define SC_ALGORITHM_RSA_HASH_NONE 0x00000100 /* only applies to PKCS1 padding */ # example: SC_ALGORITHM_ONBOARD_KEY_GEN | SC_ALGORITHM_RSA_HASH_NONE | SC_ALGORITHM_RSA_RAW flags = 80000101; #example: SC_ALGORITHM_ONBOARD_KEY_GEN | SC_ALGORITHM_RSA_PAD_PKCS1 flags = 80000002; } For V5_0 and v5_3 cards, use sc_get_max_send_size and sc_get_max_recv_size which takes care or reader sizes even on Windows where SCardControl can not get PART_10 sizes. (commit eddea6f3c2d3dafc2c09eba6695c745a61b5186f on Windows forces reader sizes to 255, 256 in reader-pcsc.c if not already set. It should not do this, but leave that up to card drivers.) pkcs15-cardos.c added: New file, pkcs15-cardos.c, added as emulation only for CardOS V5_0 and V5_3 cards. sc_pkcs15_bind_internal is called to get tokenInfo as CardOS cards are substantially PKCS15 cards. But some V5_* cards have errors in the tokenInfo, Which are corrected. For older CardOS cards, card-cardos.c will create all the card->algorithms. Pkcs15-cardos.c will check for card->algorithms and if there are none, it will do the following: SC_CARDCTL_CARDOS_PASS_ALGO_FLAGS is called twice. First to get the flags as set by user via opensc.conf card_atr or default flags set by the card driver. Then after determining from the tokenInfo what algorithms the card can support, the new flags are passed to card_cardos.c to create card->algorithms. https://atos.net/wp-content/uploads/2018/11/CT_181026_LPM_CardOS_V5-3_Multifunctionality_FS_en3_web.pdf says card supports: "“Command chaining” in accordance with ISO/IEC 7816-4" To take advantage of this with older readers, max_send_size and max_recv_size is now based on minimum of reader limits and "data_field_length" from card. This should allow card to work in older readers not capable of extended APDU. So far current cards we have seen do no appear to support “Command chaining”. Changes to be committed: modified: src/libopensc/Makefile.am modified: src/libopensc/Makefile.mak modified: src/libopensc/card-cardos.c modified: src/libopensc/cardctl.h modified: src/libopensc/cards.h new file: src/libopensc/pkcs15-cardos.c modified: src/libopensc/pkcs15-syn.c modified: src/libopensc/pkcs15-syn.h
2020-04-17 16:36:48 +00:00
pkcs15-openpgp.obj pkcs15-starcert.obj pkcs15-cardos.obj \
pkcs15-tcos.obj pkcs15-esteid.obj pkcs15-gemsafeGPK.obj \
Attached are the latest mode to OpenSC svn 3462 to use the Makefile.mak files to build on Windows. I got rutoken to compile, and took out the #ifdef's I had in last week. The rutoken programmer declared some variables in the middle of a block rather then having all the declare statements at the beginning of a block as is normally done in C. The Microsoft compile treats this as an error. (Actual many errors.) The makedef.pl is no longer needed, as the exports files can be used. Note that in the original Makefile.mak files only opensc.def and pkcs15init.def were created. winconfig.h has a number of changes. As discussed last week this could be created by autoconf. I also noted that the Active State Perl that was required for the makedef.pl has a psed command that could be used like sed to update winconfig.h. I did not attempt to do this. win32/Make.rules.mak - Use ENABLE_OPENSSL and ENABLE_ZLIB src/tools/Makefile.mak - add the rutoken.tool.exe src/tools/eidenv.c - use PACKAGE_VERSION src/pkcs11/Makefile.mak - reorder the objest to match the list in the Makefile.am. Makes it easier to read. src/include/winconfig.h - The windows version of the config.h Changes based on discussions on the list last week. src/common/Makefile.mak - renamed modules. src/pkcs15init/Makefile.mak - reordered, and added back the rutoken modules replaced the use of makdef.pl to sue the exports file. src/scconf/Makefile.mak - reordered objects. src/libopensc/card-rutoken.c - error. Moved the declares to the beginning of blocks. src/libopensc/Makefile.mak - reorder names, and add rutoken. Use the libopensc.exports file. src/libopensc/pkcs15-prkey-rutoken.c - more moving of declare statements. By Douglas E. Engert http://www.opensc-project.org/pipermail/opensc-devel/2008-April/011011.html git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3464 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-07 19:42:43 +00:00
pkcs15-actalis.obj pkcs15-atrust-acos.obj pkcs15-tccardos.obj pkcs15-piv.obj \
pkcs15-cac.obj pkcs15-esinit.obj pkcs15-westcos.obj pkcs15-pteid.obj pkcs15-din-66291.obj \
pkcs15-oberthur.obj pkcs15-itacns.obj pkcs15-gemsafeV1.obj pkcs15-sc-hsm.obj \
pkcs15-dnie.obj pkcs15-gids.obj pkcs15-iasecc.obj pkcs15-jpki.obj \
pkcs15-esteid2018.obj pkcs15-idprime.obj \
compression.obj p15card-helper.obj sm.obj \
aux-data.obj \
$(TOPDIR)\win32\versioninfo.res
2016-06-22 14:35:17 +00:00
LIBS = $(TOPDIR)\src\scconf\scconf.lib \
$(TOPDIR)\src\common\common.lib \
$(TOPDIR)\src\common\libscdl.lib \
$(TOPDIR)\src\ui\strings.lib \
$(TOPDIR)\src\ui\notify.lib \
$(TOPDIR)\src\sm\libsmiso.lib \
$(TOPDIR)\src\sm\libsmeac.lib \
2016-06-22 14:35:17 +00:00
$(TOPDIR)\src\pkcs15init\pkcs15init.lib
all: $(TOPDIR)\win32\versioninfo.res $(TARGET)
!INCLUDE $(TOPDIR)\win32\Make.rules.mak
2016-06-22 14:35:17 +00:00
opensc.dll: $(OBJECTS) $(LIBS)
Attached are the latest mode to OpenSC svn 3462 to use the Makefile.mak files to build on Windows. I got rutoken to compile, and took out the #ifdef's I had in last week. The rutoken programmer declared some variables in the middle of a block rather then having all the declare statements at the beginning of a block as is normally done in C. The Microsoft compile treats this as an error. (Actual many errors.) The makedef.pl is no longer needed, as the exports files can be used. Note that in the original Makefile.mak files only opensc.def and pkcs15init.def were created. winconfig.h has a number of changes. As discussed last week this could be created by autoconf. I also noted that the Active State Perl that was required for the makedef.pl has a psed command that could be used like sed to update winconfig.h. I did not attempt to do this. win32/Make.rules.mak - Use ENABLE_OPENSSL and ENABLE_ZLIB src/tools/Makefile.mak - add the rutoken.tool.exe src/tools/eidenv.c - use PACKAGE_VERSION src/pkcs11/Makefile.mak - reorder the objest to match the list in the Makefile.am. Makes it easier to read. src/include/winconfig.h - The windows version of the config.h Changes based on discussions on the list last week. src/common/Makefile.mak - renamed modules. src/pkcs15init/Makefile.mak - reordered, and added back the rutoken modules replaced the use of makdef.pl to sue the exports file. src/scconf/Makefile.mak - reordered objects. src/libopensc/card-rutoken.c - error. Moved the declares to the beginning of blocks. src/libopensc/Makefile.mak - reorder names, and add rutoken. Use the libopensc.exports file. src/libopensc/pkcs15-prkey-rutoken.c - more moving of declare statements. By Douglas E. Engert http://www.opensc-project.org/pipermail/opensc-devel/2008-April/011011.html git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3464 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-07 19:42:43 +00:00
echo LIBRARY $* > $*.def
echo EXPORTS >> $*.def
type lib$*.exports >> $*.def
link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:opensc.dll $(OBJECTS) $(LIBS) $(OPENPACE_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) gdi32.lib Comctl32.lib Shell32.lib user32.lib advapi32.lib ws2_32.lib
if EXIST opensc.dll.manifest mt -manifest opensc.dll.manifest -outputresource:opensc.dll;2
opensc_a.lib: $(OBJECTS)
lib $(LIBFLAGS) /out:opensc_a.lib $(OBJECTS)