SKF Wrapper

This commit is contained in:
Zhi Guan
2016-05-29 00:22:33 +02:00
parent 0cf9126a7d
commit ee4384daeb
142 changed files with 9469 additions and 6750 deletions

View File

@@ -26,7 +26,7 @@ TEST=
APPS=
LIB=$(TOP)/libcrypto.a
LIBNAMES= 4758cca aep atalla cswift gmp chil nuron sureware ubsec padlock capi
LIBNAMES= 4758cca aep atalla cswift gmp chil nuron sureware ubsec padlock skf capi
LIBSRC= e_4758cca.c \
e_aep.c \
@@ -53,7 +53,7 @@ LIBOBJ= e_4758cca.o \
SRC= $(LIBSRC)
EXHEADER=
EXHEADER=
HEADER= e_4758cca_err.c e_4758cca_err.h \
e_aep_err.c e_aep_err.h \
e_atalla_err.c e_atalla_err.h \
@@ -173,16 +173,17 @@ e_4758cca.o: ../include/openssl/crypto.h ../include/openssl/dso.h
e_4758cca.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_4758cca.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_4758cca.o: ../include/openssl/engine.h ../include/openssl/err.h
e_4758cca.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_4758cca.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_4758cca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_4758cca.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_4758cca.o: ../include/openssl/rand.h ../include/openssl/rsa.h
e_4758cca.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_4758cca.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_4758cca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
e_4758cca.o: e_4758cca.c e_4758cca_err.c e_4758cca_err.h
e_4758cca.o: vendor_defns/hw_4758_cca.h
e_4758cca.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_4758cca.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_4758cca.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_4758cca.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_4758cca.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
e_4758cca.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_4758cca.o: ../include/openssl/sha.h ../include/openssl/sm2.h
e_4758cca.o: ../include/openssl/sm3.h ../include/openssl/stack.h
e_4758cca.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_4758cca.o: ../include/openssl/x509_vfy.h e_4758cca.c e_4758cca_err.c
e_4758cca.o: e_4758cca_err.h vendor_defns/hw_4758_cca.h
e_aep.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_aep.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_aep.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -190,15 +191,16 @@ e_aep.o: ../include/openssl/dsa.h ../include/openssl/dso.h
e_aep.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_aep.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_aep.o: ../include/openssl/engine.h ../include/openssl/err.h
e_aep.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_aep.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_aep.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_aep.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_aep.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_aep.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_aep.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_aep.o: ../include/openssl/x509_vfy.h e_aep.c e_aep_err.c e_aep_err.h
e_aep.o: vendor_defns/aep.h
e_aep.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_aep.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_aep.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_aep.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_aep.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
e_aep.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_aep.o: ../include/openssl/sm2.h ../include/openssl/sm3.h
e_aep.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_aep.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_aep.c
e_aep.o: e_aep_err.c e_aep_err.h vendor_defns/aep.h
e_atalla.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_atalla.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_atalla.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -206,25 +208,28 @@ e_atalla.o: ../include/openssl/dsa.h ../include/openssl/dso.h
e_atalla.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_atalla.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_atalla.o: ../include/openssl/engine.h ../include/openssl/err.h
e_atalla.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_atalla.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_atalla.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_atalla.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_atalla.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_atalla.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_atalla.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_atalla.o: ../include/openssl/x509_vfy.h e_atalla.c e_atalla_err.c
e_atalla.o: e_atalla_err.h vendor_defns/atalla.h
e_atalla.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_atalla.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_atalla.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_atalla.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_atalla.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
e_atalla.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_atalla.o: ../include/openssl/sm2.h ../include/openssl/sm3.h
e_atalla.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_atalla.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_atalla.c
e_atalla.o: e_atalla_err.c e_atalla_err.h vendor_defns/atalla.h
e_capi.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_capi.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
e_capi.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_capi.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_capi.o: ../include/openssl/engine.h ../include/openssl/evp.h
e_capi.o: ../include/openssl/engine.h ../include/openssl/err.h
e_capi.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_capi.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_capi.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_capi.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_capi.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
e_capi.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_capi.o: ../include/openssl/sha.h ../include/openssl/sm2.h
e_capi.o: ../include/openssl/sm3.h ../include/openssl/stack.h
e_capi.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_capi.o: ../include/openssl/x509_vfy.h e_capi.c
e_chil.o: ../include/openssl/asn1.h ../include/openssl/bio.h
@@ -234,16 +239,18 @@ e_chil.o: ../include/openssl/dso.h ../include/openssl/e_os2.h
e_chil.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
e_chil.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
e_chil.o: ../include/openssl/err.h ../include/openssl/evp.h
e_chil.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_chil.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_chil.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_chil.o: ../include/openssl/pem.h ../include/openssl/pem2.h
e_chil.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
e_chil.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_chil.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_chil.o: ../include/openssl/symhacks.h ../include/openssl/ui.h
e_chil.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_chil.c
e_chil.o: e_chil_err.c e_chil_err.h vendor_defns/hwcryptohook.h
e_chil.o: ../include/openssl/kdf.h ../include/openssl/lhash.h
e_chil.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_chil.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_chil.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
e_chil.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
e_chil.o: ../include/openssl/rand.h ../include/openssl/rsa.h
e_chil.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_chil.o: ../include/openssl/sm2.h ../include/openssl/sm3.h
e_chil.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_chil.o: ../include/openssl/ui.h ../include/openssl/x509.h
e_chil.o: ../include/openssl/x509_vfy.h e_chil.c e_chil_err.c e_chil_err.h
e_chil.o: vendor_defns/hwcryptohook.h
e_cswift.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_cswift.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_cswift.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -251,26 +258,30 @@ e_cswift.o: ../include/openssl/dsa.h ../include/openssl/dso.h
e_cswift.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_cswift.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_cswift.o: ../include/openssl/engine.h ../include/openssl/err.h
e_cswift.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_cswift.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_cswift.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_cswift.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_cswift.o: ../include/openssl/rand.h ../include/openssl/rsa.h
e_cswift.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_cswift.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_cswift.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_cswift.c
e_cswift.o: e_cswift_err.c e_cswift_err.h vendor_defns/cswift.h
e_cswift.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_cswift.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_cswift.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_cswift.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_cswift.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
e_cswift.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_cswift.o: ../include/openssl/sha.h ../include/openssl/sm2.h
e_cswift.o: ../include/openssl/sm3.h ../include/openssl/stack.h
e_cswift.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_cswift.o: ../include/openssl/x509_vfy.h e_cswift.c e_cswift_err.c
e_cswift.o: e_cswift_err.h vendor_defns/cswift.h
e_gmp.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_gmp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_gmp.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
e_gmp.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
e_gmp.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
e_gmp.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_gmp.o: ../include/openssl/err.h ../include/openssl/evp.h
e_gmp.o: ../include/openssl/kdf.h ../include/openssl/lhash.h
e_gmp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_gmp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_gmp.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_gmp.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_gmp.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_gmp.o: ../include/openssl/sha.h ../include/openssl/sm2.h
e_gmp.o: ../include/openssl/sm3.h ../include/openssl/stack.h
e_gmp.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_gmp.o: ../include/openssl/x509_vfy.h e_gmp.c
e_nuron.o: ../include/openssl/asn1.h ../include/openssl/bio.h
@@ -280,28 +291,48 @@ e_nuron.o: ../include/openssl/dsa.h ../include/openssl/dso.h
e_nuron.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_nuron.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_nuron.o: ../include/openssl/engine.h ../include/openssl/err.h
e_nuron.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_nuron.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_nuron.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_nuron.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_nuron.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_nuron.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_nuron.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_nuron.o: ../include/openssl/x509_vfy.h e_nuron.c e_nuron_err.c e_nuron_err.h
e_nuron.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_nuron.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_nuron.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_nuron.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_nuron.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
e_nuron.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_nuron.o: ../include/openssl/sm2.h ../include/openssl/sm3.h
e_nuron.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_nuron.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_nuron.c
e_nuron.o: e_nuron_err.c e_nuron_err.h
e_padlock.o: ../include/openssl/aes.h ../include/openssl/asn1.h
e_padlock.o: ../include/openssl/bio.h ../include/openssl/buffer.h
e_padlock.o: ../include/openssl/crypto.h ../include/openssl/dso.h
e_padlock.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_padlock.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_padlock.o: ../include/openssl/engine.h ../include/openssl/err.h
e_padlock.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_padlock.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_padlock.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_padlock.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_padlock.o: ../include/openssl/rand.h ../include/openssl/safestack.h
e_padlock.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_padlock.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_padlock.o: ../include/openssl/x509_vfy.h e_padlock.c
e_padlock.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_padlock.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_padlock.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_padlock.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_padlock.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
e_padlock.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_padlock.o: ../include/openssl/sm2.h ../include/openssl/sm3.h
e_padlock.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_padlock.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
e_padlock.o: e_padlock.c
e_skf.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_skf.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
e_skf.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_skf.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_skf.o: ../include/openssl/engine.h ../include/openssl/err.h
e_skf.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_skf.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_skf.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_skf.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_skf.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
e_skf.o: ../include/openssl/sha.h ../include/openssl/sm1.h
e_skf.o: ../include/openssl/sm2.h ../include/openssl/sm3.h
e_skf.o: ../include/openssl/sm9.h ../include/openssl/sms4.h
e_skf.o: ../include/openssl/ssf33.h ../include/openssl/stack.h
e_skf.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_skf.o: ../include/openssl/x509_vfy.h e_skf.c e_skf_err.h
e_sureware.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_sureware.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_sureware.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -309,17 +340,18 @@ e_sureware.o: ../include/openssl/dsa.h ../include/openssl/dso.h
e_sureware.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_sureware.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_sureware.o: ../include/openssl/engine.h ../include/openssl/err.h
e_sureware.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_sureware.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_sureware.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_sureware.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
e_sureware.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
e_sureware.o: ../include/openssl/rand.h ../include/openssl/rsa.h
e_sureware.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_sureware.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_sureware.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
e_sureware.o: e_sureware.c e_sureware_err.c e_sureware_err.h
e_sureware.o: vendor_defns/sureware.h
e_sureware.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_sureware.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_sureware.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_sureware.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_sureware.o: ../include/openssl/pem.h ../include/openssl/pem2.h
e_sureware.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
e_sureware.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_sureware.o: ../include/openssl/sha.h ../include/openssl/sm2.h
e_sureware.o: ../include/openssl/sm3.h ../include/openssl/stack.h
e_sureware.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_sureware.o: ../include/openssl/x509_vfy.h e_sureware.c e_sureware_err.c
e_sureware.o: e_sureware_err.h vendor_defns/sureware.h
e_ubsec.o: ../include/openssl/asn1.h ../include/openssl/bio.h
e_ubsec.o: ../include/openssl/bn.h ../include/openssl/buffer.h
e_ubsec.o: ../include/openssl/crypto.h ../include/openssl/dh.h
@@ -327,12 +359,13 @@ e_ubsec.o: ../include/openssl/dsa.h ../include/openssl/dso.h
e_ubsec.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
e_ubsec.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
e_ubsec.o: ../include/openssl/engine.h ../include/openssl/err.h
e_ubsec.o: ../include/openssl/evp.h ../include/openssl/lhash.h
e_ubsec.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
e_ubsec.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
e_ubsec.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
e_ubsec.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
e_ubsec.o: ../include/openssl/sha.h ../include/openssl/stack.h
e_ubsec.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
e_ubsec.o: ../include/openssl/x509_vfy.h e_ubsec.c e_ubsec_err.c e_ubsec_err.h
e_ubsec.o: vendor_defns/hw_ubsec.h
e_ubsec.o: ../include/openssl/evp.h ../include/openssl/kdf.h
e_ubsec.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
e_ubsec.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
e_ubsec.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
e_ubsec.o: ../include/openssl/pkcs7.h ../include/openssl/rsa.h
e_ubsec.o: ../include/openssl/safestack.h ../include/openssl/sha.h
e_ubsec.o: ../include/openssl/sm2.h ../include/openssl/sm3.h
e_ubsec.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
e_ubsec.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h e_ubsec.c
e_ubsec.o: e_ubsec_err.c e_ubsec_err.h vendor_defns/hw_ubsec.h

