├── .gitattributes ├── .github └── workflows │ ├── android.yml │ ├── ios.yml │ ├── linux.yml │ ├── macos.yml │ └── windows.yml ├── .gitignore ├── CHANGELOG ├── LICENSE.md ├── NOTICE.md ├── README.md ├── build ├── android │ ├── build.bat │ └── jni │ │ ├── Android.mk │ │ ├── Application.mk │ │ └── empty-pkcs11.version ├── ios │ ├── build.sh │ └── empty-pkcs11.xcodeproj │ │ └── project.pbxproj ├── linux │ ├── Makefile │ ├── build.sh │ └── empty-pkcs11.version ├── macos │ ├── Makefile │ ├── build.sh │ └── empty-pkcs11.symbols └── windows │ ├── build.bat │ ├── empty-pkcs11.sln │ └── empty-pkcs11 │ ├── empty-pkcs11.vcxproj │ └── empty-pkcs11.vcxproj.filters └── src ├── cryptoki ├── pkcs11.h ├── pkcs11f.h └── pkcs11t.h ├── empty-pkcs11.c └── empty-pkcs11.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behaviour, in case users don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Explicitly declare text files we want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.c text 7 | *.cs text 8 | *.config text 9 | *.h text 10 | *.txt text 11 | 12 | # Declare files that will always have CRLF line endings on checkout. 13 | *.sln text eol=crlf 14 | *.vcxproj text eol=crlf 15 | *.vcxproj.filters text eol=crlf 16 | *.csproj text eol=crlf 17 | 18 | # Denote all files that are truly binary and should not be modified. 19 | *.pdf binary 20 | *.dll binary 21 | -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: windows-latest 12 | 13 | steps: 14 | - name: Checkout source 15 | uses: actions/checkout@v4 16 | 17 | - name: Build source 18 | shell: cmd 19 | run: | 20 | cd build/android/ 21 | build.bat 22 | 23 | - name: Upload artifacts 24 | uses: actions/upload-artifact@v4 25 | with: 26 | name: empty-pkcs11-android 27 | path: build/android/libs/ 28 | -------------------------------------------------------------------------------- /.github/workflows/ios.yml: -------------------------------------------------------------------------------- 1 | name: iOS 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: macos-latest 12 | 13 | steps: 14 | - name: Checkout source 15 | uses: actions/checkout@v4 16 | 17 | - name: Build source 18 | run: | 19 | cd build/ios/ 20 | sh build.sh 21 | 22 | - name: Upload artifacts 23 | uses: actions/upload-artifact@v4 24 | with: 25 | name: empty-pkcs11-ios 26 | path: build/ios/libempty-pkcs11-*.a 27 | -------------------------------------------------------------------------------- /.github/workflows/linux.yml: -------------------------------------------------------------------------------- 1 | name: Linux 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Setup OS 15 | run: | 16 | sudo apt-get update 17 | sudo apt-get install -y build-essential gcc-multilib 18 | 19 | - name: Checkout source 20 | uses: actions/checkout@v4 21 | 22 | - name: Build source 23 | run: | 24 | cd build/linux/ 25 | sh build.sh 26 | 27 | - name: Upload artifacts 28 | uses: actions/upload-artifact@v4 29 | with: 30 | name: empty-pkcs11-linux 31 | path: build/linux/empty-pkcs11-*.so 32 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: macOS 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: macos-latest 12 | 13 | steps: 14 | - name: Checkout source 15 | uses: actions/checkout@v4 16 | 17 | - name: Build source 18 | run: | 19 | cd build/macos/ 20 | sh build.sh 21 | 22 | - name: Upload artifacts 23 | uses: actions/upload-artifact@v4 24 | with: 25 | name: empty-pkcs11-macos 26 | path: build/macos/empty-pkcs11.dylib 27 | -------------------------------------------------------------------------------- /.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: windows-latest 12 | 13 | steps: 14 | - name: Checkout source 15 | uses: actions/checkout@v4 16 | 17 | - name: Build source 18 | shell: cmd 19 | run: | 20 | cd build/windows/ 21 | build.bat 22 | 23 | - name: Upload artifacts 24 | uses: actions/upload-artifact@v4 25 | with: 26 | name: empty-pkcs11-windows 27 | path: build/windows/empty-pkcs11-*.dll 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Bb]in/ 2 | [Oo]bj/ 3 | *.userprefs 4 | test-results/ 5 | TestResults/ 6 | *.sdf 7 | *.suo 8 | *.user 9 | Debug/ 10 | Release/ 11 | ipch/ 12 | .vs/ 13 | /build/android/libs 14 | /build/ios/build 15 | /build/ios/*.a 16 | /build/linux/*.so 17 | /build/macos/*.dylib 18 | /build/windows/*.dll -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | EMPTY-PKCS11 2.0.0 (2025-01-29) 2 | - Implements PKCS#11 v3.1 3 | - Targets current platforms 4 | 5 | EMPTY-PKCS11 1.0.0 (2019-01-29) 6 | - Initial stable release 7 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # Apache License 2 | **Version 2.0, January 2004** 3 | http://www.apache.org/licenses/ 4 | 5 | ## TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | ### 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 10 | 11 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 12 | 13 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 14 | 15 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 16 | 17 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 18 | 19 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 20 | 21 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 22 | 23 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 24 | 25 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 26 | 27 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 28 | 29 | ### 2. Grant of Copyright License. 30 | 31 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 32 | 33 | ### 3. Grant of Patent License. 34 | 35 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 36 | 37 | ### 4. Redistribution. 38 | 39 | You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 40 | 41 | * (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and 42 | 43 | * (b) You must cause any modified files to carry prominent notices stating that You changed the files; and 44 | 45 | * (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 46 | 47 | * (d) If the Work includes a "[NOTICE](NOTICE.md)" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 48 | 49 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 50 | 51 | ### 5. Submission of Contributions. 52 | 53 | Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 54 | 55 | ### 6. Trademarks. 56 | 57 | This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 58 | 59 | ### 7. Disclaimer of Warranty. 60 | 61 | Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 62 | 63 | ### 8. Limitation of Liability. 64 | 65 | In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 66 | 67 | ### 9. Accepting Warranty or Additional Liability. 68 | 69 | While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. 70 | 71 | ## END OF TERMS AND CONDITIONS 72 | 73 | ## APPENDIX: How to apply the Apache License to your work. 74 | 75 | To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. 76 | 77 | ``` 78 | Copyright [yyyy] [name of copyright owner] 79 | 80 | Licensed under the Apache License, Version 2.0 (the "License"); 81 | you may not use this file except in compliance with the License. 82 | You may obtain a copy of the License at 83 | 84 | http://www.apache.org/licenses/LICENSE-2.0 85 | 86 | Unless required by applicable law or agreed to in writing, software 87 | distributed under the License is distributed on an "AS IS" BASIS, 88 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 89 | See the License for the specific language governing permissions and 90 | limitations under the License. 91 | ``` 92 | -------------------------------------------------------------------------------- /NOTICE.md: -------------------------------------------------------------------------------- 1 | This product includes software developed at 2 | The Pkcs11Interop Project (http://www.pkcs11interop.net). 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | EMPTY-PKCS11 2 | =========== 3 | **PKCS#11 library with the simplest possible implementation** 4 | 5 | [![Windows](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/windows.yml/badge.svg?branch=master)](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/windows.yml) 6 | [![Linux](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/linux.yml/badge.svg?branch=master)](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/linux.yml) 7 | [![macOS](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/macos.yml/badge.svg?branch=master)](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/macos.yml) 8 | [![Android](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/android.yml/badge.svg?branch=master)](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/android.yml) 9 | [![iOS](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/ios.yml/badge.svg?branch=master)](https://github.com/Pkcs11Interop/empty-pkcs11/actions/workflows/ios.yml) 10 | 11 | ## Table of Contents 12 | 13 | * [Overview](#overview) 14 | * [Download](#download) 15 | * [Building the source](#building-the-source) 16 | * [Windows](#windows) 17 | * [Linux](#linux) 18 | * [macOS](#macos) 19 | * [Android](#android) 20 | * [iOS](#ios) 21 | * [License](#license) 22 | * [About](#about) 23 | 24 | ## Overview 25 | 26 | EMPTY-PKCS11 is minimalistic C library that implements [PKCS#11 v3.1](https://github.com/Pkcs11Interop/PKCS11-SPECS/tree/master/v3.1) API in the simplest possible way - all PKCS#11 functions except `C_GetFunctionList`, `C_GetInterfaceList` and `C_GetInterface` return `CKR_FUNCTION_NOT_SUPPORTED` return value. 27 | 28 | It has been tested on several desktop and mobile platforms and as such can be used as a lightweight skeleton for the development of portable PKCS#11 libraries. 29 | 30 | ## Download 31 | 32 | Signed precompiled binaries as well as source code releases can be downloaded from [releases page](https://github.com/Pkcs11Interop/empty-pkcs11/releases). 33 | Archives with source code are signed with [GnuPG key of Jaroslav Imrich](https://www.jimrich.sk/crypto/). 34 | Windows libraries are signed with [code-signing certificate of Jaroslav Imrich](https://www.jimrich.sk/crypto/). 35 | 36 | ## Building the source 37 | 38 | ### Windows 39 | 40 | Execute the build script on a 64-bit Windows machine with [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (or newer) installed: 41 | 42 | ``` 43 | cd build/windows/ 44 | build.bat 45 | ``` 46 | 47 | The script should use Visual Studio to build both 32-bit (`empty-pkcs11-x86.dll`) and 64-bit (`empty-pkcs11-x64.dll`) versions of the library. 48 | 49 | ### Linux 50 | 51 | Execute the build script on a 64-bit Linux machine with GCC, GNU Make and GCC multilib support installed (available in [build-essential](https://packages.ubuntu.com/noble/build-essential) and [gcc-multilib](https://packages.ubuntu.com/noble/gcc-multilib) packages on Ubuntu 24.04 LTS): 52 | 53 | ``` 54 | cd build/linux/ 55 | sh build.sh 56 | ``` 57 | 58 | The script should use GCC to build both 32-bit (`empty-pkcs11-x86.so`) and 64-bit (`empty-pkcs11-x64.so`) versions of the library. 59 | 60 | ### macOS 61 | 62 | Execute the build script on a 64-bit macOS machine with [Xcode](https://developer.apple.com/xcode/) and its "Command Line Tools" extension installed: 63 | 64 | ``` 65 | cd build/macos/ 66 | sh build.sh 67 | ``` 68 | 69 | The script should use Clang to build Mach-O universal binary (`empty-pkcs11.dylib`) usable on both Apple silicon and Intel-based Mac computers. 70 | 71 | ### Android 72 | 73 | Execute the build script on a 64-bit Windows machine with [Android NDK r26d](https://developer.android.com/ndk/) (or newer) unpacked in `C:\android-ndk` or in a folder defined by `ANDROID_NDK` environment variable: 74 | 75 | ``` 76 | cd build/android/ 77 | build.bat 78 | ``` 79 | 80 | The script should use Android NDK to build the library for all supported architectures. Results will be located in `libs` directory and its subdirectories. 81 | 82 | ### iOS 83 | 84 | Execute the build script on a 64-bit macOS machine with [Xcode](https://developer.apple.com/xcode/) and its "Command Line Tools" extension installed: 85 | 86 | ``` 87 | cd build/ios/ 88 | sh build.sh 89 | ``` 90 | 91 | The script should use Xcode to build the library with iphonesimulator SDK (`libempty-pkcs11-iphonesimulator.a`) and iphoneos SDK (`libempty-pkcs11-iphoneos.a`). 92 | 93 | ## License 94 | 95 | EMPTY-PKCS11 is available under the terms of the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). 96 | [Human friendly license summary](https://www.tldrlegal.com/license/apache-license-2-0-apache-2-0) is available at tldrlegal.com but the [full license text](LICENSE.md) always prevails. 97 | 98 | ## About 99 | 100 | EMPTY-PKCS11 has been written for the [Pkcs11Interop](https://www.pkcs11interop.net/) project by [Jaroslav Imrich](https://www.jimrich.sk/). 101 | Please visit project website - [pkcs11interop.net](https://www.pkcs11interop.net) - for more information. 102 | -------------------------------------------------------------------------------- /build/android/build.bat: -------------------------------------------------------------------------------- 1 | @setlocal 2 | @set PATH=%PATH%;%ANDROID_NDK%;c:\android-ndk 3 | @ndk-build -C jni 4 | @endlocal -------------------------------------------------------------------------------- /build/android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := empty-pkcs11 5 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../src 6 | LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../src/empty-pkcs11.c 7 | LOCAL_LDFLAGS += -Wl,--version-script,$(LOCAL_PATH)/empty-pkcs11.version 8 | include $(BUILD_SHARED_LIBRARY) 9 | -------------------------------------------------------------------------------- /build/android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | 3 | -------------------------------------------------------------------------------- /build/android/jni/empty-pkcs11.version: -------------------------------------------------------------------------------- 1 | EMPTYPKCS11 { 2 | global: 3 | C_*; 4 | local: 5 | *; 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /build/ios/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | rm -Rf build 6 | rm -Rf empty-pkcs11*.a 7 | 8 | xcodebuild -project empty-pkcs11.xcodeproj -target empty-pkcs11 -sdk iphonesimulator -configuration Release clean build 9 | cp build/Release-iphonesimulator/libempty-pkcs11.a libempty-pkcs11-iphonesimulator.a 10 | 11 | xcodebuild -project empty-pkcs11.xcodeproj -target empty-pkcs11 -sdk iphoneos -configuration Release clean build 12 | cp build/Release-iphoneos/libempty-pkcs11.a libempty-pkcs11-iphoneos.a 13 | -------------------------------------------------------------------------------- /build/ios/empty-pkcs11.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 487FCF101AB4E83300CF36DA /* empty-pkcs11.h in Headers */ = {isa = PBXBuildFile; fileRef = 487FCF0F1AB4E83300CF36DA /* empty-pkcs11.h */; }; 11 | 487FCF121AB4E84D00CF36DA /* empty-pkcs11.c in Sources */ = {isa = PBXBuildFile; fileRef = 487FCF111AB4E84D00CF36DA /* empty-pkcs11.c */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXFileReference section */ 15 | 487FCF081AB4E78800CF36DA /* libempty-pkcs11.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libempty-pkcs11.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 16 | 487FCF0F1AB4E83300CF36DA /* empty-pkcs11.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "empty-pkcs11.h"; path = "../../src/empty-pkcs11.h"; sourceTree = ""; }; 17 | 487FCF111AB4E84D00CF36DA /* empty-pkcs11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "empty-pkcs11.c"; path = "../../src/empty-pkcs11.c"; sourceTree = ""; }; 18 | /* End PBXFileReference section */ 19 | 20 | /* Begin PBXFrameworksBuildPhase section */ 21 | 487FCF051AB4E78800CF36DA /* Frameworks */ = { 22 | isa = PBXFrameworksBuildPhase; 23 | buildActionMask = 2147483647; 24 | files = ( 25 | ); 26 | runOnlyForDeploymentPostprocessing = 0; 27 | }; 28 | /* End PBXFrameworksBuildPhase section */ 29 | 30 | /* Begin PBXGroup section */ 31 | 487FCEFF1AB4E78800CF36DA = { 32 | isa = PBXGroup; 33 | children = ( 34 | 487FCF111AB4E84D00CF36DA /* empty-pkcs11.c */, 35 | 487FCF0F1AB4E83300CF36DA /* empty-pkcs11.h */, 36 | 487FCF091AB4E78800CF36DA /* Products */, 37 | ); 38 | sourceTree = ""; 39 | }; 40 | 487FCF091AB4E78800CF36DA /* Products */ = { 41 | isa = PBXGroup; 42 | children = ( 43 | 487FCF081AB4E78800CF36DA /* libempty-pkcs11.a */, 44 | ); 45 | name = Products; 46 | sourceTree = ""; 47 | }; 48 | /* End PBXGroup section */ 49 | 50 | /* Begin PBXHeadersBuildPhase section */ 51 | 487FCF061AB4E78800CF36DA /* Headers */ = { 52 | isa = PBXHeadersBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | 487FCF101AB4E83300CF36DA /* empty-pkcs11.h in Headers */, 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXHeadersBuildPhase section */ 60 | 61 | /* Begin PBXNativeTarget section */ 62 | 487FCF071AB4E78800CF36DA /* empty-pkcs11 */ = { 63 | isa = PBXNativeTarget; 64 | buildConfigurationList = 487FCF0C1AB4E78800CF36DA /* Build configuration list for PBXNativeTarget "empty-pkcs11" */; 65 | buildPhases = ( 66 | 487FCF041AB4E78800CF36DA /* Sources */, 67 | 487FCF051AB4E78800CF36DA /* Frameworks */, 68 | 487FCF061AB4E78800CF36DA /* Headers */, 69 | ); 70 | buildRules = ( 71 | ); 72 | dependencies = ( 73 | ); 74 | name = "empty-pkcs11"; 75 | productName = "empty-pkcs11"; 76 | productReference = 487FCF081AB4E78800CF36DA /* libempty-pkcs11.a */; 77 | productType = "com.apple.product-type.library.static"; 78 | }; 79 | /* End PBXNativeTarget section */ 80 | 81 | /* Begin PBXProject section */ 82 | 487FCF001AB4E78800CF36DA /* Project object */ = { 83 | isa = PBXProject; 84 | attributes = { 85 | LastUpgradeCheck = 0620; 86 | ORGANIZATIONNAME = ""; 87 | TargetAttributes = { 88 | 487FCF071AB4E78800CF36DA = { 89 | CreatedOnToolsVersion = 6.2; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = 487FCF031AB4E78800CF36DA /* Build configuration list for PBXProject "empty-pkcs11" */; 94 | compatibilityVersion = "Xcode 3.2"; 95 | developmentRegion = English; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | ); 100 | mainGroup = 487FCEFF1AB4E78800CF36DA; 101 | productRefGroup = 487FCF091AB4E78800CF36DA /* Products */; 102 | projectDirPath = ""; 103 | projectRoot = ""; 104 | targets = ( 105 | 487FCF071AB4E78800CF36DA /* empty-pkcs11 */, 106 | ); 107 | }; 108 | /* End PBXProject section */ 109 | 110 | /* Begin PBXSourcesBuildPhase section */ 111 | 487FCF041AB4E78800CF36DA /* Sources */ = { 112 | isa = PBXSourcesBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | 487FCF121AB4E84D00CF36DA /* empty-pkcs11.c in Sources */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXSourcesBuildPhase section */ 120 | 121 | /* Begin XCBuildConfiguration section */ 122 | 487FCF0A1AB4E78800CF36DA /* Debug */ = { 123 | isa = XCBuildConfiguration; 124 | buildSettings = { 125 | ALWAYS_SEARCH_USER_PATHS = NO; 126 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 127 | CLANG_CXX_LIBRARY = "libc++"; 128 | CLANG_ENABLE_MODULES = YES; 129 | CLANG_ENABLE_OBJC_ARC = YES; 130 | CLANG_WARN_BOOL_CONVERSION = YES; 131 | CLANG_WARN_CONSTANT_CONVERSION = YES; 132 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 133 | CLANG_WARN_EMPTY_BODY = YES; 134 | CLANG_WARN_ENUM_CONVERSION = YES; 135 | CLANG_WARN_INT_CONVERSION = YES; 136 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 137 | CLANG_WARN_UNREACHABLE_CODE = YES; 138 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 139 | COPY_PHASE_STRIP = NO; 140 | ENABLE_STRICT_OBJC_MSGSEND = YES; 141 | GCC_C_LANGUAGE_STANDARD = gnu99; 142 | GCC_DYNAMIC_NO_PIC = NO; 143 | GCC_OPTIMIZATION_LEVEL = 0; 144 | GCC_PREPROCESSOR_DEFINITIONS = ( 145 | "DEBUG=1", 146 | "$(inherited)", 147 | ); 148 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 149 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 150 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 151 | GCC_WARN_UNDECLARED_SELECTOR = YES; 152 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 153 | GCC_WARN_UNUSED_FUNCTION = YES; 154 | GCC_WARN_UNUSED_VARIABLE = YES; 155 | MACOSX_DEPLOYMENT_TARGET = 10.10; 156 | MTL_ENABLE_DEBUG_INFO = YES; 157 | ONLY_ACTIVE_ARCH = YES; 158 | SDKROOT = macosx; 159 | }; 160 | name = Debug; 161 | }; 162 | 487FCF0B1AB4E78800CF36DA /* Release */ = { 163 | isa = XCBuildConfiguration; 164 | buildSettings = { 165 | ALWAYS_SEARCH_USER_PATHS = NO; 166 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 167 | CLANG_CXX_LIBRARY = "libc++"; 168 | CLANG_ENABLE_MODULES = YES; 169 | CLANG_ENABLE_OBJC_ARC = YES; 170 | CLANG_WARN_BOOL_CONVERSION = YES; 171 | CLANG_WARN_CONSTANT_CONVERSION = YES; 172 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 173 | CLANG_WARN_EMPTY_BODY = YES; 174 | CLANG_WARN_ENUM_CONVERSION = YES; 175 | CLANG_WARN_INT_CONVERSION = YES; 176 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 177 | CLANG_WARN_UNREACHABLE_CODE = YES; 178 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 179 | COPY_PHASE_STRIP = NO; 180 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 181 | ENABLE_NS_ASSERTIONS = NO; 182 | ENABLE_STRICT_OBJC_MSGSEND = YES; 183 | GCC_C_LANGUAGE_STANDARD = gnu99; 184 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 185 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 186 | GCC_WARN_UNDECLARED_SELECTOR = YES; 187 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 188 | GCC_WARN_UNUSED_FUNCTION = YES; 189 | GCC_WARN_UNUSED_VARIABLE = YES; 190 | MACOSX_DEPLOYMENT_TARGET = 10.10; 191 | MTL_ENABLE_DEBUG_INFO = NO; 192 | SDKROOT = macosx; 193 | }; 194 | name = Release; 195 | }; 196 | 487FCF0D1AB4E78800CF36DA /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = YES; 200 | EXECUTABLE_PREFIX = lib; 201 | PRODUCT_NAME = "$(TARGET_NAME)"; 202 | SDKROOT = iphoneos; 203 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 204 | USER_HEADER_SEARCH_PATHS = ../../src/; 205 | }; 206 | name = Debug; 207 | }; 208 | 487FCF0E1AB4E78800CF36DA /* Release */ = { 209 | isa = XCBuildConfiguration; 210 | buildSettings = { 211 | ALWAYS_SEARCH_USER_PATHS = YES; 212 | EXECUTABLE_PREFIX = lib; 213 | PRODUCT_NAME = "$(TARGET_NAME)"; 214 | SDKROOT = iphoneos; 215 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 216 | USER_HEADER_SEARCH_PATHS = ../../src/; 217 | }; 218 | name = Release; 219 | }; 220 | /* End XCBuildConfiguration section */ 221 | 222 | /* Begin XCConfigurationList section */ 223 | 487FCF031AB4E78800CF36DA /* Build configuration list for PBXProject "empty-pkcs11" */ = { 224 | isa = XCConfigurationList; 225 | buildConfigurations = ( 226 | 487FCF0A1AB4E78800CF36DA /* Debug */, 227 | 487FCF0B1AB4E78800CF36DA /* Release */, 228 | ); 229 | defaultConfigurationIsVisible = 0; 230 | defaultConfigurationName = Release; 231 | }; 232 | 487FCF0C1AB4E78800CF36DA /* Build configuration list for PBXNativeTarget "empty-pkcs11" */ = { 233 | isa = XCConfigurationList; 234 | buildConfigurations = ( 235 | 487FCF0D1AB4E78800CF36DA /* Debug */, 236 | 487FCF0E1AB4E78800CF36DA /* Release */, 237 | ); 238 | defaultConfigurationIsVisible = 0; 239 | defaultConfigurationName = Release; 240 | }; 241 | /* End XCConfigurationList section */ 242 | }; 243 | rootObject = 487FCF001AB4E78800CF36DA /* Project object */; 244 | } 245 | -------------------------------------------------------------------------------- /build/linux/Makefile: -------------------------------------------------------------------------------- 1 | # Display exported symbols: 2 | # nm -D empty-pkcs11.so | grep ' T ' 3 | 4 | SRC_DIR=../../src 5 | 6 | CC= gcc 7 | ARCH_FLAGS= -m32 8 | CFLAGS= $(ARCH_FLAGS) -Wall -Wextra -Werror -O2 -I$(SRC_DIR) 9 | LIBNAME=empty-pkcs11-x86.so 10 | 11 | all: empty-pkcs11.o 12 | $(CC) $(ARCH_FLAGS) -shared -o $(LIBNAME) \ 13 | -Wl,-soname,$(LIBNAME) \ 14 | -Wl,--version-script,empty-pkcs11.version \ 15 | empty-pkcs11.o 16 | strip --strip-all $(LIBNAME) 17 | 18 | empty-pkcs11.o: $(SRC_DIR)/empty-pkcs11.c $(SRC_DIR)/*.h 19 | $(CC) $(CFLAGS) -fPIC -c $(SRC_DIR)/empty-pkcs11.c 20 | 21 | clean: 22 | -rm -f *.o 23 | 24 | distclean: clean 25 | -rm -f *.so 26 | -------------------------------------------------------------------------------- /build/linux/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | make distclean 6 | 7 | cat Makefile | sed 's/^ARCH_FLAGS=.*/ARCH_FLAGS= -m32/' | sed 's/^LIBNAME=.*/LIBNAME=empty-pkcs11-x86.so/' > Makefile.x86 8 | make -f Makefile.x86 9 | rm Makefile.x86 10 | make clean 11 | 12 | cat Makefile | sed 's/^ARCH_FLAGS=.*/ARCH_FLAGS= -m64/' | sed 's/^LIBNAME=.*/LIBNAME=empty-pkcs11-x64.so/' > Makefile.x64 13 | make -f Makefile.x64 14 | rm Makefile.x64 15 | make clean 16 | 17 | -------------------------------------------------------------------------------- /build/linux/empty-pkcs11.version: -------------------------------------------------------------------------------- 1 | EMPTYPKCS11 { 2 | global: 3 | C_*; 4 | local: 5 | *; 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /build/macos/Makefile: -------------------------------------------------------------------------------- 1 | # Display exported symbols: 2 | # nm empty-pkcs11.dylib | grep ' T ' 3 | 4 | SRC_DIR=../../src 5 | 6 | CC= clang 7 | ARCH_FLAGS= -target arm64-apple-macos11 8 | CFLAGS= $(ARCH_FLAGS) -Wall -Wextra -Werror -O2 -I$(SRC_DIR) 9 | LIBNAME=empty-pkcs11-arm64.dylib 10 | 11 | all: empty-pkcs11.o 12 | $(CC) $(ARCH_FLAGS) -dynamiclib -o $(LIBNAME) \ 13 | -Wl,-exported_symbols_list,empty-pkcs11.symbols \ 14 | empty-pkcs11.o 15 | strip -x $(LIBNAME) 16 | 17 | empty-pkcs11.o: $(SRC_DIR)/empty-pkcs11.c $(SRC_DIR)/*.h 18 | $(CC) $(CFLAGS) -fPIC -c $(SRC_DIR)/empty-pkcs11.c 19 | 20 | clean: 21 | -rm -f *.o 22 | 23 | distclean: clean 24 | -rm -f *.dylib 25 | -------------------------------------------------------------------------------- /build/macos/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | make distclean 6 | 7 | cat Makefile | sed 's/^ARCH_FLAGS=.*/ARCH_FLAGS= -target arm64-apple-macos11/' | sed 's/^LIBNAME=.*/LIBNAME=empty-pkcs11-arm64.dylib/' > Makefile.arm64 8 | make -f Makefile.arm64 9 | rm Makefile.arm64 10 | make clean 11 | 12 | cat Makefile | sed 's/^ARCH_FLAGS=.*/ARCH_FLAGS= -target x86_64-apple-macos10.12/' | sed 's/^LIBNAME=.*/LIBNAME=empty-pkcs11-x86_64.dylib/' > Makefile.x86_64 13 | make -f Makefile.x86_64 14 | rm Makefile.x86_64 15 | make clean 16 | 17 | lipo -create -output empty-pkcs11.dylib empty-pkcs11-arm64.dylib empty-pkcs11-x86_64.dylib 18 | rm empty-pkcs11-arm64.dylib empty-pkcs11-x86_64.dylib 19 | -------------------------------------------------------------------------------- /build/macos/empty-pkcs11.symbols: -------------------------------------------------------------------------------- 1 | _C_* 2 | -------------------------------------------------------------------------------- /build/windows/build.bat: -------------------------------------------------------------------------------- 1 | @rem Initialize build environment of Visual Studio 2022 Community/Professional/Enterprise 2 | @set tools= 3 | @set tmptools="c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" 4 | @if exist %tmptools% set tools=%tmptools% 5 | @set tmptools="c:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" 6 | @if exist %tmptools% set tools=%tmptools% 7 | @set tmptools="c:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" 8 | @if exist %tmptools% set tools=%tmptools% 9 | @if not defined tools goto :error 10 | 11 | @rem Build for x86 platform 12 | @setlocal 13 | @echo on 14 | call %tools% x86 15 | @echo on 16 | msbuild empty-pkcs11.sln /p:Configuration=Release /p:Platform=Win32 /target:Clean || goto :error 17 | msbuild empty-pkcs11.sln /p:Configuration=Release /p:Platform=Win32 /target:Build || goto :error 18 | copy .\Win32\Release\empty-pkcs11-x86.dll . || goto :error 19 | @endlocal 20 | 21 | @rem Build for x64 platform 22 | @setlocal 23 | @echo on 24 | call %tools% x64 25 | @echo on 26 | msbuild empty-pkcs11.sln /p:Configuration=Release /p:Platform=x64 /target:Clean || goto :error 27 | msbuild empty-pkcs11.sln /p:Configuration=Release /p:Platform=x64 /target:Build || goto :error 28 | copy .\x64\Release\empty-pkcs11-x64.dll . || goto :error 29 | @endlocal 30 | 31 | @echo *** BUILD SUCCESSFUL *** 32 | @exit /b %errorlevel% 33 | 34 | :error 35 | @echo *** BUILD FAILED *** 36 | @endlocal 37 | @exit /b %errorlevel% 38 | -------------------------------------------------------------------------------- /build/windows/empty-pkcs11.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.271 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "empty-pkcs11", "empty-pkcs11\empty-pkcs11.vcxproj", "{078A7AAC-5D04-4270-868C-3585816EC8AD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Debug|Win32.Build.0 = Debug|Win32 18 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Debug|x64.ActiveCfg = Debug|x64 19 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Debug|x64.Build.0 = Debug|x64 20 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Release|Win32.ActiveCfg = Release|Win32 21 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Release|Win32.Build.0 = Release|Win32 22 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Release|x64.ActiveCfg = Release|x64 23 | {078A7AAC-5D04-4270-868C-3585816EC8AD}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {483F00F1-3068-4BB2-90BC-F87DB3AA7B3A} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /build/windows/empty-pkcs11/empty-pkcs11.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {078A7AAC-5D04-4270-868C-3585816EC8AD} 29 | Win32Proj 30 | emptypkcs11 31 | 10.0 32 | 33 | 34 | 35 | DynamicLibrary 36 | true 37 | v143 38 | Unicode 39 | 40 | 41 | DynamicLibrary 42 | true 43 | v143 44 | Unicode 45 | 46 | 47 | DynamicLibrary 48 | false 49 | v143 50 | true 51 | Unicode 52 | 53 | 54 | DynamicLibrary 55 | false 56 | v143 57 | true 58 | Unicode 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | $(ProjectName)-x86 79 | $(SolutionDir)$(Platform)\$(Configuration)\ 80 | $(Platform)\$(Configuration)\ 81 | 82 | 83 | true 84 | $(ProjectName)-x64 85 | 86 | 87 | false 88 | $(ProjectName)-x86 89 | $(SolutionDir)$(Platform)\$(Configuration)\ 90 | $(Platform)\$(Configuration)\ 91 | 92 | 93 | false 94 | $(ProjectName)-x64 95 | 96 | 97 | 98 | NotUsing 99 | Level4 100 | Disabled 101 | WIN32;_DEBUG;_WINDOWS;_USRDLL;CRYPTOKI_EXPORTS;%(PreprocessorDefinitions) 102 | ..\..\..\src 103 | MultiThreadedDebug 104 | 105 | 106 | Windows 107 | true 108 | 109 | 110 | 111 | 112 | 113 | 114 | NotUsing 115 | Level4 116 | Disabled 117 | WIN32;_DEBUG;_WINDOWS;_USRDLL;CRYPTOKI_EXPORTS;%(PreprocessorDefinitions) 118 | ..\..\..\src 119 | MultiThreadedDebug 120 | 121 | 122 | Windows 123 | true 124 | 125 | 126 | 127 | 128 | 129 | 130 | Level4 131 | NotUsing 132 | MaxSpeed 133 | true 134 | true 135 | WIN32;NDEBUG;_WINDOWS;_USRDLL;CRYPTOKI_EXPORTS;%(PreprocessorDefinitions) 136 | ..\..\..\src 137 | MultiThreaded 138 | 139 | 140 | Windows 141 | true 142 | true 143 | true 144 | 145 | 146 | 147 | 148 | 149 | 150 | Level4 151 | NotUsing 152 | MaxSpeed 153 | true 154 | true 155 | WIN32;NDEBUG;_WINDOWS;_USRDLL;CRYPTOKI_EXPORTS;%(PreprocessorDefinitions) 156 | ..\..\..\src 157 | MultiThreaded 158 | 159 | 160 | Windows 161 | true 162 | true 163 | true 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /build/windows/empty-pkcs11/empty-pkcs11.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/cryptoki/pkcs11.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #11 Specification Version 3.1 3 | * OASIS Standard 4 | * 23 July 2023 5 | * Copyright (c) OASIS Open 2023. All Rights Reserved. 6 | * Source: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/os/include/pkcs11-v3.1/ 7 | * Latest stage of narrative specification: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/pkcs11-spec-v3.1.html 8 | * TC IPR Statement: https://www.oasis-open.org/committees/pkcs11/ipr.php 9 | */ 10 | 11 | #ifndef _PKCS11_H_ 12 | #define _PKCS11_H_ 1 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* Before including this file (pkcs11.h) (or pkcs11t.h by 19 | * itself), 5 platform-specific macros must be defined. These 20 | * macros are described below, and typical definitions for them 21 | * are also given. Be advised that these definitions can depend 22 | * on both the platform and the compiler used (and possibly also 23 | * on whether a Cryptoki library is linked statically or 24 | * dynamically). 25 | * 26 | * In addition to defining these 5 macros, the packing convention 27 | * for Cryptoki structures should be set. The Cryptoki 28 | * convention on packing is that structures should be 1-byte 29 | * aligned. 30 | * 31 | * If you're using Windows this might be done by using the following 32 | * preprocessor directive before including pkcs11.h or pkcs11t.h: 33 | * 34 | * #pragma pack(push, cryptoki, 1) 35 | * 36 | * and using the following preprocessor directive after including 37 | * pkcs11.h or pkcs11t.h: 38 | * 39 | * #pragma pack(pop, cryptoki) 40 | * 41 | * In a UNIX environment, you're on your own for this. You might 42 | * not need to do (or be able to do!) anything. 43 | * 44 | * 45 | * Now for the macros: 46 | * 47 | * 48 | * 1. CK_PTR: The indirection string for making a pointer to an 49 | * object. It can be used like this: 50 | * 51 | * typedef CK_BYTE CK_PTR CK_BYTE_PTR; 52 | * 53 | * If you're using Windows, it might be defined by: 54 | * 55 | * #define CK_PTR * 56 | * 57 | * In a typical UNIX environment, it might be defined by: 58 | * 59 | * #define CK_PTR * 60 | * 61 | * 62 | * 2. CK_DECLARE_FUNCTION(returnType, name): A macro which makes 63 | * an importable Cryptoki library function declaration out of a 64 | * return type and a function name. It should be used in the 65 | * following fashion: 66 | * 67 | * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)( 68 | * CK_VOID_PTR pReserved 69 | * ); 70 | * 71 | * If you're using Windows to declare a function in a Win32 Cryptoki .dll, 72 | * it might be defined by: 73 | * 74 | * #define CK_DECLARE_FUNCTION(returnType, name) \ 75 | * returnType __declspec(dllimport) name 76 | * 77 | * In a UNIX environment, it might be defined by: 78 | * 79 | * #define CK_DECLARE_FUNCTION(returnType, name) \ 80 | * returnType name 81 | * 82 | * 83 | * 3. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro 84 | * which makes a Cryptoki API function pointer declaration or 85 | * function pointer type declaration out of a return type and a 86 | * function name. It should be used in the following fashion: 87 | * 88 | * // Define funcPtr to be a pointer to a Cryptoki API function 89 | * // taking arguments args and returning CK_RV. 90 | * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args); 91 | * 92 | * or 93 | * 94 | * // Define funcPtrType to be the type of a pointer to a 95 | * // Cryptoki API function taking arguments args and returning 96 | * // CK_RV, and then define funcPtr to be a variable of type 97 | * // funcPtrType. 98 | * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args); 99 | * funcPtrType funcPtr; 100 | * 101 | * If you're using Windows to access 102 | * functions in a Win32 Cryptoki .dll, in might be defined by: 103 | * 104 | * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ 105 | * returnType __declspec(dllimport) (* name) 106 | * 107 | * In a UNIX environment, it might be defined by: 108 | * 109 | * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ 110 | * returnType (* name) 111 | * 112 | * 113 | * 4. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes 114 | * a function pointer type for an application callback out of 115 | * a return type for the callback and a name for the callback. 116 | * It should be used in the following fashion: 117 | * 118 | * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args); 119 | * 120 | * to declare a function pointer, myCallback, to a callback 121 | * which takes arguments args and returns a CK_RV. It can also 122 | * be used like this: 123 | * 124 | * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args); 125 | * myCallbackType myCallback; 126 | * 127 | * If you're using Windows, it might be defined by: 128 | * 129 | * #define CK_CALLBACK_FUNCTION(returnType, name) \ 130 | * returnType (* name) 131 | * 132 | * In a UNIX environment, it might be defined by: 133 | * 134 | * #define CK_CALLBACK_FUNCTION(returnType, name) \ 135 | * returnType (* name) 136 | * 137 | * 138 | * 5. NULL_PTR: This macro is the value of a NULL pointer. 139 | * 140 | * In any ANSI/ISO C environment (and in many others as well), 141 | * this should best be defined by 142 | * 143 | * #ifndef NULL_PTR 144 | * #define NULL_PTR 0 145 | * #endif 146 | */ 147 | 148 | 149 | /* All the various Cryptoki types and #define'd values are in the 150 | * file pkcs11t.h. 151 | */ 152 | #include "pkcs11t.h" 153 | 154 | #define __PASTE(x,y) x##y 155 | 156 | 157 | /* ============================================================== 158 | * Define the "extern" form of all the entry points. 159 | * ============================================================== 160 | */ 161 | 162 | #define CK_NEED_ARG_LIST 1 163 | #define CK_PKCS11_FUNCTION_INFO(name) \ 164 | extern CK_DECLARE_FUNCTION(CK_RV, name) 165 | 166 | /* pkcs11f.h has all the information about the Cryptoki 167 | * function prototypes. 168 | */ 169 | #include "pkcs11f.h" 170 | 171 | #undef CK_NEED_ARG_LIST 172 | #undef CK_PKCS11_FUNCTION_INFO 173 | 174 | 175 | /* ============================================================== 176 | * Define the typedef form of all the entry points. That is, for 177 | * each Cryptoki function C_XXX, define a type CK_C_XXX which is 178 | * a pointer to that kind of function. 179 | * ============================================================== 180 | */ 181 | 182 | #define CK_NEED_ARG_LIST 1 183 | #define CK_PKCS11_FUNCTION_INFO(name) \ 184 | typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name)) 185 | 186 | /* pkcs11f.h has all the information about the Cryptoki 187 | * function prototypes. 188 | */ 189 | #include "pkcs11f.h" 190 | 191 | #undef CK_NEED_ARG_LIST 192 | #undef CK_PKCS11_FUNCTION_INFO 193 | 194 | 195 | /* ============================================================== 196 | * Define structed vector of entry points. A CK_FUNCTION_LIST 197 | * contains a CK_VERSION indicating a library's Cryptoki version 198 | * and then a whole slew of function pointers to the routines in 199 | * the library. This type was declared, but not defined, in 200 | * pkcs11t.h. 201 | * ============================================================== 202 | */ 203 | 204 | #define CK_PKCS11_FUNCTION_INFO(name) \ 205 | __PASTE(CK_,name) name; 206 | 207 | /* Create the 3.0 Function list */ 208 | struct CK_FUNCTION_LIST_3_0 { 209 | 210 | CK_VERSION version; /* Cryptoki version */ 211 | 212 | /* Pile all the function pointers into the CK_FUNCTION_LIST. */ 213 | /* pkcs11f.h has all the information about the Cryptoki 214 | * function prototypes. 215 | */ 216 | #include "pkcs11f.h" 217 | 218 | }; 219 | 220 | #define CK_PKCS11_2_0_ONLY 1 221 | 222 | /* Continue to define the old CK_FUNCTION_LIST */ 223 | struct CK_FUNCTION_LIST { 224 | 225 | CK_VERSION version; /* Cryptoki version */ 226 | 227 | /* Pile all the function pointers into the CK_FUNCTION_LIST. */ 228 | /* pkcs11f.h has all the information about the Cryptoki 229 | * function prototypes. 230 | */ 231 | #include "pkcs11f.h" 232 | 233 | }; 234 | 235 | #undef CK_PKCS11_FUNCTION_INFO 236 | #undef CK_PKCS11_2_0_ONLY 237 | 238 | 239 | #undef __PASTE 240 | 241 | #ifdef __cplusplus 242 | } 243 | #endif 244 | 245 | #endif /* _PKCS11_H_ */ 246 | 247 | -------------------------------------------------------------------------------- /src/cryptoki/pkcs11f.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #11 Specification Version 3.1 3 | * OASIS Standard 4 | * 23 July 2023 5 | * Copyright (c) OASIS Open 2023. All Rights Reserved. 6 | * Source: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/os/include/pkcs11-v3.1/ 7 | * Latest stage of narrative specification: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/pkcs11-spec-v3.1.html 8 | * TC IPR Statement: https://www.oasis-open.org/committees/pkcs11/ipr.php 9 | */ 10 | 11 | /* This header file contains pretty much everything about all the 12 | * Cryptoki function prototypes. Because this information is 13 | * used for more than just declaring function prototypes, the 14 | * order of the functions appearing herein is important, and 15 | * should not be altered. 16 | */ 17 | 18 | /* General-purpose */ 19 | 20 | /* C_Initialize initializes the Cryptoki library. */ 21 | CK_PKCS11_FUNCTION_INFO(C_Initialize) 22 | #ifdef CK_NEED_ARG_LIST 23 | ( 24 | CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets 25 | * cast to CK_C_INITIALIZE_ARGS_PTR 26 | * and dereferenced 27 | */ 28 | ); 29 | #endif 30 | 31 | 32 | /* C_Finalize indicates that an application is done with the 33 | * Cryptoki library. 34 | */ 35 | CK_PKCS11_FUNCTION_INFO(C_Finalize) 36 | #ifdef CK_NEED_ARG_LIST 37 | ( 38 | CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */ 39 | ); 40 | #endif 41 | 42 | 43 | /* C_GetInfo returns general information about Cryptoki. */ 44 | CK_PKCS11_FUNCTION_INFO(C_GetInfo) 45 | #ifdef CK_NEED_ARG_LIST 46 | ( 47 | CK_INFO_PTR pInfo /* location that receives information */ 48 | ); 49 | #endif 50 | 51 | 52 | /* C_GetFunctionList returns the function list. */ 53 | CK_PKCS11_FUNCTION_INFO(C_GetFunctionList) 54 | #ifdef CK_NEED_ARG_LIST 55 | ( 56 | CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to 57 | * function list 58 | */ 59 | ); 60 | #endif 61 | 62 | 63 | 64 | /* Slot and token management */ 65 | 66 | /* C_GetSlotList obtains a list of slots in the system. */ 67 | CK_PKCS11_FUNCTION_INFO(C_GetSlotList) 68 | #ifdef CK_NEED_ARG_LIST 69 | ( 70 | CK_BBOOL tokenPresent, /* only slots with tokens */ 71 | CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */ 72 | CK_ULONG_PTR pulCount /* receives number of slots */ 73 | ); 74 | #endif 75 | 76 | 77 | /* C_GetSlotInfo obtains information about a particular slot in 78 | * the system. 79 | */ 80 | CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo) 81 | #ifdef CK_NEED_ARG_LIST 82 | ( 83 | CK_SLOT_ID slotID, /* the ID of the slot */ 84 | CK_SLOT_INFO_PTR pInfo /* receives the slot information */ 85 | ); 86 | #endif 87 | 88 | 89 | /* C_GetTokenInfo obtains information about a particular token 90 | * in the system. 91 | */ 92 | CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo) 93 | #ifdef CK_NEED_ARG_LIST 94 | ( 95 | CK_SLOT_ID slotID, /* ID of the token's slot */ 96 | CK_TOKEN_INFO_PTR pInfo /* receives the token information */ 97 | ); 98 | #endif 99 | 100 | 101 | /* C_GetMechanismList obtains a list of mechanism types 102 | * supported by a token. 103 | */ 104 | CK_PKCS11_FUNCTION_INFO(C_GetMechanismList) 105 | #ifdef CK_NEED_ARG_LIST 106 | ( 107 | CK_SLOT_ID slotID, /* ID of token's slot */ 108 | CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */ 109 | CK_ULONG_PTR pulCount /* gets # of mechs. */ 110 | ); 111 | #endif 112 | 113 | 114 | /* C_GetMechanismInfo obtains information about a particular 115 | * mechanism possibly supported by a token. 116 | */ 117 | CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo) 118 | #ifdef CK_NEED_ARG_LIST 119 | ( 120 | CK_SLOT_ID slotID, /* ID of the token's slot */ 121 | CK_MECHANISM_TYPE type, /* type of mechanism */ 122 | CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */ 123 | ); 124 | #endif 125 | 126 | 127 | /* C_InitToken initializes a token. */ 128 | CK_PKCS11_FUNCTION_INFO(C_InitToken) 129 | #ifdef CK_NEED_ARG_LIST 130 | ( 131 | CK_SLOT_ID slotID, /* ID of the token's slot */ 132 | CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */ 133 | CK_ULONG ulPinLen, /* length in bytes of the PIN */ 134 | CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */ 135 | ); 136 | #endif 137 | 138 | 139 | /* C_InitPIN initializes the normal user's PIN. */ 140 | CK_PKCS11_FUNCTION_INFO(C_InitPIN) 141 | #ifdef CK_NEED_ARG_LIST 142 | ( 143 | CK_SESSION_HANDLE hSession, /* the session's handle */ 144 | CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */ 145 | CK_ULONG ulPinLen /* length in bytes of the PIN */ 146 | ); 147 | #endif 148 | 149 | 150 | /* C_SetPIN modifies the PIN of the user who is logged in. */ 151 | CK_PKCS11_FUNCTION_INFO(C_SetPIN) 152 | #ifdef CK_NEED_ARG_LIST 153 | ( 154 | CK_SESSION_HANDLE hSession, /* the session's handle */ 155 | CK_UTF8CHAR_PTR pOldPin, /* the old PIN */ 156 | CK_ULONG ulOldLen, /* length of the old PIN */ 157 | CK_UTF8CHAR_PTR pNewPin, /* the new PIN */ 158 | CK_ULONG ulNewLen /* length of the new PIN */ 159 | ); 160 | #endif 161 | 162 | 163 | 164 | /* Session management */ 165 | 166 | /* C_OpenSession opens a session between an application and a 167 | * token. 168 | */ 169 | CK_PKCS11_FUNCTION_INFO(C_OpenSession) 170 | #ifdef CK_NEED_ARG_LIST 171 | ( 172 | CK_SLOT_ID slotID, /* the slot's ID */ 173 | CK_FLAGS flags, /* from CK_SESSION_INFO */ 174 | CK_VOID_PTR pApplication, /* passed to callback */ 175 | CK_NOTIFY Notify, /* callback function */ 176 | CK_SESSION_HANDLE_PTR phSession /* gets session handle */ 177 | ); 178 | #endif 179 | 180 | 181 | /* C_CloseSession closes a session between an application and a 182 | * token. 183 | */ 184 | CK_PKCS11_FUNCTION_INFO(C_CloseSession) 185 | #ifdef CK_NEED_ARG_LIST 186 | ( 187 | CK_SESSION_HANDLE hSession /* the session's handle */ 188 | ); 189 | #endif 190 | 191 | 192 | /* C_CloseAllSessions closes all sessions with a token. */ 193 | CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions) 194 | #ifdef CK_NEED_ARG_LIST 195 | ( 196 | CK_SLOT_ID slotID /* the token's slot */ 197 | ); 198 | #endif 199 | 200 | 201 | /* C_GetSessionInfo obtains information about the session. */ 202 | CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo) 203 | #ifdef CK_NEED_ARG_LIST 204 | ( 205 | CK_SESSION_HANDLE hSession, /* the session's handle */ 206 | CK_SESSION_INFO_PTR pInfo /* receives session info */ 207 | ); 208 | #endif 209 | 210 | 211 | /* C_GetOperationState obtains the state of the cryptographic operation 212 | * in a session. 213 | */ 214 | CK_PKCS11_FUNCTION_INFO(C_GetOperationState) 215 | #ifdef CK_NEED_ARG_LIST 216 | ( 217 | CK_SESSION_HANDLE hSession, /* session's handle */ 218 | CK_BYTE_PTR pOperationState, /* gets state */ 219 | CK_ULONG_PTR pulOperationStateLen /* gets state length */ 220 | ); 221 | #endif 222 | 223 | 224 | /* C_SetOperationState restores the state of the cryptographic 225 | * operation in a session. 226 | */ 227 | CK_PKCS11_FUNCTION_INFO(C_SetOperationState) 228 | #ifdef CK_NEED_ARG_LIST 229 | ( 230 | CK_SESSION_HANDLE hSession, /* session's handle */ 231 | CK_BYTE_PTR pOperationState, /* holds state */ 232 | CK_ULONG ulOperationStateLen, /* holds state length */ 233 | CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */ 234 | CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */ 235 | ); 236 | #endif 237 | 238 | 239 | /* C_Login logs a user into a token. */ 240 | CK_PKCS11_FUNCTION_INFO(C_Login) 241 | #ifdef CK_NEED_ARG_LIST 242 | ( 243 | CK_SESSION_HANDLE hSession, /* the session's handle */ 244 | CK_USER_TYPE userType, /* the user type */ 245 | CK_UTF8CHAR_PTR pPin, /* the user's PIN */ 246 | CK_ULONG ulPinLen /* the length of the PIN */ 247 | ); 248 | #endif 249 | 250 | 251 | /* C_Logout logs a user out from a token. */ 252 | CK_PKCS11_FUNCTION_INFO(C_Logout) 253 | #ifdef CK_NEED_ARG_LIST 254 | ( 255 | CK_SESSION_HANDLE hSession /* the session's handle */ 256 | ); 257 | #endif 258 | 259 | 260 | 261 | /* Object management */ 262 | 263 | /* C_CreateObject creates a new object. */ 264 | CK_PKCS11_FUNCTION_INFO(C_CreateObject) 265 | #ifdef CK_NEED_ARG_LIST 266 | ( 267 | CK_SESSION_HANDLE hSession, /* the session's handle */ 268 | CK_ATTRIBUTE_PTR pTemplate, /* the object's template */ 269 | CK_ULONG ulCount, /* attributes in template */ 270 | CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */ 271 | ); 272 | #endif 273 | 274 | 275 | /* C_CopyObject copies an object, creating a new object for the 276 | * copy. 277 | */ 278 | CK_PKCS11_FUNCTION_INFO(C_CopyObject) 279 | #ifdef CK_NEED_ARG_LIST 280 | ( 281 | CK_SESSION_HANDLE hSession, /* the session's handle */ 282 | CK_OBJECT_HANDLE hObject, /* the object's handle */ 283 | CK_ATTRIBUTE_PTR pTemplate, /* template for new object */ 284 | CK_ULONG ulCount, /* attributes in template */ 285 | CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */ 286 | ); 287 | #endif 288 | 289 | 290 | /* C_DestroyObject destroys an object. */ 291 | CK_PKCS11_FUNCTION_INFO(C_DestroyObject) 292 | #ifdef CK_NEED_ARG_LIST 293 | ( 294 | CK_SESSION_HANDLE hSession, /* the session's handle */ 295 | CK_OBJECT_HANDLE hObject /* the object's handle */ 296 | ); 297 | #endif 298 | 299 | 300 | /* C_GetObjectSize gets the size of an object in bytes. */ 301 | CK_PKCS11_FUNCTION_INFO(C_GetObjectSize) 302 | #ifdef CK_NEED_ARG_LIST 303 | ( 304 | CK_SESSION_HANDLE hSession, /* the session's handle */ 305 | CK_OBJECT_HANDLE hObject, /* the object's handle */ 306 | CK_ULONG_PTR pulSize /* receives size of object */ 307 | ); 308 | #endif 309 | 310 | 311 | /* C_GetAttributeValue obtains the value of one or more object 312 | * attributes. 313 | */ 314 | CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue) 315 | #ifdef CK_NEED_ARG_LIST 316 | ( 317 | CK_SESSION_HANDLE hSession, /* the session's handle */ 318 | CK_OBJECT_HANDLE hObject, /* the object's handle */ 319 | CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */ 320 | CK_ULONG ulCount /* attributes in template */ 321 | ); 322 | #endif 323 | 324 | 325 | /* C_SetAttributeValue modifies the value of one or more object 326 | * attributes. 327 | */ 328 | CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue) 329 | #ifdef CK_NEED_ARG_LIST 330 | ( 331 | CK_SESSION_HANDLE hSession, /* the session's handle */ 332 | CK_OBJECT_HANDLE hObject, /* the object's handle */ 333 | CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */ 334 | CK_ULONG ulCount /* attributes in template */ 335 | ); 336 | #endif 337 | 338 | 339 | /* C_FindObjectsInit initializes a search for token and session 340 | * objects that match a template. 341 | */ 342 | CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit) 343 | #ifdef CK_NEED_ARG_LIST 344 | ( 345 | CK_SESSION_HANDLE hSession, /* the session's handle */ 346 | CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */ 347 | CK_ULONG ulCount /* attrs in search template */ 348 | ); 349 | #endif 350 | 351 | 352 | /* C_FindObjects continues a search for token and session 353 | * objects that match a template, obtaining additional object 354 | * handles. 355 | */ 356 | CK_PKCS11_FUNCTION_INFO(C_FindObjects) 357 | #ifdef CK_NEED_ARG_LIST 358 | ( 359 | CK_SESSION_HANDLE hSession, /* session's handle */ 360 | CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */ 361 | CK_ULONG ulMaxObjectCount, /* max handles to get */ 362 | CK_ULONG_PTR pulObjectCount /* actual # returned */ 363 | ); 364 | #endif 365 | 366 | 367 | /* C_FindObjectsFinal finishes a search for token and session 368 | * objects. 369 | */ 370 | CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal) 371 | #ifdef CK_NEED_ARG_LIST 372 | ( 373 | CK_SESSION_HANDLE hSession /* the session's handle */ 374 | ); 375 | #endif 376 | 377 | 378 | 379 | /* Encryption and decryption */ 380 | 381 | /* C_EncryptInit initializes an encryption operation. */ 382 | CK_PKCS11_FUNCTION_INFO(C_EncryptInit) 383 | #ifdef CK_NEED_ARG_LIST 384 | ( 385 | CK_SESSION_HANDLE hSession, /* the session's handle */ 386 | CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */ 387 | CK_OBJECT_HANDLE hKey /* handle of encryption key */ 388 | ); 389 | #endif 390 | 391 | 392 | /* C_Encrypt encrypts single-part data. */ 393 | CK_PKCS11_FUNCTION_INFO(C_Encrypt) 394 | #ifdef CK_NEED_ARG_LIST 395 | ( 396 | CK_SESSION_HANDLE hSession, /* session's handle */ 397 | CK_BYTE_PTR pData, /* the plaintext data */ 398 | CK_ULONG ulDataLen, /* bytes of plaintext */ 399 | CK_BYTE_PTR pEncryptedData, /* gets ciphertext */ 400 | CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */ 401 | ); 402 | #endif 403 | 404 | 405 | /* C_EncryptUpdate continues a multiple-part encryption 406 | * operation. 407 | */ 408 | CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate) 409 | #ifdef CK_NEED_ARG_LIST 410 | ( 411 | CK_SESSION_HANDLE hSession, /* session's handle */ 412 | CK_BYTE_PTR pPart, /* the plaintext data */ 413 | CK_ULONG ulPartLen, /* plaintext data len */ 414 | CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ 415 | CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */ 416 | ); 417 | #endif 418 | 419 | 420 | /* C_EncryptFinal finishes a multiple-part encryption 421 | * operation. 422 | */ 423 | CK_PKCS11_FUNCTION_INFO(C_EncryptFinal) 424 | #ifdef CK_NEED_ARG_LIST 425 | ( 426 | CK_SESSION_HANDLE hSession, /* session handle */ 427 | CK_BYTE_PTR pLastEncryptedPart, /* last c-text */ 428 | CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */ 429 | ); 430 | #endif 431 | 432 | 433 | /* C_DecryptInit initializes a decryption operation. */ 434 | CK_PKCS11_FUNCTION_INFO(C_DecryptInit) 435 | #ifdef CK_NEED_ARG_LIST 436 | ( 437 | CK_SESSION_HANDLE hSession, /* the session's handle */ 438 | CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */ 439 | CK_OBJECT_HANDLE hKey /* handle of decryption key */ 440 | ); 441 | #endif 442 | 443 | 444 | /* C_Decrypt decrypts encrypted data in a single part. */ 445 | CK_PKCS11_FUNCTION_INFO(C_Decrypt) 446 | #ifdef CK_NEED_ARG_LIST 447 | ( 448 | CK_SESSION_HANDLE hSession, /* session's handle */ 449 | CK_BYTE_PTR pEncryptedData, /* ciphertext */ 450 | CK_ULONG ulEncryptedDataLen, /* ciphertext length */ 451 | CK_BYTE_PTR pData, /* gets plaintext */ 452 | CK_ULONG_PTR pulDataLen /* gets p-text size */ 453 | ); 454 | #endif 455 | 456 | 457 | /* C_DecryptUpdate continues a multiple-part decryption 458 | * operation. 459 | */ 460 | CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate) 461 | #ifdef CK_NEED_ARG_LIST 462 | ( 463 | CK_SESSION_HANDLE hSession, /* session's handle */ 464 | CK_BYTE_PTR pEncryptedPart, /* encrypted data */ 465 | CK_ULONG ulEncryptedPartLen, /* input length */ 466 | CK_BYTE_PTR pPart, /* gets plaintext */ 467 | CK_ULONG_PTR pulPartLen /* p-text size */ 468 | ); 469 | #endif 470 | 471 | 472 | /* C_DecryptFinal finishes a multiple-part decryption 473 | * operation. 474 | */ 475 | CK_PKCS11_FUNCTION_INFO(C_DecryptFinal) 476 | #ifdef CK_NEED_ARG_LIST 477 | ( 478 | CK_SESSION_HANDLE hSession, /* the session's handle */ 479 | CK_BYTE_PTR pLastPart, /* gets plaintext */ 480 | CK_ULONG_PTR pulLastPartLen /* p-text size */ 481 | ); 482 | #endif 483 | 484 | 485 | 486 | /* Message digesting */ 487 | 488 | /* C_DigestInit initializes a message-digesting operation. */ 489 | CK_PKCS11_FUNCTION_INFO(C_DigestInit) 490 | #ifdef CK_NEED_ARG_LIST 491 | ( 492 | CK_SESSION_HANDLE hSession, /* the session's handle */ 493 | CK_MECHANISM_PTR pMechanism /* the digesting mechanism */ 494 | ); 495 | #endif 496 | 497 | 498 | /* C_Digest digests data in a single part. */ 499 | CK_PKCS11_FUNCTION_INFO(C_Digest) 500 | #ifdef CK_NEED_ARG_LIST 501 | ( 502 | CK_SESSION_HANDLE hSession, /* the session's handle */ 503 | CK_BYTE_PTR pData, /* data to be digested */ 504 | CK_ULONG ulDataLen, /* bytes of data to digest */ 505 | CK_BYTE_PTR pDigest, /* gets the message digest */ 506 | CK_ULONG_PTR pulDigestLen /* gets digest length */ 507 | ); 508 | #endif 509 | 510 | 511 | /* C_DigestUpdate continues a multiple-part message-digesting 512 | * operation. 513 | */ 514 | CK_PKCS11_FUNCTION_INFO(C_DigestUpdate) 515 | #ifdef CK_NEED_ARG_LIST 516 | ( 517 | CK_SESSION_HANDLE hSession, /* the session's handle */ 518 | CK_BYTE_PTR pPart, /* data to be digested */ 519 | CK_ULONG ulPartLen /* bytes of data to be digested */ 520 | ); 521 | #endif 522 | 523 | 524 | /* C_DigestKey continues a multi-part message-digesting 525 | * operation, by digesting the value of a secret key as part of 526 | * the data already digested. 527 | */ 528 | CK_PKCS11_FUNCTION_INFO(C_DigestKey) 529 | #ifdef CK_NEED_ARG_LIST 530 | ( 531 | CK_SESSION_HANDLE hSession, /* the session's handle */ 532 | CK_OBJECT_HANDLE hKey /* secret key to digest */ 533 | ); 534 | #endif 535 | 536 | 537 | /* C_DigestFinal finishes a multiple-part message-digesting 538 | * operation. 539 | */ 540 | CK_PKCS11_FUNCTION_INFO(C_DigestFinal) 541 | #ifdef CK_NEED_ARG_LIST 542 | ( 543 | CK_SESSION_HANDLE hSession, /* the session's handle */ 544 | CK_BYTE_PTR pDigest, /* gets the message digest */ 545 | CK_ULONG_PTR pulDigestLen /* gets byte count of digest */ 546 | ); 547 | #endif 548 | 549 | 550 | 551 | /* Signing and MACing */ 552 | 553 | /* C_SignInit initializes a signature (private key encryption) 554 | * operation, where the signature is (will be) an appendix to 555 | * the data, and plaintext cannot be recovered from the 556 | * signature. 557 | */ 558 | CK_PKCS11_FUNCTION_INFO(C_SignInit) 559 | #ifdef CK_NEED_ARG_LIST 560 | ( 561 | CK_SESSION_HANDLE hSession, /* the session's handle */ 562 | CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ 563 | CK_OBJECT_HANDLE hKey /* handle of signature key */ 564 | ); 565 | #endif 566 | 567 | 568 | /* C_Sign signs (encrypts with private key) data in a single 569 | * part, where the signature is (will be) an appendix to the 570 | * data, and plaintext cannot be recovered from the signature. 571 | */ 572 | CK_PKCS11_FUNCTION_INFO(C_Sign) 573 | #ifdef CK_NEED_ARG_LIST 574 | ( 575 | CK_SESSION_HANDLE hSession, /* the session's handle */ 576 | CK_BYTE_PTR pData, /* the data to sign */ 577 | CK_ULONG ulDataLen, /* count of bytes to sign */ 578 | CK_BYTE_PTR pSignature, /* gets the signature */ 579 | CK_ULONG_PTR pulSignatureLen /* gets signature length */ 580 | ); 581 | #endif 582 | 583 | 584 | /* C_SignUpdate continues a multiple-part signature operation, 585 | * where the signature is (will be) an appendix to the data, 586 | * and plaintext cannot be recovered from the signature. 587 | */ 588 | CK_PKCS11_FUNCTION_INFO(C_SignUpdate) 589 | #ifdef CK_NEED_ARG_LIST 590 | ( 591 | CK_SESSION_HANDLE hSession, /* the session's handle */ 592 | CK_BYTE_PTR pPart, /* the data to sign */ 593 | CK_ULONG ulPartLen /* count of bytes to sign */ 594 | ); 595 | #endif 596 | 597 | 598 | /* C_SignFinal finishes a multiple-part signature operation, 599 | * returning the signature. 600 | */ 601 | CK_PKCS11_FUNCTION_INFO(C_SignFinal) 602 | #ifdef CK_NEED_ARG_LIST 603 | ( 604 | CK_SESSION_HANDLE hSession, /* the session's handle */ 605 | CK_BYTE_PTR pSignature, /* gets the signature */ 606 | CK_ULONG_PTR pulSignatureLen /* gets signature length */ 607 | ); 608 | #endif 609 | 610 | 611 | /* C_SignRecoverInit initializes a signature operation, where 612 | * the data can be recovered from the signature. 613 | */ 614 | CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit) 615 | #ifdef CK_NEED_ARG_LIST 616 | ( 617 | CK_SESSION_HANDLE hSession, /* the session's handle */ 618 | CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ 619 | CK_OBJECT_HANDLE hKey /* handle of the signature key */ 620 | ); 621 | #endif 622 | 623 | 624 | /* C_SignRecover signs data in a single operation, where the 625 | * data can be recovered from the signature. 626 | */ 627 | CK_PKCS11_FUNCTION_INFO(C_SignRecover) 628 | #ifdef CK_NEED_ARG_LIST 629 | ( 630 | CK_SESSION_HANDLE hSession, /* the session's handle */ 631 | CK_BYTE_PTR pData, /* the data to sign */ 632 | CK_ULONG ulDataLen, /* count of bytes to sign */ 633 | CK_BYTE_PTR pSignature, /* gets the signature */ 634 | CK_ULONG_PTR pulSignatureLen /* gets signature length */ 635 | ); 636 | #endif 637 | 638 | 639 | 640 | /* Verifying signatures and MACs */ 641 | 642 | /* C_VerifyInit initializes a verification operation, where the 643 | * signature is an appendix to the data, and plaintext cannot 644 | * cannot be recovered from the signature (e.g. DSA). 645 | */ 646 | CK_PKCS11_FUNCTION_INFO(C_VerifyInit) 647 | #ifdef CK_NEED_ARG_LIST 648 | ( 649 | CK_SESSION_HANDLE hSession, /* the session's handle */ 650 | CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ 651 | CK_OBJECT_HANDLE hKey /* verification key */ 652 | ); 653 | #endif 654 | 655 | 656 | /* C_Verify verifies a signature in a single-part operation, 657 | * where the signature is an appendix to the data, and plaintext 658 | * cannot be recovered from the signature. 659 | */ 660 | CK_PKCS11_FUNCTION_INFO(C_Verify) 661 | #ifdef CK_NEED_ARG_LIST 662 | ( 663 | CK_SESSION_HANDLE hSession, /* the session's handle */ 664 | CK_BYTE_PTR pData, /* signed data */ 665 | CK_ULONG ulDataLen, /* length of signed data */ 666 | CK_BYTE_PTR pSignature, /* signature */ 667 | CK_ULONG ulSignatureLen /* signature length*/ 668 | ); 669 | #endif 670 | 671 | 672 | /* C_VerifyUpdate continues a multiple-part verification 673 | * operation, where the signature is an appendix to the data, 674 | * and plaintext cannot be recovered from the signature. 675 | */ 676 | CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate) 677 | #ifdef CK_NEED_ARG_LIST 678 | ( 679 | CK_SESSION_HANDLE hSession, /* the session's handle */ 680 | CK_BYTE_PTR pPart, /* signed data */ 681 | CK_ULONG ulPartLen /* length of signed data */ 682 | ); 683 | #endif 684 | 685 | 686 | /* C_VerifyFinal finishes a multiple-part verification 687 | * operation, checking the signature. 688 | */ 689 | CK_PKCS11_FUNCTION_INFO(C_VerifyFinal) 690 | #ifdef CK_NEED_ARG_LIST 691 | ( 692 | CK_SESSION_HANDLE hSession, /* the session's handle */ 693 | CK_BYTE_PTR pSignature, /* signature to verify */ 694 | CK_ULONG ulSignatureLen /* signature length */ 695 | ); 696 | #endif 697 | 698 | 699 | /* C_VerifyRecoverInit initializes a signature verification 700 | * operation, where the data is recovered from the signature. 701 | */ 702 | CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit) 703 | #ifdef CK_NEED_ARG_LIST 704 | ( 705 | CK_SESSION_HANDLE hSession, /* the session's handle */ 706 | CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ 707 | CK_OBJECT_HANDLE hKey /* verification key */ 708 | ); 709 | #endif 710 | 711 | 712 | /* C_VerifyRecover verifies a signature in a single-part 713 | * operation, where the data is recovered from the signature. 714 | */ 715 | CK_PKCS11_FUNCTION_INFO(C_VerifyRecover) 716 | #ifdef CK_NEED_ARG_LIST 717 | ( 718 | CK_SESSION_HANDLE hSession, /* the session's handle */ 719 | CK_BYTE_PTR pSignature, /* signature to verify */ 720 | CK_ULONG ulSignatureLen, /* signature length */ 721 | CK_BYTE_PTR pData, /* gets signed data */ 722 | CK_ULONG_PTR pulDataLen /* gets signed data len */ 723 | ); 724 | #endif 725 | 726 | 727 | 728 | /* Dual-function cryptographic operations */ 729 | 730 | /* C_DigestEncryptUpdate continues a multiple-part digesting 731 | * and encryption operation. 732 | */ 733 | CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate) 734 | #ifdef CK_NEED_ARG_LIST 735 | ( 736 | CK_SESSION_HANDLE hSession, /* session's handle */ 737 | CK_BYTE_PTR pPart, /* the plaintext data */ 738 | CK_ULONG ulPartLen, /* plaintext length */ 739 | CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ 740 | CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ 741 | ); 742 | #endif 743 | 744 | 745 | /* C_DecryptDigestUpdate continues a multiple-part decryption and 746 | * digesting operation. 747 | */ 748 | CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate) 749 | #ifdef CK_NEED_ARG_LIST 750 | ( 751 | CK_SESSION_HANDLE hSession, /* session's handle */ 752 | CK_BYTE_PTR pEncryptedPart, /* ciphertext */ 753 | CK_ULONG ulEncryptedPartLen, /* ciphertext length */ 754 | CK_BYTE_PTR pPart, /* gets plaintext */ 755 | CK_ULONG_PTR pulPartLen /* gets plaintext len */ 756 | ); 757 | #endif 758 | 759 | 760 | /* C_SignEncryptUpdate continues a multiple-part signing and 761 | * encryption operation. 762 | */ 763 | CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate) 764 | #ifdef CK_NEED_ARG_LIST 765 | ( 766 | CK_SESSION_HANDLE hSession, /* session's handle */ 767 | CK_BYTE_PTR pPart, /* the plaintext data */ 768 | CK_ULONG ulPartLen, /* plaintext length */ 769 | CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ 770 | CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ 771 | ); 772 | #endif 773 | 774 | 775 | /* C_DecryptVerifyUpdate continues a multiple-part decryption and 776 | * verify operation. 777 | */ 778 | CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate) 779 | #ifdef CK_NEED_ARG_LIST 780 | ( 781 | CK_SESSION_HANDLE hSession, /* session's handle */ 782 | CK_BYTE_PTR pEncryptedPart, /* ciphertext */ 783 | CK_ULONG ulEncryptedPartLen, /* ciphertext length */ 784 | CK_BYTE_PTR pPart, /* gets plaintext */ 785 | CK_ULONG_PTR pulPartLen /* gets p-text length */ 786 | ); 787 | #endif 788 | 789 | 790 | 791 | /* Key management */ 792 | 793 | /* C_GenerateKey generates a secret key, creating a new key 794 | * object. 795 | */ 796 | CK_PKCS11_FUNCTION_INFO(C_GenerateKey) 797 | #ifdef CK_NEED_ARG_LIST 798 | ( 799 | CK_SESSION_HANDLE hSession, /* the session's handle */ 800 | CK_MECHANISM_PTR pMechanism, /* key generation mech. */ 801 | CK_ATTRIBUTE_PTR pTemplate, /* template for new key */ 802 | CK_ULONG ulCount, /* # of attrs in template */ 803 | CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */ 804 | ); 805 | #endif 806 | 807 | 808 | /* C_GenerateKeyPair generates a public-key/private-key pair, 809 | * creating new key objects. 810 | */ 811 | CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair) 812 | #ifdef CK_NEED_ARG_LIST 813 | ( 814 | CK_SESSION_HANDLE hSession, /* session handle */ 815 | CK_MECHANISM_PTR pMechanism, /* key-gen mech. */ 816 | CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template for pub. key */ 817 | CK_ULONG ulPublicKeyAttributeCount, /* # pub. attrs. */ 818 | CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template for priv. key */ 819 | CK_ULONG ulPrivateKeyAttributeCount, /* # priv. attrs. */ 820 | CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. key handle */ 821 | CK_OBJECT_HANDLE_PTR phPrivateKey /* gets priv. key handle */ 822 | ); 823 | #endif 824 | 825 | 826 | /* C_WrapKey wraps (i.e., encrypts) a key. */ 827 | CK_PKCS11_FUNCTION_INFO(C_WrapKey) 828 | #ifdef CK_NEED_ARG_LIST 829 | ( 830 | CK_SESSION_HANDLE hSession, /* the session's handle */ 831 | CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */ 832 | CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */ 833 | CK_OBJECT_HANDLE hKey, /* key to be wrapped */ 834 | CK_BYTE_PTR pWrappedKey, /* gets wrapped key */ 835 | CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */ 836 | ); 837 | #endif 838 | 839 | 840 | /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new 841 | * key object. 842 | */ 843 | CK_PKCS11_FUNCTION_INFO(C_UnwrapKey) 844 | #ifdef CK_NEED_ARG_LIST 845 | ( 846 | CK_SESSION_HANDLE hSession, /* session's handle */ 847 | CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */ 848 | CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */ 849 | CK_BYTE_PTR pWrappedKey, /* the wrapped key */ 850 | CK_ULONG ulWrappedKeyLen, /* wrapped key len */ 851 | CK_ATTRIBUTE_PTR pTemplate, /* new key template */ 852 | CK_ULONG ulAttributeCount, /* template length */ 853 | CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ 854 | ); 855 | #endif 856 | 857 | 858 | /* C_DeriveKey derives a key from a base key, creating a new key 859 | * object. 860 | */ 861 | CK_PKCS11_FUNCTION_INFO(C_DeriveKey) 862 | #ifdef CK_NEED_ARG_LIST 863 | ( 864 | CK_SESSION_HANDLE hSession, /* session's handle */ 865 | CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */ 866 | CK_OBJECT_HANDLE hBaseKey, /* base key */ 867 | CK_ATTRIBUTE_PTR pTemplate, /* new key template */ 868 | CK_ULONG ulAttributeCount, /* template length */ 869 | CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ 870 | ); 871 | #endif 872 | 873 | 874 | 875 | /* Random number generation */ 876 | 877 | /* C_SeedRandom mixes additional seed material into the token's 878 | * random number generator. 879 | */ 880 | CK_PKCS11_FUNCTION_INFO(C_SeedRandom) 881 | #ifdef CK_NEED_ARG_LIST 882 | ( 883 | CK_SESSION_HANDLE hSession, /* the session's handle */ 884 | CK_BYTE_PTR pSeed, /* the seed material */ 885 | CK_ULONG ulSeedLen /* length of seed material */ 886 | ); 887 | #endif 888 | 889 | 890 | /* C_GenerateRandom generates random data. */ 891 | CK_PKCS11_FUNCTION_INFO(C_GenerateRandom) 892 | #ifdef CK_NEED_ARG_LIST 893 | ( 894 | CK_SESSION_HANDLE hSession, /* the session's handle */ 895 | CK_BYTE_PTR RandomData, /* receives the random data */ 896 | CK_ULONG ulRandomLen /* # of bytes to generate */ 897 | ); 898 | #endif 899 | 900 | 901 | 902 | /* Parallel function management */ 903 | 904 | /* C_GetFunctionStatus is a legacy function; it obtains an 905 | * updated status of a function running in parallel with an 906 | * application. 907 | */ 908 | CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus) 909 | #ifdef CK_NEED_ARG_LIST 910 | ( 911 | CK_SESSION_HANDLE hSession /* the session's handle */ 912 | ); 913 | #endif 914 | 915 | 916 | /* C_CancelFunction is a legacy function; it cancels a function 917 | * running in parallel. 918 | */ 919 | CK_PKCS11_FUNCTION_INFO(C_CancelFunction) 920 | #ifdef CK_NEED_ARG_LIST 921 | ( 922 | CK_SESSION_HANDLE hSession /* the session's handle */ 923 | ); 924 | #endif 925 | 926 | 927 | /* C_WaitForSlotEvent waits for a slot event (token insertion, 928 | * removal, etc.) to occur. 929 | */ 930 | CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent) 931 | #ifdef CK_NEED_ARG_LIST 932 | ( 933 | CK_FLAGS flags, /* blocking/nonblocking flag */ 934 | CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */ 935 | CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */ 936 | ); 937 | #endif 938 | 939 | #ifndef CK_PKCS11_2_0_ONLY 940 | /* C_GetInterfaceList returns all the interfaces supported by the module*/ 941 | CK_PKCS11_FUNCTION_INFO(C_GetInterfaceList) 942 | #ifdef CK_NEED_ARG_LIST 943 | ( 944 | CK_INTERFACE_PTR pInterfacesList, /* returned interfaces */ 945 | CK_ULONG_PTR pulCount /* number of interfaces returned */ 946 | ); 947 | #endif 948 | 949 | /* C_GetInterface returns a specific interface from the module. */ 950 | CK_PKCS11_FUNCTION_INFO(C_GetInterface) 951 | #ifdef CK_NEED_ARG_LIST 952 | ( 953 | CK_UTF8CHAR_PTR pInterfaceName, /* name of the interface */ 954 | CK_VERSION_PTR pVersion, /* version of the interface */ 955 | CK_INTERFACE_PTR_PTR ppInterface, /* returned interface */ 956 | CK_FLAGS flags /* flags controlling the semantics 957 | * of the interface */ 958 | ); 959 | #endif 960 | 961 | CK_PKCS11_FUNCTION_INFO(C_LoginUser) 962 | #ifdef CK_NEED_ARG_LIST 963 | ( 964 | CK_SESSION_HANDLE hSession, /* the session's handle */ 965 | CK_USER_TYPE userType, /* the user type */ 966 | CK_UTF8CHAR_PTR pPin, /* the user's PIN */ 967 | CK_ULONG ulPinLen, /* the length of the PIN */ 968 | CK_UTF8CHAR_PTR pUsername, /* the user's name */ 969 | CK_ULONG ulUsernameLen /*the length of the user's name */ 970 | ); 971 | #endif 972 | 973 | CK_PKCS11_FUNCTION_INFO(C_SessionCancel) 974 | #ifdef CK_NEED_ARG_LIST 975 | ( 976 | CK_SESSION_HANDLE hSession, /* the session's handle */ 977 | CK_FLAGS flags /* flags control which sessions are cancelled */ 978 | ); 979 | #endif 980 | 981 | CK_PKCS11_FUNCTION_INFO(C_MessageEncryptInit) 982 | #ifdef CK_NEED_ARG_LIST 983 | ( 984 | CK_SESSION_HANDLE hSession, /* the session's handle */ 985 | CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */ 986 | CK_OBJECT_HANDLE hKey /* handle of encryption key */ 987 | ); 988 | #endif 989 | 990 | CK_PKCS11_FUNCTION_INFO(C_EncryptMessage) 991 | #ifdef CK_NEED_ARG_LIST 992 | ( 993 | CK_SESSION_HANDLE hSession, /* the session's handle */ 994 | CK_VOID_PTR pParameter, /* message specific parameter */ 995 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 996 | CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ 997 | CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */ 998 | CK_BYTE_PTR pPlaintext, /* plain text */ 999 | CK_ULONG ulPlaintextLen, /* plain text length */ 1000 | CK_BYTE_PTR pCiphertext, /* gets cipher text */ 1001 | CK_ULONG_PTR pulCiphertextLen /* gets cipher text length */ 1002 | ); 1003 | #endif 1004 | 1005 | CK_PKCS11_FUNCTION_INFO(C_EncryptMessageBegin) 1006 | #ifdef CK_NEED_ARG_LIST 1007 | ( 1008 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1009 | CK_VOID_PTR pParameter, /* message specific parameter */ 1010 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1011 | CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ 1012 | CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */ 1013 | ); 1014 | #endif 1015 | 1016 | CK_PKCS11_FUNCTION_INFO(C_EncryptMessageNext) 1017 | #ifdef CK_NEED_ARG_LIST 1018 | ( 1019 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1020 | CK_VOID_PTR pParameter, /* message specific parameter */ 1021 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1022 | CK_BYTE_PTR pPlaintextPart, /* plain text */ 1023 | CK_ULONG ulPlaintextPartLen, /* plain text length */ 1024 | CK_BYTE_PTR pCiphertextPart, /* gets cipher text */ 1025 | CK_ULONG_PTR pulCiphertextPartLen, /* gets cipher text length */ 1026 | CK_FLAGS flags /* multi mode flag */ 1027 | ); 1028 | #endif 1029 | 1030 | CK_PKCS11_FUNCTION_INFO(C_MessageEncryptFinal) 1031 | #ifdef CK_NEED_ARG_LIST 1032 | ( 1033 | CK_SESSION_HANDLE hSession /* the session's handle */ 1034 | ); 1035 | #endif 1036 | 1037 | CK_PKCS11_FUNCTION_INFO(C_MessageDecryptInit) 1038 | #ifdef CK_NEED_ARG_LIST 1039 | ( 1040 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1041 | CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */ 1042 | CK_OBJECT_HANDLE hKey /* handle of decryption key */ 1043 | ); 1044 | #endif 1045 | 1046 | CK_PKCS11_FUNCTION_INFO(C_DecryptMessage) 1047 | #ifdef CK_NEED_ARG_LIST 1048 | ( 1049 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1050 | CK_VOID_PTR pParameter, /* message specific parameter */ 1051 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1052 | CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ 1053 | CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */ 1054 | CK_BYTE_PTR pCiphertext, /* cipher text */ 1055 | CK_ULONG ulCiphertextLen, /* cipher text length */ 1056 | CK_BYTE_PTR pPlaintext, /* gets plain text */ 1057 | CK_ULONG_PTR pulPlaintextLen /* gets plain text length */ 1058 | ); 1059 | #endif 1060 | 1061 | CK_PKCS11_FUNCTION_INFO(C_DecryptMessageBegin) 1062 | #ifdef CK_NEED_ARG_LIST 1063 | ( 1064 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1065 | CK_VOID_PTR pParameter, /* message specific parameter */ 1066 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1067 | CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ 1068 | CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */ 1069 | ); 1070 | #endif 1071 | 1072 | CK_PKCS11_FUNCTION_INFO(C_DecryptMessageNext) 1073 | #ifdef CK_NEED_ARG_LIST 1074 | ( 1075 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1076 | CK_VOID_PTR pParameter, /* message specific parameter */ 1077 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1078 | CK_BYTE_PTR pCiphertextPart, /* cipher text */ 1079 | CK_ULONG ulCiphertextPartLen, /* cipher text length */ 1080 | CK_BYTE_PTR pPlaintextPart, /* gets plain text */ 1081 | CK_ULONG_PTR pulPlaintextPartLen, /* gets plain text length */ 1082 | CK_FLAGS flags /* multi mode flag */ 1083 | ); 1084 | #endif 1085 | 1086 | CK_PKCS11_FUNCTION_INFO(C_MessageDecryptFinal) 1087 | #ifdef CK_NEED_ARG_LIST 1088 | ( 1089 | CK_SESSION_HANDLE hSession /* the session's handle */ 1090 | ); 1091 | #endif 1092 | 1093 | CK_PKCS11_FUNCTION_INFO(C_MessageSignInit) 1094 | #ifdef CK_NEED_ARG_LIST 1095 | ( 1096 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1097 | CK_MECHANISM_PTR pMechanism, /* the signing mechanism */ 1098 | CK_OBJECT_HANDLE hKey /* handle of signing key */ 1099 | ); 1100 | #endif 1101 | 1102 | CK_PKCS11_FUNCTION_INFO(C_SignMessage) 1103 | #ifdef CK_NEED_ARG_LIST 1104 | ( 1105 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1106 | CK_VOID_PTR pParameter, /* message specific parameter */ 1107 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1108 | CK_BYTE_PTR pData, /* data to sign */ 1109 | CK_ULONG ulDataLen, /* data to sign length */ 1110 | CK_BYTE_PTR pSignature, /* gets signature */ 1111 | CK_ULONG_PTR pulSignatureLen /* gets signature length */ 1112 | ); 1113 | #endif 1114 | 1115 | CK_PKCS11_FUNCTION_INFO(C_SignMessageBegin) 1116 | #ifdef CK_NEED_ARG_LIST 1117 | ( 1118 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1119 | CK_VOID_PTR pParameter, /* message specific parameter */ 1120 | CK_ULONG ulParameterLen /* length of message specific parameter */ 1121 | ); 1122 | #endif 1123 | 1124 | CK_PKCS11_FUNCTION_INFO(C_SignMessageNext) 1125 | #ifdef CK_NEED_ARG_LIST 1126 | ( 1127 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1128 | CK_VOID_PTR pParameter, /* message specific parameter */ 1129 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1130 | CK_BYTE_PTR pData, /* data to sign */ 1131 | CK_ULONG ulDataLen, /* data to sign length */ 1132 | CK_BYTE_PTR pSignature, /* gets signature */ 1133 | CK_ULONG_PTR pulSignatureLen /* gets signature length */ 1134 | ); 1135 | #endif 1136 | 1137 | CK_PKCS11_FUNCTION_INFO(C_MessageSignFinal) 1138 | #ifdef CK_NEED_ARG_LIST 1139 | ( 1140 | CK_SESSION_HANDLE hSession /* the session's handle */ 1141 | ); 1142 | #endif 1143 | 1144 | CK_PKCS11_FUNCTION_INFO(C_MessageVerifyInit) 1145 | #ifdef CK_NEED_ARG_LIST 1146 | ( 1147 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1148 | CK_MECHANISM_PTR pMechanism, /* the signing mechanism */ 1149 | CK_OBJECT_HANDLE hKey /* handle of signing key */ 1150 | ); 1151 | #endif 1152 | 1153 | CK_PKCS11_FUNCTION_INFO(C_VerifyMessage) 1154 | #ifdef CK_NEED_ARG_LIST 1155 | ( 1156 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1157 | CK_VOID_PTR pParameter, /* message specific parameter */ 1158 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1159 | CK_BYTE_PTR pData, /* data to sign */ 1160 | CK_ULONG ulDataLen, /* data to sign length */ 1161 | CK_BYTE_PTR pSignature, /* signature */ 1162 | CK_ULONG ulSignatureLen /* signature length */ 1163 | ); 1164 | #endif 1165 | 1166 | CK_PKCS11_FUNCTION_INFO(C_VerifyMessageBegin) 1167 | #ifdef CK_NEED_ARG_LIST 1168 | ( 1169 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1170 | CK_VOID_PTR pParameter, /* message specific parameter */ 1171 | CK_ULONG ulParameterLen /* length of message specific parameter */ 1172 | ); 1173 | #endif 1174 | 1175 | CK_PKCS11_FUNCTION_INFO(C_VerifyMessageNext) 1176 | #ifdef CK_NEED_ARG_LIST 1177 | ( 1178 | CK_SESSION_HANDLE hSession, /* the session's handle */ 1179 | CK_VOID_PTR pParameter, /* message specific parameter */ 1180 | CK_ULONG ulParameterLen, /* length of message specific parameter */ 1181 | CK_BYTE_PTR pData, /* data to sign */ 1182 | CK_ULONG ulDataLen, /* data to sign length */ 1183 | CK_BYTE_PTR pSignature, /* signature */ 1184 | CK_ULONG ulSignatureLen /* signature length */ 1185 | ); 1186 | #endif 1187 | 1188 | CK_PKCS11_FUNCTION_INFO(C_MessageVerifyFinal) 1189 | #ifdef CK_NEED_ARG_LIST 1190 | ( 1191 | CK_SESSION_HANDLE hSession /* the session's handle */ 1192 | ); 1193 | #endif 1194 | 1195 | #endif /* CK_PKCS11_2_0_ONLY */ 1196 | -------------------------------------------------------------------------------- /src/empty-pkcs11.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-2025 The Pkcs11Interop Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Written for the Pkcs11Interop project by: 19 | * Jaroslav IMRICH 20 | */ 21 | 22 | 23 | #include "empty-pkcs11.h" 24 | 25 | 26 | CK_FUNCTION_LIST empty_pkcs11_2_40_functions = 27 | { 28 | {0x02, 0x28}, 29 | &C_Initialize, 30 | &C_Finalize, 31 | &C_GetInfo, 32 | &C_GetFunctionList, 33 | &C_GetSlotList, 34 | &C_GetSlotInfo, 35 | &C_GetTokenInfo, 36 | &C_GetMechanismList, 37 | &C_GetMechanismInfo, 38 | &C_InitToken, 39 | &C_InitPIN, 40 | &C_SetPIN, 41 | &C_OpenSession, 42 | &C_CloseSession, 43 | &C_CloseAllSessions, 44 | &C_GetSessionInfo, 45 | &C_GetOperationState, 46 | &C_SetOperationState, 47 | &C_Login, 48 | &C_Logout, 49 | &C_CreateObject, 50 | &C_CopyObject, 51 | &C_DestroyObject, 52 | &C_GetObjectSize, 53 | &C_GetAttributeValue, 54 | &C_SetAttributeValue, 55 | &C_FindObjectsInit, 56 | &C_FindObjects, 57 | &C_FindObjectsFinal, 58 | &C_EncryptInit, 59 | &C_Encrypt, 60 | &C_EncryptUpdate, 61 | &C_EncryptFinal, 62 | &C_DecryptInit, 63 | &C_Decrypt, 64 | &C_DecryptUpdate, 65 | &C_DecryptFinal, 66 | &C_DigestInit, 67 | &C_Digest, 68 | &C_DigestUpdate, 69 | &C_DigestKey, 70 | &C_DigestFinal, 71 | &C_SignInit, 72 | &C_Sign, 73 | &C_SignUpdate, 74 | &C_SignFinal, 75 | &C_SignRecoverInit, 76 | &C_SignRecover, 77 | &C_VerifyInit, 78 | &C_Verify, 79 | &C_VerifyUpdate, 80 | &C_VerifyFinal, 81 | &C_VerifyRecoverInit, 82 | &C_VerifyRecover, 83 | &C_DigestEncryptUpdate, 84 | &C_DecryptDigestUpdate, 85 | &C_SignEncryptUpdate, 86 | &C_DecryptVerifyUpdate, 87 | &C_GenerateKey, 88 | &C_GenerateKeyPair, 89 | &C_WrapKey, 90 | &C_UnwrapKey, 91 | &C_DeriveKey, 92 | &C_SeedRandom, 93 | &C_GenerateRandom, 94 | &C_GetFunctionStatus, 95 | &C_CancelFunction, 96 | &C_WaitForSlotEvent 97 | }; 98 | 99 | 100 | CK_INTERFACE empty_pkcs11_2_40_interface = 101 | { 102 | (CK_CHAR*)"PKCS 11", 103 | &empty_pkcs11_2_40_functions, 104 | 0 105 | }; 106 | 107 | 108 | CK_FUNCTION_LIST_3_0 empty_pkcs11_3_1_functions = 109 | { 110 | {0x03, 0x01}, 111 | &C_Initialize, 112 | &C_Finalize, 113 | &C_GetInfo, 114 | &C_GetFunctionList, 115 | &C_GetSlotList, 116 | &C_GetSlotInfo, 117 | &C_GetTokenInfo, 118 | &C_GetMechanismList, 119 | &C_GetMechanismInfo, 120 | &C_InitToken, 121 | &C_InitPIN, 122 | &C_SetPIN, 123 | &C_OpenSession, 124 | &C_CloseSession, 125 | &C_CloseAllSessions, 126 | &C_GetSessionInfo, 127 | &C_GetOperationState, 128 | &C_SetOperationState, 129 | &C_Login, 130 | &C_Logout, 131 | &C_CreateObject, 132 | &C_CopyObject, 133 | &C_DestroyObject, 134 | &C_GetObjectSize, 135 | &C_GetAttributeValue, 136 | &C_SetAttributeValue, 137 | &C_FindObjectsInit, 138 | &C_FindObjects, 139 | &C_FindObjectsFinal, 140 | &C_EncryptInit, 141 | &C_Encrypt, 142 | &C_EncryptUpdate, 143 | &C_EncryptFinal, 144 | &C_DecryptInit, 145 | &C_Decrypt, 146 | &C_DecryptUpdate, 147 | &C_DecryptFinal, 148 | &C_DigestInit, 149 | &C_Digest, 150 | &C_DigestUpdate, 151 | &C_DigestKey, 152 | &C_DigestFinal, 153 | &C_SignInit, 154 | &C_Sign, 155 | &C_SignUpdate, 156 | &C_SignFinal, 157 | &C_SignRecoverInit, 158 | &C_SignRecover, 159 | &C_VerifyInit, 160 | &C_Verify, 161 | &C_VerifyUpdate, 162 | &C_VerifyFinal, 163 | &C_VerifyRecoverInit, 164 | &C_VerifyRecover, 165 | &C_DigestEncryptUpdate, 166 | &C_DecryptDigestUpdate, 167 | &C_SignEncryptUpdate, 168 | &C_DecryptVerifyUpdate, 169 | &C_GenerateKey, 170 | &C_GenerateKeyPair, 171 | &C_WrapKey, 172 | &C_UnwrapKey, 173 | &C_DeriveKey, 174 | &C_SeedRandom, 175 | &C_GenerateRandom, 176 | &C_GetFunctionStatus, 177 | &C_CancelFunction, 178 | &C_WaitForSlotEvent, 179 | &C_GetInterfaceList, 180 | &C_GetInterface, 181 | &C_LoginUser, 182 | &C_SessionCancel, 183 | &C_MessageEncryptInit, 184 | &C_EncryptMessage, 185 | &C_EncryptMessageBegin, 186 | &C_EncryptMessageNext, 187 | &C_MessageEncryptFinal, 188 | &C_MessageDecryptInit, 189 | &C_DecryptMessage, 190 | &C_DecryptMessageBegin, 191 | &C_DecryptMessageNext, 192 | &C_MessageDecryptFinal, 193 | &C_MessageSignInit, 194 | &C_SignMessage, 195 | &C_SignMessageBegin, 196 | &C_SignMessageNext, 197 | &C_MessageSignFinal, 198 | &C_MessageVerifyInit, 199 | &C_VerifyMessage, 200 | &C_VerifyMessageBegin, 201 | &C_VerifyMessageNext, 202 | &C_MessageVerifyFinal 203 | }; 204 | 205 | 206 | CK_INTERFACE empty_pkcs11_3_1_interface = 207 | { 208 | (CK_CHAR*)"PKCS 11", 209 | &empty_pkcs11_3_1_functions, 210 | 0 211 | }; 212 | 213 | 214 | CK_DEFINE_FUNCTION(CK_RV, C_Initialize)(CK_VOID_PTR pInitArgs) 215 | { 216 | UNUSED(pInitArgs); 217 | 218 | return CKR_FUNCTION_NOT_SUPPORTED; 219 | } 220 | 221 | 222 | CK_DEFINE_FUNCTION(CK_RV, C_Finalize)(CK_VOID_PTR pReserved) 223 | { 224 | UNUSED(pReserved); 225 | 226 | return CKR_FUNCTION_NOT_SUPPORTED; 227 | } 228 | 229 | 230 | CK_DEFINE_FUNCTION(CK_RV, C_GetInfo)(CK_INFO_PTR pInfo) 231 | { 232 | UNUSED(pInfo); 233 | 234 | return CKR_FUNCTION_NOT_SUPPORTED; 235 | } 236 | 237 | 238 | CK_DEFINE_FUNCTION(CK_RV, C_GetFunctionList)(CK_FUNCTION_LIST_PTR_PTR ppFunctionList) 239 | { 240 | if (NULL == ppFunctionList) 241 | return CKR_ARGUMENTS_BAD; 242 | 243 | *ppFunctionList = &empty_pkcs11_2_40_functions; 244 | 245 | return CKR_OK; 246 | } 247 | 248 | 249 | CK_DEFINE_FUNCTION(CK_RV, C_GetSlotList)(CK_BBOOL tokenPresent, CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount) 250 | { 251 | UNUSED(tokenPresent); 252 | UNUSED(pSlotList); 253 | UNUSED(pulCount); 254 | 255 | return CKR_FUNCTION_NOT_SUPPORTED; 256 | } 257 | 258 | 259 | CK_DEFINE_FUNCTION(CK_RV, C_GetSlotInfo)(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo) 260 | { 261 | UNUSED(slotID); 262 | UNUSED(pInfo); 263 | 264 | return CKR_FUNCTION_NOT_SUPPORTED; 265 | } 266 | 267 | 268 | CK_DEFINE_FUNCTION(CK_RV, C_GetTokenInfo)(CK_SLOT_ID slotID, CK_TOKEN_INFO_PTR pInfo) 269 | { 270 | UNUSED(slotID); 271 | UNUSED(pInfo); 272 | 273 | return CKR_FUNCTION_NOT_SUPPORTED; 274 | } 275 | 276 | 277 | CK_DEFINE_FUNCTION(CK_RV, C_GetMechanismList)(CK_SLOT_ID slotID, CK_MECHANISM_TYPE_PTR pMechanismList, CK_ULONG_PTR pulCount) 278 | { 279 | UNUSED(slotID); 280 | UNUSED(pMechanismList); 281 | UNUSED(pulCount); 282 | 283 | return CKR_FUNCTION_NOT_SUPPORTED; 284 | } 285 | 286 | 287 | CK_DEFINE_FUNCTION(CK_RV, C_GetMechanismInfo)(CK_SLOT_ID slotID, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR pInfo) 288 | { 289 | UNUSED(slotID); 290 | UNUSED(type); 291 | UNUSED(pInfo); 292 | 293 | return CKR_FUNCTION_NOT_SUPPORTED; 294 | } 295 | 296 | 297 | CK_DEFINE_FUNCTION(CK_RV, C_InitToken)(CK_SLOT_ID slotID, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen, CK_UTF8CHAR_PTR pLabel) 298 | { 299 | UNUSED(slotID); 300 | UNUSED(pPin); 301 | UNUSED(ulPinLen); 302 | UNUSED(pLabel); 303 | 304 | return CKR_FUNCTION_NOT_SUPPORTED; 305 | } 306 | 307 | 308 | CK_DEFINE_FUNCTION(CK_RV, C_InitPIN)(CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen) 309 | { 310 | UNUSED(hSession); 311 | UNUSED(pPin); 312 | UNUSED(ulPinLen); 313 | 314 | return CKR_FUNCTION_NOT_SUPPORTED; 315 | } 316 | 317 | 318 | CK_DEFINE_FUNCTION(CK_RV, C_SetPIN)(CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pOldPin, CK_ULONG ulOldLen, CK_UTF8CHAR_PTR pNewPin, CK_ULONG ulNewLen) 319 | { 320 | UNUSED(hSession); 321 | UNUSED(pOldPin); 322 | UNUSED(ulOldLen); 323 | UNUSED(pNewPin); 324 | UNUSED(ulNewLen); 325 | 326 | return CKR_FUNCTION_NOT_SUPPORTED; 327 | } 328 | 329 | 330 | CK_DEFINE_FUNCTION(CK_RV, C_OpenSession)(CK_SLOT_ID slotID, CK_FLAGS flags, CK_VOID_PTR pApplication, CK_NOTIFY Notify, CK_SESSION_HANDLE_PTR phSession) 331 | { 332 | UNUSED(slotID); 333 | UNUSED(flags); 334 | UNUSED(pApplication); 335 | UNUSED(Notify); 336 | UNUSED(phSession); 337 | 338 | return CKR_FUNCTION_NOT_SUPPORTED; 339 | } 340 | 341 | 342 | CK_DEFINE_FUNCTION(CK_RV, C_CloseSession)(CK_SESSION_HANDLE hSession) 343 | { 344 | UNUSED(hSession); 345 | 346 | return CKR_FUNCTION_NOT_SUPPORTED; 347 | } 348 | 349 | 350 | CK_DEFINE_FUNCTION(CK_RV, C_CloseAllSessions)(CK_SLOT_ID slotID) 351 | { 352 | UNUSED(slotID); 353 | 354 | return CKR_FUNCTION_NOT_SUPPORTED; 355 | } 356 | 357 | 358 | CK_DEFINE_FUNCTION(CK_RV, C_GetSessionInfo)(CK_SESSION_HANDLE hSession, CK_SESSION_INFO_PTR pInfo) 359 | { 360 | UNUSED(hSession); 361 | UNUSED(pInfo); 362 | 363 | return CKR_FUNCTION_NOT_SUPPORTED; 364 | } 365 | 366 | 367 | CK_DEFINE_FUNCTION(CK_RV, C_GetOperationState)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pOperationState, CK_ULONG_PTR pulOperationStateLen) 368 | { 369 | UNUSED(hSession); 370 | UNUSED(pOperationState); 371 | UNUSED(pulOperationStateLen); 372 | 373 | return CKR_FUNCTION_NOT_SUPPORTED; 374 | } 375 | 376 | 377 | CK_DEFINE_FUNCTION(CK_RV, C_SetOperationState)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pOperationState, CK_ULONG ulOperationStateLen, CK_OBJECT_HANDLE hEncryptionKey, CK_OBJECT_HANDLE hAuthenticationKey) 378 | { 379 | UNUSED(hSession); 380 | UNUSED(pOperationState); 381 | UNUSED(ulOperationStateLen); 382 | UNUSED(hEncryptionKey); 383 | UNUSED(hAuthenticationKey); 384 | 385 | return CKR_FUNCTION_NOT_SUPPORTED; 386 | } 387 | 388 | 389 | CK_DEFINE_FUNCTION(CK_RV, C_Login)(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen) 390 | { 391 | UNUSED(hSession); 392 | UNUSED(userType); 393 | UNUSED(pPin); 394 | UNUSED(ulPinLen); 395 | 396 | return CKR_FUNCTION_NOT_SUPPORTED; 397 | } 398 | 399 | 400 | CK_DEFINE_FUNCTION(CK_RV, C_Logout)(CK_SESSION_HANDLE hSession) 401 | { 402 | UNUSED(hSession); 403 | 404 | return CKR_FUNCTION_NOT_SUPPORTED; 405 | } 406 | 407 | 408 | CK_DEFINE_FUNCTION(CK_RV, C_CreateObject)(CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phObject) 409 | { 410 | UNUSED(hSession); 411 | UNUSED(pTemplate); 412 | UNUSED(ulCount); 413 | UNUSED(phObject); 414 | 415 | return CKR_FUNCTION_NOT_SUPPORTED; 416 | } 417 | 418 | 419 | CK_DEFINE_FUNCTION(CK_RV, C_CopyObject)(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phNewObject) 420 | { 421 | UNUSED(hSession); 422 | UNUSED(hObject); 423 | UNUSED(pTemplate); 424 | UNUSED(ulCount); 425 | UNUSED(phNewObject); 426 | 427 | return CKR_FUNCTION_NOT_SUPPORTED; 428 | } 429 | 430 | 431 | CK_DEFINE_FUNCTION(CK_RV, C_DestroyObject)(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject) 432 | { 433 | UNUSED(hSession); 434 | UNUSED(hObject); 435 | 436 | return CKR_FUNCTION_NOT_SUPPORTED; 437 | } 438 | 439 | 440 | CK_DEFINE_FUNCTION(CK_RV, C_GetObjectSize)(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ULONG_PTR pulSize) 441 | { 442 | UNUSED(hSession); 443 | UNUSED(hObject); 444 | UNUSED(pulSize); 445 | 446 | return CKR_FUNCTION_NOT_SUPPORTED; 447 | } 448 | 449 | 450 | CK_DEFINE_FUNCTION(CK_RV, C_GetAttributeValue)(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) 451 | { 452 | UNUSED(hSession); 453 | UNUSED(hObject); 454 | UNUSED(pTemplate); 455 | UNUSED(ulCount); 456 | 457 | return CKR_FUNCTION_NOT_SUPPORTED; 458 | } 459 | 460 | 461 | CK_DEFINE_FUNCTION(CK_RV, C_SetAttributeValue)(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) 462 | { 463 | UNUSED(hSession); 464 | UNUSED(hObject); 465 | UNUSED(pTemplate); 466 | UNUSED(ulCount); 467 | 468 | return CKR_FUNCTION_NOT_SUPPORTED; 469 | } 470 | 471 | 472 | CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsInit)(CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) 473 | { 474 | UNUSED(hSession); 475 | UNUSED(pTemplate); 476 | UNUSED(ulCount); 477 | 478 | return CKR_FUNCTION_NOT_SUPPORTED; 479 | } 480 | 481 | 482 | CK_DEFINE_FUNCTION(CK_RV, C_FindObjects)(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE_PTR phObject, CK_ULONG ulMaxObjectCount, CK_ULONG_PTR pulObjectCount) 483 | { 484 | UNUSED(hSession); 485 | UNUSED(phObject); 486 | UNUSED(ulMaxObjectCount); 487 | UNUSED(pulObjectCount); 488 | 489 | return CKR_FUNCTION_NOT_SUPPORTED; 490 | } 491 | 492 | 493 | CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsFinal)(CK_SESSION_HANDLE hSession) 494 | { 495 | UNUSED(hSession); 496 | 497 | return CKR_FUNCTION_NOT_SUPPORTED; 498 | } 499 | 500 | 501 | CK_DEFINE_FUNCTION(CK_RV, C_EncryptInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 502 | { 503 | UNUSED(hSession); 504 | UNUSED(pMechanism); 505 | UNUSED(hKey); 506 | 507 | return CKR_FUNCTION_NOT_SUPPORTED; 508 | } 509 | 510 | 511 | CK_DEFINE_FUNCTION(CK_RV, C_Encrypt)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pEncryptedData, CK_ULONG_PTR pulEncryptedDataLen) 512 | { 513 | UNUSED(hSession); 514 | UNUSED(pData); 515 | UNUSED(ulDataLen); 516 | UNUSED(pEncryptedData); 517 | UNUSED(pulEncryptedDataLen); 518 | 519 | return CKR_FUNCTION_NOT_SUPPORTED; 520 | } 521 | 522 | 523 | CK_DEFINE_FUNCTION(CK_RV, C_EncryptUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen, CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen) 524 | { 525 | UNUSED(hSession); 526 | UNUSED(pPart); 527 | UNUSED(ulPartLen); 528 | UNUSED(pEncryptedPart); 529 | UNUSED(pulEncryptedPartLen); 530 | 531 | return CKR_FUNCTION_NOT_SUPPORTED; 532 | } 533 | 534 | 535 | CK_DEFINE_FUNCTION(CK_RV, C_EncryptFinal)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pLastEncryptedPart, CK_ULONG_PTR pulLastEncryptedPartLen) 536 | { 537 | UNUSED(hSession); 538 | UNUSED(pLastEncryptedPart); 539 | UNUSED(pulLastEncryptedPartLen); 540 | 541 | return CKR_FUNCTION_NOT_SUPPORTED; 542 | } 543 | 544 | 545 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 546 | { 547 | UNUSED(hSession); 548 | UNUSED(pMechanism); 549 | UNUSED(hKey); 550 | 551 | return CKR_FUNCTION_NOT_SUPPORTED; 552 | } 553 | 554 | 555 | CK_DEFINE_FUNCTION(CK_RV, C_Decrypt)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedData, CK_ULONG ulEncryptedDataLen, CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen) 556 | { 557 | UNUSED(hSession); 558 | UNUSED(pEncryptedData); 559 | UNUSED(ulEncryptedDataLen); 560 | UNUSED(pData); 561 | UNUSED(pulDataLen); 562 | 563 | return CKR_FUNCTION_NOT_SUPPORTED; 564 | } 565 | 566 | 567 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart, CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) 568 | { 569 | UNUSED(hSession); 570 | UNUSED(pEncryptedPart); 571 | UNUSED(ulEncryptedPartLen); 572 | UNUSED(pPart); 573 | UNUSED(pulPartLen); 574 | 575 | return CKR_FUNCTION_NOT_SUPPORTED; 576 | } 577 | 578 | 579 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptFinal)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pLastPart, CK_ULONG_PTR pulLastPartLen) 580 | { 581 | UNUSED(hSession); 582 | UNUSED(pLastPart); 583 | UNUSED(pulLastPartLen); 584 | 585 | return CKR_FUNCTION_NOT_SUPPORTED; 586 | } 587 | 588 | 589 | CK_DEFINE_FUNCTION(CK_RV, C_DigestInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism) 590 | { 591 | UNUSED(hSession); 592 | UNUSED(pMechanism); 593 | 594 | return CKR_FUNCTION_NOT_SUPPORTED; 595 | } 596 | 597 | 598 | CK_DEFINE_FUNCTION(CK_RV, C_Digest)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen) 599 | { 600 | UNUSED(hSession); 601 | UNUSED(pData); 602 | UNUSED(ulDataLen); 603 | UNUSED(pDigest); 604 | UNUSED(pulDigestLen); 605 | 606 | return CKR_FUNCTION_NOT_SUPPORTED; 607 | } 608 | 609 | 610 | CK_DEFINE_FUNCTION(CK_RV, C_DigestUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen) 611 | { 612 | UNUSED(hSession); 613 | UNUSED(pPart); 614 | UNUSED(ulPartLen); 615 | 616 | return CKR_FUNCTION_NOT_SUPPORTED; 617 | } 618 | 619 | 620 | CK_DEFINE_FUNCTION(CK_RV, C_DigestKey)(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hKey) 621 | { 622 | UNUSED(hSession); 623 | UNUSED(hKey); 624 | 625 | return CKR_FUNCTION_NOT_SUPPORTED; 626 | } 627 | 628 | 629 | CK_DEFINE_FUNCTION(CK_RV, C_DigestFinal)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen) 630 | { 631 | UNUSED(hSession); 632 | UNUSED(pDigest); 633 | UNUSED(pulDigestLen); 634 | 635 | return CKR_FUNCTION_NOT_SUPPORTED; 636 | } 637 | 638 | 639 | CK_DEFINE_FUNCTION(CK_RV, C_SignInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 640 | { 641 | UNUSED(hSession); 642 | UNUSED(pMechanism); 643 | UNUSED(hKey); 644 | 645 | return CKR_FUNCTION_NOT_SUPPORTED; 646 | } 647 | 648 | 649 | CK_DEFINE_FUNCTION(CK_RV, C_Sign)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen) 650 | { 651 | UNUSED(hSession); 652 | UNUSED(pData); 653 | UNUSED(ulDataLen); 654 | UNUSED(pSignature); 655 | UNUSED(pulSignatureLen); 656 | 657 | return CKR_FUNCTION_NOT_SUPPORTED; 658 | } 659 | 660 | 661 | CK_DEFINE_FUNCTION(CK_RV, C_SignUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen) 662 | { 663 | UNUSED(hSession); 664 | UNUSED(pPart); 665 | UNUSED(ulPartLen); 666 | 667 | return CKR_FUNCTION_NOT_SUPPORTED; 668 | } 669 | 670 | 671 | CK_DEFINE_FUNCTION(CK_RV, C_SignFinal)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen) 672 | { 673 | UNUSED(hSession); 674 | UNUSED(pSignature); 675 | UNUSED(pulSignatureLen); 676 | 677 | return CKR_FUNCTION_NOT_SUPPORTED; 678 | } 679 | 680 | 681 | CK_DEFINE_FUNCTION(CK_RV, C_SignRecoverInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 682 | { 683 | UNUSED(hSession); 684 | UNUSED(pMechanism); 685 | UNUSED(hKey); 686 | 687 | return CKR_FUNCTION_NOT_SUPPORTED; 688 | } 689 | 690 | 691 | CK_DEFINE_FUNCTION(CK_RV, C_SignRecover)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen) 692 | { 693 | UNUSED(hSession); 694 | UNUSED(pData); 695 | UNUSED(ulDataLen); 696 | UNUSED(pSignature); 697 | UNUSED(pulSignatureLen); 698 | 699 | return CKR_FUNCTION_NOT_SUPPORTED; 700 | } 701 | 702 | 703 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 704 | { 705 | UNUSED(hSession); 706 | UNUSED(pMechanism); 707 | UNUSED(hKey); 708 | 709 | return CKR_FUNCTION_NOT_SUPPORTED; 710 | } 711 | 712 | 713 | CK_DEFINE_FUNCTION(CK_RV, C_Verify)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) 714 | { 715 | UNUSED(hSession); 716 | UNUSED(pData); 717 | UNUSED(ulDataLen); 718 | UNUSED(pSignature); 719 | UNUSED(ulSignatureLen); 720 | 721 | return CKR_FUNCTION_NOT_SUPPORTED; 722 | } 723 | 724 | 725 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen) 726 | { 727 | UNUSED(hSession); 728 | UNUSED(pPart); 729 | UNUSED(ulPartLen); 730 | 731 | return CKR_FUNCTION_NOT_SUPPORTED; 732 | } 733 | 734 | 735 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyFinal)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) 736 | { 737 | UNUSED(hSession); 738 | UNUSED(pSignature); 739 | UNUSED(ulSignatureLen); 740 | 741 | return CKR_FUNCTION_NOT_SUPPORTED; 742 | } 743 | 744 | 745 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyRecoverInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 746 | { 747 | UNUSED(hSession); 748 | UNUSED(pMechanism); 749 | UNUSED(hKey); 750 | 751 | return CKR_FUNCTION_NOT_SUPPORTED; 752 | } 753 | 754 | 755 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyRecover)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen, CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen) 756 | { 757 | UNUSED(hSession); 758 | UNUSED(pSignature); 759 | UNUSED(ulSignatureLen); 760 | UNUSED(pData); 761 | UNUSED(pulDataLen); 762 | 763 | return CKR_FUNCTION_NOT_SUPPORTED; 764 | } 765 | 766 | 767 | CK_DEFINE_FUNCTION(CK_RV, C_DigestEncryptUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen, CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen) 768 | { 769 | UNUSED(hSession); 770 | UNUSED(pPart); 771 | UNUSED(ulPartLen); 772 | UNUSED(pEncryptedPart); 773 | UNUSED(pulEncryptedPartLen); 774 | 775 | return CKR_FUNCTION_NOT_SUPPORTED; 776 | } 777 | 778 | 779 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptDigestUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart, CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) 780 | { 781 | UNUSED(hSession); 782 | UNUSED(pEncryptedPart); 783 | UNUSED(ulEncryptedPartLen); 784 | UNUSED(pPart); 785 | UNUSED(pulPartLen); 786 | 787 | return CKR_FUNCTION_NOT_SUPPORTED; 788 | } 789 | 790 | 791 | CK_DEFINE_FUNCTION(CK_RV, C_SignEncryptUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen, CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen) 792 | { 793 | UNUSED(hSession); 794 | UNUSED(pPart); 795 | UNUSED(ulPartLen); 796 | UNUSED(pEncryptedPart); 797 | UNUSED(pulEncryptedPartLen); 798 | 799 | return CKR_FUNCTION_NOT_SUPPORTED; 800 | } 801 | 802 | 803 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptVerifyUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart, CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) 804 | { 805 | UNUSED(hSession); 806 | UNUSED(pEncryptedPart); 807 | UNUSED(ulEncryptedPartLen); 808 | UNUSED(pPart); 809 | UNUSED(pulPartLen); 810 | 811 | return CKR_FUNCTION_NOT_SUPPORTED; 812 | } 813 | 814 | 815 | CK_DEFINE_FUNCTION(CK_RV, C_GenerateKey)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phKey) 816 | { 817 | UNUSED(hSession); 818 | UNUSED(pMechanism); 819 | UNUSED(pTemplate); 820 | UNUSED(ulCount); 821 | UNUSED(phKey); 822 | 823 | return CKR_FUNCTION_NOT_SUPPORTED; 824 | } 825 | 826 | 827 | CK_DEFINE_FUNCTION(CK_RV, C_GenerateKeyPair)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_ATTRIBUTE_PTR pPublicKeyTemplate, CK_ULONG ulPublicKeyAttributeCount, CK_ATTRIBUTE_PTR pPrivateKeyTemplate, CK_ULONG ulPrivateKeyAttributeCount, CK_OBJECT_HANDLE_PTR phPublicKey, CK_OBJECT_HANDLE_PTR phPrivateKey) 828 | { 829 | UNUSED(hSession); 830 | UNUSED(pMechanism); 831 | UNUSED(pPublicKeyTemplate); 832 | UNUSED(ulPublicKeyAttributeCount); 833 | UNUSED(pPrivateKeyTemplate); 834 | UNUSED(ulPrivateKeyAttributeCount); 835 | UNUSED(phPublicKey); 836 | UNUSED(phPrivateKey); 837 | 838 | return CKR_FUNCTION_NOT_SUPPORTED; 839 | } 840 | 841 | 842 | CK_DEFINE_FUNCTION(CK_RV, C_WrapKey)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hWrappingKey, CK_OBJECT_HANDLE hKey, CK_BYTE_PTR pWrappedKey, CK_ULONG_PTR pulWrappedKeyLen) 843 | { 844 | UNUSED(hSession); 845 | UNUSED(pMechanism); 846 | UNUSED(hWrappingKey); 847 | UNUSED(hKey); 848 | UNUSED(pWrappedKey); 849 | UNUSED(pulWrappedKeyLen); 850 | 851 | return CKR_FUNCTION_NOT_SUPPORTED; 852 | } 853 | 854 | 855 | CK_DEFINE_FUNCTION(CK_RV, C_UnwrapKey)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hUnwrappingKey, CK_BYTE_PTR pWrappedKey, CK_ULONG ulWrappedKeyLen, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey) 856 | { 857 | UNUSED(hSession); 858 | UNUSED(pMechanism); 859 | UNUSED(hUnwrappingKey); 860 | UNUSED(pWrappedKey); 861 | UNUSED(ulWrappedKeyLen); 862 | UNUSED(pTemplate); 863 | UNUSED(ulAttributeCount); 864 | UNUSED(phKey); 865 | 866 | return CKR_FUNCTION_NOT_SUPPORTED; 867 | } 868 | 869 | 870 | CK_DEFINE_FUNCTION(CK_RV, C_DeriveKey)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hBaseKey, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey) 871 | { 872 | UNUSED(hSession); 873 | UNUSED(pMechanism); 874 | UNUSED(hBaseKey); 875 | UNUSED(pTemplate); 876 | UNUSED(ulAttributeCount); 877 | UNUSED(phKey); 878 | 879 | return CKR_FUNCTION_NOT_SUPPORTED; 880 | } 881 | 882 | 883 | CK_DEFINE_FUNCTION(CK_RV, C_SeedRandom)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen) 884 | { 885 | UNUSED(hSession); 886 | UNUSED(pSeed); 887 | UNUSED(ulSeedLen); 888 | 889 | return CKR_FUNCTION_NOT_SUPPORTED; 890 | } 891 | 892 | 893 | CK_DEFINE_FUNCTION(CK_RV, C_GenerateRandom)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR RandomData, CK_ULONG ulRandomLen) 894 | { 895 | UNUSED(hSession); 896 | UNUSED(RandomData); 897 | UNUSED(ulRandomLen); 898 | 899 | return CKR_FUNCTION_NOT_SUPPORTED; 900 | } 901 | 902 | 903 | CK_DEFINE_FUNCTION(CK_RV, C_GetFunctionStatus)(CK_SESSION_HANDLE hSession) 904 | { 905 | UNUSED(hSession); 906 | 907 | return CKR_FUNCTION_NOT_SUPPORTED; 908 | } 909 | 910 | 911 | CK_DEFINE_FUNCTION(CK_RV, C_CancelFunction)(CK_SESSION_HANDLE hSession) 912 | { 913 | UNUSED(hSession); 914 | 915 | return CKR_FUNCTION_NOT_SUPPORTED; 916 | } 917 | 918 | 919 | CK_DEFINE_FUNCTION(CK_RV, C_WaitForSlotEvent)(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, CK_VOID_PTR pReserved) 920 | { 921 | UNUSED(flags); 922 | UNUSED(pSlot); 923 | UNUSED(pReserved); 924 | 925 | return CKR_FUNCTION_NOT_SUPPORTED; 926 | } 927 | 928 | 929 | CK_DEFINE_FUNCTION(CK_RV, C_GetInterfaceList)(CK_INTERFACE_PTR pInterfacesList, CK_ULONG_PTR pulCount) 930 | { 931 | if (NULL == pulCount) 932 | return CKR_ARGUMENTS_BAD; 933 | 934 | if (NULL == pInterfacesList) 935 | { 936 | *pulCount = 2; 937 | } 938 | else 939 | { 940 | if (*pulCount < 2) 941 | return CKR_BUFFER_TOO_SMALL; 942 | 943 | pInterfacesList[0].pInterfaceName = empty_pkcs11_2_40_interface.pInterfaceName; 944 | pInterfacesList[0].pFunctionList = empty_pkcs11_2_40_interface.pFunctionList; 945 | pInterfacesList[0].flags = empty_pkcs11_2_40_interface.flags; 946 | 947 | pInterfacesList[1].pInterfaceName = empty_pkcs11_3_1_interface.pInterfaceName; 948 | pInterfacesList[1].pFunctionList = empty_pkcs11_3_1_interface.pFunctionList; 949 | pInterfacesList[1].flags = empty_pkcs11_3_1_interface.flags; 950 | } 951 | 952 | return CKR_OK; 953 | } 954 | 955 | 956 | CK_DEFINE_FUNCTION(CK_RV, C_GetInterface)(CK_UTF8CHAR_PTR pInterfaceName, CK_VERSION_PTR pVersion, CK_INTERFACE_PTR_PTR ppInterface, CK_FLAGS flags) 957 | { 958 | if (NULL == ppInterface) 959 | return CKR_ARGUMENTS_BAD; 960 | 961 | if (flags != 0) 962 | { 963 | *ppInterface = NULL; 964 | return CKR_OK; 965 | } 966 | 967 | if (NULL != pInterfaceName) 968 | { 969 | const char* requested_interface_name = (const char*)pInterfaceName; 970 | const char* supported_interface_name = "PKCS 11"; 971 | 972 | if (strlen(requested_interface_name) != strlen(supported_interface_name) || 0 != strcmp(requested_interface_name, supported_interface_name)) 973 | { 974 | *ppInterface = NULL; 975 | return CKR_OK; 976 | } 977 | } 978 | 979 | if (NULL != pVersion) 980 | { 981 | if (pVersion->major == empty_pkcs11_2_40_functions.version.major && pVersion->minor == empty_pkcs11_2_40_functions.version.minor) 982 | { 983 | *ppInterface = &empty_pkcs11_2_40_interface; 984 | return CKR_OK; 985 | } 986 | else if (pVersion->major == empty_pkcs11_3_1_functions.version.major && pVersion->minor == empty_pkcs11_3_1_functions.version.minor) 987 | { 988 | *ppInterface = &empty_pkcs11_3_1_interface; 989 | return CKR_OK; 990 | } 991 | else 992 | { 993 | *ppInterface = NULL; 994 | return CKR_OK; 995 | } 996 | } 997 | 998 | *ppInterface = &empty_pkcs11_3_1_interface; 999 | return CKR_OK; 1000 | } 1001 | 1002 | 1003 | CK_DEFINE_FUNCTION(CK_RV, C_LoginUser)(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen, CK_UTF8CHAR_PTR pUsername, CK_ULONG ulUsernameLen) 1004 | { 1005 | UNUSED(hSession); 1006 | UNUSED(userType); 1007 | UNUSED(pPin); 1008 | UNUSED(ulPinLen); 1009 | UNUSED(pUsername); 1010 | UNUSED(ulUsernameLen); 1011 | 1012 | return CKR_FUNCTION_NOT_SUPPORTED; 1013 | } 1014 | 1015 | 1016 | CK_DEFINE_FUNCTION(CK_RV, C_SessionCancel)(CK_SESSION_HANDLE hSession, CK_FLAGS flags) 1017 | { 1018 | UNUSED(hSession); 1019 | UNUSED(flags); 1020 | 1021 | return CKR_FUNCTION_NOT_SUPPORTED; 1022 | } 1023 | 1024 | 1025 | CK_DEFINE_FUNCTION(CK_RV, C_MessageEncryptInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 1026 | { 1027 | UNUSED(hSession); 1028 | UNUSED(pMechanism); 1029 | UNUSED(hKey); 1030 | 1031 | return CKR_FUNCTION_NOT_SUPPORTED; 1032 | } 1033 | 1034 | 1035 | CK_DEFINE_FUNCTION(CK_RV, C_EncryptMessage)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pAssociatedData, CK_ULONG ulAssociatedDataLen, CK_BYTE_PTR pPlaintext, CK_ULONG ulPlaintextLen, CK_BYTE_PTR pCiphertext, CK_ULONG_PTR pulCiphertextLen) 1036 | { 1037 | UNUSED(hSession); 1038 | UNUSED(pParameter); 1039 | UNUSED(ulParameterLen); 1040 | UNUSED(pAssociatedData); 1041 | UNUSED(ulAssociatedDataLen); 1042 | UNUSED(pPlaintext); 1043 | UNUSED(ulPlaintextLen); 1044 | UNUSED(pCiphertext); 1045 | UNUSED(pulCiphertextLen); 1046 | 1047 | return CKR_FUNCTION_NOT_SUPPORTED; 1048 | } 1049 | 1050 | 1051 | CK_DEFINE_FUNCTION(CK_RV, C_EncryptMessageBegin)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pAssociatedData, CK_ULONG ulAssociatedDataLen) 1052 | { 1053 | UNUSED(hSession); 1054 | UNUSED(pParameter); 1055 | UNUSED(ulParameterLen); 1056 | UNUSED(pAssociatedData); 1057 | UNUSED(ulAssociatedDataLen); 1058 | 1059 | return CKR_FUNCTION_NOT_SUPPORTED; 1060 | } 1061 | 1062 | 1063 | CK_DEFINE_FUNCTION(CK_RV, C_EncryptMessageNext)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pPlaintextPart, CK_ULONG ulPlaintextPartLen, CK_BYTE_PTR pCiphertextPart, CK_ULONG_PTR pulCiphertextPartLen, CK_FLAGS flags) 1064 | { 1065 | UNUSED(hSession); 1066 | UNUSED(pParameter); 1067 | UNUSED(ulParameterLen); 1068 | UNUSED(pPlaintextPart); 1069 | UNUSED(ulPlaintextPartLen); 1070 | UNUSED(pCiphertextPart); 1071 | UNUSED(pulCiphertextPartLen); 1072 | UNUSED(flags); 1073 | 1074 | return CKR_FUNCTION_NOT_SUPPORTED; 1075 | } 1076 | 1077 | 1078 | CK_DEFINE_FUNCTION(CK_RV, C_MessageEncryptFinal)(CK_SESSION_HANDLE hSession) 1079 | { 1080 | UNUSED(hSession); 1081 | 1082 | return CKR_FUNCTION_NOT_SUPPORTED; 1083 | } 1084 | 1085 | 1086 | CK_DEFINE_FUNCTION(CK_RV, C_MessageDecryptInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 1087 | { 1088 | UNUSED(hSession); 1089 | UNUSED(pMechanism); 1090 | UNUSED(hKey); 1091 | 1092 | return CKR_FUNCTION_NOT_SUPPORTED; 1093 | } 1094 | 1095 | 1096 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptMessage)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pAssociatedData, CK_ULONG ulAssociatedDataLen, CK_BYTE_PTR pCiphertext, CK_ULONG ulCiphertextLen, CK_BYTE_PTR pPlaintext, CK_ULONG_PTR pulPlaintextLen) 1097 | { 1098 | UNUSED(hSession); 1099 | UNUSED(pParameter); 1100 | UNUSED(ulParameterLen); 1101 | UNUSED(pAssociatedData); 1102 | UNUSED(ulAssociatedDataLen); 1103 | UNUSED(pCiphertext); 1104 | UNUSED(ulCiphertextLen); 1105 | UNUSED(pPlaintext); 1106 | UNUSED(pulPlaintextLen); 1107 | 1108 | return CKR_FUNCTION_NOT_SUPPORTED; 1109 | } 1110 | 1111 | 1112 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptMessageBegin)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pAssociatedData, CK_ULONG ulAssociatedDataLen) 1113 | { 1114 | UNUSED(hSession); 1115 | UNUSED(pParameter); 1116 | UNUSED(ulParameterLen); 1117 | UNUSED(pAssociatedData); 1118 | UNUSED(ulAssociatedDataLen); 1119 | 1120 | return CKR_FUNCTION_NOT_SUPPORTED; 1121 | } 1122 | 1123 | 1124 | CK_DEFINE_FUNCTION(CK_RV, C_DecryptMessageNext)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pCiphertextPart, CK_ULONG ulCiphertextPartLen, CK_BYTE_PTR pPlaintextPart, CK_ULONG_PTR pulPlaintextPartLen, CK_FLAGS flags) 1125 | { 1126 | UNUSED(hSession); 1127 | UNUSED(pParameter); 1128 | UNUSED(ulParameterLen); 1129 | UNUSED(pCiphertextPart); 1130 | UNUSED(ulCiphertextPartLen); 1131 | UNUSED(pPlaintextPart); 1132 | UNUSED(pulPlaintextPartLen); 1133 | UNUSED(flags); 1134 | 1135 | return CKR_FUNCTION_NOT_SUPPORTED; 1136 | } 1137 | 1138 | 1139 | CK_DEFINE_FUNCTION(CK_RV, C_MessageDecryptFinal)(CK_SESSION_HANDLE hSession) 1140 | { 1141 | UNUSED(hSession); 1142 | 1143 | return CKR_FUNCTION_NOT_SUPPORTED; 1144 | } 1145 | 1146 | 1147 | CK_DEFINE_FUNCTION(CK_RV, C_MessageSignInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 1148 | { 1149 | UNUSED(hSession); 1150 | UNUSED(pMechanism); 1151 | UNUSED(hKey); 1152 | 1153 | return CKR_FUNCTION_NOT_SUPPORTED; 1154 | } 1155 | 1156 | 1157 | CK_DEFINE_FUNCTION(CK_RV, C_SignMessage)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen) 1158 | { 1159 | UNUSED(hSession); 1160 | UNUSED(pParameter); 1161 | UNUSED(ulParameterLen); 1162 | UNUSED(pData); 1163 | UNUSED(ulDataLen); 1164 | UNUSED(pSignature); 1165 | UNUSED(pulSignatureLen); 1166 | 1167 | return CKR_FUNCTION_NOT_SUPPORTED; 1168 | } 1169 | 1170 | 1171 | CK_DEFINE_FUNCTION(CK_RV, C_SignMessageBegin)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen) 1172 | { 1173 | UNUSED(hSession); 1174 | UNUSED(pParameter); 1175 | UNUSED(ulParameterLen); 1176 | 1177 | return CKR_FUNCTION_NOT_SUPPORTED; 1178 | } 1179 | 1180 | 1181 | CK_DEFINE_FUNCTION(CK_RV, C_SignMessageNext)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen) 1182 | { 1183 | UNUSED(hSession); 1184 | UNUSED(pParameter); 1185 | UNUSED(ulParameterLen); 1186 | UNUSED(pData); 1187 | UNUSED(ulDataLen); 1188 | UNUSED(pSignature); 1189 | UNUSED(pulSignatureLen); 1190 | 1191 | return CKR_FUNCTION_NOT_SUPPORTED; 1192 | } 1193 | 1194 | 1195 | CK_DEFINE_FUNCTION(CK_RV, C_MessageSignFinal)(CK_SESSION_HANDLE hSession) 1196 | { 1197 | UNUSED(hSession); 1198 | 1199 | return CKR_FUNCTION_NOT_SUPPORTED; 1200 | } 1201 | 1202 | 1203 | CK_DEFINE_FUNCTION(CK_RV, C_MessageVerifyInit)(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey) 1204 | { 1205 | UNUSED(hSession); 1206 | UNUSED(pMechanism); 1207 | UNUSED(hKey); 1208 | 1209 | return CKR_FUNCTION_NOT_SUPPORTED; 1210 | } 1211 | 1212 | 1213 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyMessage)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) 1214 | { 1215 | UNUSED(hSession); 1216 | UNUSED(pParameter); 1217 | UNUSED(ulParameterLen); 1218 | UNUSED(pData); 1219 | UNUSED(ulDataLen); 1220 | UNUSED(pSignature); 1221 | UNUSED(ulSignatureLen); 1222 | 1223 | return CKR_FUNCTION_NOT_SUPPORTED; 1224 | } 1225 | 1226 | 1227 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyMessageBegin)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen) 1228 | { 1229 | UNUSED(hSession); 1230 | UNUSED(pParameter); 1231 | UNUSED(ulParameterLen); 1232 | 1233 | return CKR_FUNCTION_NOT_SUPPORTED; 1234 | } 1235 | 1236 | 1237 | CK_DEFINE_FUNCTION(CK_RV, C_VerifyMessageNext)(CK_SESSION_HANDLE hSession, CK_VOID_PTR pParameter, CK_ULONG ulParameterLen, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) 1238 | { 1239 | UNUSED(hSession); 1240 | UNUSED(pParameter); 1241 | UNUSED(ulParameterLen); 1242 | UNUSED(pData); 1243 | UNUSED(ulDataLen); 1244 | UNUSED(pSignature); 1245 | UNUSED(ulSignatureLen); 1246 | 1247 | return CKR_FUNCTION_NOT_SUPPORTED; 1248 | } 1249 | 1250 | 1251 | CK_DEFINE_FUNCTION(CK_RV, C_MessageVerifyFinal)(CK_SESSION_HANDLE hSession) 1252 | { 1253 | UNUSED(hSession); 1254 | 1255 | return CKR_FUNCTION_NOT_SUPPORTED; 1256 | } 1257 | -------------------------------------------------------------------------------- /src/empty-pkcs11.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-2025 The Pkcs11Interop Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Written for the Pkcs11Interop project by: 19 | * Jaroslav IMRICH 20 | */ 21 | 22 | 23 | #include 24 | #include 25 | 26 | 27 | // Removes unused parameter warning 28 | #define UNUSED(x) (void)(x) 29 | 30 | 31 | #ifdef _WIN32 32 | 33 | 34 | // PKCS#11 related stuff 35 | #pragma pack(push, cryptoki, 1) 36 | 37 | #define CK_IMPORT_SPEC __declspec(dllimport) 38 | 39 | #ifdef CRYPTOKI_EXPORTS 40 | #define CK_EXPORT_SPEC __declspec(dllexport) 41 | #else 42 | #define CK_EXPORT_SPEC CK_IMPORT_SPEC 43 | #endif 44 | 45 | #define CK_CALL_SPEC __cdecl 46 | 47 | #define CK_PTR * 48 | #define CK_DEFINE_FUNCTION(returnType, name) returnType CK_EXPORT_SPEC CK_CALL_SPEC name 49 | #define CK_DECLARE_FUNCTION(returnType, name) returnType CK_EXPORT_SPEC CK_CALL_SPEC name 50 | #define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType CK_IMPORT_SPEC (CK_CALL_SPEC CK_PTR name) 51 | #define CK_CALLBACK_FUNCTION(returnType, name) returnType (CK_CALL_SPEC CK_PTR name) 52 | 53 | #ifndef NULL_PTR 54 | #define NULL_PTR 0 55 | #endif 56 | 57 | #include 58 | 59 | #pragma pack(pop, cryptoki) 60 | 61 | 62 | #else // #ifdef _WIN32 63 | 64 | 65 | // PKCS#11 related stuff 66 | #define CK_PTR * 67 | #define CK_DEFINE_FUNCTION(returnType, name) returnType name 68 | #define CK_DECLARE_FUNCTION(returnType, name) returnType name 69 | #define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType (* name) 70 | #define CK_CALLBACK_FUNCTION(returnType, name) returnType (* name) 71 | 72 | #ifndef NULL_PTR 73 | #define NULL_PTR 0 74 | #endif 75 | 76 | #include 77 | 78 | 79 | #endif // #ifdef _WIN32 80 | --------------------------------------------------------------------------------