View File

@@ -96,11 +96,13 @@ gost2001.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost2001.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost2001.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost2001.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost2001.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
gost2001.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
gost2001.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost2001.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost2001.o: ../../include/openssl/opensslconf.h
gost2001.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost2001.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
gost2001.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
gost2001.o: ../../include/openssl/sm2.h ../../include/openssl/sm3.h
gost2001.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
gost2001.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
gost2001.o: e_gost_err.h gost2001.c gost89.h gost_lcl.h gost_params.h
@@ -111,14 +113,16 @@ gost2001_keyx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
gost2001_keyx.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost2001_keyx.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost2001_keyx.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost2001_keyx.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
gost2001_keyx.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost2001_keyx.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost2001_keyx.o: ../../include/openssl/obj_mac.h
gost2001_keyx.o: ../../include/openssl/objects.h
gost2001_keyx.o: ../../include/openssl/opensslconf.h
gost2001_keyx.o: ../../include/openssl/opensslv.h
gost2001_keyx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
gost2001_keyx.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
gost2001_keyx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
gost2001_keyx.o: ../../include/openssl/sha.h ../../include/openssl/sm2.h
gost2001_keyx.o: ../../include/openssl/sm3.h ../../include/openssl/stack.h
gost2001_keyx.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
gost2001_keyx.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost2001_keyx.c
gost2001_keyx.o: gost2001_keyx.h gost89.h gost_keywrap.h gost_lcl.h gosthash.h
@@ -129,14 +133,16 @@ gost94_keyx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
gost94_keyx.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
gost94_keyx.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
gost94_keyx.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
gost94_keyx.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
gost94_keyx.o: ../../include/openssl/engine.h ../../include/openssl/err.h
gost94_keyx.o: ../../include/openssl/evp.h ../../include/openssl/kdf.h
gost94_keyx.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
gost94_keyx.o: ../../include/openssl/objects.h
gost94_keyx.o: ../../include/openssl/opensslconf.h
gost94_keyx.o: ../../include/openssl/opensslv.h
gost94_keyx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
gost94_keyx.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
gost94_keyx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
gost94_keyx.o: ../../include/openssl/sha.h ../../include/openssl/sm2.h
gost94_keyx.o: ../../include/openssl/sm3.h ../../include/openssl/stack.h
gost94_keyx.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
gost94_keyx.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost89.h
gost94_keyx.o: gost94_keyx.c gost_keywrap.h gost_lcl.h gosthash.h
@@ -147,12 +153,14 @@ gost_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
gost_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
gost_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
gost_ameth.o: ../../include/openssl/engine.h ../../include/openssl/err.h
gost_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
gost_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost_ameth.o: ../../include/openssl/evp.h ../../include/openssl/kdf.h
gost_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
gost_ameth.o: ../../include/openssl/objects.h
gost_ameth.o: ../../include/openssl/opensslconf.h
gost_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
gost_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
gost_ameth.o: ../../include/openssl/sha.h ../../include/openssl/sm2.h
gost_ameth.o: ../../include/openssl/sm3.h ../../include/openssl/stack.h
gost_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
gost_ameth.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost89.h
gost_ameth.o: gost_ameth.c gost_lcl.h gost_params.h gosthash.h
@@ -162,12 +170,14 @@ gost_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
gost_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost_asn1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost_asn1.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost_asn1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
gost_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost_asn1.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost_asn1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost_asn1.o: ../../include/openssl/opensslconf.h
gost_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
gost_asn1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
gost_asn1.o: ../../include/openssl/sha.h ../../include/openssl/sm2.h
gost_asn1.o: ../../include/openssl/sm3.h ../../include/openssl/stack.h
gost_asn1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
gost_asn1.o: ../../include/openssl/x509_vfy.h gost89.h gost_asn1.c gost_lcl.h
gost_asn1.o: gosthash.h
@@ -177,12 +187,14 @@ gost_crypt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
gost_crypt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost_crypt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost_crypt.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost_crypt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
gost_crypt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost_crypt.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost_crypt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost_crypt.o: ../../include/openssl/opensslconf.h
gost_crypt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost_crypt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
gost_crypt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
gost_crypt.o: ../../include/openssl/sm2.h ../../include/openssl/sm3.h
gost_crypt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
gost_crypt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
gost_crypt.o: e_gost_err.h gost89.h gost_crypt.c gost_lcl.h gosthash.h
@@ -193,11 +205,13 @@ gost_ctl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost_ctl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost_ctl.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost_ctl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost_ctl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
gost_ctl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
gost_ctl.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost_ctl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost_ctl.o: ../../include/openssl/opensslconf.h
gost_ctl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost_ctl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
gost_ctl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
gost_ctl.o: ../../include/openssl/sha.h ../../include/openssl/sm2.h
gost_ctl.o: ../../include/openssl/sm3.h ../../include/openssl/stack.h
gost_ctl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
gost_ctl.o: ../../include/openssl/x509_vfy.h gost89.h gost_ctl.c gost_lcl.h
gost_ctl.o: gosthash.h
@@ -208,11 +222,13 @@ gost_eng.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost_eng.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost_eng.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost_eng.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost_eng.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
gost_eng.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
gost_eng.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost_eng.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost_eng.o: ../../include/openssl/opensslconf.h
gost_eng.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost_eng.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
gost_eng.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
gost_eng.o: ../../include/openssl/sha.h ../../include/openssl/sm2.h
gost_eng.o: ../../include/openssl/sm3.h ../../include/openssl/stack.h
gost_eng.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
gost_eng.o: ../../include/openssl/x509_vfy.h e_gost_err.h gost89.h gost_eng.c
gost_eng.o: gost_lcl.h gosthash.h
@@ -223,11 +239,13 @@ gost_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
gost_md.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost_md.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost_md.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
gost_md.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost_md.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
gost_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
gost_md.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
gost_md.o: ../../include/openssl/sm2.h ../../include/openssl/sm3.h
gost_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
gost_md.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
gost_md.o: e_gost_err.h gost89.h gost_lcl.h gost_md.c gosthash.h
@@ -245,13 +263,15 @@ gost_pmeth.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
gost_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
gost_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
gost_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
gost_pmeth.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
gost_pmeth.o: ../../include/openssl/engine.h ../../include/openssl/err.h
gost_pmeth.o: ../../include/openssl/evp.h ../../include/openssl/kdf.h
gost_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
gost_pmeth.o: ../../include/openssl/objects.h
gost_pmeth.o: ../../include/openssl/opensslconf.h
gost_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
gost_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
gost_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/sm2.h
gost_pmeth.o: ../../include/openssl/sm3.h ../../include/openssl/stack.h
gost_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
gost_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
gost_pmeth.o: e_gost_err.h gost89.h gost_lcl.h gost_params.h gost_pmeth.c
@@ -263,12 +283,13 @@ gost_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
gost_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
gost_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
gost_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
gost_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
gost_sign.o: ../../include/openssl/objects.h
gost_sign.o: ../../include/openssl/kdf.h ../../include/openssl/lhash.h
gost_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
gost_sign.o: ../../include/openssl/opensslconf.h
gost_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
gost_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
gost_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
gost_sign.o: ../../include/openssl/sm2.h ../../include/openssl/sm3.h
gost_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
gost_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
gost_sign.o: e_gost_err.h gost89.h gost_lcl.h gost_params.h gost_sign.c

Binary file not shown.

View File

@@ -62,12 +62,13 @@
#include <openssl/sm3.h>
#include <openssl/sms4.h>
#include <openssl/sm9.h>
#include "skf/skf.h"
#include <openssl/skf.h>
#include <openssl/skf_ex.h>
#include "e_skf_err.h"
static DEVHANDLE skf_dev_handle = NULL;
static HAPPLICATION skf_app_handle = NULL;
static HCONTAINER skf_container_handle = NULL;
static DEVHANDLE hDev = NULL;
static HAPPLICATION hApp = NULL;
static HCONTAINER hContainer = NULL;
static int authkey_set = 0;
static unsigned char authkey[16];
@@ -103,6 +104,7 @@ static const ENGINE_CMD_DEFN skf_cmd_defns[] = {
{SKF_CMD_OPEN_APP,
"OPEN_APP",
"Open application with specified name",
ENGINE_CMD_FLAG_STRING},
{SKF_CMD_VERIFY_PIN,
"VERIFY_PIN",
"Specifies user's PIN of the application to open",
@@ -111,14 +113,14 @@ static const ENGINE_CMD_DEFN skf_cmd_defns[] = {
"OPEN_CONTAINER",
"Open container wtith specified name",
ENGINE_CMD_FLAG_STRING},
{0, NULL, NULL, 0}
{0, NULL, NULL, 0},
};
int set_authkey(const char *authkey_hex)
{
// convert the
ESKFerr(ESKF_F_SET_AUTHKEY, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
int set_userpin(const char *pin)
@@ -127,12 +129,17 @@ int set_userpin(const char *pin)
return 0;
}
strcpy(userpin, pin);
ESKFerr(ESKF_F_SET_USERPIN, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
int open_dev(const char *devname)
{
if ((rv = SKF_ConnectDev(dev, &hDev)) != SAR_OK) {
ULONG rv;
DEVINFO devInfo;
if ((rv = SKF_ConnectDev(devname, &hDev)) != SAR_OK) {
goto end;
}
@@ -152,6 +159,8 @@ int open_dev(const char *devname)
goto end;
}
ESKFerr(ESKF_F_OPEN_DEV, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
@@ -163,6 +172,8 @@ int open_app(const char *appname)
if ((rv = SKF_VerifyPIN(hApp, USER_TYPE, pin, &retryCount)) != SAR_OK) {
goto end;
}
ESKFerr(ESKF_F_OPEN_APP, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
@@ -177,6 +188,8 @@ int open_container(const char *containername)
if (containerType != CONTAINER_TYPE_ECC) {
goto end;
}
ESKFerr(ESKF_F_OPEN_CONTAINER, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
@@ -196,6 +209,8 @@ static int skf_engine_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
default:
break;
}
ESKFerr(ESKF_F_SKF_ENGINE_CTRL, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
@@ -235,22 +250,28 @@ static EVP_PKEY *skf_load_pubkey(ENGINE *e, const char *key_id,
if (!(ret = EVP_PKEY_new())) {
goto end;
}
EVP_PKEY_assign_SM2(ret, ec_key);
//EVP_PKEY_assign_SM2(ret, ec_key);
end:
EC_KEY_free(ec_key);
BN_free(x);
BN_free(y)
return ret;
ESKFerr(ESKF_F_SKF_LOAD_PUBKEY, ESKF_R_NOT_IMPLEMENTED);
return ret;
}
static int skf_init(ENGINE *e)
{
ESKFerr(ESKF_F_SKF_INIT, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
static int skf_finish(ENGINE *e)
{
{
ESKFerr(ESKF_F_SKF_FINISH, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
@@ -264,7 +285,7 @@ static int skf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
case NID_ssf33_ecb:
ulAlgID = SGD_SSF33_ECB;
break;
case NID_ssf33_cbc:
case NID_ssf33_cbc:
ulAlgID = SGD_SSF33_CBC;
break;
case NID_ssf33_cfb128:
@@ -307,10 +328,11 @@ static int skf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
if ((rv = SKF_SetSymmKey(skf_dev_handle, (BYTE *)key, ulAlgID,
&(dat->hKey))) != SAR_OK) {
SKFerr(SKF_F_SKF_INIT_KEY, 0);
return 0;
}
ESKFerr(ESKF_F_SKF_INIT_KEY, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -367,6 +389,8 @@ static int skf_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
}
ESKFerr(ESKF_F_SKF_CIPHER, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -472,7 +496,9 @@ static int skf_ciphers(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, i
return 0;
}
return 1;
ESKFerr(ESKF_F_SKF_CIPHERS, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -481,10 +507,11 @@ int skf_rand_bytes(unsigned char *buf, int num)
ULONG rv;
if ((rv = SKF_GenRandom(hDev, buf, (ULONG)num)) != SAR_OK) {
SKFerr(SKF_F_SKF_RAND_BYTES, skf_err2openssl(rv));
return 0;
}
ESKFerr(ESKF_F_SKF_RAND_BYTES, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -505,10 +532,11 @@ static int skf_sm3_init(EVP_MD_CTX *ctx)
HANDLE hHash;
if ((rv = SKF_DigestInit(hDev, SGD_SM3, NULL, NULL, 0, &hHash)) != SAR_OK) {
SKFerr(SKF_F_SM3_INIT, skf_err2openssl(rv));
return 0;
}
ESKFerr(ESKF_F_SKF_SM3_INIT, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -519,10 +547,11 @@ static int skf_sm3_update(EVP_MD_CTX *ctx, const void *data, size_t count)
ULONG ulDataLen = (ULONG)count;
if ((rv = SKF_DigestUpdate((HANDLE)ctx->md_data, pbData, ulDataLen)) != SAR_OK) {
SKFerr(SKF_F_SKF_SM3_UPDATE, skf_err2openssl(rv));
return 0;
}
ESKFerr(ESKF_F_SKF_SM3_UPDATE, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -533,15 +562,15 @@ static int skf_sm3_final(EVP_MD_CTX *ctx, unsigned char *md)
ULONG ulHashLen = SM3_DIGEST_LENGTH;
if ((rv = SKF_DigestFinal(hHash, pHashData, &ulHashLen)) != SAR_OK) {
SKFerr(SKF_F_SKF_SM3_FINAL, skf_err2openssl(rv));
return 0;
}
if ((rv = SKF_CloseHandle(hHash)) != SAR_OK) {
SKFerr(SKF_F_SKF_SM3_FINAL, skf_err2openssl(rv));
return 0;
}
ESKFerr(ESKF_F_SKF_SM3_FINAL, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -580,6 +609,8 @@ static int skf_digests(ENGINE *e, const EVP_MD **digest, const int **nids, int n
return 0;
}
ESKFerr(ESKF_F_SKF_DIGESTS, ESKF_R_NOT_IMPLEMENTED);
return 1;
}
@@ -599,6 +630,8 @@ static int skf_rsa_sign(int type, const unsigned char *m, unsigned int mlen,
goto end;
}
ESKFerr(ESKF_F_SKF_RSA_SIGN, ESKF_R_NOT_IMPLEMENTED);
return 0;
}
@@ -649,6 +682,8 @@ end:
ECDSA_SIG_free(ret);
ret = NULL;
}
ESKFerr(ESKF_F_SKF_SM2_DO_SIGN, ESKF_R_NOT_IMPLEMENTED);
return ret;
}
@@ -675,6 +710,7 @@ static ENGINE *engine_skf(void)
return NULL;
}
return ret;
}

View File

@@ -0,0 +1 @@
L ESKF e_skf_err.h e_skf_err.c

View File

View File

@@ -1,146 +1,151 @@
#include "skf/skf.h"
static ERR_STRING_DATA SKF_str_functs[] = {
{ERR_FUNC(SKF_F_SKF_INIT_KEY), "SKF_INIT_KEY"},
{ERR_FUNC(SKF_F_SKF_CIPHER), "SKF_CIPHER"},
{ERR_FUNC(SKF_F_SKF_INIT), "SKF_INIT"},
{ERR_FUNC(SKF_F_SKF_CTRL), "SKF_CTRL"},
{ERR_FUNC(SKF_F_SKF_FINISH), "SKF_FINISH"},
{0, NULL}
};
static ERR_STRING_DATA SKF_str_reasons[] = {
{ERR_REASON(SKF_F_OK), ok"},
{0, NULL}
};
int skf_err2openssl(int err)
{
switch (err) {
case SAR_OK:
return SKF_R_SAR_OK;
case SAR_FAIL:
return SKF_R_SAR_FAIL;
case SAR_UNKNOWNERR:
case SAR_NOTSUPPORTYETERR:
case SAR_FILEERR:
case SAR_INVALIDHANDLEERR:
case SAR_INVALIDPARAMERR:
case SAR_READFILEERR:
case SAR_WRITEFILEERR:
case SAR_NAMELENERR:
case SAR_KEYUSAGEERR:
case SAR_MODULUSLENERR:
case SAR_NOTINITIALIZEERR:
case SAR_OBJERR:
case SAR_MEMORYERR:
case SAR_TIMEOUTERR:
case SAR_INDATALENERR
case SAR_INDATAERR
case SAR_GENRANDERR
case SAR_HASHOBJERR
case SAR_HASHERR
case SAR_GENRSAKEYERR
case SAR_RSAMODULUSLENERR
case SAR_CSPIMPRTPUBKEYERR
case SAR_RSAENCERR
case SAR_RSADECERR
case SAR_HASHNOTEQUALERR
case SAR_KEYNOTFOUNTERR
case SAR_CERTNOTFOUNTERR
case SAR_NOTEXPORTERR
case SAR_DECRYPTPADERR
case SAR_MACLENERR
case SAR_BUFFER_TOO_SMALL
case SAR_KEYINFOTYPEERR
case SAR_NOT_EVENTERR
case SAR_DEVICE_REMOVED
case SAR_PIN_INCORRECT
case SAR_PIN_LOCKED
case SAR_PIN_INVALID
case SAR_PIN_LEN_RANGE
case SAR_USER_ALREADY_LOGGED_IN
case SAR_USER_PIN_NOT_INITIALIZED
case SAR_USER_TYPE_INVALID
case SAR_APPLICATION_NAME_INVALID
case SAR_APPLICATION_EXISTS
case SAR_USER_NOT_LOGGED_IN
case SAR_APPLICATION_NOT_EXISTS
case SAR_FILE_ALREADY_EXIST
case SAR_NO_ROOM
case SAR_FILE_NOT_EXIST
}
typedef struct {
int err_no;
char *err_str;
} skf_errstr[] = {
{ SAR_OK, "Success" },
{ SAR_FAIL, "Failure" },
{ SAR_UNKNOWNERR, "Unknown error" },
{ SAR_NOTSUPPORTYETERR, "Not supported" },
{ SAR_FILEERR, "File error" },
{ SAR_INVALIDHANDLEERR, "Invalid handler" },
{ SAR_INVALIDPARAMERR, "Invalid parameter" },
{ SAR_READFILEERR, "Read file error" },
{ SAR_WRITEFILEERR "Write file error" },
{ SAR_NAMELENERR, "Name length error" },
{ SAR_KEYUSAGEERR, "Key usage error" },
{ SAR_MODULUSLENERR, "Modulus length error" },
{ SAR_NOTINITIALIZEERR, "Not initialized" },
{ SAR_OBJERR, "Object error" },
{ SAR_MEMORYERR, "Memory error" },
{ SAR_TIMEOUTERR, "Time out" },
{ SAR_INDATALENERR, "Input data length error" },
{ SAR_INDATAERR, "Input data error" },
{ SAR_GENRANDERR, "Generate randomness error" },
{ SAR_HASHOBJERR, "Hash object error" },
{ SAR_HASHERR, "Hash error" },
{ SAR_GENRSAKEYERR, "Genenerate RSA key error" },
{ SAR_RSAMODULUSLENERR, "RSA modulus length error" },
{ SAR_CSPIMPRTPUBKEYERR, "CSP import public key error" },
{ SAR_RSAENCERR, "RSA encryption error" },
{ SAR_RSADECERR, "RSA decryption error" },
{ SAR_HASHNOTEQUALERR, "Hash not equal" },
{ SAR_KEYNOTFOUNTERR, "Key not found" },
{ SAR_CERTNOTFOUNTERR, "Certificate not found" },
{ SAR_NOTEXPORTERR, "Not exported" },
{ SAR_DECRYPTPADERR, "Decrypt pad error" },
{ SAR_MACLENERR, "MAC length error" },
{ SAR_BUFFER_TOO_SMALL, "Buffer too small" },
{ SAR_KEYINFOTYPEERR, "Key info type error" },
{ SAR_NOT_EVENTERR, "No event error" },
{ SAR_DEVICE_REMOVED "Device removed" },
{ SAR_PIN_INCORRECT, "PIN incorrect" },
{ SAR_PIN_LOCKED, "PIN locked" },
{ SAR_PIN_INVALID, "PIN invalid" },
{ SAR_PIN_LEN_RANGE, "PIN length error" },
{ SAR_USER_ALREADY_LOGGED_IN, "User already logged in" },
{ SAR_USER_PIN_NOT_INITIALIZED, "User PIN not initialized" },
{ SAR_USER_TYPE_INVALID, "User type invalid" },
{ SAR_APPLICATION_NAME_INVALID, "Application name invalid" },
{ SAR_APPLICATION_EXISTS, "Application already exist" },
{ SAR_USER_NOT_LOGGED_IN, "User not logged in" },
{ SAR_APPLICATION_NOT_EXISTS, "Application not exist" },
{ SAR_FILE_ALREADY_EXIST, "File already exist" },
{ SAR_NO_ROOM, "No file space" },
{ SAR_FILE_NOT_EXIST, "File not exist" }
};
LPSTR DEVAPI SKF_GetErrorString(ULONG ulError)
{
return NULL;
}
/* e_skf_err.c */
/* ====================================================================
* Copyright (c) 1999-2016 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
/*
* NOTE: this file was auto generated by the mkerr.pl script: any changes
* made to it will be overwritten when the script next updates this file,
* only reason strings will be preserved.
*/
#include <stdio.h>
#include <openssl/err.h>
#include "e_skf_err.h"
/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
# define ERR_FUNC(func) ERR_PACK(0,func,0)
# define ERR_REASON(reason) ERR_PACK(0,0,reason)
static ERR_STRING_DATA ESKF_str_functs[] = {
{ERR_FUNC(ESKF_F_OPEN_APP), "OPEN_APP"},
{ERR_FUNC(ESKF_F_OPEN_CONTAINER), "OPEN_CONTAINER"},
{ERR_FUNC(ESKF_F_OPEN_DEV), "OPEN_DEV"},
{ERR_FUNC(ESKF_F_SET_AUTHKEY), "SET_AUTHKEY"},
{ERR_FUNC(ESKF_F_SET_USERPIN), "SET_USERPIN"},
{ERR_FUNC(ESKF_F_SKF_CIPHER), "SKF_CIPHER"},
{ERR_FUNC(ESKF_F_SKF_CIPHERS), "SKF_CIPHERS"},
{ERR_FUNC(ESKF_F_SKF_DIGESTS), "SKF_DIGESTS"},
{ERR_FUNC(ESKF_F_SKF_ENGINE_CTRL), "SKF_ENGINE_CTRL"},
{ERR_FUNC(ESKF_F_SKF_FINISH), "SKF_FINISH"},
{ERR_FUNC(ESKF_F_SKF_INIT), "SKF_INIT"},
{ERR_FUNC(ESKF_F_SKF_INIT_KEY), "SKF_INIT_KEY"},
{ERR_FUNC(ESKF_F_SKF_LOAD_PUBKEY), "SKF_LOAD_PUBKEY"},
{ERR_FUNC(ESKF_F_SKF_RAND_BYTES), "SKF_RAND_BYTES"},
{ERR_FUNC(ESKF_F_SKF_RSA_SIGN), "SKF_RSA_SIGN"},
{ERR_FUNC(ESKF_F_SKF_SM2_DO_SIGN), "SKF_SM2_DO_SIGN"},
{ERR_FUNC(ESKF_F_SKF_SM3_FINAL), "SKF_SM3_FINAL"},
{ERR_FUNC(ESKF_F_SKF_SM3_INIT), "SKF_SM3_INIT"},
{ERR_FUNC(ESKF_F_SKF_SM3_UPDATE), "SKF_SM3_UPDATE"},
{0, NULL}
};
static ERR_STRING_DATA ESKF_str_reasons[] = {
{ERR_REASON(ESKF_R_NOT_IMPLEMENTED), "not implemented"},
{0, NULL}
};
#endif
#ifdef ESKF_LIB_NAME
static ERR_STRING_DATA ESKF_lib_name[] = {
{0, ESKF_LIB_NAME},
{0, NULL}
};
#endif
static int ESKF_lib_error_code = 0;
static int ESKF_error_init = 1;
static void ERR_load_ESKF_strings(void)
{
if (ESKF_lib_error_code == 0)
ESKF_lib_error_code = ERR_get_next_error_library();
if (ESKF_error_init) {
ESKF_error_init = 0;
#ifndef OPENSSL_NO_ERR
ERR_load_strings(ESKF_lib_error_code, ESKF_str_functs);
ERR_load_strings(ESKF_lib_error_code, ESKF_str_reasons);
#endif
#ifdef ESKF_LIB_NAME
ESKF_lib_name->error = ERR_PACK(ESKF_lib_error_code, 0, 0);
ERR_load_strings(0, ESKF_lib_name);
#endif
}
}
static void ERR_unload_ESKF_strings(void)
{
if (ESKF_error_init == 0) {
#ifndef OPENSSL_NO_ERR
ERR_unload_strings(ESKF_lib_error_code, ESKF_str_functs);
ERR_unload_strings(ESKF_lib_error_code, ESKF_str_reasons);
#endif
#ifdef ESKF_LIB_NAME
ERR_unload_strings(0, ESKF_lib_name);
#endif
ESKF_error_init = 1;
}
}
static void ERR_ESKF_error(int function, int reason, char *file, int line)
{
if (ESKF_lib_error_code == 0)
ESKF_lib_error_code = ERR_get_next_error_library();
ERR_PUT_error(ESKF_lib_error_code, function, reason, file, line);
}

View File

@@ -1,75 +1,96 @@
#ifndef HEADER_SKF_ERR_H
#define HEADER_SKF_ERR_H
/* engines/e_skf_err.h */
/* ====================================================================
* Copyright (c) 2015-2016 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*/
#ifndef HEADER_E_SKF_ERR_H
#define HEADER_E_SKF_ERR_H
#ifdef __cplusplus
extern "C" {
#endif
/* BEGIN ERROR CODES */
/*
* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
static void ERR_load_ESKF_strings(void);
static void ERR_unload_ESKF_strings(void);
static void ERR_ESKF_error(int function, int reason, char *file, int line);
# define ESKFerr(f,r) ERR_ESKF_error((f),(r),__FILE__,__LINE__)
static void ERR_load_SKF_strings(void);
static void ERR_unload_SKF_strings(void);
static void ERR_SKF_error(int function, int reason, char *file, int line);
# define SKFerr(f,r) ERR_SKF_error((f),(r),__FILE__,__LINE__)
/* Error codes for the ESKF functions. */
/* Function codes. */
#define SKF_F_SKF_RAND 100
# define ESKF_F_OPEN_APP 100
# define ESKF_F_OPEN_CONTAINER 101
# define ESKF_F_OPEN_DEV 102
# define ESKF_F_SET_AUTHKEY 103
# define ESKF_F_SET_USERPIN 104
# define ESKF_F_SKF_CIPHER 105
# define ESKF_F_SKF_CIPHERS 106
# define ESKF_F_SKF_DIGESTS 107
# define ESKF_F_SKF_ENGINE_CTRL 108
# define ESKF_F_SKF_FINISH 109
# define ESKF_F_SKF_INIT 110
# define ESKF_F_SKF_INIT_KEY 111
# define ESKF_F_SKF_LOAD_PUBKEY 112
# define ESKF_F_SKF_RAND_BYTES 113
# define ESKF_F_SKF_RSA_SIGN 114
# define ESKF_F_SKF_SM2_DO_SIGN 115
# define ESKF_F_SKF_SM3_FINAL 116
# define ESKF_F_SKF_SM3_INIT 117
# define ESKF_F_SKF_SM3_UPDATE 118
/* Reason codes. */
#define SKF_R_OK 110
#define SKF_R_FAIL 101
#define SKF_R_UNKNOWNERR 102
#define SKF_R_NOTSUPPORTYETERR 103
#define SKF_R_FILEERR 104
#define SKF_R_INVALIDHANDLEERR 105
#define SKF_R_INVALIDPARAMERR 106
#define SKF_R_READFILEERR 107
#define SKF_R_WRITEFILEERR 108
#define SKF_R_NAMELENERR 109
#define SKF_R_KEYUSAGEERR 110
#define SKF_R_MODULUSLENERR 111
#define SKF_R_NOTINITIALIZEERR 112
#define SKF_R_OBJERR 113
#define SKF_R_MEMORYERR 114
#define SKF_R_TIMEOUTERR 115
#define SKF_R_INDATALENERR 116
#define SKF_R_INDATAERR 117
#define SKF_R_GENRANDERR 118
#define SKF_R_HASHOBJERR 119
#define SKF_R_HASHERR 120
#define SKF_R_GENRSAKEYERR 121
#define SKF_R_RSAMODULUSLENERR 122
#define SKF_R_CSPIMPRTPUBKEYERR 123
#define SKF_R_RSAENCERR 124
#define SKF_R_RSADECERR 125
#define SKF_R_HASHNOTEQUALERR 126
#define SKF_R_KEYNOTFOUNTERR 127
#define SKF_R_CERTNOTFOUNTERR 128
#define SKF_R_NOTEXPORTERR 129
#define SKF_R_DECRYPTPADERR 130
#define SKF_R_MACLENERR 131
#define SKF_R_BUFFER_TOO_SMALL 132
#define SKF_R_KEYINFOTYPEERR 133
#define SKF_R_NOT_EVENTERR 134
#define SKF_R_DEVICE_REMOVED 135
#define SKF_R_PIN_INCORRECT 136
#define SKF_R_PIN_LOCKED 137
#define SKF_R_PIN_INVALID 138
#define SKF_R_PIN_LEN_RANGE 139
#define SKF_R_USER_ALREADY_LOGGED_IN 140
#define SKF_R_USER_PIN_NOT_INITIALIZED 141
#define SKF_R_USER_TYPE_INVALID 142
#define SKF_R_APPLICATION_NAME_INVALID 143
#define SKF_R_APPLICATION_EXISTS 144
#define SKF_R_USER_NOT_LOGGED_IN 145
#define SKF_R_APPLICATION_NOT_EXISTS 146
#define SKF_R_FILE_ALREADY_EXIST 147
#define SKF_R_NO_ROOM 148
#define SKF_R_FILE_NOT_EXIST 149
# define ESKF_R_NOT_IMPLEMENTED 100
#ifdef __cplusplus
}

719
engines/skf/skf_dummy.c Executable file
View File

@@ -0,0 +1,719 @@
/* engines/skf/skf_dummy.c */
/* ====================================================================
* Copyright (c) 2015-2016 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*/
#include <stdio.h>
#include <string.h>
#include "skf.h"
#define DEV_NAME "skf-soft-token"
#define DEV_NAME_LIST DEV_NAME"\0"
#define APP_NAME "default-app"
#define APP_NAME_LIST APP_NAME"\0"
#define CONTAINER_NAME "container0"
#define CONTAINER_NAME_LIST CONTAINER_NAME"\0"
ULONG DEVAPI SKF_WaitForDevEvent(LPSTR szDevName,
ULONG *pulDevNameLen, ULONG *pulEvent)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_CancelWaitForDevEvent()
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_EnumDev(BOOL bPresent,
LPSTR szNameList,
ULONG *pulSize)
{
return SAR_OK;
}
ULONG DEVAPI SKF_ConnectDev(LPSTR szName,
DEVHANDLE *phDev)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DisConnectDev(DEVHANDLE hDev)
{
return SAR_OK;
}
ULONG DEVAPI SKF_GetDevState(LPSTR szDevName,
ULONG *pulDevState)
{
if (!pulDevState) {
return SAR_INVALIDPARAMERR;
}
*pulDevState = DEV_PRESENT_STATE;
return SAR_OK;
}
ULONG DEVAPI SKF_SetLabel(DEVHANDLE hDev,
LPSTR szLabel)
{
return SAR_OK;
}
ULONG DEVAPI SKF_GetDevInfo(DEVHANDLE hDev,
DEVINFO *pDevInfo)
{
DEVINFO devInfo;
bzero(&devInfo, sizeof(DEVINFO));
devInfo.Version.major = 1;
devInfo.Version.minor = 0;
strcpy((char *)&devInfo.Manufacturer, "GmSSL Project (http://gmssl.org)");
strcpy((char *)&devInfo.Issuer, "GmSSL Project (http://gmssl.org)");
strcpy((char *)&devInfo.Label, "SKF Softotken");
strcpy((char *)&devInfo.SerialNumber, "000001");
devInfo.HWVersion.major = 1;
devInfo.HWVersion.minor = 0;
devInfo.FirmwareVersion.major = 1;
devInfo.FirmwareVersion.minor = 0;
devInfo.AlgSymCap = 0x0000041F;
devInfo.AlgAsymCap = 0x00030700;
devInfo.AlgHashCap = 0x00000007;
devInfo.DevAuthAlgId = SGD_SM4_CBC;
devInfo.TotalSpace = 0;
devInfo.FreeSpace = 0;
devInfo.MaxECCBufferSize = 0; /* FIXME: max inlen of ECC encrypt */
devInfo.MaxBufferSize = 0; /* FIXME: max inlen of SM4 encrypt */
memcpy(pDevInfo, &devInfo, sizeof(DEVINFO));
return SAR_OK;
}
ULONG DEVAPI SKF_LockDev(DEVHANDLE hDev,
ULONG ulTimeOut)
{
return SAR_OK;
}
ULONG DEVAPI SKF_UnlockDev(DEVHANDLE hDev)
{
return SAR_OK;
}
ULONG DEVAPI SKF_Transmit(DEVHANDLE hDev,
BYTE *pbCommand,
ULONG ulCommandLen,
BYTE *pbData,
ULONG *pulDataLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_ChangeDevAuthKey(DEVHANDLE hDev,
BYTE *pbKeyValue,
ULONG ulKeyLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DevAuth(DEVHANDLE hDev,
BYTE *pbAuthData,
ULONG ulLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_ChangePIN(HAPPLICATION hApplication,
ULONG ulPINType,
LPSTR szOldPin,
LPSTR szNewPin,
ULONG *pulRetryCount)
{
return SAR_OK;
}
LONG DEVAPI SKF_GetPINInfo(HAPPLICATION hApplication,
ULONG ulPINType,
ULONG *pulMaxRetryCount,
ULONG *pulRemainRetryCount,
BOOL *pbDefaultPin)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_VerifyPIN(HAPPLICATION hApplication,
ULONG ulPINType,
LPSTR szPIN,
ULONG *pulRetryCount)
{
return SAR_OK;
}
ULONG DEVAPI SKF_UnblockPIN(HAPPLICATION hApplication,
LPSTR szAdminPIN,
LPSTR szNewUserPIN,
ULONG *pulRetryCount)
{
return SAR_OK;
}
ULONG DEVAPI SKF_ClearSecureState(HAPPLICATION hApplication)
{
return SAR_OK;
}
ULONG DEVAPI SKF_CreateApplication(DEVHANDLE hDev,
LPSTR szAppName,
LPSTR szAdminPin,
DWORD dwAdminPinRetryCount,
LPSTR szUserPin,
DWORD dwUserPinRetryCount,
DWORD dwCreateFileRights,
HAPPLICATION *phApplication)
{
return SAR_OK;
}
ULONG DEVAPI SKF_EnumApplication(DEVHANDLE hDev,
LPSTR szAppName,
ULONG *pulSize)
{
if (!szAppName) {
*pulSize = sizeof(APP_NAME_LIST);
return SAR_OK;
}
if (*pulSize < sizeof(APP_NAME_LIST)) {
return SAR_BUFFER_TOO_SMALL;
}
memcpy(szAppName, APP_NAME_LIST, sizeof(APP_NAME_LIST));
return SAR_OK;
}
ULONG DEVAPI SKF_DeleteApplication(DEVHANDLE hDev,
LPSTR szAppName)
{
return SAR_OK;
}
ULONG DEVAPI SKF_OpenApplication(DEVHANDLE hDev,
LPSTR szAppName,
HAPPLICATION *phApplication)
{
if (!phApplication) {
return SAR_INVALIDPARAMERR;
}
return SAR_OK;
}
ULONG DEVAPI SKF_CloseApplication(HAPPLICATION hApplication)
{
return SAR_OK;
}
ULONG DEVAPI SKF_CreateFile(HAPPLICATION hApplication,
LPSTR szFileName,
ULONG ulFileSize,
ULONG ulReadRights,
ULONG ulWriteRights)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_DeleteFile(HAPPLICATION hApplication,
LPSTR szFileName)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_EnumFiles(HAPPLICATION hApplication,
LPSTR szFileList,
ULONG *pulSize)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_GetFileInfo(HAPPLICATION hApplication,
LPSTR szFileName,
FILEATTRIBUTE *pFileInfo)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ReadFile(HAPPLICATION hApplication,
LPSTR szFileName,
ULONG ulOffset,
ULONG ulSize,
BYTE * pbOutData,
ULONG *pulOutLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_WriteFile(HAPPLICATION hApplication,
LPSTR szFileName,
ULONG ulOffset,
BYTE *pbData,
ULONG ulSize)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_CreateContainer(HAPPLICATION hApplication,
LPSTR szContainerName,
HCONTAINER *phContainer)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DeleteContainer(HAPPLICATION hApplication,
LPSTR szContainerName)
{
return SAR_OK;
}
ULONG DEVAPI SKF_EnumContainer(HAPPLICATION hApplication,
LPSTR szContainerName,
ULONG *pulSize)
{
if (!pulSize) {
return SAR_INVALIDPARAMERR;
}
if (!szContainerName) {
*pulSize = sizeof(CONTAINER_NAME_LIST);
return SAR_OK;
}
if (*pulSize < sizeof(CONTAINER_NAME_LIST)) {
return SAR_BUFFER_TOO_SMALL;
}
memcpy(szContainerName, CONTAINER_NAME_LIST, sizeof(CONTAINER_NAME_LIST));
return SAR_OK;
}
ULONG DEVAPI SKF_OpenContainer(HAPPLICATION hApplication,
LPSTR szContainerName,
HCONTAINER *phContainer)
{
return SAR_OK;
}
ULONG DEVAPI SKF_CloseContainer(HCONTAINER hContainer)
{
return SAR_OK;
}
ULONG DEVAPI SKF_GetContainerType(HCONTAINER hContainer,
ULONG *pulContainerType)
{
if (!pulContainerType) {
return SAR_INVALIDPARAMERR;
}
*pulContainerType = CONTAINER_TYPE_ECC;
return SAR_OK;
}
ULONG DEVAPI SKF_ImportCertificate(HCONTAINER hContainer,
BOOL bSignFlag,
BYTE *pbCert,
ULONG ulCertLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_ExportCertificate(HCONTAINER hContainer,
BOOL bSignFlag,
BYTE* pbCert,
ULONG *pulCertLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_GenRandom(DEVHANDLE hDev,
BYTE *pbRandom,
ULONG ulRandomLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_GenExtRSAKey(DEVHANDLE hDev,
ULONG ulBitsLen,
RSAPRIVATEKEYBLOB *pBlob)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_GenRSAKeyPair(HCONTAINER hContainer,
ULONG ulBitsLen,
RSAPUBLICKEYBLOB *pBlob)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ImportRSAKeyPair(HCONTAINER hContainer,
ULONG ulSymAlgId,
BYTE *pbWrappedKey,
ULONG ulWrappedKeyLen,
BYTE *pbEncryptedData,
ULONG ulEncryptedDataLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_RSASignData(HCONTAINER hContainer,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbSignature,
ULONG *pulSignLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_RSAVerify(DEVHANDLE hDev,
RSAPUBLICKEYBLOB *pRSAPubKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbSignature,
ULONG ulSignLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_RSAExportSessionKey(HCONTAINER hContainer,
ULONG ulAlgId,
RSAPUBLICKEYBLOB *pPubKey,
BYTE *pbData,
ULONG *pulDataLen,
HANDLE *phSessionKey)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ExtRSAPubKeyOperation(DEVHANDLE hDev,
RSAPUBLICKEYBLOB *pRSAPubKeyBlob,
BYTE *pbInput,
ULONG ulInputLen,
BYTE *pbOutput,
ULONG *pulOutputLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ExtRSAPriKeyOperation(DEVHANDLE hDev,
RSAPRIVATEKEYBLOB *pRSAPriKeyBlob,
BYTE *pbInput,
ULONG ulInputLen,
BYTE *pbOutput,
ULONG *pulOutputLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_GenECCKeyPair(HCONTAINER hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pBlob)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ImportECCKeyPair(HCONTAINER hContainer,
PENVELOPEDKEYBLOB pEnvelopedKeyBlob)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ECCSignData(HCONTAINER hContainer,
BYTE *pbData,
ULONG ulDataLen,
PECCSIGNATUREBLOB pSignature)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ECCVerify(DEVHANDLE hDev,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
PECCSIGNATUREBLOB pSignature)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ECCExportSessionKey(HCONTAINER hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pPubKey,
PECCCIPHERBLOB pData,
HANDLE *phSessionKey)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ExtECCEncrypt(DEVHANDLE hDev,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
BYTE *pbPlainText,
ULONG ulPlainTextLen,
PECCCIPHERBLOB pCipherText)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ExtECCDecrypt(DEVHANDLE hDev,
ECCPRIVATEKEYBLOB *pECCPriKeyBlob,
PECCCIPHERBLOB pCipherText,
BYTE *pbPlainText,
ULONG *pulPlainTextLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ExtECCSign(DEVHANDLE hDev,
ECCPRIVATEKEYBLOB *pECCPriKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
PECCSIGNATUREBLOB pSignature)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ExtECCVerify(DEVHANDLE hDev,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
PECCSIGNATUREBLOB pSignature)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_GenerateAgreementDataWithECC(HCONTAINER hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pTempECCPubKeyBlob,
BYTE *pbID,
ULONG ulIDLen,
HANDLE *phAgreementHandle)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_GenerateAgreementDataAndKeyWithECC(HANDLE hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pSponsorECCPubKeyBlob,
ECCPUBLICKEYBLOB *pSponsorTempECCPubKeyBlob,
ECCPUBLICKEYBLOB *pTempECCPubKeyBlob,
BYTE *pbID,
ULONG ulIDLen,
BYTE *pbSponsorID,
ULONG ulSponsorIDLen,
HANDLE *phKeyHandle)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_GenerateKeyWithECC(HANDLE hAgreementHandle,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
ECCPUBLICKEYBLOB *pTempECCPubKeyBlob,
BYTE *pbID,
ULONG ulIDLen,
HANDLE *phKeyHandle)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ExportPublicKey(HCONTAINER hContainer,
BOOL bSignFlag,
BYTE* pbBlob,
ULONG* pulBlobLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_ImportSessionKey(HCONTAINER hContainer,
ULONG ulAlgId,
BYTE *pbWrapedData,
ULONG ulWrapedLen,
HANDLE *phKey)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_SetSymmKey(DEVHANDLE hDev,
BYTE *pbKey,
ULONG ulAlgID,
HANDLE *phKey)
{
return SAR_OK;
}
ULONG DEVAPI SKF_EncryptInit(HANDLE hKey,
BLOCKCIPHERPARAM EncryptParam)
{
return SAR_OK;
}
ULONG DEVAPI SKF_Encrypt(HANDLE hKey,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbEncryptedData,
ULONG *pulEncryptedLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_EncryptUpdate(HANDLE hKey,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbEncryptedData,
ULONG *pulEncryptedLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_EncryptFinal(HANDLE hKey,
BYTE *pbEncryptedData,
ULONG *pulEncryptedDataLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DecryptInit(HANDLE hKey,
BLOCKCIPHERPARAM DecryptParam)
{
return SAR_OK;
}
ULONG DEVAPI SKF_Decrypt(HANDLE hKey,
BYTE *pbEncryptedData,
ULONG ulEncryptedLen,
BYTE *pbData,
ULONG *pulDataLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DecryptUpdate(HANDLE hKey,
BYTE *pbEncryptedData,
ULONG ulEncryptedLen,
BYTE *pbData,
ULONG *pulDataLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DecryptFinal(HANDLE hKey,
BYTE *pbDecryptedData,
ULONG *pulDecryptedDataLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DigestInit(DEVHANDLE hDev,
ULONG ulAlgID,
ECCPUBLICKEYBLOB *pPubKey,
BYTE *pucID,
ULONG ulIDLen,
HANDLE *phHash)
{
return SAR_OK;
}
ULONG DEVAPI SKF_Digest(HANDLE hHash,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbHashData,
ULONG *pulHashLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DigestUpdate(HANDLE hHash,
BYTE *pbData,
ULONG ulDataLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_DigestFinal(HANDLE hHash,
BYTE *pHashData,
ULONG *pulHashLen)
{
return SAR_OK;
}
ULONG DEVAPI SKF_MacInit(HANDLE hKey,
BLOCKCIPHERPARAM *pMacParam,
HANDLE *phMac)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_Mac(HANDLE hMac,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbMacData,
ULONG *pulMacLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_MacUpdate(HANDLE hMac,
BYTE *pbData,
ULONG ulDataLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_MacFinal(HANDLE hMac,
BYTE *pbMacData,
ULONG *pulMacDataLen)
{
return SAR_NOTSUPPORTYETERR;
}
ULONG DEVAPI SKF_CloseHandle(HANDLE hHandle)
{
return SAR_NOTSUPPORTYETERR;
}

260
engines/skf/skftest.c Normal file
View File

@@ -0,0 +1,260 @@
/* engines/skf/skftest.c */
/* ====================================================================
* Copyright (c) 2015-2016 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "skf.h"
#define AUTH_RAND_LEN 16
#define AUTH_DATA_LEN 16
#define AUTH_KEY_LEN 16
int main(int argc, char **argv)
{
ULONG rv;
BYTE buf[2048];
ULONG len;
BOOL bPresent = TRUE;
CHAR devNameList[256];
LPSTR devName;
DEVHANDLE hDev = NULL;
ULONG devState;
char *devStateStr;
DEVINFO devInfo;
BYTE authRand[AUTH_RAND_LEN];
BYTE authData[AUTH_DATA_LEN];
BYTE authKey[AUTH_KEY_LEN];
BLOCKCIPHERPARAM authParam;
HANDLE hAuthKey = NULL;
CHAR appNameList[256];
LPSTR appName;
HAPPLICATION hApp = NULL;
CHAR containerNameList[256];
LPSTR containerName;
HCONTAINER hContainer = NULL;
ULONG containerType;
char *containerTypeStr;
BYTE dgst[32];
ULONG dgstLen = sizeof(dgst);
ECCSIGNATUREBLOB sigblob;
len = sizeof(devNameList);
if ((rv = SKF_EnumDev(bPresent, devNameList, &len)) != SAR_OK) {
goto end;
}
devName = devNameList;
printf("Device Name : %s\n", devName);
if ((rv = SKF_GetDevState(devName, &devState)) != SAR_OK) {
goto end;
}
switch (devState) {
case DEV_ABSENT_STATE:
devStateStr = "DEV_ABSENT_STATE";
break;
case DEV_PRESENT_STATE:
devStateStr = "DEV_PRESENT_STATE";
break;
case DEV_UNKNOW_STATE:
devStateStr = "DEV_UNKNOW_STATE";
break;
default:
devStateStr = "(undefined)";
}
printf("Device State: %s\n", devStateStr);
if ((rv = SKF_ConnectDev(devName, &hDev)) != SAR_OK) {
goto end;
}
if ((rv = SKF_GetDevInfo(hDev, &devInfo)) != SAR_OK) {
goto end;
}
printf("Device Info:\n");
printf(" Device Version : %d.%d\n", devInfo.Version.major, devInfo.Version.minor);
printf(" Manufacturer : %s\n", devInfo.Manufacturer);
printf(" Issuer : %s\n", devInfo.Issuer);
printf(" Label : %s\n", devInfo.Label);
printf(" Serial Number : %s\n", devInfo.SerialNumber);
printf(" Hardware Version : %d.%d\n", devInfo.HWVersion.major, devInfo.HWVersion.minor);
printf(" Firmware Version : %d.%d\n", devInfo.FirmwareVersion.major, devInfo.FirmwareVersion.minor);
printf(" AlgSymCap : 0x%08x\n", devInfo.AlgSymCap);
printf(" AlgAsymCap : 0x%08x\n", devInfo.AlgAsymCap);
printf(" AlgHashCap : 0x%08x\n", devInfo.AlgHashCap);
printf(" AlgHashCap : 0x%08x\n", devInfo.DevAuthAlgId);
printf(" Total Space : %u\n", devInfo.TotalSpace);
printf(" Free Space : %u\n", devInfo.FreeSpace);
printf(" MaxECCBuffer : %u\n", devInfo.MaxECCBufferSize);
printf(" MaxBuffer : %u\n", devInfo.MaxBufferSize);
/* Device Authentication */
if ((rv = SKF_GenRandom(hDev, authRand, sizeof(authRand))) != SAR_OK) {
fprintf(stderr, "error: %s %d\n", __FILE__, __LINE__);
goto end;
}
if ((rv = SKF_SetSymmKey(hDev, authKey, devInfo.DevAuthAlgId, &hAuthKey)) != SAR_OK) {
fprintf(stderr, "error: %s %d\n", __FILE__, __LINE__);
goto end;
}
bzero(&authParam, sizeof(authParam));
if ((rv = SKF_EncryptInit(hAuthKey, authParam)) != SAR_OK) {
fprintf(stderr, "error: %s %d\n", __FILE__, __LINE__);
goto end;
}
if ((rv = SKF_Encrypt(hAuthKey, authRand, sizeof(authRand), authData, &len)) != SAR_OK) {
fprintf(stderr, "error: %s %d\n", __FILE__, __LINE__);
goto end;
}
if ((rv = SKF_DevAuth(hDev, authData, len)) != SAR_OK) {
fprintf(stderr, "error: %s %d\n", __FILE__, __LINE__);
goto end;
}
printf("Device Authentication Passed.\n");
/* Open Application */
len = sizeof(appNameList);
if ((rv = SKF_EnumApplication(hDev, appNameList, &len)) != SAR_OK) {
goto end;
}
appName = appNameList;
printf("Application Name : %s\n", appName);
if ((rv = SKF_OpenApplication(hDev, appName, &hApp)) != SAR_OK) {
goto end;
}
/* Open Containter */
len = sizeof(containerNameList);
if ((rv = SKF_EnumContainer(hApp, containerNameList, &len)) != SAR_OK) {
goto end;
}
containerName = containerNameList;
printf("Container Name: %s\n", containerName);
if ((rv = SKF_OpenContainer(hApp, containerName, &hContainer)) != SAR_OK) {
goto end;
}
if ((rv = SKF_GetContainerType(hContainer, &containerType)) != SAR_OK) {
goto end;
}
switch (containerType) {
case CONTAINER_TYPE_UNDEF:
containerTypeStr = "Undef";
break;
case CONTAINER_TYPE_RSA:
containerTypeStr = "RSA";
break;
case CONTAINER_TYPE_ECC:
containerTypeStr = "ECC";
break;
default:
containerTypeStr = "(error)";
}
printf("Container Type: %s\n", containerTypeStr);
/* Sign */
if ((rv = SKF_ECCSignData(hContainer, dgst, dgstLen, &sigblob)) != SAR_OK) {
goto end;
}
/* Export Signing Public Key */
if ((rv = SKF_ExportPublicKey(hContainer, TRUE, buf, &len)) != SAR_OK) {
goto end;
}
printf("Success\n");
end:
//SKF_CloseContainer(hContainer);
//SKF_CloseApplication(hApp);
return 0;
}
int open_container(const char *dev, const char *app, const char *container,
const unsigned char *authkey, size_t authkeylen)
{
DEVHANDLE hDev = NULL;
DEVINFO devInfo;
HAPPLICATION hApp = NULL;
HCONTAINER hContainer = NULL;
return 0;
}