diff --git a/.gitignore b/.gitignore index 3bf25c0..3a4c601 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,10 @@ +.idea/ # ---> Rust # Generated by Cargo # will have compiled files and executables debug/ target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ea5c08a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "pkcs11test"] + path = pkcs11test + url = https://github.com/google/pkcs11test diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..7b66c24 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1501 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cached" +version = "0.51.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0feb64151eed3da6107fddd2d717a6ca4b9dbd74e43784c55c841d1abfe5a295" +dependencies = [ + "hashbrown", + "instant", + "once_cell", + "thiserror", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "der_derive", + "flagset", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "des" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e" +dependencies = [ + "cipher", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "flagset" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb3aa5e95cf9aabc17f060cfa0ced7b83f042390760ca53bf09df9968acaa1" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin", +] + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "native-pkcs11" +version = "0.2.18" +dependencies = [ + "cached", + "native-pkcs11-core", + "native-pkcs11-piv", + "native-pkcs11-traits", + "once_cell", + "pkcs11-sys", + "serial_test", + "thiserror", + "tracing", + "tracing-error", + "tracing-journald", + "tracing-subscriber", +] + +[[package]] +name = "native-pkcs11-core" +version = "0.2.18" +dependencies = [ + "native-pkcs11-piv", + "native-pkcs11-traits", + "once_cell", + "p256", + "pkcs1", + "pkcs11-sys", + "serial_test", + "strum", + "strum_macros", + "thiserror", + "tracing", +] + +[[package]] +name = "native-pkcs11-piv" +version = "0.2.18" +dependencies = [ + "core-foundation", + "native-pkcs11-traits", + "p256", + "rand", + "rsa", + "security-framework", + "security-framework-sys", + "serial_test", + "spki", + "thiserror", + "tracing", + "tracing-error", + "x509-cert", + "yubikey", +] + +[[package]] +name = "native-pkcs11-traits" +version = "0.2.18" +dependencies = [ + "once_cell", + "rand", + "x509-cert", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "serde", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "parking_lot" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pcsc" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ed9d7f816b7d9ce9ddb0062dd2f393b3af31411a95a35411809b4b9116ea08" +dependencies = [ + "bitflags 1.3.2", + "pcsc-sys", +] + +[[package]] +name = "pcsc-sys" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09e9ba80f2c4d167f936d27594f7248bca3295921ffbfa44a24b339b6cb7403" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs11-sys" +version = "0.2.18" +dependencies = [ + "bindgen", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro2" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.3", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rsa" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "sha2", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "scc" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ad2bbb0ae5100a07b7a6f2ed7ab5fd0045551a4c507989b7a620046ea3efdc" +dependencies = [ + "sdd", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sdd" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +dependencies = [ + "bitflags 2.5.0", + "core-foundation", + "core-foundation-sys", + "libc", + "num-bigint", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serial_test" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" +dependencies = [ + "once_cell", + "parking_lot", + "scc", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "2.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tls_codec" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e78c9c330f8c85b2bae7c8368f2739157db9991235123aa1b15ef9502bfb6a" +dependencies = [ + "tls_codec_derive", + "zeroize", +] + +[[package]] +name = "tls_codec_derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d9ef545650e79f30233c0003bcc2504d7efac6dad25fca40744de773fe2049c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +dependencies = [ + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-journald" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba316a74e8fc3c3896a850dba2375928a9fa171b085ecddfc7c054d39970f3fd" +dependencies = [ + "libc", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "uuid" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" +dependencies = [ + "getrandom", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "x509-cert" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94" +dependencies = [ + "const-oid", + "der", + "sha1", + "signature", + "spki", + "tls_codec", +] + +[[package]] +name = "yubikey" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d1efb43c1e3edd4cf871c8dc500d900abfa083c1f2bab10b781ea8ffcadedcb" +dependencies = [ + "base16ct", + "der", + "des", + "ecdsa", + "elliptic-curve", + "hmac", + "log", + "nom", + "num-bigint-dig", + "num-integer", + "num-traits", + "p256", + "p384", + "pbkdf2", + "pcsc", + "rand_core", + "rsa", + "secrecy", + "sha1", + "sha2", + "signature", + "subtle", + "uuid", + "x509-cert", + "zeroize", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..009c8dd --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,23 @@ +[workspace] +resolver = "2" +members = [ + "native-pkcs11", + "native-pkcs11-core", + "native-pkcs11-traits", + "native-pkcs11-piv", + "pkcs11-sys", +] + +[workspace.package] +authors = [ + "Brandon Weeks ", + "Kevin King ", +] +edition = "2021" +rust-version = "1.65" +repository = "https://github.com/google/native-pkcs11" +license = "Apache-2.0" + +[profile.release] +strip = "symbols" +panic = "abort" diff --git a/LICENSE b/LICENSE index 2071b23..261eeb9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,201 @@ -MIT License + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Copyright (c) + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + 1. Definitions. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "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. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "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. + + "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). + + "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. + + "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." + + "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. + + 2. Grant of Copyright License. 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. + + 3. Grant of Patent License. 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. + + 4. Redistribution. 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (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 + + (d) If the Work includes a "NOTICE" 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. + + 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. + + 5. Submission of Contributions. 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. + + 6. Trademarks. 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. + + 7. Disclaimer of Warranty. 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. + + 8. Limitation of Liability. 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. + + 9. Accepting Warranty or Additional Liability. 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. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + 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. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 44eba2a..a58ce8c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ -# yubikey-piv-pkcs11 +Yubikey PIV PKCS#11 + +> Fork form: https://github.com/google/native-pkcs11 + -Yubikey PIV PKCS#11 \ No newline at end of file diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..7b9124d --- /dev/null +++ b/deny.toml @@ -0,0 +1,29 @@ +targets = [ + { triple = "aarch64-apple-darwin" }, + { triple = "x86_64-apple-darwin" }, + { triple = "x86_64-pc-windows-msvc" }, + { triple = "x86_64-unknown-linux-gnu" }, +] + +[advisories] +vulnerability = "deny" +unmaintained = "deny" +unsound = "deny" +yanked = "deny" +notice = "deny" +ignore = ["RUSTSEC-2023-0071"] + +[licenses] +allow = ["Apache-2.0", "BSD-3-Clause", "ISC", "MIT", "Unicode-DFS-2016"] +copyleft = "deny" + +[bans] +multiple-versions = "deny" +skip = [ + { name = "regex-automata", version = "=0.1.10" }, + { name = "regex-syntax", version = "=0.6.29" }, +] + +[sources] +unknown-registry = "deny" +unknown-git = "deny" diff --git a/native-pkcs11-core/Cargo.toml b/native-pkcs11-core/Cargo.toml new file mode 100644 index 0000000..ef407d5 --- /dev/null +++ b/native-pkcs11-core/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "native-pkcs11-core" +version = "0.2.18" +description = "Shared cross-platform PKCS#11 module logic for native-pkcs11." +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +repository.workspace = true +license.workspace = true + +[dependencies] +native-pkcs11-traits = { version = "0.2.0", path = "../native-pkcs11-traits" } +once_cell = "1.19.0" +p256 = { version = "0.13.2", default-features = false, features = [ + "arithmetic", + "pkcs8", + "std", +] } +pkcs1 = { version = "0.7.5", default-features = false } +pkcs11-sys = { version = "0.2.0", path = "../pkcs11-sys" } +strum = "0.26.3" +strum_macros = "0.26.4" +thiserror = "1.0.61" +tracing = "0.1.40" +native-pkcs11-piv = { version = "0.2.0", path = "../native-pkcs11-piv" } + +[dev-dependencies] +serial_test = { version = "3.1.1", default-features = false } diff --git a/native-pkcs11-core/LICENSE b/native-pkcs11-core/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/native-pkcs11-core/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "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. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "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. + + "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). + + "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. + + "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." + + "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. + + 2. Grant of Copyright License. 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. + + 3. Grant of Patent License. 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. + + 4. Redistribution. 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (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 + + (d) If the Work includes a "NOTICE" 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. + + 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. + + 5. Submission of Contributions. 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. + + 6. Trademarks. 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. + + 7. Disclaimer of Warranty. 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. + + 8. Limitation of Liability. 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. + + 9. Accepting Warranty or Additional Liability. 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. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + 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. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/native-pkcs11-core/src/attribute.rs b/native-pkcs11-core/src/attribute.rs new file mode 100644 index 0000000..ac7284d --- /dev/null +++ b/native-pkcs11-core/src/attribute.rs @@ -0,0 +1,377 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::{collections::BTreeSet, ffi::CString}; + +use pkcs11_sys::*; +use strum_macros::Display; + +use crate::{Error, Result}; + +#[derive(Debug, Display, PartialEq, Eq)] +pub enum AttributeType { + AlwaysAuthenticate, + AlwaysSensitive, + Application, + CertificateCategory, + CertificateType, + Class, + Coefficient, + Decrypt, + EcParams, + EcPoint, + Encrypt, + Exponent1, + Exponent2, + Extractable, + Id, + Issuer, + KeyType, + Label, + Modulus, + ModulusBits, + NeverExtractable, + Prime1, + Prime2, + Private, + PrivateExponent, + ProfileId, + PublicExponent, + Sensitive, + SerialNumber, + Sign, + SignRecover, + Subject, + Token, + Trusted, + Unwrap, + Value, + ValueLen, + Verify, + VerifyRecover, + Wrap, +} + +impl TryFrom for AttributeType { + type Error = Error; + + fn try_from(type_: CK_ATTRIBUTE_TYPE) -> Result { + match type_ { + CKA_ALWAYS_AUTHENTICATE => Ok(AttributeType::AlwaysAuthenticate), + CKA_ALWAYS_SENSITIVE => Ok(AttributeType::AlwaysSensitive), + CKA_APPLICATION => Ok(AttributeType::Application), + CKA_CERTIFICATE_CATEGORY => Ok(AttributeType::CertificateCategory), + CKA_CERTIFICATE_TYPE => Ok(AttributeType::CertificateType), + CKA_CLASS => Ok(AttributeType::Class), + CKA_COEFFICIENT => Ok(AttributeType::Coefficient), + CKA_DECRYPT => Ok(AttributeType::Decrypt), + CKA_EC_PARAMS => Ok(AttributeType::EcParams), + CKA_EC_POINT => Ok(AttributeType::EcPoint), + CKA_ENCRYPT => Ok(AttributeType::Encrypt), + CKA_EXPONENT_1 => Ok(AttributeType::Exponent1), + CKA_EXPONENT_2 => Ok(AttributeType::Exponent2), + CKA_EXTRACTABLE => Ok(AttributeType::Extractable), + CKA_ID => Ok(AttributeType::Id), + CKA_ISSUER => Ok(AttributeType::Issuer), + CKA_KEY_TYPE => Ok(AttributeType::KeyType), + CKA_LABEL => Ok(AttributeType::Label), + CKA_MODULUS => Ok(AttributeType::Modulus), + CKA_MODULUS_BITS => Ok(AttributeType::ModulusBits), + CKA_NEVER_EXTRACTABLE => Ok(AttributeType::NeverExtractable), + CKA_PRIME_1 => Ok(AttributeType::Prime1), + CKA_PRIME_2 => Ok(AttributeType::Prime2), + CKA_PRIVATE => Ok(AttributeType::Private), + CKA_PRIVATE_EXPONENT => Ok(AttributeType::PrivateExponent), + CKA_PROFILE_ID => Ok(AttributeType::ProfileId), + CKA_PUBLIC_EXPONENT => Ok(AttributeType::PublicExponent), + CKA_SENSITIVE => Ok(AttributeType::Sensitive), + CKA_SIGN => Ok(AttributeType::Sign), + CKA_SIGN_RECOVER => Ok(AttributeType::SignRecover), + CKA_SERIAL_NUMBER => Ok(AttributeType::SerialNumber), + CKA_SUBJECT => Ok(AttributeType::Subject), + CKA_TOKEN => Ok(AttributeType::Token), + CKA_TRUSTED => Ok(AttributeType::Trusted), + CKA_UNWRAP => Ok(AttributeType::Unwrap), + CKA_VALUE => Ok(AttributeType::Value), + CKA_VALUE_LEN => Ok(AttributeType::ValueLen), + CKA_VERIFY => Ok(AttributeType::Verify), + CKA_VERIFY_RECOVER => Ok(AttributeType::VerifyRecover), + CKA_WRAP => Ok(AttributeType::Wrap), + _ => Err(Error::AttributeTypeInvalid(type_)), + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum Attribute { + AlwaysAuthenticate(bool), + AlwaysSensitive(bool), + Application(CString), + CertificateCategory(CK_CERTIFICATE_CATEGORY), + CertificateType(CK_CERTIFICATE_TYPE), + Class(CK_OBJECT_CLASS), + Coefficient(Vec), + Decrypt(bool), + EcParams(Vec), + EcPoint(Vec), + Encrypt(bool), + Exponent1(Vec), + Exponent2(Vec), + Extractable(bool), + Id(Vec), + Issuer(Vec), + KeyType(CK_KEY_TYPE), + Label(String), + Modulus(Vec), + ModulusBits(CK_ULONG), + NeverExtractable(bool), + Prime1(Vec), + Prime2(Vec), + Private(bool), + PrivateExponent(Vec), + ProfileId(CK_PROFILE_ID), + PublicExponent(Vec), + Sensitive(bool), + SerialNumber(Vec), + Sign(bool), + SignRecover(bool), + Subject(Vec), + Token(bool), + Trusted(bool), + Unwrap(bool), + Value(Vec), + ValueLen(CK_ULONG), + Verify(bool), + VerifyRecover(bool), + Wrap(bool), +} + +impl Attribute { + pub fn attribute_type(&self) -> AttributeType { + match self { + Attribute::AlwaysAuthenticate(_) => AttributeType::AlwaysAuthenticate, + Attribute::AlwaysSensitive(_) => AttributeType::AlwaysSensitive, + Attribute::Application(_) => AttributeType::Application, + Attribute::CertificateCategory(_) => AttributeType::CertificateCategory, + Attribute::CertificateType(_) => AttributeType::CertificateType, + Attribute::Class(_) => AttributeType::Class, + Attribute::Coefficient(_) => AttributeType::Coefficient, + Attribute::Decrypt(_) => AttributeType::Decrypt, + Attribute::EcParams(_) => AttributeType::EcParams, + Attribute::EcPoint(_) => AttributeType::EcPoint, + Attribute::Encrypt(_) => AttributeType::Encrypt, + Attribute::Exponent1(_) => AttributeType::Exponent1, + Attribute::Exponent2(_) => AttributeType::Exponent2, + Attribute::Extractable(_) => AttributeType::Extractable, + Attribute::Id(_) => AttributeType::Id, + Attribute::Issuer(_) => AttributeType::Issuer, + Attribute::KeyType(_) => AttributeType::KeyType, + Attribute::Label(_) => AttributeType::Label, + Attribute::Modulus(_) => AttributeType::Modulus, + Attribute::ModulusBits(_) => AttributeType::ModulusBits, + Attribute::NeverExtractable(_) => AttributeType::NeverExtractable, + Attribute::Prime1(_) => AttributeType::Prime1, + Attribute::Prime2(_) => AttributeType::Prime2, + Attribute::Private(_) => AttributeType::Private, + Attribute::PrivateExponent(_) => AttributeType::PrivateExponent, + Attribute::ProfileId(_) => AttributeType::ProfileId, + Attribute::PublicExponent(_) => AttributeType::PublicExponent, + Attribute::Sensitive(_) => AttributeType::Sensitive, + Attribute::SerialNumber(_) => AttributeType::SerialNumber, + Attribute::Sign(_) => AttributeType::Sign, + Attribute::SignRecover(_) => AttributeType::SignRecover, + Attribute::Subject(_) => AttributeType::Subject, + Attribute::Token(_) => AttributeType::Token, + Attribute::Trusted(_) => AttributeType::Trusted, + Attribute::Unwrap(_) => AttributeType::Unwrap, + Attribute::Value(_) => AttributeType::Value, + Attribute::ValueLen(_) => AttributeType::ValueLen, + Attribute::Verify(_) => AttributeType::Verify, + Attribute::VerifyRecover(_) => AttributeType::VerifyRecover, + Attribute::Wrap(_) => AttributeType::Wrap, + } + } + + pub fn as_raw_value(&self) -> Vec { + match self { + Attribute::AlwaysAuthenticate(bool) + | Attribute::AlwaysSensitive(bool) + | Attribute::Decrypt(bool) + | Attribute::Encrypt(bool) + | Attribute::Extractable(bool) + | Attribute::NeverExtractable(bool) + | Attribute::Private(bool) + | Attribute::Sensitive(bool) + | Attribute::Sign(bool) + | Attribute::SignRecover(bool) + | Attribute::Token(bool) + | Attribute::Trusted(bool) + | Attribute::Unwrap(bool) + | Attribute::Verify(bool) + | Attribute::VerifyRecover(bool) + | Attribute::Wrap(bool) => { + CK_BBOOL::to_ne_bytes(if *bool { CK_TRUE } else { CK_FALSE }).to_vec() + } + Attribute::CertificateCategory(int) + | Attribute::CertificateType(int) + | Attribute::Class(int) + | Attribute::KeyType(int) + | Attribute::ModulusBits(int) + | Attribute::ProfileId(int) + | Attribute::ValueLen(int) => int.to_ne_bytes().to_vec(), + Attribute::Coefficient(bytes) + | Attribute::EcParams(bytes) + | Attribute::EcPoint(bytes) + | Attribute::Exponent1(bytes) + | Attribute::Exponent2(bytes) + | Attribute::Id(bytes) + | Attribute::Issuer(bytes) + | Attribute::Modulus(bytes) + | Attribute::Prime1(bytes) + | Attribute::Prime2(bytes) + | Attribute::PrivateExponent(bytes) + | Attribute::PublicExponent(bytes) + | Attribute::SerialNumber(bytes) + | Attribute::Subject(bytes) + | Attribute::Value(bytes) => bytes.to_vec(), + Attribute::Application(c_string) => c_string.as_bytes().to_vec(), + Attribute::Label(string) => string.as_bytes().to_vec(), + } + } +} + +impl TryFrom for Attribute { + type Error = Error; + + fn try_from(attribute: CK_ATTRIBUTE) -> Result { + let attr_type = AttributeType::try_from(attribute.type_)?; + let val = if attribute.ulValueLen > 0 { + if attribute.pValue.is_null() { + return Err(Error::NullPtr); + } + unsafe { + std::slice::from_raw_parts( + attribute.pValue as *const u8, + attribute.ulValueLen.try_into()?, + ) + } + } else { + &[] + }; + match attr_type { + AttributeType::AlwaysAuthenticate => { + Ok(Attribute::AlwaysAuthenticate(try_u8_into_bool(val)?)) + } + AttributeType::AlwaysSensitive => { + Ok(Attribute::AlwaysSensitive(try_u8_into_bool(val)?)) + } + AttributeType::Application => Ok(Attribute::Application(CString::from_vec_with_nul( + val.to_vec(), + )?)), + AttributeType::CertificateCategory => Ok(Attribute::CertificateCategory( + CK_CERTIFICATE_CATEGORY::from_ne_bytes(val.try_into()?), + )), + AttributeType::CertificateType => Ok(Attribute::CertificateType( + CK_CERTIFICATE_TYPE::from_ne_bytes(val.try_into()?), + )), + AttributeType::Class => Ok(Attribute::Class(CK_OBJECT_CLASS::from_ne_bytes( + val.try_into()?, + ))), + AttributeType::Coefficient => Ok(Attribute::Coefficient(val.to_vec())), + AttributeType::Decrypt => Ok(Attribute::Decrypt(try_u8_into_bool(val)?)), + AttributeType::EcParams => Ok(Attribute::EcParams(val.to_vec())), + AttributeType::EcPoint => Ok(Attribute::EcPoint(val.to_vec())), + AttributeType::Encrypt => Ok(Attribute::Encrypt(try_u8_into_bool(val)?)), + AttributeType::Exponent1 => Ok(Attribute::Exponent1(val.to_vec())), + AttributeType::Exponent2 => Ok(Attribute::Exponent2(val.to_vec())), + AttributeType::Extractable => Ok(Attribute::Extractable(try_u8_into_bool(val)?)), + AttributeType::Id => Ok(Attribute::Id(val.to_vec())), + AttributeType::Issuer => Ok(Attribute::Issuer(val.to_vec())), + AttributeType::KeyType => Ok(Attribute::KeyType(CK_KEY_TYPE::from_ne_bytes( + val.try_into()?, + ))), + AttributeType::Label => Ok(Attribute::Label(String::from_utf8(val.to_vec())?)), + AttributeType::Modulus => Ok(Attribute::Modulus(val.to_vec())), + AttributeType::ModulusBits => Ok(Attribute::ModulusBits(CK_ULONG::from_ne_bytes( + val.try_into()?, + ))), + AttributeType::NeverExtractable => { + Ok(Attribute::NeverExtractable(try_u8_into_bool(val)?)) + } + AttributeType::Prime1 => Ok(Attribute::Prime1(val.to_vec())), + AttributeType::Prime2 => Ok(Attribute::Prime2(val.to_vec())), + AttributeType::Private => Ok(Attribute::Private(try_u8_into_bool(val)?)), + AttributeType::PrivateExponent => Ok(Attribute::PrivateExponent(val.to_vec())), + AttributeType::ProfileId => Ok(Attribute::ProfileId(CK_ULONG::from_ne_bytes( + val.try_into()?, + ))), + AttributeType::PublicExponent => Ok(Attribute::PublicExponent(val.to_vec())), + AttributeType::Sensitive => Ok(Attribute::Sensitive(try_u8_into_bool(val)?)), + AttributeType::SerialNumber => Ok(Attribute::SerialNumber(val.to_vec())), + AttributeType::Subject => Ok(Attribute::Subject(val.to_vec())), + AttributeType::Sign => Ok(Attribute::Sign(try_u8_into_bool(val)?)), + AttributeType::SignRecover => Ok(Attribute::SignRecover(try_u8_into_bool(val)?)), + AttributeType::Token => Ok(Attribute::Token(try_u8_into_bool(val)?)), + AttributeType::Trusted => Ok(Attribute::Trusted(try_u8_into_bool(val)?)), + AttributeType::Unwrap => Ok(Attribute::Unwrap(try_u8_into_bool(val)?)), + AttributeType::Value => Ok(Attribute::Value(val.to_vec())), + AttributeType::ValueLen => Ok(Attribute::ValueLen(CK_ULONG::from_ne_bytes( + val.try_into()?, + ))), + AttributeType::Verify => Ok(Attribute::Verify(try_u8_into_bool(val)?)), + AttributeType::VerifyRecover => Ok(Attribute::VerifyRecover(try_u8_into_bool(val)?)), + AttributeType::Wrap => Ok(Attribute::Wrap(try_u8_into_bool(val)?)), + } + } +} + +// Borrowed from: +// https://github.com/parallaxsecond/rust-cryptoki/blob/89055f2a30e30d07a99e5904e9231d743c75d8e5/cryptoki/src/object.rs#L769 +fn try_u8_into_bool(slice: &[u8]) -> Result { + let as_array: [u8; std::mem::size_of::()] = slice.try_into()?; + let as_byte = CK_BBOOL::from_ne_bytes(as_array); + Ok(!matches!(as_byte, 0u8)) +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Attributes(BTreeSet); + +impl Attributes { + pub fn get(&self, type_: AttributeType) -> Option<&Attribute> { + self.0.iter().find(|&attr| attr.attribute_type() == type_) + } + + pub fn len(&self) -> usize { + self.0.len() + } + + pub fn is_empty(&self) -> bool { + self.0.is_empty() + } +} + +impl<'a> IntoIterator for &'a Attributes { + type Item = &'a Attribute; + type IntoIter = std::collections::btree_set::Iter<'a, Attribute>; + + fn into_iter(self) -> Self::IntoIter { + self.0.iter() + } +} + +impl From> for Attributes { + fn from(value: Vec) -> Self { + Attributes(BTreeSet::from_iter(value)) + } +} diff --git a/native-pkcs11-core/src/lib.rs b/native-pkcs11-core/src/lib.rs new file mode 100644 index 0000000..b0ac852 --- /dev/null +++ b/native-pkcs11-core/src/lib.rs @@ -0,0 +1,141 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use attribute::AttributeType; +use pkcs11_sys::*; +use thiserror::Error; + +pub mod attribute; +pub mod mechanism; +pub mod object; + +pub type Result = std::result::Result; + +#[derive(Error, Debug)] +pub enum Error { + // Cryptoki errors. + #[error("arguments bad")] + ArgumentsBad, + + #[error("{0} is not a valid attribute type")] + AttributeTypeInvalid(CK_ATTRIBUTE_TYPE), + + #[error("the value for attribute {0} is invalid")] + AttributeValueInvalid(AttributeType), + + #[error("buffer too small")] + BufferTooSmall, + + #[error("cryptoki module has already been initialized")] + CryptokiAlreadyInitialized, + + #[error("cryptoki module has not been initialized")] + CryptokiNotInitialized, + + #[error("function not parallel")] + FunctionNotParallel, + + #[error("function not supported")] + FunctionNotSupported, + + #[error("key handle {0} is invalid")] + KeyHandleInvalid(CK_OBJECT_HANDLE), + + #[error("module cannot function without being able to spawn threads")] + NeedToCreateThreads, + + #[error("{0} is not a valid mechanism")] + MechanismInvalid(CK_MECHANISM_TYPE), + + #[error("object {0} is invalid")] + ObjectHandleInvalid(CK_OBJECT_HANDLE), + + #[error("operation has not been initialized")] + OperationNotInitialized, + + #[error("no random number generator")] + RandomNoRng, + + #[error("session handle {0} is invalid")] + SessionHandleInvalid(CK_SESSION_HANDLE), + + #[error("token does not support parallel sessions")] + SessionParallelNotSupported, + + #[error("slot id {0} is invalid")] + SlotIdInvalid(CK_SLOT_ID), + + #[error("token is write protected")] + TokenWriteProtected, + + // Other errors. + #[error("{0}")] + FromUtf8(#[from] std::string::FromUtf8Error), + + #[error("{0}")] + FromVecWithNul(#[from] std::ffi::FromVecWithNulError), + + #[error("null pointer error")] + NullPtr, + + #[error("{0}")] + Pkcs11Piv(#[from] native_pkcs11_piv::Error), + + #[error("{0}")] + TryFromInt(#[from] std::num::TryFromIntError), + + #[error("{0}")] + TryFromSlice(#[from] std::array::TryFromSliceError), + + // Catch-all for backend-related errors. + #[error("{0}")] + Backend(#[from] Box), + + #[error("{0}")] + Todo(String), +} + +impl From for CK_RV { + fn from(e: Error) -> Self { + match e { + Error::ArgumentsBad => CKR_ARGUMENTS_BAD, + Error::AttributeTypeInvalid(_) => CKR_ATTRIBUTE_TYPE_INVALID, + Error::AttributeValueInvalid(_) => CKR_ATTRIBUTE_VALUE_INVALID, + Error::BufferTooSmall => CKR_BUFFER_TOO_SMALL, + Error::CryptokiAlreadyInitialized => CKR_CRYPTOKI_ALREADY_INITIALIZED, + Error::CryptokiNotInitialized => CKR_CRYPTOKI_NOT_INITIALIZED, + Error::FunctionNotParallel => CKR_FUNCTION_NOT_PARALLEL, + Error::FunctionNotSupported => CKR_FUNCTION_NOT_SUPPORTED, + Error::KeyHandleInvalid(_) => CKR_KEY_HANDLE_INVALID, + Error::MechanismInvalid(_) => CKR_MECHANISM_INVALID, + Error::NeedToCreateThreads => CKR_NEED_TO_CREATE_THREADS, + Error::ObjectHandleInvalid(_) => CKR_OBJECT_HANDLE_INVALID, + Error::OperationNotInitialized => CKR_OPERATION_NOT_INITIALIZED, + Error::RandomNoRng => CKR_RANDOM_NO_RNG, + Error::SessionHandleInvalid(_) => CKR_SESSION_HANDLE_INVALID, + Error::SessionParallelNotSupported => CKR_SESSION_PARALLEL_NOT_SUPPORTED, + Error::SlotIdInvalid(_) => CKR_SLOT_ID_INVALID, + Error::TokenWriteProtected => CKR_TOKEN_WRITE_PROTECTED, + + Error::Backend(_) + | Error::FromUtf8(_) + | Error::FromVecWithNul(_) + | Error::NullPtr + | Error::Todo(_) + | Error::TryFromInt(_) + | Error::TryFromSlice(_) => CKR_GENERAL_ERROR, + Error::Pkcs11Piv(_) => CKR_GENERAL_ERROR, + } + } +} diff --git a/native-pkcs11-core/src/mechanism.rs b/native-pkcs11-core/src/mechanism.rs new file mode 100644 index 0000000..a69828b --- /dev/null +++ b/native-pkcs11-core/src/mechanism.rs @@ -0,0 +1,147 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use native_pkcs11_traits::{DigestType, SignatureAlgorithm}; +use pkcs11_sys::*; + +use crate::Error; + +pub const SUPPORTED_SIGNATURE_MECHANISMS: &[CK_MECHANISM_TYPE] = &[ + CKM_RSA_PKCS, + CKM_SHA1_RSA_PKCS, + CKM_SHA256_RSA_PKCS, + CKM_SHA384_RSA_PKCS, + CKM_SHA512_RSA_PKCS, + CKM_ECDSA, + CKM_RSA_PKCS_PSS, +]; + +pub enum Mechanism { + Ecdsa, + RsaPkcs, + RsaPkcsSha1, + RsaPkcsSha256, + RsaPkcsSha384, + RsaPkcsSha512, + RsaPss { + digest_algorithm: native_pkcs11_traits::DigestType, + mask_generation_function: native_pkcs11_traits::DigestType, + salt_length: u64, + }, +} + +#[allow(clippy::missing_safety_doc)] +pub unsafe fn parse_mechanism(mechanism: CK_MECHANISM) -> Result { + match mechanism.mechanism { + CKM_ECDSA => Ok(Mechanism::Ecdsa), + CKM_RSA_PKCS => Ok(Mechanism::RsaPkcs), + CKM_SHA1_RSA_PKCS => Ok(Mechanism::RsaPkcsSha1), + CKM_SHA256_RSA_PKCS => Ok(Mechanism::RsaPkcsSha256), + CKM_SHA384_RSA_PKCS => Ok(Mechanism::RsaPkcsSha384), + CKM_SHA512_RSA_PKCS => Ok(Mechanism::RsaPkcsSha512), + CKM_RSA_PKCS_PSS => { + // Bind to locals to prevent unaligned reads https://github.com/rust-lang/rust/issues/82523 + let mechanism_type = mechanism.mechanism; + let parameter_ptr = mechanism.pParameter; + let parameter_len = mechanism.ulParameterLen; + if parameter_ptr.is_null() { + tracing::error!("pParameter null"); + return Err(Error::MechanismInvalid(mechanism_type)); + } + if (parameter_len as usize) != std::mem::size_of::() { + tracing::error!( + "pParameter incorrect: {} != {}", + parameter_len, + std::mem::size_of::() + ); + return Err(Error::MechanismInvalid(mechanism_type)); + } + // TODO(kcking): check alignment as well? + let params: CK_RSA_PKCS_PSS_PARAMS = + unsafe { (parameter_ptr as *mut CK_RSA_PKCS_PSS_PARAMS).read() }; + let mgf = params.mgf; + let hash_alg = params.hashAlg; + let salt_len = params.sLen; + + let mgf = match mgf { + CKG_MGF1_SHA1 => DigestType::Sha1, + CKG_MGF1_SHA224 => DigestType::Sha224, + CKG_MGF1_SHA256 => DigestType::Sha256, + CKG_MGF1_SHA384 => DigestType::Sha384, + CKG_MGF1_SHA512 => DigestType::Sha512, + _ => { + tracing::error!("Unsupported mgf: {}", mgf); + return Err(Error::MechanismInvalid(mechanism_type)); + } + }; + + let hash_alg = match hash_alg { + CKM_SHA_1 => DigestType::Sha1, + CKM_SHA224 => DigestType::Sha224, + CKM_SHA256 => DigestType::Sha256, + CKM_SHA384 => DigestType::Sha384, + CKM_SHA512 => DigestType::Sha512, + _ => { + tracing::error!("Unsupported hashAlg: {}", hash_alg); + return Err(Error::MechanismInvalid(mechanism_type)); + } + }; + + #[allow(clippy::unnecessary_cast)] + Ok(Mechanism::RsaPss { + digest_algorithm: hash_alg, + mask_generation_function: mgf, + // Cast needed on windows + salt_length: salt_len as u64, + }) + } + _ => Err(Error::MechanismInvalid(mechanism.mechanism)), + } +} + +impl From for CK_MECHANISM_TYPE { + fn from(mechanism: Mechanism) -> Self { + match mechanism { + Mechanism::Ecdsa => CKM_ECDSA, + Mechanism::RsaPkcs => CKM_RSA_PKCS, + Mechanism::RsaPkcsSha1 => CKM_SHA1_RSA_PKCS, + Mechanism::RsaPkcsSha256 => CKM_SHA256_RSA_PKCS, + Mechanism::RsaPkcsSha384 => CKM_SHA384_RSA_PKCS, + Mechanism::RsaPkcsSha512 => CKM_SHA512_RSA_PKCS, + Mechanism::RsaPss { .. } => CKM_RSA_PKCS_PSS, + } + } +} + +impl From for SignatureAlgorithm { + fn from(mechanism: Mechanism) -> Self { + match mechanism { + Mechanism::Ecdsa => SignatureAlgorithm::Ecdsa, + Mechanism::RsaPkcs => SignatureAlgorithm::RsaPkcs1v15Raw, + Mechanism::RsaPkcsSha1 => SignatureAlgorithm::RsaPkcs1v15Sha1, + Mechanism::RsaPkcsSha256 => SignatureAlgorithm::RsaPkcs1v15Sha256, + Mechanism::RsaPkcsSha384 => SignatureAlgorithm::RsaPkcs1v15Sha384, + Mechanism::RsaPkcsSha512 => SignatureAlgorithm::RsaPkcs1v15Sha512, + Mechanism::RsaPss { + digest_algorithm, + mask_generation_function, + salt_length, + } => SignatureAlgorithm::RsaPss { + digest: digest_algorithm, + mask_generation_function, + salt_length, + }, + } + } +} diff --git a/native-pkcs11-core/src/object.rs b/native-pkcs11-core/src/object.rs new file mode 100644 index 0000000..77c977e --- /dev/null +++ b/native-pkcs11-core/src/object.rs @@ -0,0 +1,214 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::{ffi::CString, fmt::Debug, sync::Arc}; + +use native_pkcs11_traits::{ + backend, + Certificate, + CertificateExt, + KeyAlgorithm, + PrivateKey, + PublicKey, +}; +use p256::pkcs8::{ + der::{asn1::OctetString, Encode}, + AssociatedOid, +}; +use pkcs1::{der::Decode, RsaPublicKey}; +use pkcs11_sys::{ + CKC_X_509, + CKK_EC, + CKK_RSA, + CKO_CERTIFICATE, + CKO_PRIVATE_KEY, + CKO_PROFILE, + CKO_PUBLIC_KEY, + CK_CERTIFICATE_CATEGORY_UNSPECIFIED, + CK_PROFILE_ID, +}; +use tracing::debug; + +use crate::attribute::{Attribute, AttributeType, Attributes}; + +#[derive(Debug)] +pub struct DataObject { + pub application: CString, + pub label: String, + pub value: Vec, +} + +// Usage of generics is a workaround for the following issue: +// https://github.com/rust-lang/rust/issues/78808#issuecomment-1664416547 +#[derive(Debug, PartialEq, Hash, Eq)] +pub enum Object< + DynCertificate: ?Sized + PartialEq = dyn Certificate, + DynPrivateKey: ?Sized + PartialEq = dyn PrivateKey, + DynPublicKey: ?Sized + PartialEq = dyn PublicKey, +> { + Certificate(Arc), + PrivateKey(Arc), + Profile(CK_PROFILE_ID), + PublicKey(Arc), +} + +impl Clone for Object { + fn clone(&self) -> Self { + match self { + Object::Certificate(cert) => Object::Certificate(cert.clone()), + Object::PrivateKey(private_key) => Object::PrivateKey(private_key.clone()), + Object::Profile(id) => Object::Profile(*id), + Object::PublicKey(public_key) => Object::PublicKey(public_key.clone()), + } + } +} + +impl Object { + pub fn attribute(&self, type_: AttributeType) -> Option { + match self { + Object::Certificate(cert) => match type_ { + AttributeType::CertificateCategory => Some(Attribute::CertificateCategory( + CK_CERTIFICATE_CATEGORY_UNSPECIFIED, + )), + AttributeType::CertificateType => Some(Attribute::CertificateType(CKC_X_509)), + AttributeType::Class => Some(Attribute::Class(CKO_CERTIFICATE)), + AttributeType::Id => Some(Attribute::Id(cert.public_key().public_key_hash())), + AttributeType::Issuer => Some(Attribute::Issuer(cert.issuer())), + AttributeType::Label => Some(Attribute::Label(cert.label())), + AttributeType::Token => Some(Attribute::Token(true)), + AttributeType::Trusted => Some(Attribute::Trusted(false)), + AttributeType::SerialNumber => Some(Attribute::SerialNumber(cert.serial_number())), + AttributeType::Subject => Some(Attribute::Subject(cert.subject())), + AttributeType::Value => Some(Attribute::Value(cert.to_der())), + _ => { + debug!("certificate: type_ unimplemented: {:?}", type_); + None + } + }, + Object::PrivateKey(private_key) => match type_ { + AttributeType::AlwaysSensitive => Some(Attribute::AlwaysSensitive(true)), + AttributeType::AlwaysAuthenticate => Some(Attribute::AlwaysAuthenticate(false)), + AttributeType::Class => Some(Attribute::Class(CKO_PRIVATE_KEY)), + AttributeType::Decrypt => Some(Attribute::Decrypt(false)), + AttributeType::EcParams => { + Some(Attribute::EcParams(p256::NistP256::OID.to_der().ok()?)) + } + AttributeType::Extractable => Some(Attribute::Extractable(false)), + AttributeType::Id => Some(Attribute::Id(private_key.public_key_hash())), + AttributeType::KeyType => Some(Attribute::KeyType(match private_key.algorithm() { + native_pkcs11_traits::KeyAlgorithm::Rsa => CKK_RSA, + native_pkcs11_traits::KeyAlgorithm::Ecc => CKK_EC, + })), + AttributeType::Label => Some(Attribute::Label(private_key.label())), + AttributeType::Modulus => { + let modulus = private_key + .find_public_key(backend()) + .ok() + .flatten() + .and_then(|public_key| { + let der = public_key.to_der(); + RsaPublicKey::from_der(&der) + .map(|pk| pk.modulus.as_bytes().to_vec()) + .ok() + }); + modulus.map(Attribute::Modulus) + } + AttributeType::NeverExtractable => Some(Attribute::NeverExtractable(true)), + AttributeType::Private => Some(Attribute::Private(true)), + AttributeType::PublicExponent => { + let public_exponent = private_key + .find_public_key(backend()) + .ok() + .flatten() + .and_then(|public_key| { + let der = public_key.to_der(); + RsaPublicKey::from_der(&der) + .map(|pk| pk.public_exponent.as_bytes().to_vec()) + .ok() + }); + public_exponent.map(Attribute::PublicExponent) + } + AttributeType::Sensitive => Some(Attribute::Sensitive(true)), + AttributeType::Sign => Some(Attribute::Sign(true)), + AttributeType::SignRecover => Some(Attribute::SignRecover(false)), + AttributeType::Token => Some(Attribute::Token(true)), + AttributeType::Unwrap => Some(Attribute::Unwrap(false)), + _ => { + debug!("private_key: type_ unimplemented: {:?}", type_); + None + } + }, + Object::Profile(id) => match type_ { + AttributeType::Class => Some(Attribute::Class(CKO_PROFILE)), + AttributeType::ProfileId => Some(Attribute::ProfileId(*id)), + AttributeType::Token => Some(Attribute::Token(true)), + _ => { + debug!("profile: type_ unimplemented: {:?}", type_); + None + } + }, + Object::PublicKey(pk) => match type_ { + AttributeType::Class => Some(Attribute::Class(CKO_PUBLIC_KEY)), + AttributeType::Label => Some(Attribute::Label(pk.label())), + AttributeType::Modulus => { + let key = pk.to_der(); + let key = RsaPublicKey::from_der(&key).unwrap(); + Some(Attribute::Modulus(key.modulus.as_bytes().to_vec())) + } + AttributeType::PublicExponent => { + let key = pk.to_der(); + let key = RsaPublicKey::from_der(&key).unwrap(); + Some(Attribute::Modulus(key.public_exponent.as_bytes().to_vec())) + } + AttributeType::KeyType => Some(Attribute::KeyType(match pk.algorithm() { + native_pkcs11_traits::KeyAlgorithm::Rsa => CKK_RSA, + native_pkcs11_traits::KeyAlgorithm::Ecc => CKK_EC, + })), + AttributeType::Id => Some(Attribute::Id(pk.public_key_hash())), + AttributeType::EcPoint => { + if pk.algorithm() != KeyAlgorithm::Ecc { + return None; + } + let wrapped = OctetString::new(pk.to_der()).ok()?; + Some(Attribute::EcPoint(wrapped.to_der().ok()?)) + } + AttributeType::EcParams => { + Some(Attribute::EcParams(p256::NistP256::OID.to_der().ok()?)) + } + _ => { + debug!("public_key: type_ unimplemented: {:?}", type_); + None + } + }, + } + } + + pub fn matches(&self, others: &Attributes) -> bool { + if let Some(class) = others.get(AttributeType::Class) { + if *class != self.attribute(AttributeType::Class).unwrap() { + return false; + } + } + for other in others { + if let Some(attr) = self.attribute(other.attribute_type()) { + if *other != attr { + return false; + } + } else { + return false; + } + } + true + } +} diff --git a/native-pkcs11-piv/Cargo.toml b/native-pkcs11-piv/Cargo.toml new file mode 100644 index 0000000..4b2ff37 --- /dev/null +++ b/native-pkcs11-piv/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "native-pkcs11-piv" +version = "0.2.18" +description = "native-pkcs11 backend for macos keychain." +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +repository.workspace = true +license.workspace = true + +[dependencies] +native-pkcs11-traits = { version = "0.2.0", path = "../native-pkcs11-traits" } +p256 = { version = "0.13.2", default-features = false, features = [ + "arithmetic", + "pkcs8", + "std", +] } +rand = "0.8.5" +rsa = { version = "0.9.6", default-features = false, features = ["std"] } +# TODO: temporary workaround for RustCrypto/traits#1262, remove after upgrading +# the p256 package past 0.13.0. +spki = { version = "0.7.3", features = ["std"] } +thiserror = "1.0.61" +tracing = "0.1.40" +tracing-error = { version = "0.2.0", default-features = false } +x509-cert = { version = "0.2.5", default-features = false } +yubikey = { version = "0.8.0", features = ["untested"] } + +[dev-dependencies] +serial_test = { version = "3.1.1", default-features = false } + +[target.'cfg(target_os="macos")'.dependencies] +core-foundation = { version = "0.9.4", features = ["mac_os_10_8_features"] } +security-framework = { version = "2.11.0", features = ["OSX_10_15"] } +security-framework-sys = { version = "2.11.0", features = ["OSX_10_15"] } diff --git a/native-pkcs11-piv/LICENSE b/native-pkcs11-piv/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/native-pkcs11-piv/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "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. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "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. + + "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). + + "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. + + "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." + + "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. + + 2. Grant of Copyright License. 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. + + 3. Grant of Patent License. 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. + + 4. Redistribution. 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (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 + + (d) If the Work includes a "NOTICE" 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. + + 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. + + 5. Submission of Contributions. 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. + + 6. Trademarks. 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. + + 7. Disclaimer of Warranty. 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. + + 8. Limitation of Liability. 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. + + 9. Accepting Warranty or Additional Liability. 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. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + 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. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/native-pkcs11-piv/src/lib.rs b/native-pkcs11-piv/src/lib.rs new file mode 100644 index 0000000..aaa40c5 --- /dev/null +++ b/native-pkcs11-piv/src/lib.rs @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// Workaround for platform-specific crates in workspace root. +/// https://github.com/rust-lang/cargo/issues/5220 +mod piv; + +pub use piv::*; diff --git a/native-pkcs11-piv/src/piv/backend.rs b/native-pkcs11-piv/src/piv/backend.rs new file mode 100644 index 0000000..6d29049 --- /dev/null +++ b/native-pkcs11-piv/src/piv/backend.rs @@ -0,0 +1,189 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::{collections::HashMap, sync::Arc}; + +use core_foundation::{ + base::{TCFType, ToVoid}, + string::CFString, +}; +use native_pkcs11_traits::Backend; +use security_framework::{item::KeyClass, key::SecKey}; +use security_framework_sys::item::kSecAttrLabel; +use tracing::instrument; + +use crate::{ + certificate::{find_all_certificates, YubikeyPivCertificate}, + key::{ + find_all_keys, + find_key, + find_key2, + generate_key, + Algorithm, + YubikeyPivPrivateKey, + YubikeyPivPublicKey, + }, + keychain, +}; + +#[derive(Debug, Default)] +pub struct YubikeyPivBackend; + +impl YubikeyPivBackend { + pub fn new() -> Self { + Self + } +} + +impl Backend for YubikeyPivBackend { + fn name(&self) -> String { + "Keychain".into() + } + + #[instrument] + fn find_all_certificates( + &self, + ) -> native_pkcs11_traits::Result>> { + let certs = find_all_certificates()? + .into_iter() + .map(YubikeyPivCertificate::new) + .filter_map(Result::ok) + .map(|cert| Box::new(cert) as _) + .collect(); + Ok(certs) + } + + #[instrument] + fn find_private_key( + &self, + query: native_pkcs11_traits::KeySearchOptions, + ) -> native_pkcs11_traits::Result>> { + let mut pubkeys_by_pubkey_hash: HashMap, SecKey> = + HashMap::from_iter(find_all_certificates()?.into_iter().filter_map(|c| { + c.certificate() + .ok() + .and_then(|cert| cert.public_key().ok()) + .and_then(|pk| pk.application_label().map(|pubkey_hash| (pubkey_hash, pk))) + })); + + let mut find_pubkey_for_seckey = |sec_key: &SecKey| -> Option { + sec_key + .application_label() + .and_then(|pubkey_hash| pubkeys_by_pubkey_hash.remove(&pubkey_hash)) + // TODO(kcking): populate label if searching by label + .and_then(|sec_key| YubikeyPivPublicKey::new(sec_key, "").ok()) + }; + let opt_key = match query { + native_pkcs11_traits::KeySearchOptions::Label(label) => { + find_key(KeyClass::private(), &label) + .ok() + .map(|sec_key| { + let cert = find_pubkey_for_seckey(&sec_key); + YubikeyPivPrivateKey::new(sec_key, label, cert) + }) + .transpose()? + } + native_pkcs11_traits::KeySearchOptions::PublicKeyHash(public_key_hash) => { + find_key2(KeyClass::private(), &public_key_hash)? + .map(|sec_key| { + let cert = find_pubkey_for_seckey(&sec_key); + YubikeyPivPrivateKey::new(sec_key, "", cert) + }) + .transpose()? + } + }; + Ok(opt_key.map(|sec_key| Arc::new(sec_key) as _)) + } + + #[instrument] + fn find_public_key( + &self, + query: native_pkcs11_traits::KeySearchOptions, + ) -> native_pkcs11_traits::Result>> { + let opt_key = match query { + native_pkcs11_traits::KeySearchOptions::Label(label) => { + find_key(KeyClass::public(), &label) + .ok() + .map(|sec_key| YubikeyPivPublicKey::new(sec_key, label)) + .transpose()? + } + native_pkcs11_traits::KeySearchOptions::PublicKeyHash(public_key_hash) => { + find_key2(KeyClass::public(), &public_key_hash)? + .map(|sec_key| YubikeyPivPublicKey::new(sec_key, "")) + .transpose()? + } + }; + Ok(opt_key.map(|sec_key| Box::new(sec_key) as _)) + } + + #[instrument] + fn generate_key( + &self, + algorithm: native_pkcs11_traits::KeyAlgorithm, + label: Option<&str>, + ) -> native_pkcs11_traits::Result> { + let alg = match algorithm { + native_pkcs11_traits::KeyAlgorithm::Rsa => Algorithm::RSA, + native_pkcs11_traits::KeyAlgorithm::Ecc => Algorithm::ECC, + }; + let label = label.unwrap_or(""); + Ok(generate_key(alg, label, Some(keychain::location()?)) + .map(|key| YubikeyPivPrivateKey::new(key, label, None).map(Arc::new))??) + } + + fn find_all_private_keys( + &self, + ) -> native_pkcs11_traits::Result>> { + let sec_keys = find_all_keys(KeyClass::private())?; + let keys = sec_keys + .into_iter() + .filter_map(|sec_key| { + let label: Option = sec_key + .attributes() + .find(unsafe { kSecAttrLabel }.to_void()) + .map(|label| { + unsafe { CFString::wrap_under_get_rule(label.cast()) }.to_string() + }); + let label: String = label.unwrap_or_default(); + + YubikeyPivPrivateKey::new(sec_key, label, None).ok() + }) + .map(|k| Arc::new(k) as _); + + Ok(keys.collect()) + } + + fn find_all_public_keys( + &self, + ) -> native_pkcs11_traits::Result>> { + let sec_keys = find_all_keys(KeyClass::public())?; + + let keys = sec_keys + .into_iter() + .filter_map(|sec_key| { + let label: Option = sec_key + .attributes() + .find(unsafe { kSecAttrLabel }.to_void()) + .map(|label| { + unsafe { CFString::wrap_under_get_rule(label.cast()) }.to_string() + }); + let label: String = label.unwrap_or_default(); + + YubikeyPivPublicKey::new(sec_key, label).ok() + }) + .map(|k| Arc::new(k) as _); + + Ok(keys.collect()) + } +} diff --git a/native-pkcs11-piv/src/piv/certificate.rs b/native-pkcs11-piv/src/piv/certificate.rs new file mode 100644 index 0000000..94848c3 --- /dev/null +++ b/native-pkcs11-piv/src/piv/certificate.rs @@ -0,0 +1,412 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::{ + str::FromStr, + time::{Duration, SystemTime}, +}; + +use native_pkcs11_traits::random_label; +use rsa::{pkcs1::DecodeRsaPublicKey, pkcs8::AssociatedOid}; +use security_framework::{ + certificate::SecCertificate, + identity::SecIdentity, + item::{add_item, AddRef, ItemAddOptions, ItemClass, Reference}, + key::SecKey, + os::macos::identity::SecIdentityExt, +}; +use security_framework_sys::base::errSecItemNotFound; +use x509_cert::{ + der::{ + asn1::{GeneralizedTime, Ia5String, OctetString}, + oid::ObjectIdentifier, + Decode, + Encode, + }, + ext::{ + pkix::{ + name::GeneralName, + AuthorityKeyIdentifier, + BasicConstraints, + ExtendedKeyUsage, + KeyUsage, + KeyUsages, + SubjectAltName, + SubjectKeyIdentifier, + }, + Extension, + }, + name::{Name, RdnSequence}, + serial_number::SerialNumber, + spki::{der::asn1::BitString, EncodePublicKey, SubjectPublicKeyInfo}, + time::Validity, + Certificate, + TbsCertificate, +}; + +use crate::{ + key::{Algorithm, YubikeyPivPublicKey}, + keychain, + Result, +}; + +pub struct YubikeyPivCertificate { + pub label: String, + pub identity: SecIdentity, + pub public_key: YubikeyPivPublicKey, + certificate_der: Vec, +} + +impl YubikeyPivCertificate { + pub fn new(identity: impl Into) -> Result { + let identity: SecIdentity = identity.into(); + let label = identity.certificate().unwrap().subject_summary(); + let pk = identity.certificate()?.public_key()?; + Ok(Self { + certificate_der: identity.certificate()?.to_der(), + label: label.clone(), + identity, + public_key: YubikeyPivPublicKey::new(pk, label)?, + }) + } +} + +impl std::fmt::Debug for YubikeyPivCertificate { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("KeychainCertificate") + .field("label", &self.label) + .field("identity", &self.identity) + .finish() + } +} + +impl native_pkcs11_traits::Certificate for YubikeyPivCertificate { + fn label(&self) -> String { + self.label.to_string() + } + + fn public_key(&self) -> &dyn native_pkcs11_traits::PublicKey { + &self.public_key + } + + fn to_der(&self) -> Vec { + self.certificate_der.clone() + } + + fn delete(self: Box) { + let _ = self.identity.delete(); + } +} + +pub fn import_certificate(der: &[u8]) -> Result { + let cert = SecCertificate::from_der(der)?; + + let add_params = ItemAddOptions::new(security_framework::item::ItemAddValue::Ref( + AddRef::Certificate(cert.clone()), + )) + .set_location(keychain::location()?) + .set_label(cert.subject_summary()) + .to_dictionary(); + add_item(add_params)?; + + Ok(cert) +} + +pub fn find_certificate(pub_key_hash: &[u8]) -> Result> { + let results = crate::piv::keychain::item_search_options()? + .load_refs(true) + .class(ItemClass::certificate()) + .pub_key_hash(pub_key_hash) + .search()?; + + if results.is_empty() { + return Ok(None); + } + + let cert = match results.into_iter().next().ok_or("certificate not found")? { + security_framework::item::SearchResult::Ref(Reference::Certificate(certificate)) => { + certificate + } + _ => return Err("no key ref")?, + }; + + Ok(Some(SecIdentity::with_certificate(&[], &cert)?)) +} + +pub fn find_all_certificates() -> Result> { + let results = crate::piv::keychain::item_search_options()? + .load_refs(true) + .class(ItemClass::identity()) + .limit(99) + .search(); + + if let Err(e) = results { + if e.code() == errSecItemNotFound { + return Ok(vec![]); + } + } + + let loaded_identites = results? + .into_iter() + .filter_map(|result| match result { + security_framework::item::SearchResult::Ref(Reference::Identity(identity)) => { + Some(identity) + } + _ => None, + }) + .collect(); + + Ok(loaded_identites) +} + +// NOTE(kcking): After some empirical tests, it appears SecIdentity is really +// just a SecCertificate that happens to have an associated SecKey private key +// in the keychain. Both `SecItemAdd` and `SecItemDelete` treat a SecIdentity +// like it is the underlying SecCertificate. Further reading: +// https://stackoverflow.com/a/13041370. +// +// For example, if we import a SecCertificate, then convert it to a SecIdentity +// with SecIdentity::with_certificate, trying to import the resulting +// SecIdentity will error with "already exists". Keychain is treating this +// scenario as trying to import the same certificate twice. +// +// An official Apple source also _hints_ at this behavior by saying "working +// with identities as keychain items is very much like working with +// certificates" +// https://developer.apple.com/documentation/security/certificate_key_and_trust_services/identities/storing_an_identity_in_the_keychain?language=objc. +// +// Overall, this means storing SecIdentities isn't any more useful to us than +// storing SecCertificates. The main use case is using +// `SecIdentity::with_certificate` to search for the private key corresponding +// to a certificate. +pub fn import_identity(certificate: &SecCertificate) -> Result { + let keychain = keychain::keychain_or_default()?; + let identity = SecIdentity::with_certificate(&[keychain], certificate)?; + + let add_params = ItemAddOptions::new(security_framework::item::ItemAddValue::Ref( + AddRef::Identity(identity.clone()), + )) + .set_location(keychain::location()?) + .set_label(certificate.subject_summary()) + .to_dictionary(); + + match add_item(add_params) { + Ok(_) => Ok(identity), + Err(e) + if e.message() == Some("The specified item already exists in the keychain.".into()) => + { + Ok(identity) + } + Err(e) => Err(e.into()), + } +} + +pub fn random_serial_number() -> [u8; 16] { + use rand::Rng; + rand::thread_rng().gen::().to_be_bytes() +} + +const EXTENDED_KEY_USAGE_SERVER_AUTHENTICATION: ObjectIdentifier = + ObjectIdentifier::new_unwrap("1.3.6.1.5.5.7.3.1"); +const EXTENDED_KEY_USAGE_CLIENT_AUTHENTICATION: ObjectIdentifier = + ObjectIdentifier::new_unwrap("1.3.6.1.5.5.7.3.2"); + +/// Demonstrate signing a certificate +pub fn self_signed_certificate(key_algorithm: Algorithm, private_key: &SecKey) -> Result> { + let public_key = private_key + .public_key() + .ok_or("no public key")? + .external_representation() + .ok_or("no external representation")? + .to_vec(); + + let public_key = match key_algorithm { + Algorithm::RSA => rsa::RsaPublicKey::from_pkcs1_der(&public_key)? + .to_public_key_der()? + .as_bytes() + .to_owned(), + Algorithm::ECC => p256::PublicKey::from_sec1_bytes(public_key.as_slice())? + .to_public_key_der()? + .as_bytes() + .to_owned(), + }; + + let spki = SubjectPublicKeyInfo::try_from(public_key.as_slice())?; + + let subject_name = + RdnSequence::from_str(&format!("cn=Test Cert {}", random_label()))?.to_der()?; + let issuer_name = RdnSequence::from_str("cn=GShoe LLC")?.to_der()?; + + let serial_number = random_serial_number(); + + let san = GeneralName::DnsName(Ia5String::new("localhost")?); + let san = SubjectAltName(vec![san]).to_der()?; + + let key_usage = KeyUsage( + KeyUsages::DigitalSignature | KeyUsages::KeyEncipherment | KeyUsages::KeyAgreement, + ) + .to_der()?; + + let extended_key_usage = ExtendedKeyUsage(vec![ + EXTENDED_KEY_USAGE_CLIENT_AUTHENTICATION, + EXTENDED_KEY_USAGE_SERVER_AUTHENTICATION, + ]) + .to_der()?; + + let basic_constraints = BasicConstraints { + ca: false, + path_len_constraint: None, + } + .to_der()?; + + let sk_and_ak_id = random_serial_number(); + let sk_id = SubjectKeyIdentifier(OctetString::new(sk_and_ak_id)?).to_der()?; + let ak_id = AuthorityKeyIdentifier { + key_identifier: Some(OctetString::new(sk_and_ak_id)?), + authority_cert_issuer: None, + authority_cert_serial_number: None, + } + .to_der()?; + + let tbs_certificate = TbsCertificate { + version: x509_cert::Version::V3, + // NOTE: can't be empty + serial_number: SerialNumber::new(&serial_number)?, + signature: spki.algorithm.clone(), + issuer: Name::from_der(&issuer_name)?, + validity: Validity { + not_before: x509_cert::time::Time::GeneralTime(GeneralizedTime::from_system_time( + SystemTime::now() - Duration::from_secs(60 * 60 * 24), + )?), + not_after: x509_cert::time::Time::GeneralTime(GeneralizedTime::from_system_time( + SystemTime::now() + Duration::from_secs(60 * 60 * 24), + )?), + }, + subject: Name::from_der(&subject_name)?, + subject_public_key_info: spki.clone(), + + // webpki appears to not support these fields: + // https://github.com/briansmith/webpki/blob/17d9189981a618120fd8217a913828e7418e2484/src/cert.rs#L78 + issuer_unique_id: None, + subject_unique_id: None, + + extensions: Some(vec![ + Extension { + extn_id: BasicConstraints::OID, + critical: true, + extn_value: OctetString::new(basic_constraints)?, + }, + Extension { + extn_id: SubjectAltName::OID, + critical: false, + extn_value: OctetString::new(san)?, + }, + Extension { + extn_id: KeyUsage::OID, + critical: true, + extn_value: OctetString::new(key_usage)?, + }, + Extension { + extn_id: ExtendedKeyUsage::OID, + critical: false, + extn_value: OctetString::new(extended_key_usage)?, + }, + Extension { + extn_id: SubjectKeyIdentifier::OID, + critical: false, + extn_value: OctetString::new(sk_id)?, + }, + Extension { + extn_id: AuthorityKeyIdentifier::OID, + critical: false, + extn_value: OctetString::new(ak_id)?, + }, + ]), + }; + + let payload = tbs_certificate.to_der()?; + let signature = private_key.create_signature( + match key_algorithm { + Algorithm::RSA => security_framework_sys::key::Algorithm::RSASignatureMessagePSSSHA256, + Algorithm::ECC => { + security_framework_sys::key::Algorithm::ECDSASignatureMessageX962SHA256 + } + }, + &payload, + )?; + + let cert = Certificate { + tbs_certificate, + signature_algorithm: spki.algorithm, + signature: BitString::from_bytes(signature.as_slice())?, + }; + + Ok(cert.to_der()?) +} + +#[cfg(test)] +mod test { + use native_pkcs11_traits::random_label; + use serial_test::serial; + + use super::*; + #[test] + #[serial] + #[ignore = "https://github.com/google/native-pkcs11/issues/302"] + fn test_self_signed_certificate() -> Result<()> { + use security_framework::item::{ItemClass, Limit}; + + use crate::key::generate_key; + + let label = random_label(); + let key = generate_key(Algorithm::RSA, &label, Some(keychain::location()?))?; + + let cert = self_signed_certificate(Algorithm::RSA, &key)?; + + let cert = import_certificate(&cert)?; + + // NOTE(kcking): Importing a certificate that has a private key already + // stored in the keychain will treat that certificate as an identity, even + // without calling import_identity. + // let identity = import_identity(&cert)?; + + // HACK(kcking): The macOS keychain takes some time to flush all of the updates + // such that they are visible to the next search query. + std::thread::sleep(std::time::Duration::from_secs(1)); + + assert!( + crate::piv::keychain::item_search_options()? + .class(ItemClass::identity()) + .limit(Limit::All) + .load_refs(true) + .search()? + .iter() + .any(|result| match result { + security_framework::item::SearchResult::Ref( + security_framework::item::Reference::Identity(id), + ) => id.certificate().unwrap().subject() == cert.subject(), + _ => false, + }) + ); + + // Clean up + cert.delete()?; + // NOTE(kcking): Deleting the certificate also deletes the identity since + // they are the same underlying object, so identity.delete() is not needed. + // identity.delete()?; + key.public_key().ok_or("no public key")?.delete()?; + key.delete()?; + Ok(()) + } +} diff --git a/native-pkcs11-piv/src/piv/key.rs b/native-pkcs11-piv/src/piv/key.rs new file mode 100644 index 0000000..3efecf2 --- /dev/null +++ b/native-pkcs11-piv/src/piv/key.rs @@ -0,0 +1,565 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fmt::Debug; + +use core_foundation::base::ToVoid; +use native_pkcs11_traits::{KeyAlgorithm, PrivateKey, PublicKey, SignatureAlgorithm}; +use security_framework::{ + item::{ItemClass, KeyClass, Limit, Location, Reference}, + key::{GenerateKeyOptions, KeyType, SecKey}, +}; +// TODO(bweeks,kcking): remove dependency on security-framework-sys crate. +use security_framework_sys::item::{ + kSecAttrKeyType, + kSecAttrKeyTypeEC, + kSecAttrKeyTypeRSA, + kSecAttrTokenID, +}; +use tracing::instrument; + +use crate::Result; + +#[derive(Debug)] +pub enum Algorithm { + RSA, + ECC, +} + +fn sigalg_to_seckeyalg( + signature_algorithm: &SignatureAlgorithm, +) -> Result { + use security_framework_sys::key::Algorithm::*; + let alg = match signature_algorithm { + native_pkcs11_traits::SignatureAlgorithm::Ecdsa => ECDSASignatureRFC4754, + native_pkcs11_traits::SignatureAlgorithm::RsaRaw => RSASignatureRaw, + native_pkcs11_traits::SignatureAlgorithm::RsaPkcs1v15Raw => RSASignatureDigestPKCS1v15Raw, + native_pkcs11_traits::SignatureAlgorithm::RsaPkcs1v15Sha1 => { + RSASignatureMessagePKCS1v15SHA1 + } + native_pkcs11_traits::SignatureAlgorithm::RsaPkcs1v15Sha384 => { + RSASignatureMessagePKCS1v15SHA384 + } + native_pkcs11_traits::SignatureAlgorithm::RsaPkcs1v15Sha256 => { + RSASignatureMessagePKCS1v15SHA256 + } + native_pkcs11_traits::SignatureAlgorithm::RsaPkcs1v15Sha512 => { + RSASignatureMessagePKCS1v15SHA512 + } + native_pkcs11_traits::SignatureAlgorithm::RsaPss { + digest, + mask_generation_function, + salt_length, + } => { + // SecurityFramework only supports digest == mgf, salt_length == len(digest). + if digest != mask_generation_function || digest.digest_len() != *salt_length as usize { + return Err(crate::ErrorKind::UnsupportedSignatureAlgorithm( + signature_algorithm.clone(), + ) + .into()); + } + match mask_generation_function { + native_pkcs11_traits::DigestType::Sha1 => RSASignatureDigestPSSSHA1, + native_pkcs11_traits::DigestType::Sha224 => RSASignatureDigestPSSSHA224, + native_pkcs11_traits::DigestType::Sha256 => RSASignatureDigestPSSSHA256, + native_pkcs11_traits::DigestType::Sha384 => RSASignatureDigestPSSSHA384, + native_pkcs11_traits::DigestType::Sha512 => RSASignatureDigestPSSSHA512, + } + } + }; + Ok(alg) +} + +#[derive(Debug)] +pub struct YubikeyPivPrivateKey { + sec_key: SecKey, + label: String, + public_key_hash: Vec, + algorithm: KeyAlgorithm, + pub_key: Option, +} + +impl YubikeyPivPrivateKey { + #[instrument] + pub fn new( + sec_key: SecKey, + label: impl Into + Debug, + pub_key: Option, + ) -> Result { + let label = label.into(); + let public_key_hash = sec_key.application_label().ok_or("no application_label")?; + Ok(Self { + algorithm: sec_key_algorithm(&sec_key)?, + sec_key, + label, + public_key_hash, + pub_key, + }) + } +} + +impl PrivateKey for YubikeyPivPrivateKey { + #[instrument] + fn public_key_hash(&self) -> Vec { + self.public_key_hash.clone() + } + + #[instrument] + fn label(&self) -> String { + self.label.clone() + } + + #[instrument] + fn sign( + &self, + algorithm: &native_pkcs11_traits::SignatureAlgorithm, + data: &[u8], + ) -> native_pkcs11_traits::Result> { + let algorithm = sigalg_to_seckeyalg(algorithm)?; + Ok(self.sec_key.create_signature(algorithm, data.as_ref())?) + } + + #[instrument] + fn delete(&self) { + let _ = self.sec_key.delete(); + } + + #[instrument] + fn algorithm(&self) -> KeyAlgorithm { + self.algorithm + } + fn find_public_key( + &self, + _backend: &dyn native_pkcs11_traits::Backend, + ) -> native_pkcs11_traits::Result>> { + let sec_copy = self + .sec_key + .public_key() + .map(|sec_key| YubikeyPivPublicKey::new(sec_key, self.label())) + .transpose() + .ok() + .flatten() + .map(|key| Box::new(key) as _); + if sec_copy.is_some() { + return Ok(sec_copy); + } + Ok(self.pub_key.clone().map(|key| Box::new(key) as _)) + } +} + +fn sec_key_algorithm(sec_key: &SecKey) -> Result { + let attributes = sec_key.attributes(); + if attributes + .find(unsafe { kSecAttrTokenID }.to_void()) + .is_some() + { + // The only possible kSecAttrtokenID is kSecAttrTokenIDSecureEnclave. + // + // SecureEnclave keys do not have kSecAttrKeyType populated, but we can + // assume they are Ecc. + return Ok(KeyAlgorithm::Ecc); + } + let key_ty = sec_key + .attributes() + .find(unsafe { kSecAttrKeyType }.to_void()) + .and_then(|key_type| match *key_type as *const _ { + ty if ty == unsafe { kSecAttrKeyTypeRSA } => Some(KeyAlgorithm::Rsa), + ty if ty == unsafe { kSecAttrKeyTypeEC } => Some(KeyAlgorithm::Ecc), + _ => None, + }) + .ok_or("no key type")?; + Ok(key_ty) +} + +#[derive(Debug, Clone)] +pub struct YubikeyPivPublicKey { + pub sec_key: SecKey, + pub label: String, + der: Vec, + public_key_hash: Vec, + algorithm: KeyAlgorithm, +} + +impl YubikeyPivPublicKey { + #[instrument] + pub fn new(sec_key: SecKey, label: impl Into + Debug) -> Result { + let der = sec_key + .external_representation() + .ok_or("no external representation")?; + let key_ty = sec_key_algorithm(&sec_key)?; + Ok(Self { + public_key_hash: sec_key.application_label().ok_or("no application_label")?, + sec_key, + label: label.into(), + der: der.to_vec(), + algorithm: key_ty, + }) + } +} + +impl PublicKey for YubikeyPivPublicKey { + #[instrument] + fn public_key_hash(&self) -> Vec { + self.public_key_hash.clone() + } + + #[instrument] + fn label(&self) -> String { + self.label.clone() + } + + #[instrument] + fn to_der(&self) -> Vec { + self.der.clone() + } + + #[instrument] + fn verify( + &self, + algorithm: &native_pkcs11_traits::SignatureAlgorithm, + data: &[u8], + signature: &[u8], + ) -> native_pkcs11_traits::Result<()> { + let algorithm = sigalg_to_seckeyalg(algorithm)?; + let result = self.sec_key.verify_signature(algorithm, data, signature)?; + if !result { + return Err("verify failed")?; + } + Ok(()) + } + + fn delete(self: Box) { + let _ = self.sec_key.delete(); + } + + fn algorithm(&self) -> KeyAlgorithm { + self.algorithm + } +} + +#[instrument(skip(location))] +pub fn generate_key( + algorithm: Algorithm, + label: &str, + location: Option, +) -> Result { + let (ty, size) = match algorithm { + Algorithm::RSA => (KeyType::rsa(), 2048), + Algorithm::ECC => (KeyType::ec(), 256), + }; + + let opts = GenerateKeyOptions { + key_type: Some(ty), + size_in_bits: Some(size), + label: Some(label.into()), + token: Some(security_framework::key::Token::Software), + location, + access_control: None, + } + .to_dictionary(); + + Ok(SecKey::generate(opts).map_err(|e| e.to_string())?) +} + +pub fn find_key(class: KeyClass, label: &str) -> Result { + let results = crate::keychain::item_search_options()? + .load_refs(true) + .label(label) + .class(ItemClass::key()) + .key_class(class) + .limit(1) + .search(); + + let loaded_key = match results?.into_iter().next().ok_or("key not found")? { + security_framework::item::SearchResult::Ref(Reference::Key(key)) => key, + _ => return Err("no key ref")?, + }; + + Ok(loaded_key) +} + +#[instrument] +pub fn find_key2(class: KeyClass, label: &[u8]) -> Result> { + let results = crate::keychain::item_search_options()? + .load_refs(true) + .class(ItemClass::key()) + .key_class(class) + .application_label(label) + .limit(1) + .search(); + + let results = match results { + Err(e) if e.code() == -25300 => return Ok(None), + Err(e) => return Err(e)?, + Ok(results) => results, + }; + + let loaded_key = results + .into_iter() + .next() + .map(|key| match key { + security_framework::item::SearchResult::Ref(Reference::Key(key)) => Ok::<_, &str>(key), + _ => Err("no key ref")?, + }) + .transpose()?; + + Ok(loaded_key) +} + +#[instrument] +pub fn find_all_keys(key_class: KeyClass) -> Result> { + let results = crate::keychain::item_search_options()? + .load_refs(true) + .class(ItemClass::key()) + .key_class(key_class) + .limit(Limit::All) + .search(); + + let results = match results { + Err(e) if e.code() == -25300 => return Ok(vec![]), + Err(e) => return Err(e)?, + Ok(results) => results, + }; + + let keys = results + .into_iter() + .filter_map(|res| match res { + security_framework::item::SearchResult::Ref(Reference::Key(key)) => Some(key), + _ => None, + }) + .collect(); + + Ok(keys) +} + +#[cfg(test)] +mod test { + use core_foundation::base::{TCFType, ToVoid}; + use native_pkcs11_traits::{random_label, Backend}; + use security_framework::item::{add_item, AddRef, ItemAddOptions, Limit}; + use security_framework_sys::item::{kSecAttrLabel, kSecValueRef}; + use serial_test::serial; + + use super::*; + use crate::{keychain, KeychainBackend}; + #[test] + #[serial] + fn key_label() -> crate::Result<()> { + let label = random_label(); + let key = generate_key(Algorithm::RSA, &label, Some(keychain::location()?))?; + + let mut found = false; + for res in crate::keychain::item_search_options()? + .key_class(KeyClass::private()) + .limit(Limit::Max(1)) + .load_attributes(true) + .load_refs(true) + .label(&label) + .search()? + { + found = true; + let (found_key, found_label) = match res { + security_framework::item::SearchResult::Ref(_) => panic!(), + security_framework::item::SearchResult::Dict(d) => { + let key = unsafe { + SecKey::wrap_under_get_rule(d.get(kSecValueRef.to_void()).cast_mut().cast()) + }; + let label = unsafe { + core_foundation::string::CFString::wrap_under_get_rule( + d.get(kSecAttrLabel.to_void()).cast_mut().cast(), + ) + }; + (key, label.to_string()) + } + security_framework::item::SearchResult::Data(_) => panic!(), + security_framework::item::SearchResult::Other => panic!(), + }; + + assert_eq!( + found_key.external_representation().unwrap().to_vec(), + key.external_representation().unwrap().to_vec() + ); + + assert_eq!(found_label, label); + } + key.public_key().unwrap().delete()?; + key.delete()?; + assert!(found); + Ok(()) + } + + #[test] + #[serial] + fn key_lifecycle() -> Result<()> { + for (key_alg, sig_alg) in [ + ( + Algorithm::ECC, + security_framework_sys::key::Algorithm::ECDSASignatureDigestX962, + ), + ( + Algorithm::RSA, + security_framework_sys::key::Algorithm::RSASignatureDigestPKCS1v15Raw, + ), + ] { + let label = &random_label(); + + let key = generate_key(key_alg, label, Some(keychain::location()?))?; + + let first_pubkey = key + .public_key() + .ok_or("no pubkey")? + .external_representation() + .ok_or("no external_representation")? + .to_vec(); + + std::mem::drop(key); + + let loaded_key = find_key(KeyClass::private(), label)?; + + let payload = vec![0u8; 32]; + let signature = loaded_key.create_signature(sig_alg, &payload)?; + + let loaded_pubkey = loaded_key.public_key().ok_or("no pubkey")?; + let sig_valid = loaded_pubkey.verify_signature(sig_alg, &payload, &signature)?; + assert!(sig_valid); + + assert_eq!( + loaded_pubkey.external_representation().unwrap().to_vec(), + first_pubkey + ); + + loaded_key.public_key().ok_or("no pubkey")?.delete()?; + loaded_key.delete()?; + } + + Ok(()) + } + + #[test] + #[ignore] + fn stress_test_keygen() { + let try_gen_key = || -> bool { + let label = random_label(); + match generate_key(Algorithm::RSA, &label, Some(keychain::location().unwrap())) { + Ok(key) => { + let _ = key.delete(); + true + } + Err(e) => { + eprintln!("{:?}", e); + false + } + } + }; + + let mut handles = vec![]; + for _ in 0..20 { + handles.push(std::thread::spawn(try_gen_key)); + } + assert!( + handles + .into_iter() + .map(|h| h.join().unwrap()) + // fold so we don't early exit other threads + .all(|b| b) + ); + } + + #[test] + #[ignore = "https://github.com/google/native-pkcs11/issues/302"] + fn keychain_pubkey_hash_find() -> Result<()> { + let key1 = generate_key(Algorithm::ECC, &random_label(), Some(keychain::location()?))?; + let key2 = generate_key(Algorithm::ECC, &random_label(), Some(keychain::location()?))?; + assert_ne!(key1.application_label(), key2.application_label()); + + for keyclass in [KeyClass::public(), KeyClass::private()] { + for key in [&key1, &key2] { + assert_eq!( + find_key2(keyclass, &key.application_label().unwrap())? + .unwrap() + .application_label() + .unwrap(), + key.application_label().unwrap() + ); + } + } + + for key in [&key1, &key2] { + key.public_key().as_ref().map(SecKey::delete); + let _ = key.delete(); + } + + Ok(()) + } + + #[test] + #[ignore = "demonstrate bug"] + fn unpersisted_public_key() -> Result<()> { + // NOTE(kcking): + // 1) Manually-imported keys are super scuffed. + // Manually imported key can be searched by label (if imported with + // that label), but cannot be searched by application_label (aka public + // key hash). Perhaps we are supposed to set this value at import time. + // + // 2) Manually-imported private keys do not return a corresponding + // public key from SecKeyCopyPublicKey (`.public_key()` in rust). + + let label = random_label(); + let key1 = SecKey::generate( + GenerateKeyOptions::default() + .set_key_type(KeyType::ec()) + .set_label(&label) + .to_dictionary(), + )?; + + let pubkey_hash = key1.public_key().unwrap().application_label().unwrap(); + + add_item( + ItemAddOptions::new(security_framework::item::ItemAddValue::Ref(AddRef::Key( + key1, + ))) + .set_label(&label) + .to_dictionary(), + )?; + + // NOTE(kcking): this fails to find the generated key, most likely + // because application_label is not automatically populated by + // SecurityFramework when importing a SecKey + // + // let found_key = + // KeychainBackend::find_private_key(native_pkcs11_traits::KeySearchOptions::PublicKeyHash( + // pubkey_hash + // .as_slice() + // .try_into() + // .map_err(|_| "into array")?, + // )) + // .map_err(|e| { + // dbg!(e); + // "find" + // })? + // .unwrap(); + + let found_key = KeychainBackend + .find_private_key(native_pkcs11_traits::KeySearchOptions::Label(label)) + .map_err(|e| { + dbg!(e); + "find" + })? + .unwrap(); + + assert_eq!(pubkey_hash, found_key.public_key_hash()); + + Ok(()) + } +} diff --git a/native-pkcs11-piv/src/piv/keychain.rs b/native-pkcs11-piv/src/piv/keychain.rs new file mode 100644 index 0000000..ef4e06c --- /dev/null +++ b/native-pkcs11-piv/src/piv/keychain.rs @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use security_framework::{ + item::{ItemSearchOptions, Location}, + os::macos::{item::ItemSearchOptionsExt, keychain::SecKeychain}, +}; + +use crate::Result; + +fn keychain() -> Result> { + match std::env::var("NATIVE_PKCS11_KEYCHAIN_PATH") { + Ok(path) => Ok(Some(SecKeychain::open(path)?)), + Err(_) => Ok(None), + } +} + +pub(crate) fn keychain_or_default() -> Result { + match keychain()? { + Some(keychain) => Ok(keychain), + None => Ok(SecKeychain::default()?), + } +} + +pub(crate) fn location() -> Result { + match keychain()? { + Some(keychain) => Ok(Location::FileKeychain(keychain)), + None => Ok(Location::DefaultFileKeychain), + } +} + +pub fn item_search_options() -> Result { + let mut opts = ItemSearchOptions::new(); + if let Some(keychain) = keychain()? { + opts.keychains(&[keychain]); + } + Ok(opts) +} diff --git a/native-pkcs11-piv/src/piv/mod.rs b/native-pkcs11-piv/src/piv/mod.rs new file mode 100644 index 0000000..00a5b83 --- /dev/null +++ b/native-pkcs11-piv/src/piv/mod.rs @@ -0,0 +1,100 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fmt::Debug; + +pub use backend::YubikeyPivBackend; +use core_foundation::error::CFError; +use native_pkcs11_traits::SignatureAlgorithm; +use thiserror::Error; +use tracing_error::SpanTrace; + +mod backend; +pub mod certificate; +pub mod key; +pub mod keychain; + +pub type Result = std::result::Result; + +pub struct Error { + error: ErrorKind, + context: SpanTrace, +} + +impl Debug for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + writeln!(f, "{:?}", self.error)?; + self.context.fmt(f) + } +} + +impl std::error::Error for Error {} + +impl> From for Error { + fn from(e: E) -> Self { + Error { + error: e.into(), + context: SpanTrace::capture(), + } + } +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + writeln!(f, "{}", self.error)?; + std::fmt::Display::fmt(&self.context, f) + } +} + +#[derive(Error, Debug)] +pub enum ErrorKind { + #[error("GenericError {0}")] + Generic(String), + + #[error("{0}")] + Der(#[from] x509_cert::der::Error), + + #[error("{0}")] + SecurityFramework(#[from] security_framework::base::Error), + + #[error("{0}")] + Spki(#[from] x509_cert::spki::Error), + + #[error("{0}")] + P256(#[from] p256::elliptic_curve::Error), + + #[error("{0}")] + Pkcs1(#[from] rsa::pkcs1::Error), + + #[error("{0:?}")] + UnsupportedSignatureAlgorithm(SignatureAlgorithm), +} + +impl From for ErrorKind { + fn from(e: CFError) -> Self { + ErrorKind::SecurityFramework(security_framework::base::Error::from_code(e.code() as i32)) + } +} + +impl From<&str> for ErrorKind { + fn from(s: &str) -> Self { + ErrorKind::Generic(s.to_string()) + } +} + +impl From for ErrorKind { + fn from(s: String) -> Self { + ErrorKind::Generic(s) + } +} diff --git a/native-pkcs11-piv/test-codesigned.sh b/native-pkcs11-piv/test-codesigned.sh new file mode 100755 index 0000000..ca1468a --- /dev/null +++ b/native-pkcs11-piv/test-codesigned.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +set -e + +# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script +cd $(dirname -- "$( readlink -f -- "$0"; )") + +cargo build --bin signedtest + +./codesigning-testing/codesign.sh $PWD/../target/debug/signedtest + +(../target/debug/signedtest && echo SUCCESS) || (echo FAIL && exit 1) diff --git a/native-pkcs11-traits/Cargo.toml b/native-pkcs11-traits/Cargo.toml new file mode 100644 index 0000000..bab35af --- /dev/null +++ b/native-pkcs11-traits/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "native-pkcs11-traits" +version = "0.2.18" +description = "Traits for implementing and interactive with native-pkcs11 module backends." +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +repository.workspace = true +license.workspace = true + +[dependencies] +once_cell = "1.19.0" +rand = "0.8.5" +x509-cert = { version = "0.2.5", default-features = false } diff --git a/native-pkcs11-traits/LICENSE b/native-pkcs11-traits/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/native-pkcs11-traits/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "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. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "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. + + "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). + + "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. + + "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." + + "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. + + 2. Grant of Copyright License. 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. + + 3. Grant of Patent License. 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. + + 4. Redistribution. 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (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 + + (d) If the Work includes a "NOTICE" 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. + + 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. + + 5. Submission of Contributions. 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. + + 6. Trademarks. 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. + + 7. Disclaimer of Warranty. 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. + + 8. Limitation of Liability. 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. + + 9. Accepting Warranty or Additional Liability. 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. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + 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. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/native-pkcs11-traits/src/lib.rs b/native-pkcs11-traits/src/lib.rs new file mode 100644 index 0000000..5bb1cf8 --- /dev/null +++ b/native-pkcs11-traits/src/lib.rs @@ -0,0 +1,221 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::{ + any::Any, + hash::Hash, + sync::{Arc, RwLock}, +}; + +pub use once_cell; +use once_cell::sync::Lazy; +use x509_cert::der::Decode; + +pub type Result = std::result::Result>; +pub type Digest = [u8; 20]; + +// The Backend is first staged so it can be stored in a Box. This +// allows the Backend to be reference with `&'static`. +static STAGED_BACKEND: RwLock>> = RwLock::new(None); +static BACKEND: Lazy> = + Lazy::new(|| STAGED_BACKEND.write().unwrap().take().unwrap()); + +/// Stores a backend to later be returned by all calls `crate::backend()`. +pub fn register_backend(backend: Box) { + *STAGED_BACKEND.write().unwrap() = Some(backend); +} + +pub fn backend() -> &'static dyn Backend { + BACKEND.as_ref() +} + +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum DigestType { + Sha1, + Sha224, + Sha256, + Sha384, + Sha512, +} + +impl DigestType { + pub fn digest_len(&self) -> usize { + match self { + DigestType::Sha1 => 20, + DigestType::Sha224 => 28, + DigestType::Sha256 => 32, + DigestType::Sha384 => 48, + DigestType::Sha512 => 64, + } + } +} + +#[derive(Debug, Clone)] +pub enum SignatureAlgorithm { + Ecdsa, + RsaRaw, + RsaPkcs1v15Raw, + RsaPkcs1v15Sha1, + RsaPkcs1v15Sha384, + RsaPkcs1v15Sha256, + RsaPkcs1v15Sha512, + RsaPss { + digest: DigestType, + mask_generation_function: DigestType, + salt_length: u64, + }, +} + +pub trait PrivateKey: Send + Sync { + fn public_key_hash(&self) -> Vec; + fn label(&self) -> String; + fn sign(&self, algorithm: &SignatureAlgorithm, data: &[u8]) -> Result>; + fn delete(&self); + fn algorithm(&self) -> KeyAlgorithm; + fn find_public_key(&self, backend: &dyn Backend) -> Result>> { + let pubkey_hash: Digest = self.public_key_hash().as_slice().try_into()?; + backend.find_public_key(KeySearchOptions::PublicKeyHash(pubkey_hash)) + } +} + +impl std::fmt::Debug for dyn PrivateKey { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("PrivateKey") + .field("label", &self.label()) + .finish_non_exhaustive() + } +} + +impl PartialEq for dyn PrivateKey { + fn eq(&self, other: &Self) -> bool { + self.public_key_hash() == other.public_key_hash() && self.label() == other.label() + } +} + +impl Eq for dyn PrivateKey {} +impl Hash for dyn PrivateKey { + fn hash(&self, state: &mut H) { + self.type_id().hash(state); + self.public_key_hash().hash(state); + self.label().hash(state); + } +} + +pub trait PublicKey: Send + Sync + std::fmt::Debug { + fn public_key_hash(&self) -> Vec; + fn label(&self) -> String; + fn to_der(&self) -> Vec; + fn verify(&self, algorithm: &SignatureAlgorithm, data: &[u8], signature: &[u8]) -> Result<()>; + fn delete(self: Box); + fn algorithm(&self) -> KeyAlgorithm; +} + +impl PartialEq for dyn PublicKey { + fn eq(&self, other: &Self) -> bool { + self.public_key_hash() == other.public_key_hash() && self.label() == other.label() + } +} + +impl Eq for dyn PublicKey {} +impl Hash for dyn PublicKey { + fn hash(&self, state: &mut H) { + self.type_id().hash(state); + self.public_key_hash().hash(state); + self.label().hash(state); + } +} + +pub trait Certificate: Send + Sync + std::fmt::Debug { + fn label(&self) -> String; + fn to_der(&self) -> Vec; + fn public_key(&self) -> &dyn PublicKey; + fn delete(self: Box); + fn algorithm(&self) -> KeyAlgorithm { + self.public_key().algorithm() + } +} + +impl PartialEq for dyn Certificate { + fn eq(&self, other: &Self) -> bool { + self.to_der() == other.to_der() && self.label() == other.label() + } +} +impl Eq for dyn Certificate {} +impl Hash for dyn Certificate { + fn hash(&self, state: &mut H) { + self.type_id().hash(state); + self.to_der().hash(state); + self.label().hash(state); + } +} + +pub trait CertificateExt: Certificate { + fn issuer(&self) -> Vec { + let der = self.to_der(); + let c = x509_cert::Certificate::from_der(&der).unwrap(); + x509_cert::der::Encode::to_der(&c.tbs_certificate.issuer).unwrap() + } + + fn serial_number(&self) -> Vec { + let der = self.to_der(); + let c = x509_cert::Certificate::from_der(&der).unwrap(); + x509_cert::der::Encode::to_der(&c.tbs_certificate.serial_number).unwrap() + } + + fn subject(&self) -> Vec { + let der = self.to_der(); + let c = x509_cert::Certificate::from_der(&der).unwrap(); + x509_cert::der::Encode::to_der(&c.tbs_certificate.subject).unwrap() + } +} + +impl CertificateExt for T {} + +#[derive(Debug)] +pub enum KeySearchOptions { + // TODO(kcking): search keys by _both_ label and public key hash as that is how + // they are de-duped and referenced. + Label(String), + PublicKeyHash(Digest), +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum KeyAlgorithm { + Rsa, + Ecc, +} + +pub trait Backend: Send + Sync { + fn name(&self) -> String; + fn find_all_certificates(&self) -> Result>>; + fn find_private_key(&self, query: KeySearchOptions) -> Result>>; + fn find_public_key(&self, query: KeySearchOptions) -> Result>>; + fn find_all_private_keys(&self) -> Result>>; + fn find_all_public_keys(&self) -> Result>>; + fn generate_key( + &self, + algorithm: KeyAlgorithm, + label: Option<&str>, + ) -> Result>; +} + +pub fn random_label() -> String { + use rand::{distributions::Alphanumeric, Rng}; + String::from("bumpkey ") + + &rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(32) + .map(char::from) + .collect::() +} diff --git a/native-pkcs11/Cargo.toml b/native-pkcs11/Cargo.toml new file mode 100644 index 0000000..c664476 --- /dev/null +++ b/native-pkcs11/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "native-pkcs11" +version = "0.2.18" +description = "Cross-platform PKCS#11 module written in rust. Can be extended with custom credential backends." +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +repository.workspace = true +license.workspace = true + +[features] +custom-function-list = [] + +[dependencies] +cached = { version = "0.51.4", default-features = false } +native-pkcs11-core = { version = "^0.2.14", path = "../native-pkcs11-core" } +native-pkcs11-traits = { version = "0.2.0", path = "../native-pkcs11-traits" } +once_cell = "1.19.0" +pkcs11-sys = { version = "0.2.0", path = "../pkcs11-sys" } +thiserror = "1.0.61" +tracing = "0.1.40" +tracing-error = "0.2.0" +tracing-journald = "0.3" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +native-pkcs11-piv = { version = "0.2.0", path = "../native-pkcs11-piv" } + +[lib] +name = "yubikey_piv_pkcs11" +crate-type = ["lib", "cdylib"] + +[dev-dependencies] +serial_test = { version = "3.1.1", default-features = false } +tracing = { version = "0.1.40", default-features = false } +tracing-subscriber = { version = "0.3.18", default-features = false, features = [ + "env-filter", +] } + diff --git a/native-pkcs11/src/lib.rs b/native-pkcs11/src/lib.rs new file mode 100644 index 0000000..936754f --- /dev/null +++ b/native-pkcs11/src/lib.rs @@ -0,0 +1,1601 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#![allow(non_snake_case)] +#![allow(clippy::missing_safety_doc)] +#![deny(unsafe_op_in_unsafe_fn)] + +use native_pkcs11_core::{ + attribute::{Attribute, Attributes}, + mechanism::{parse_mechanism, SUPPORTED_SIGNATURE_MECHANISMS}, + object::{self, Object}, +}; +pub use native_pkcs11_core::Error; +use native_pkcs11_traits::backend; +use pkcs11_sys::*; +// Export necessary items for registering a custom Backend. +pub use pkcs11_sys::{CK_FUNCTION_LIST, CK_FUNCTION_LIST_PTR_PTR, CK_RV, CKR_OK}; +use std::{ + cmp, + slice, + sync::{ + atomic::{AtomicBool, Ordering}, + Once, + }, +}; +use tracing::metadata::LevelFilter; +use tracing_error::ErrorLayer; +use tracing_subscriber::{EnvFilter, fmt::format::FmtSpan, prelude::*, Registry}; + +use crate::{ + sessions::{FindContext, SignContext}, + utils::right_pad_string_to_array, +}; + +mod object_store; +mod sessions; +mod utils; + +const LIBRARY_DESCRIPTION: &[u8; 32] = b" "; +const MANUFACTURER_ID: &[u8; 32] = b"google "; +const SLOT_DESCRIPTION: &[u8; 64] = + b"Platform Cryptography Support "; +const SLOT_ID: CK_SLOT_ID = 1; +const TOKEN_MODEL: &[u8; 16] = b"software "; +const TOKEN_SERIAL_NUMBER: &[u8; 16] = b"0000000000000000"; + +static INITIALIZED: AtomicBool = AtomicBool::new(false); + +type Result = std::result::Result<(), Error>; + +fn result_to_rv(f: F) -> CK_RV +where + F: FnOnce() -> Result, +{ + match f() { + Ok(()) => CKR_OK, + Err(e) => { + tracing::error!(%e); + e.into() + } + } +} + +macro_rules! cryptoki_fn { + (fn $name:ident ( $($arg:ident : $type:ty),* $(,)?) $body:block) => { + #[tracing::instrument] + #[no_mangle] + pub extern "C" fn $name($($arg: $type),*) -> CK_RV { + // TODO(bweeks): should this be `expr` instead of `block`? + result_to_rv(|| $body) + } + }; + (unsafe fn $name:ident ( $($arg:ident : $type:ty),* $(,)?) $body:block) => { + #[tracing::instrument] + #[no_mangle] + pub unsafe extern "C" fn $name($($arg: $type),*) -> CK_RV { + // TODO(bweeks): should this be `expr` instead of `block`? + result_to_rv(|| $body) + } + }; +} + +macro_rules! cryptoki_fn_not_supported { + ($name:ident, $($arg:ident: $type:ty),*) => { + cryptoki_fn!(fn $name($($arg: $type),*) {Err(Error::FunctionNotSupported)}); + }; +} + +macro_rules! not_null { + ($ptr:expr) => { + if $ptr.is_null() { + return Err(Error::ArgumentsBad); + } + }; +} + +macro_rules! initialized { + () => { + if INITIALIZED.load(Ordering::SeqCst) == false { + return Err(Error::CryptokiNotInitialized); + } + }; +} + +macro_rules! valid_session { + ($handle:expr) => { + if !sessions::exists($handle) { + return Err(Error::SessionHandleInvalid($handle)); + } + }; +} + +macro_rules! valid_slot { + ($id:expr) => { + if $id != SLOT_ID { + return Err(Error::SlotIdInvalid($id)); + } + }; +} + +pub static mut FUNC_LIST: CK_FUNCTION_LIST = CK_FUNCTION_LIST { + // In this structure ‘version’ is the cryptoki specification version number. The major and minor + // versions must be set to 0x02 and 0x28 indicating a version 2.40 compatible structure. + version: CK_VERSION { major: 2, minor: 4 }, + C_Initialize: Some(C_Initialize), + C_Finalize: Some(C_Finalize), + C_GetInfo: Some(C_GetInfo), + C_GetFunctionList: Some(C_GetFunctionList), + C_GetSlotList: Some(C_GetSlotList), + C_GetSlotInfo: Some(C_GetSlotInfo), + C_GetTokenInfo: Some(C_GetTokenInfo), + C_GetMechanismList: Some(C_GetMechanismList), + C_GetMechanismInfo: Some(C_GetMechanismInfo), + C_InitToken: Some(C_InitToken), + C_InitPIN: Some(C_InitPIN), + C_SetPIN: Some(C_SetPIN), + C_OpenSession: Some(C_OpenSession), + C_CloseSession: Some(C_CloseSession), + C_CloseAllSessions: Some(C_CloseAllSessions), + C_GetSessionInfo: Some(C_GetSessionInfo), + C_GetOperationState: Some(C_GetOperationState), + C_SetOperationState: Some(C_SetOperationState), + C_Login: Some(C_Login), + C_Logout: Some(C_Logout), + C_CreateObject: Some(C_CreateObject), + C_CopyObject: Some(C_CopyObject), + C_DestroyObject: Some(C_DestroyObject), + C_GetObjectSize: Some(C_GetObjectSize), + C_GetAttributeValue: Some(C_GetAttributeValue), + C_SetAttributeValue: Some(C_SetAttributeValue), + C_FindObjectsInit: Some(C_FindObjectsInit), + C_FindObjects: Some(C_FindObjects), + C_FindObjectsFinal: Some(C_FindObjectsFinal), + C_EncryptInit: Some(C_EncryptInit), + C_Encrypt: Some(C_Encrypt), + C_EncryptUpdate: Some(C_EncryptUpdate), + C_EncryptFinal: Some(C_EncryptFinal), + C_DecryptInit: Some(C_DecryptInit), + C_Decrypt: Some(C_Decrypt), + C_DecryptUpdate: Some(C_DecryptUpdate), + C_DecryptFinal: Some(C_DecryptFinal), + C_DigestInit: Some(C_DigestInit), + C_Digest: Some(C_Digest), + C_DigestUpdate: Some(C_DigestUpdate), + C_DigestKey: Some(C_DigestKey), + C_DigestFinal: Some(C_DigestFinal), + C_SignInit: Some(C_SignInit), + C_Sign: Some(C_Sign), + C_SignUpdate: Some(C_SignUpdate), + C_SignFinal: Some(C_SignFinal), + C_SignRecoverInit: Some(C_SignRecoverInit), + C_SignRecover: Some(C_SignRecover), + C_VerifyInit: Some(C_VerifyInit), + C_Verify: Some(C_Verify), + C_VerifyUpdate: Some(C_VerifyUpdate), + C_VerifyFinal: Some(C_VerifyFinal), + C_VerifyRecoverInit: Some(C_VerifyRecoverInit), + C_VerifyRecover: Some(C_VerifyRecover), + C_DigestEncryptUpdate: Some(C_DigestEncryptUpdate), + C_DecryptDigestUpdate: Some(C_DecryptDigestUpdate), + C_SignEncryptUpdate: Some(C_SignEncryptUpdate), + C_DecryptVerifyUpdate: Some(C_DecryptVerifyUpdate), + C_GenerateKey: Some(C_GenerateKey), + C_GenerateKeyPair: Some(C_GenerateKeyPair), + C_WrapKey: Some(C_WrapKey), + C_UnwrapKey: Some(C_UnwrapKey), + C_DeriveKey: Some(C_DeriveKey), + C_SeedRandom: Some(C_SeedRandom), + C_GenerateRandom: Some(C_GenerateRandom), + C_GetFunctionStatus: Some(C_GetFunctionStatus), + C_CancelFunction: Some(C_CancelFunction), + C_WaitForSlotEvent: Some(C_WaitForSlotEvent), +}; + +static TRACING_INIT: Once = Once::new(); + +cryptoki_fn!( + fn C_Initialize(pInitArgs: CK_VOID_PTR) { + TRACING_INIT.call_once(|| { + let env_filter = EnvFilter::builder() + .with_default_directive(LevelFilter::WARN.into()) + .from_env_lossy(); + let force_stderr = std::env::var("NATIVE_PKCS11_LOG_STDERR").is_ok(); + if !force_stderr { + if let Ok(journald_layer) = tracing_journald::layer() { + _ = Registry::default() + .with(journald_layer.with_syslog_identifier("native-pkcs11".into())) + .with(env_filter) + .with(ErrorLayer::default()) + .try_init(); + return; + } + } + _ = Registry::default() + .with( + tracing_subscriber::fmt::layer() + .with_writer(std::io::stderr) + .with_span_events(FmtSpan::ENTER), + ) + .with(env_filter) + .with(ErrorLayer::default()) + .try_init(); + }); + if !pInitArgs.is_null() { + let args = unsafe { *(pInitArgs as CK_C_INITIALIZE_ARGS_PTR) }; + if !args.pReserved.is_null() { + return Err(Error::ArgumentsBad); + } + } + if INITIALIZED.swap(true, Ordering::SeqCst) { + return Err(Error::CryptokiAlreadyInitialized); + } + Ok(()) + } +); + +cryptoki_fn!( + fn C_Finalize(pReserved: CK_VOID_PTR) { + initialized!(); + if !pReserved.is_null() { + return Err(Error::ArgumentsBad); + } + INITIALIZED.store(false, Ordering::SeqCst); + Ok(()) + } +); + +cryptoki_fn!( + unsafe fn C_GetInfo(pInfo: CK_INFO_PTR) { + initialized!(); + not_null!(pInfo); + let info = CK_INFO { + cryptokiVersion: CK_VERSION { + major: CRYPTOKI_VERSION_MAJOR, + minor: CRYPTOKI_VERSION_MINOR, + }, + manufacturerID: *MANUFACTURER_ID, + flags: 0, + libraryDescription: *LIBRARY_DESCRIPTION, + libraryVersion: CK_VERSION { major: 0, minor: 1 }, + }; + unsafe { *pInfo = info }; + Ok(()) + } +); + +#[cfg(not(feature = "custom-function-list"))] +cryptoki_fn!( + unsafe fn C_GetFunctionList(ppFunctionList: CK_FUNCTION_LIST_PTR_PTR) { + not_null!(ppFunctionList); + unsafe { *ppFunctionList = std::ptr::addr_of_mut!(FUNC_LIST) }; + + native_pkcs11_traits::register_backend(Box::new( + native_pkcs11_piv::YubikeyPivBackend {}, + )); + + Ok(()) + } +); + +cryptoki_fn!( + unsafe fn C_GetSlotList( + _tokenPresent: CK_BBOOL, + pSlotList: CK_SLOT_ID_PTR, + pulCount: CK_ULONG_PTR, + ) { + initialized!(); + not_null!(pulCount); + if !pSlotList.is_null() { + if unsafe { *pulCount } < 1 { + return Err(Error::BufferTooSmall); + } + // TODO: this should be an array. + unsafe { *pSlotList = SLOT_ID }; + } + unsafe { *pulCount = 1 }; + Ok(()) + } +); + +cryptoki_fn!( + unsafe fn C_GetSlotInfo(slotID: CK_SLOT_ID, pInfo: CK_SLOT_INFO_PTR) { + initialized!(); + valid_slot!(slotID); + not_null!(pInfo); + let info = CK_SLOT_INFO { + slotDescription: *SLOT_DESCRIPTION, + manufacturerID: *MANUFACTURER_ID, + flags: CKF_TOKEN_PRESENT, + // TODO: populate all fields. + ..Default::default() + }; + unsafe { *pInfo = info }; + Ok(()) + } +); + +cryptoki_fn!( + unsafe fn C_GetTokenInfo(slotID: CK_SLOT_ID, pInfo: CK_TOKEN_INFO_PTR) { + initialized!(); + valid_slot!(slotID); + not_null!(pInfo); + let label = right_pad_string_to_array(backend().name()); + + let info = CK_TOKEN_INFO { + label, + manufacturerID: *MANUFACTURER_ID, + model: *TOKEN_MODEL, + serialNumber: *TOKEN_SERIAL_NUMBER, + flags: CKF_TOKEN_INITIALIZED | CKF_PROTECTED_AUTHENTICATION_PATH | CKF_WRITE_PROTECTED, + ulMaxSessionCount: CK_UNAVAILABLE_INFORMATION, + ulSessionCount: CK_UNAVAILABLE_INFORMATION, + ulMaxRwSessionCount: CK_UNAVAILABLE_INFORMATION, + ulRwSessionCount: CK_UNAVAILABLE_INFORMATION, + ulTotalPublicMemory: CK_UNAVAILABLE_INFORMATION, + ulFreePublicMemory: CK_UNAVAILABLE_INFORMATION, + ulTotalPrivateMemory: CK_UNAVAILABLE_INFORMATION, + ulFreePrivateMemory: CK_UNAVAILABLE_INFORMATION, + // TODO: populate all fields. + ..Default::default() + }; + unsafe { *pInfo = info }; + Ok(()) + } +); + +cryptoki_fn!( + unsafe fn C_GetMechanismList( + slotID: CK_SLOT_ID, + pMechanismList: CK_MECHANISM_TYPE_PTR, + pulCount: CK_ULONG_PTR, + ) { + initialized!(); + not_null!(pulCount); + valid_slot!(slotID); + if !pMechanismList.is_null() { + if (unsafe { *pulCount } as usize) < SUPPORTED_SIGNATURE_MECHANISMS.len() { + unsafe { *pulCount = SUPPORTED_SIGNATURE_MECHANISMS.len() as CK_ULONG }; + return Err(Error::BufferTooSmall); + } + unsafe { + slice::from_raw_parts_mut(pMechanismList, SUPPORTED_SIGNATURE_MECHANISMS.len()) + } + .copy_from_slice(SUPPORTED_SIGNATURE_MECHANISMS); + } + unsafe { *pulCount = SUPPORTED_SIGNATURE_MECHANISMS.len() as CK_ULONG }; + Ok(()) + } +); + +cryptoki_fn!( + unsafe fn C_GetMechanismInfo( + slotID: CK_SLOT_ID, + mechType: CK_MECHANISM_TYPE, + pInfo: CK_MECHANISM_INFO_PTR, + ) { + initialized!(); + valid_slot!(slotID); + not_null!(pInfo); + if !SUPPORTED_SIGNATURE_MECHANISMS.contains(&mechType) { + return Err(Error::MechanismInvalid(mechType)); + } + let info = CK_MECHANISM_INFO { + flags: CKF_SIGN, + ..Default::default() + }; + unsafe { *pInfo = info }; + Ok(()) + } +); + +cryptoki_fn!( + fn C_InitToken( + slotID: CK_SLOT_ID, + _pPin: CK_UTF8CHAR_PTR, + _ulPinLen: CK_ULONG, + _pLabel: CK_UTF8CHAR_PTR, + ) { + initialized!(); + valid_slot!(slotID); + Err(Error::TokenWriteProtected) + } +); + +cryptoki_fn!( + fn C_InitPIN(hSession: CK_SESSION_HANDLE, _pPin: CK_UTF8CHAR_PTR, _ulPinLen: CK_ULONG) { + initialized!(); + valid_session!(hSession); + Err(Error::TokenWriteProtected) + } +); + +cryptoki_fn!( + fn C_SetPIN( + hSession: CK_SESSION_HANDLE, + _pOldPin: CK_UTF8CHAR_PTR, + _ulOldLen: CK_ULONG, + _pNewPin: CK_UTF8CHAR_PTR, + _ulNewLen: CK_ULONG, + ) { + initialized!(); + valid_session!(hSession); + Err(Error::TokenWriteProtected) + } +); + +cryptoki_fn!( + unsafe fn C_OpenSession( + slotID: CK_SLOT_ID, + flags: CK_FLAGS, + _pApplication: CK_VOID_PTR, + _Notify: CK_NOTIFY, + phSession: CK_SESSION_HANDLE_PTR, + ) { + initialized!(); + valid_slot!(slotID); + not_null!(phSession); + if flags & CKF_SERIAL_SESSION == 0 { + return Err(Error::SessionParallelNotSupported); + } + unsafe { *phSession = sessions::create(flags) }; + Ok(()) + } +); + +cryptoki_fn!( + fn C_CloseSession(hSession: CK_SESSION_HANDLE) { + initialized!(); + if sessions::close(hSession) { + return Ok(()); + } + Err(Error::SessionHandleInvalid(hSession)) + } +); + +cryptoki_fn!( + fn C_CloseAllSessions(slotID: CK_SLOT_ID) { + initialized!(); + valid_slot!(slotID); + sessions::close_all(); + Ok(()) + } +); + +cryptoki_fn!( + unsafe fn C_GetSessionInfo(hSession: CK_SESSION_HANDLE, pInfo: CK_SESSION_INFO_PTR) { + initialized!(); + valid_session!(hSession); + not_null!(pInfo); + let flags = sessions::flags(hSession); + let state = if flags & CKF_RW_SESSION == 0 { + CKS_RO_USER_FUNCTIONS + } else { + CKS_RW_USER_FUNCTIONS + }; + let info = CK_SESSION_INFO { + slotID: SLOT_ID, + state, + flags, + ulDeviceError: 0, + }; + unsafe { *pInfo = info }; + Ok(()) + } +); + +cryptoki_fn_not_supported!( + C_GetOperationState, + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + pulOperationStateLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_SetOperationState, + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + ulOperationStateLen: CK_ULONG, + hEncryptionKey: CK_OBJECT_HANDLE, + hAuthenticationKey: CK_OBJECT_HANDLE +); + +cryptoki_fn!( + fn C_Login( + hSession: CK_SESSION_HANDLE, + _userType: CK_USER_TYPE, + _pPin: CK_UTF8CHAR_PTR, + _ulPinLen: CK_ULONG, + ) { + initialized!(); + valid_session!(hSession); + Ok(()) + } +); + +cryptoki_fn!( + fn C_Logout(hSession: CK_SESSION_HANDLE) { + initialized!(); + valid_session!(hSession); + Ok(()) + } +); + +cryptoki_fn_not_supported!( + C_CreateObject, + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phObject: CK_OBJECT_HANDLE_PTR +); + +cryptoki_fn_not_supported!( + C_CopyObject, + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phNewObject: CK_OBJECT_HANDLE_PTR +); + +cryptoki_fn_not_supported!( + C_DestroyObject, + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE +); + +cryptoki_fn_not_supported!( + C_GetObjectSize, + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pulSize: CK_ULONG_PTR +); + +cryptoki_fn!( + unsafe fn C_GetAttributeValue( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) { + initialized!(); + valid_session!(hSession); + not_null!(pTemplate); + sessions::session(hSession, |_session| -> Result { + let object_store = sessions::OBJECT_STORE.lock().unwrap(); + let object = match object_store.get(&hObject) { + Some(object) => object, + None => { + return Err(Error::ObjectHandleInvalid(hObject)); + } + }; + let template = if ulCount > 0 { + if pTemplate.is_null() { + return Err(Error::ArgumentsBad); + } + unsafe { slice::from_raw_parts_mut(pTemplate, ulCount as usize) } + } else { + &mut [] + }; + let mut result = Ok(()); + for attribute in template.iter_mut() { + let type_ = attribute + .type_ + .try_into() + .map_err(|_| Error::AttributeTypeInvalid(attribute.type_))?; + if let Some(value) = object.attribute(type_) { + let value = value.as_raw_value(); + attribute.ulValueLen = value.len() as CK_ULONG; + if attribute.pValue.is_null() { + continue; + } + if (attribute.ulValueLen as usize) < value.len() { + result = Err(Error::BufferTooSmall); + continue; + } + unsafe { slice::from_raw_parts_mut(attribute.pValue as *mut u8, value.len()) } + .copy_from_slice(&value); + } else { + attribute.ulValueLen = CK_UNAVAILABLE_INFORMATION; + result = Err(Error::AttributeTypeInvalid(attribute.type_)); + } + } + result + }) + } +); + +cryptoki_fn_not_supported!( + C_SetAttributeValue, + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG +); + +cryptoki_fn!( + unsafe fn C_FindObjectsInit( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) { + initialized!(); + valid_session!(hSession); + let template: Attributes = unsafe { slice::from_raw_parts(pTemplate, ulCount as usize) } + .iter() + .map(|attr| (*attr).try_into()) + .collect::>>()? + .into(); + sessions::session(hSession, |session| -> Result { + session.find_ctx = Some(FindContext { + objects: sessions::OBJECT_STORE.lock().unwrap().find(template)?, + }); + Ok(()) + }) + } +); + +cryptoki_fn!( + unsafe fn C_FindObjects( + hSession: CK_SESSION_HANDLE, + phObject: CK_OBJECT_HANDLE_PTR, + ulMaxObjectCount: CK_ULONG, + pulObjectCount: CK_ULONG_PTR, + ) { + initialized!(); + valid_session!(hSession); + not_null!(phObject); + not_null!(pulObjectCount); + sessions::session(hSession, |session| -> Result { + let find_ctx = match &mut session.find_ctx { + Some(find_ctx) => find_ctx, + None => { + unsafe { *pulObjectCount = 0 }; + return Err(Error::OperationNotInitialized); + } + }; + if find_ctx.objects.is_empty() { + unsafe { *pulObjectCount = 0 }; + return Ok(()); + } + let max_objects = cmp::min(find_ctx.objects.len(), ulMaxObjectCount as usize); + let output = unsafe { slice::from_raw_parts_mut(phObject, max_objects) }; + output.copy_from_slice( + &find_ctx + .objects + .drain(0..max_objects) + .collect::>(), + ); + unsafe { *pulObjectCount = max_objects as CK_ULONG }; + Ok(()) + }) + } +); + +cryptoki_fn!( + fn C_FindObjectsFinal(hSession: CK_SESSION_HANDLE) { + initialized!(); + valid_session!(hSession); + sessions::session(hSession, |session| -> Result { + if session.find_ctx.is_none() { + return Err(Error::OperationNotInitialized); + } + session.find_ctx = None; + Ok(()) + }) + } +); + +cryptoki_fn_not_supported!( + C_EncryptInit, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE +); + +cryptoki_fn_not_supported!( + C_Encrypt, + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pEncryptedData: CK_BYTE_PTR, + pulEncryptedDataLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_EncryptUpdate, + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_EncryptFinal, + hSession: CK_SESSION_HANDLE, + pLastEncryptedPart: CK_BYTE_PTR, + pulLastEncryptedPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DecryptInit, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE +); + +cryptoki_fn_not_supported!( + C_Decrypt, + hSession: CK_SESSION_HANDLE, + pEncryptedData: CK_BYTE_PTR, + ulEncryptedDataLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DecryptUpdate, + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DecryptFinal, + hSession: CK_SESSION_HANDLE, + pLastPart: CK_BYTE_PTR, + pulLastPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DigestInit, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR +); + +cryptoki_fn_not_supported!( + C_Digest, + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DigestUpdate, + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG +); + +cryptoki_fn_not_supported!( + C_DigestKey, + hSession: CK_SESSION_HANDLE, + hKey: CK_OBJECT_HANDLE +); + +cryptoki_fn_not_supported!( + C_DigestFinal, + hSession: CK_SESSION_HANDLE, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR +); + +cryptoki_fn!( + unsafe fn C_SignInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) { + initialized!(); + valid_session!(hSession); + not_null!(pMechanism); + sessions::session(hSession, |session| -> Result { + let object_store = sessions::OBJECT_STORE.lock().unwrap(); + let private_key = match object_store.get(&hKey) { + Some(Object::PrivateKey(private_key)) => private_key, + Some(_) | None => return Err(Error::KeyHandleInvalid(hKey)), + }; + let mechanism = unsafe { parse_mechanism(pMechanism.read()) }?; + session.sign_ctx = Some(SignContext { + algorithm: mechanism.into(), + private_key: private_key.clone(), + payload: None, + }); + Ok(()) + }) + } +); + +cryptoki_fn!( + unsafe fn C_Sign( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) { + initialized!(); + valid_session!(hSession); + not_null!(pData); + not_null!(pulSignatureLen); + sessions::session(hSession, |session| -> Result { + let data = unsafe { slice::from_raw_parts(pData, ulDataLen as usize) }; + unsafe { session.sign(Some(data), pSignature, pulSignatureLen) }?; + Ok(()) + }) + } +); + +cryptoki_fn!( + unsafe fn C_SignUpdate(hSession: CK_SESSION_HANDLE, pPart: CK_BYTE_PTR, ulPartLen: CK_ULONG) { + initialized!(); + valid_session!(hSession); + not_null!(pPart); + sessions::session(hSession, |session| -> Result { + let sign_ctx = match session.sign_ctx.as_mut() { + None => return Err(Error::OperationNotInitialized), + Some(sign_ctx) => sign_ctx, + }; + sign_ctx + .payload + .get_or_insert(vec![]) + .extend_from_slice(unsafe { slice::from_raw_parts(pPart, ulPartLen as usize) }); + Ok(()) + }) + } +); + +cryptoki_fn!( + unsafe fn C_SignFinal( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) { + initialized!(); + valid_session!(hSession); + not_null!(pSignature); + not_null!(pulSignatureLen); + sessions::session(hSession, |session| -> Result { + unsafe { session.sign(None, pSignature, pulSignatureLen) }?; + Ok(()) + }) + } +); + +cryptoki_fn_not_supported!( + C_SignRecoverInit, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE +); + +cryptoki_fn_not_supported!( + C_SignRecover, + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_VerifyInit, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE +); + +cryptoki_fn_not_supported!( + C_Verify, + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG +); + +cryptoki_fn_not_supported!( + C_VerifyUpdate, + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG +); + +cryptoki_fn_not_supported!( + C_VerifyFinal, + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG +); + +cryptoki_fn_not_supported!( + C_VerifyRecoverInit, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE +); + +cryptoki_fn_not_supported!( + C_VerifyRecover, + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DigestEncryptUpdate, + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DecryptDigestUpdate, + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_SignEncryptUpdate, + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_DecryptVerifyUpdate, + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_GenerateKey, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR +); + +cryptoki_fn_not_supported!( + C_GenerateKeyPair, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pPublicKeyTemplate: CK_ATTRIBUTE_PTR, + ulPublicKeyAttributeCount: CK_ULONG, + pPrivateKeyTemplate: CK_ATTRIBUTE_PTR, + ulPrivateKeyAttributeCount: CK_ULONG, + phPublicKey: CK_OBJECT_HANDLE_PTR, + phPrivateKey: CK_OBJECT_HANDLE_PTR +); + +cryptoki_fn_not_supported!( + C_WrapKey, + hSession: CK_SESSION_HANDLE, + _pMechanism: CK_MECHANISM_PTR, + _hWrappingKey: CK_OBJECT_HANDLE, + _hKey: CK_OBJECT_HANDLE, + _pWrappedKey: CK_BYTE_PTR, + _pulWrappedKeyLen: CK_ULONG_PTR +); + +cryptoki_fn_not_supported!( + C_UnwrapKey, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hUnwrappingKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + ulWrappedKeyLen: CK_ULONG, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR +); + +cryptoki_fn_not_supported!( + C_DeriveKey, + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hBaseKey: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR +); + +cryptoki_fn!( + fn C_SeedRandom(hSession: CK_SESSION_HANDLE, pSeed: CK_BYTE_PTR, _ulSeedLen: CK_ULONG) { + initialized!(); + valid_session!(hSession); + not_null!(pSeed); + Err(Error::RandomNoRng) + } +); + +cryptoki_fn!( + fn C_GenerateRandom( + hSession: CK_SESSION_HANDLE, + pRandomData: CK_BYTE_PTR, + _ulRandomLen: CK_ULONG, + ) { + initialized!(); + valid_session!(hSession); + not_null!(pRandomData); + Err(Error::RandomNoRng) + } +); + +cryptoki_fn!( + fn C_GetFunctionStatus(hSession: CK_SESSION_HANDLE) { + initialized!(); + valid_session!(hSession); + Err(Error::FunctionNotParallel) + } +); + +cryptoki_fn!( + fn C_CancelFunction(hSession: CK_SESSION_HANDLE) { + initialized!(); + valid_session!(hSession); + Err(Error::FunctionNotParallel) + } +); + +cryptoki_fn_not_supported!( + C_WaitForSlotEvent, + flags: CK_FLAGS, + pSlot: CK_SLOT_ID_PTR, + pReserved: CK_VOID_PTR +); + +#[cfg(test)] +pub mod tests { + use serial_test::serial; + use std::ptr; + + use super::*; + + pub fn test_init() { + if !INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) { + let mut func_list: &mut CK_FUNCTION_LIST = &mut CK_FUNCTION_LIST { + ..Default::default() + }; + unsafe { C_GetFunctionList((&mut func_list) as *mut _ as *mut _) }; + } + } + + #[test] + #[serial] + fn get_initialize() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + assert_eq!( + C_Initialize(ptr::null_mut()), + CKR_CRYPTOKI_ALREADY_INITIALIZED + ); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + let mut args = CK_C_INITIALIZE_ARGS::default(); + assert_eq!( + C_Initialize(&mut args as CK_C_INITIALIZE_ARGS_PTR as *mut std::ffi::c_void), + CKR_OK + ); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + // Expect CKR_ARGUMENTS_BAD if pReserved is not null. + args.pReserved = 1 as *mut u32 as *mut std::ffi::c_void; + assert_eq!( + C_Initialize(&mut args as CK_C_INITIALIZE_ARGS_PTR as *mut std::ffi::c_void), + CKR_ARGUMENTS_BAD + ); + } + + #[test] + #[serial] + fn finalize() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + // Expect CKR_ARGUMENTS_BAD if pReserved is not null. + assert_eq!( + C_Finalize(1 as *mut u32 as *mut std::ffi::c_void), + CKR_ARGUMENTS_BAD + ); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_CRYPTOKI_NOT_INITIALIZED); + } + + #[test] + #[serial] + fn get_info() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut info = CK_INFO::default(); + assert_eq!(unsafe { C_GetInfo(&mut info) }, CKR_OK); + // Expect CKR_ARGUMENTS_BAD if pInfo is null. + assert_eq!(unsafe { C_GetInfo(ptr::null_mut()) }, CKR_ARGUMENTS_BAD); + // Expect CKR_CRYPTOKI_NOT_INITIALIZED if token is not initialized. + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_GetInfo(&mut info) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn get_function_list() { + test_init(); + let mut function_list = CK_FUNCTION_LIST::default(); + let mut function_list_pointer: *mut CK_FUNCTION_LIST = &mut function_list; + assert_eq!( + unsafe { C_GetFunctionList(&mut function_list_pointer) }, + CKR_OK + ); + // Expect CKR_ARGUMENTS_BAD if ppFunctionList is null. + assert_eq!( + unsafe { C_GetFunctionList(ptr::null_mut()) }, + CKR_ARGUMENTS_BAD + ); + } + + #[test] + #[serial] + fn get_slot_list() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut count = 0; + assert_eq!( + unsafe { C_GetSlotList(CK_FALSE, std::ptr::null_mut(), &mut count) }, + CKR_OK + ); + assert_eq!(count, 1); + // Expect CKR_ARGUMENTS_BAD if pulCount is null. + assert_eq!( + unsafe { C_GetSlotList(CK_FALSE, ptr::null_mut(), ptr::null_mut()) }, + CKR_ARGUMENTS_BAD + ); + // Expect CKR_BUFFER_TOO_SMALL if pulCount is less than the number of + // slots. + let mut count = 0; + let mut slot_list = vec![0; 0]; + assert_eq!( + unsafe { C_GetSlotList(CK_FALSE, slot_list.as_mut_ptr(), &mut count) }, + CKR_BUFFER_TOO_SMALL + ); + // Expect CKR_CRYPTOKI_NOT_INITIALIZED if token is not initialized. + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_GetSlotList(CK_FALSE, std::ptr::null_mut(), &mut count) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ) + } + + #[test] + #[serial] + fn get_slot_info() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut slot_info = CK_SLOT_INFO::default(); + assert_eq!(unsafe { C_GetSlotInfo(SLOT_ID, &mut slot_info) }, CKR_OK); + // Expect CKR_ARGUMENTS_BAD if pInfo is null. + assert_eq!( + unsafe { C_GetSlotInfo(SLOT_ID, ptr::null_mut()) }, + CKR_ARGUMENTS_BAD + ); + // Expect CKR_SLOT_ID_INVALID if slotID references a nonexistent slot. + assert_eq!( + unsafe { C_GetSlotInfo(SLOT_ID + 1, ptr::null_mut()) }, + CKR_SLOT_ID_INVALID + ); + // Expect CKR_CRYPTOKI_NOT_INITIALIZED if token is not initialized. + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_GetSlotInfo(SLOT_ID, &mut slot_info) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn get_token_info() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_GetTokenInfo(SLOT_ID, &mut CK_TOKEN_INFO::default()) }, + CKR_OK + ); + // Expect CKR_SLOT_ID_INVALID if slotID references a nonexistent slot. + assert_eq!( + unsafe { C_GetTokenInfo(SLOT_ID + 1, ptr::null_mut()) }, + CKR_SLOT_ID_INVALID + ); + // Expect CKR_ARGUMENTS_BAD if pInfo is null. + assert_eq!( + unsafe { C_GetSlotInfo(SLOT_ID, ptr::null_mut()) }, + CKR_ARGUMENTS_BAD + ); + // Expect CKR_CRYPTOKI_NOT_INITIALIZED if token is not initialized. + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_GetTokenInfo(SLOT_ID, &mut CK_TOKEN_INFO::default()) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn get_mechanism_list() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut count = 0; + assert_eq!( + unsafe { C_GetMechanismList(SLOT_ID, ptr::null_mut(), &mut count) }, + CKR_OK + ); + assert_ne!(count, 0); + let mut mechanisms = Vec::::with_capacity(count as usize); + assert_eq!( + unsafe { C_GetMechanismList(SLOT_ID, mechanisms.as_mut_ptr(), &mut count) }, + CKR_OK + ); + unsafe { + mechanisms.set_len(count as usize); + } + assert_eq!(mechanisms, *SUPPORTED_SIGNATURE_MECHANISMS); + // Expect CKR_SLOT_ID_INVALID if slotID references a nonexistent slot. + assert_eq!( + unsafe { C_GetMechanismList(SLOT_ID + 1, ptr::null_mut(), &mut count) }, + CKR_SLOT_ID_INVALID + ); + // Expect CKR_ARGUMENTS_BAD if pulCount is null. + assert_eq!( + unsafe { C_GetMechanismList(SLOT_ID, ptr::null_mut(), ptr::null_mut()) }, + CKR_ARGUMENTS_BAD + ); + // Expect CKR_BUFFER_TOO_SMALL if pulCount is less than the number of + // mechanisms. + assert_eq!( + unsafe { C_GetMechanismList(SLOT_ID, mechanisms.as_mut_ptr(), &mut (count - 1)) }, + CKR_BUFFER_TOO_SMALL + ); + // Expect CKR_CRYPTOKI_NOT_INITIALIZED if token is not initialized. + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_GetMechanismList(SLOT_ID, ptr::null_mut(), ptr::null_mut()) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn get_mechanism_info() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut info = CK_MECHANISM_INFO::default(); + assert_eq!( + unsafe { C_GetMechanismInfo(SLOT_ID, SUPPORTED_SIGNATURE_MECHANISMS[0], &mut info) }, + CKR_OK + ); + // Expect CKR_MECHANISM_INVALID if type is an unsupported mechanism. + assert_eq!( + unsafe { C_GetMechanismInfo(SLOT_ID, CKM_DSA, &mut info) }, + CKR_MECHANISM_INVALID + ); + // Expect CKR_ARGUMENTS_BAD if pInfo is null. + assert_eq!( + unsafe { + C_GetMechanismInfo(SLOT_ID, SUPPORTED_SIGNATURE_MECHANISMS[0], ptr::null_mut()) + }, + CKR_ARGUMENTS_BAD + ); + // Expect CKR_CRYPTOKI_NOT_INITIALIZED if token is not initialized. + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { + C_GetMechanismInfo(SLOT_ID, SUPPORTED_SIGNATURE_MECHANISMS[0], ptr::null_mut()) + }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn open_session() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let flags = CKF_SERIAL_SESSION; + let mut handle = CK_INVALID_HANDLE; + assert_eq!( + unsafe { C_OpenSession(SLOT_ID, flags, ptr::null_mut(), None, &mut handle) }, + CKR_OK + ); + // Expect CKR_SLOT_ID_INVALID if slotID references a nonexistent slot. + assert_eq!( + unsafe { C_OpenSession(SLOT_ID + 1, flags, ptr::null_mut(), None, &mut handle) }, + CKR_SLOT_ID_INVALID + ); + // Expect CKR_SESSION_PARALLEL_NOT_SUPPORTED if CKF_SERIAL_SESSION flag + // is not set. + assert_eq!( + unsafe { C_OpenSession(SLOT_ID, 0, ptr::null_mut(), None, &mut handle) }, + CKR_SESSION_PARALLEL_NOT_SUPPORTED + ); + // Expect CKR_ARGUMENTS_BAD if phSession is null. + assert_eq!( + unsafe { C_OpenSession(SLOT_ID, flags, ptr::null_mut(), None, ptr::null_mut()) }, + CKR_ARGUMENTS_BAD + ); + assert_eq!(C_CloseSession(handle), CKR_OK); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + } + + #[test] + #[serial] + fn close_sesson() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut handle = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut handle, + ) + }, + CKR_OK + ); + assert_eq!(C_CloseSession(handle), CKR_OK); + // Expect CKR_SESSION_HANDLE_INVALID if the session has already been closed. + assert_eq!(C_CloseSession(handle), CKR_SESSION_HANDLE_INVALID); + // Expect CKR_SESSION_HANDLE_INVALID if hSession is not a valid handle. + assert_eq!( + C_CloseSession(CK_INVALID_HANDLE), + CKR_SESSION_HANDLE_INVALID + ); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + } + + #[test] + #[serial] + fn get_session_info() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut handle = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut handle, + ) + }, + CKR_OK + ); + let mut session_info = CK_SESSION_INFO::default(); + assert_eq!( + unsafe { C_GetSessionInfo(handle, &mut session_info) }, + CKR_OK + ); + // Expect CKR_SESSION_HANDLE_INVALID if hSession is not a valid handle. + assert_eq!( + unsafe { C_GetSessionInfo(CK_INVALID_HANDLE, &mut session_info) }, + CKR_SESSION_HANDLE_INVALID + ); + // Expect CKR_ARGUMENTS_BAD if pInfo is null. + assert_eq!( + unsafe { C_GetSessionInfo(handle, ptr::null_mut()) }, + CKR_ARGUMENTS_BAD + ); + assert_eq!(C_CloseSession(handle), CKR_OK); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + } + + #[test] + #[serial] + fn get_attribute_value() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut session_h = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut session_h, + ) + }, + CKR_OK + ); + let mut template = vec![CK_ATTRIBUTE::default()]; + // Expect CKR_OBJECT_HANDLE_INVALID if hObject is not a valid handle. + assert_eq!( + unsafe { + C_GetAttributeValue( + session_h, + CK_INVALID_HANDLE, + template.as_mut_ptr(), + template.len() as CK_ULONG, + ) + }, + CKR_OBJECT_HANDLE_INVALID + ); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_GetAttributeValue(session_h, 0, template.as_mut_ptr(), 0) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn find_objects_init() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut handle = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut handle, + ) + }, + CKR_OK + ); + let mut template = vec![]; + assert_eq!( + unsafe { C_FindObjectsInit(handle, template.as_mut_ptr(), template.len() as CK_ULONG) }, + CKR_OK + ); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_FindObjectsInit(handle, template.as_mut_ptr(), template.len() as CK_ULONG) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn find_objects() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut handle = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut handle, + ) + }, + CKR_OK + ); + let mut template = vec![CK_ATTRIBUTE { + type_: CKA_CLASS, + pValue: CKO_PRIVATE_KEY as CK_VOID_PTR, + ulValueLen: std::mem::size_of_val(&CKO_PRIVATE_KEY) as CK_ULONG, + }]; + assert_eq!( + unsafe { C_FindObjectsInit(handle, template.as_mut_ptr(), 0) }, + CKR_OK + ); + let mut objects = vec![CK_OBJECT_HANDLE::default()]; + let mut count = 0; + assert_eq!( + unsafe { C_FindObjects(handle, objects.as_mut_ptr(), 1, &mut count) }, + CKR_OK + ); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!( + unsafe { C_FindObjects(handle, ptr::null_mut(), 0, ptr::null_mut()) }, + CKR_CRYPTOKI_NOT_INITIALIZED + ); + } + + #[test] + #[serial] + fn find_objects_final() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut handle = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut handle, + ) + }, + CKR_OK + ); + let mut template = vec![]; + assert_eq!( + unsafe { C_FindObjectsInit(handle, template.as_mut_ptr(), template.len() as CK_ULONG) }, + CKR_OK + ); + assert_eq!(C_FindObjectsFinal(handle), CKR_OK); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + assert_eq!(C_FindObjectsFinal(handle), CKR_CRYPTOKI_NOT_INITIALIZED); + } + + #[test] + #[serial] + fn get_function_status() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut session_h = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut session_h, + ) + }, + CKR_OK + ); + assert_eq!(C_GetFunctionStatus(session_h), CKR_FUNCTION_NOT_PARALLEL); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + } + + #[test] + #[serial] + fn cancel_function() { + test_init(); + assert_eq!(C_Initialize(ptr::null_mut()), CKR_OK); + let mut session_h = CK_INVALID_HANDLE; + assert_eq!( + unsafe { + C_OpenSession( + SLOT_ID, + CKF_SERIAL_SESSION, + ptr::null_mut(), + None, + &mut session_h, + ) + }, + CKR_OK + ); + assert_eq!(C_GetFunctionStatus(session_h), CKR_FUNCTION_NOT_PARALLEL); + assert_eq!(C_Finalize(ptr::null_mut()), CKR_OK); + } +} diff --git a/native-pkcs11/src/object_store.rs b/native-pkcs11/src/object_store.rs new file mode 100644 index 0000000..48af12f --- /dev/null +++ b/native-pkcs11/src/object_store.rs @@ -0,0 +1,252 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::collections::HashMap; + +use cached::{Cached, TimedCache}; +use native_pkcs11_core::{ + attribute::{Attribute, AttributeType, Attributes}, + Result, +}; +use native_pkcs11_traits::{backend, KeySearchOptions}; +use pkcs11_sys::{ + CKO_CERTIFICATE, + CKO_PRIVATE_KEY, + CKO_PUBLIC_KEY, + CKO_SECRET_KEY, + CKP_BASELINE_PROVIDER, + CK_OBJECT_HANDLE, +}; +use tracing::{instrument, warn}; + +use crate::{object::Object, Error}; + +#[derive(Debug)] +pub struct ObjectStore { + objects: HashMap, + handles_by_object: HashMap, + next_object_handle: CK_OBJECT_HANDLE, + query_cache: TimedCache>, +} + +impl ObjectStore { + #[instrument(skip(self))] + pub fn insert(&mut self, object: Object) -> CK_OBJECT_HANDLE { + if let Some(existing_handle) = self.handles_by_object.get(&object) { + return *existing_handle; + } + let handle = self.next_object_handle + 1; + self.next_object_handle += 1; + self.objects.insert(handle, object.clone()); + self.handles_by_object.insert(object, handle); + handle + } + + #[instrument(skip(self))] + pub fn get(&self, handle: &CK_OBJECT_HANDLE) -> Option<&Object> { + self.objects.get(handle) + } + + #[instrument(skip(self))] + pub fn find(&mut self, template: Attributes) -> Result> { + // Cache certificates. + // + // Firefox + NSS query certificates for every TLS connection in order to + // evaluate server trust. Cache the results for 3 seconds. + if let Some(c) = self.query_cache.cache_get(&template) { + Ok(c.to_vec()) + } else { + let output = self.find_impl(&template)?; + self.query_cache.cache_set(template, output.clone()); + Ok(output) + } + } + + #[instrument(skip(self))] + fn find_impl(&mut self, template: &Attributes) -> Result> { + self.find_with_backend(template)?; + if template.is_empty() { + Ok(self.find_all()) + } else { + Ok(self.find_store(template)) + } + } + + #[instrument(skip(self))] + fn find_all(&self) -> Vec { + self.objects.keys().copied().collect() + } + + #[instrument(skip(self))] + fn find_store(&self, template: &Attributes) -> Vec { + self.objects + .iter() + .filter(|(_, object)| object.matches(template)) + .map(|(handle, _)| *handle) + .collect() + } + + #[instrument(skip(self))] + fn find_with_backend(&mut self, template: &Attributes) -> Result<()> { + if template.is_empty() { + self.find_with_backend_all_certificates()?; + self.find_with_backend_all_public_keys()?; + self.find_with_backend_all_private_keys()?; + return Ok(()); + } + + let class = match template.get(AttributeType::Class) { + Some(Attribute::Class(class)) => class, + None => { + return Err(Error::Todo("no class attribute".to_string())); + } + class => { + return Err(Error::Todo(format!("class {:?} not implemented", class))); + } + }; + match *class { + CKO_CERTIFICATE => { + if template.len() > 1 { + warn!("ignoring attributes for certificate search"); + } + self.find_with_backend_all_certificates()?; + } + // CKO_NSS_TRUST | CKO_NETSCAPE_BUILTIN_ROOT_LIST + 3461563219 | 3461563220 => (), + CKO_SECRET_KEY => (), + CKO_PUBLIC_KEY | CKO_PRIVATE_KEY => { + let opts = if let Some(Attribute::Id(id)) = template.get(AttributeType::Id) { + KeySearchOptions::PublicKeyHash(id.as_slice().try_into()?) + } else if let Some(Attribute::Label(label)) = template.get(AttributeType::Label) { + KeySearchOptions::Label(label.into()) + } else { + match *class { + CKO_PRIVATE_KEY => self.find_with_backend_all_private_keys()?, + CKO_PUBLIC_KEY => self.find_with_backend_all_public_keys()?, + _ => unreachable!(), + } + return Ok(()); + }; + match *class { + CKO_PRIVATE_KEY => backend().find_private_key(opts)?.map(|key| { + self.insert(Object::PrivateKey(key)); + }), + CKO_PUBLIC_KEY => backend().find_public_key(opts)?.map(|key| { + self.insert(Object::PublicKey(key.into())); + }), + _ => unreachable!(), + }; + } + _ => { + return Err(Error::AttributeTypeInvalid(*class)); + } + } + Ok(()) + } + + fn find_with_backend_all_certificates(&mut self) -> Result<()> { + for cert in backend().find_all_certificates()? { + let private_key = backend().find_private_key(KeySearchOptions::PublicKeyHash( + cert.public_key().public_key_hash().as_slice().try_into()?, + ))?; + // Check if certificate has an associated PrivateKey. + match private_key { + Some(key) => key, + None => continue, + }; + self.insert(Object::Certificate(cert.into())); + } + Ok(()) + } + + fn find_with_backend_all_public_keys(&mut self) -> Result<()> { + for private_key in backend().find_all_private_keys()? { + self.insert(Object::PrivateKey(private_key)); + } + Ok(()) + } + + fn find_with_backend_all_private_keys(&mut self) -> Result<()> { + for private_key in backend().find_all_private_keys()? { + self.insert(Object::PrivateKey(private_key)); + } + Ok(()) + } +} + +impl Default for ObjectStore { + fn default() -> Self { + Self { + objects: HashMap::from([(1, Object::Profile(CKP_BASELINE_PROVIDER))]), + handles_by_object: HashMap::from([(Object::Profile(CKP_BASELINE_PROVIDER), 1)]), + next_object_handle: 2, + query_cache: TimedCache::with_lifespan(10), + } + } +} + +#[cfg(test)] +mod tests { + use std::vec; + + use native_pkcs11_traits::{backend, random_label, KeyAlgorithm}; + use pkcs11_sys::CKO_PRIVATE_KEY; + use serial_test::serial; + + use super::*; + use crate::tests::test_init; + + #[test] + #[serial] + fn test_object_store() { + test_init(); + + let label = &format!("objectstore test {}", random_label()); + + let key = backend() + .generate_key(native_pkcs11_traits::KeyAlgorithm::Rsa, Some(label)) + .unwrap(); + + let mut store = ObjectStore::default(); + + let template = Attributes::from(vec![ + Attribute::Class(CKO_PRIVATE_KEY), + Attribute::Label(label.into()), + ]); + let private_key_handle = store.find(template.clone()).unwrap()[0]; + // find again + assert_eq!(store.find(template).unwrap()[0], private_key_handle); + + key.find_public_key(backend()).unwrap().unwrap().delete(); + key.delete(); + } + + #[test] + #[serial] + fn key_alg() -> Result<()> { + test_init(); + let ec = backend().generate_key(KeyAlgorithm::Ecc, Some(&random_label()))?; + let rsa = backend().generate_key(KeyAlgorithm::Rsa, Some(&random_label()))?; + + assert_eq!(ec.algorithm(), KeyAlgorithm::Ecc); + assert_eq!(rsa.algorithm(), KeyAlgorithm::Rsa); + + for key in [ec, rsa] { + key.find_public_key(backend()).unwrap().unwrap().delete(); + key.delete(); + } + + Ok(()) + } +} diff --git a/native-pkcs11/src/sessions.rs b/native-pkcs11/src/sessions.rs new file mode 100644 index 0000000..b436ca9 --- /dev/null +++ b/native-pkcs11/src/sessions.rs @@ -0,0 +1,131 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::{ + collections::HashMap, + sync::{self, atomic::Ordering, Arc}, +}; + +use native_pkcs11_traits::{PrivateKey, SignatureAlgorithm}; +use once_cell::sync::Lazy; +use pkcs11_sys::{CK_BYTE_PTR, CK_FLAGS, CK_OBJECT_HANDLE, CK_SESSION_HANDLE, CK_ULONG_PTR}; + +use crate::{object_store::ObjectStore, Error, Result}; + +// "Valid session handles in Cryptoki always have nonzero values." +#[cfg(not(target_os = "windows"))] +static NEXT_SESSION_HANDLE: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); +#[cfg(target_os = "windows")] +static NEXT_SESSION_HANDLE: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(1); + +type SessionMap = HashMap; + +static SESSIONS: Lazy> = Lazy::new(Default::default); +pub static OBJECT_STORE: Lazy> = Lazy::new(Default::default); + +#[derive(Debug)] +pub struct FindContext { + pub objects: Vec, +} + +#[derive(Debug)] +pub struct SignContext { + pub algorithm: SignatureAlgorithm, + pub private_key: Arc, + /// Payload stored for multipart C_SignUpdate operations. + pub payload: Option>, +} + +impl Session { + /// Sign the provided data, or stored payload if data is not provided. + pub unsafe fn sign( + &mut self, + data: Option<&[u8]>, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> Result { + let sign_ctx = match self.sign_ctx.as_mut() { + Some(sign_ctx) => sign_ctx, + None => return Err(Error::OperationNotInitialized), + }; + let data = data + .or(sign_ctx.payload.as_deref()) + .ok_or(Error::OperationNotInitialized)?; + let signature = match sign_ctx.private_key.sign(&sign_ctx.algorithm, data) { + Ok(sig) => sig, + Err(e) => { + tracing::error!("signature failed: {e:?}"); + return Err(Error::ArgumentsBad); + } + }; + if !pSignature.is_null() { + // TODO(bweeks): This will cause a second sign call when this function is + // called again with an appropriately-sized buffer. Do we really need to + // sign twice for ECDSA? Consider storing the signature in the ctx for the next + // call. + if (unsafe { *pulSignatureLen } as usize) < signature.len() { + return Err(Error::BufferTooSmall); + } + unsafe { std::slice::from_raw_parts_mut(pSignature, signature.len()) } + .copy_from_slice(&signature); + self.sign_ctx = None; + } + unsafe { *pulSignatureLen = signature.len().try_into().unwrap() }; + Ok(()) + } +} + +#[derive(Default)] +pub struct Session { + flags: CK_FLAGS, + pub find_ctx: Option, + pub sign_ctx: Option, +} + +pub fn create(flags: CK_FLAGS) -> CK_SESSION_HANDLE { + let handle = NEXT_SESSION_HANDLE.fetch_add(1, Ordering::SeqCst); + SESSIONS.lock().unwrap().insert( + handle, + Session { + flags, + ..Default::default() + }, + ); + handle +} + +pub fn exists(handle: CK_SESSION_HANDLE) -> bool { + SESSIONS.lock().unwrap().contains_key(&handle) +} + +pub fn flags(handle: CK_SESSION_HANDLE) -> CK_FLAGS { + SESSIONS.lock().unwrap().get(&handle).unwrap().flags +} + +pub fn session(h: CK_SESSION_HANDLE, callback: F) -> crate::Result +where + F: FnOnce(&mut Session) -> crate::Result, +{ + let mut session_map = SESSIONS.lock().unwrap(); + let session = &mut session_map.get_mut(&h).unwrap(); + callback(session) +} + +pub fn close(handle: CK_SESSION_HANDLE) -> bool { + SESSIONS.lock().unwrap().remove(&handle).is_some() +} + +pub fn close_all() { + SESSIONS.lock().unwrap().clear() +} diff --git a/native-pkcs11/src/utils.rs b/native-pkcs11/src/utils.rs new file mode 100644 index 0000000..de54f6f --- /dev/null +++ b/native-pkcs11/src/utils.rs @@ -0,0 +1,45 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::io::Write; + +pub fn right_pad_string_to_array(s: impl Into) -> [u8; N] { + let mut s: String = s.into(); + let new_len = (0..=N) + .rev() + .find(|idx| s.is_char_boundary(*idx)) + .unwrap_or(0); + s.truncate(new_len); + + let mut out = [b' '; N]; + let _ = out.as_mut_slice().write_all(s.as_bytes()); + + out +} + +#[cfg(test)] +mod test { + use super::*; + #[test] + fn string_padding() { + assert_eq!(right_pad_string_to_array::<4>("asd"), *b"asd "); + assert_eq!(right_pad_string_to_array::<3>("asd"), *b"asd"); + assert_eq!(right_pad_string_to_array::<2>("asd"), *b"as"); + assert_eq!( + right_pad_string_to_array::<5>("🧑‍🔬"), + // Utf-8 encoding of "person" followed by a space. + [0xF0, 0x9F, 0xA7, 0x91, b' '] + ); + } +} diff --git a/pkcs11-sys/.gitignore b/pkcs11-sys/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/pkcs11-sys/.gitignore @@ -0,0 +1 @@ +/target diff --git a/pkcs11-sys/Cargo.toml b/pkcs11-sys/Cargo.toml new file mode 100644 index 0000000..05a9f2d --- /dev/null +++ b/pkcs11-sys/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "pkcs11-sys" +version = "0.2.18" +description = "Generated bindings for pkcs11.h. Useful for building PKCS#11 modules in rust." +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +repository.workspace = true +license.workspace = true + +[build-dependencies] +bindgen = { version = "0.69.4", optional = true } diff --git a/pkcs11-sys/LICENSE b/pkcs11-sys/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/pkcs11-sys/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "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. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "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. + + "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). + + "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. + + "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." + + "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. + + 2. Grant of Copyright License. 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. + + 3. Grant of Patent License. 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. + + 4. Redistribution. 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (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 + + (d) If the Work includes a "NOTICE" 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. + + 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. + + 5. Submission of Contributions. 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. + + 6. Trademarks. 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. + + 7. Disclaimer of Warranty. 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. + + 8. Limitation of Liability. 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. + + 9. Accepting Warranty or Additional Liability. 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. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + 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. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/pkcs11-sys/build.rs b/pkcs11-sys/build.rs new file mode 100644 index 0000000..cc9e50f --- /dev/null +++ b/pkcs11-sys/build.rs @@ -0,0 +1,188 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "bindgen")] +mod generate { + + use bindgen::callbacks; + + const LICENSE_HEADER: &str = r###"// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License."###; + + #[derive(Debug)] + pub struct CargoCallbacks; + + impl callbacks::ParseCallbacks for CargoCallbacks { + // https://github.com/rust-lang/rust-bindgen/issues/1594 + fn int_macro(&self, name: &str, _: i64) -> Option { + if ["CK_TRUE", "CK_FALSE"].contains(&name) { + Some(callbacks::IntKind::Custom { + name: "CK_BBOOL", + is_signed: false, + }) + } else if name.starts_with("CK_") { + Some(callbacks::IntKind::Custom { + name: "CK_ULONG", + is_signed: false, + }) + } else if name.starts_with("CKA_") { + Some(callbacks::IntKind::Custom { + name: "CK_ATTRIBUTE_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKC_") { + Some(callbacks::IntKind::Custom { + name: "CK_CERTIFICATE_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKD_") { + Some(callbacks::IntKind::Custom { + name: "CK_EC_KDF_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKF_") { + Some(callbacks::IntKind::Custom { + name: "CK_FLAGS", + is_signed: false, + }) + } else if name.starts_with("CKG_MGF1_") { + Some(callbacks::IntKind::Custom { + name: "CK_RSA_PKCS_MGF_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKG_") { + Some(callbacks::IntKind::Custom { + name: "CK_GENERATOR_FUNCTION", + is_signed: false, + }) + } else if name.starts_with("CKH_") { + Some(callbacks::IntKind::Custom { + name: "CK_HW_FEATURE_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKK_") { + Some(callbacks::IntKind::Custom { + name: "CK_KEY_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKM_") { + Some(callbacks::IntKind::Custom { + name: "CK_MECHANISM_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKN_") { + Some(callbacks::IntKind::Custom { + name: "CK_NOTIFICATION", + is_signed: false, + }) + } else if name.starts_with("CKO_") { + Some(callbacks::IntKind::Custom { + name: "CK_OBJECT_CLASS", + is_signed: false, + }) + } else if name.starts_with("CKP_") { + Some(callbacks::IntKind::Custom { + name: "CK_PROFILE_ID", + is_signed: false, + }) + } else if name.starts_with("CKR_") { + Some(callbacks::IntKind::Custom { + name: "CK_RV", + is_signed: false, + }) + } else if name.starts_with("CKS_") { + Some(callbacks::IntKind::Custom { + name: "CK_STATE", + is_signed: false, + }) + } else if name.starts_with("CKU_") { + Some(callbacks::IntKind::Custom { + name: "CK_USER_TYPE", + is_signed: false, + }) + } else if name.starts_with("CKZ_") { + Some(callbacks::IntKind::Custom { + name: "CK_RSA_PKCS_OAEP_SOURCE_TYPE", + is_signed: false, + }) + } else if name.starts_with("CRYPTOKI_VERSION_") { + Some(callbacks::IntKind::Custom { + name: "CK_BYTE", + is_signed: false, + }) + } else { + None + } + } + + fn include_file(&self, filename: &str) { + println!("cargo:rerun-if-changed={filename}"); + } + + fn will_parse_macro(&self, name: &str) -> callbacks::MacroParsingBehavior { + if name.starts_with('_') { + callbacks::MacroParsingBehavior::Ignore + } else { + callbacks::MacroParsingBehavior::Default + } + } + } + + #[allow(unused)] + fn windows_modifications(builder: bindgen::Builder) -> bindgen::Builder { + builder.blocklist_item("CK_UNAVAILABLE_INFORMATION") + } + + fn target_specific_output_path() -> String { + format!("src/pkcs11_{}.rs", std::env::consts::FAMILY) + } + + pub fn generate_main() { + println!("cargo:rerun-if-changed=pkcs11.h"); + + let bindings = bindgen::Builder::default() + .header("pkcs11.h") + .derive_default(true) + .parse_callbacks(Box::new(CargoCallbacks)) + .raw_line(LICENSE_HEADER); + + #[cfg(target_os = "windows")] + let bindings = windows_modifications(bindings); + + let bindings = bindings.generate().expect("failed to generate bindings"); + + bindings + .write_to_file(target_specific_output_path()) + .expect("failed to write bindings"); + } +} + +#[cfg(not(feature = "bindgen"))] +fn main() {} + +#[cfg(feature = "bindgen")] +fn main() { + generate::generate_main(); +} diff --git a/pkcs11-sys/pkcs11.h b/pkcs11-sys/pkcs11.h new file mode 100644 index 0000000..b4c9795 --- /dev/null +++ b/pkcs11-sys/pkcs11.h @@ -0,0 +1,43 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This header file incorporates WIN32-specific advice from +// https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/cs01/include/pkcs11-v3.1/pkcs11.h. + +#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32) +#define CK_DECLARE_FUNCTION(returnType, name) returnType __declspec(dllexport) name +#define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType __declspec(dllimport)(*name) +/* There is a matching pop below. */ +#pragma pack(push, cryptoki, 1) +#else +#define CK_DECLARE_FUNCTION(returnType, name) returnType name +#define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType(*name) +#endif + +#define CK_PTR * +#define CK_DEFINE_FUNCTION(returnType, name) returnType name +#define CK_CALLBACK_FUNCTION(returnType, name) returnType(*name) + +#ifndef NULL_PTR +#define NULL_PTR 0 +#endif + +#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32) +#endif + +#include "third_party/pkcs11/pkcs11.h" + +#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32) +#pragma pack(pop, cryptoki) +#endif \ No newline at end of file diff --git a/pkcs11-sys/src/lib.rs b/pkcs11-sys/src/lib.rs new file mode 100644 index 0000000..a145a27 --- /dev/null +++ b/pkcs11-sys/src/lib.rs @@ -0,0 +1,29 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +#[cfg(target_os = "windows")] +mod pkcs11_windows; +#[cfg(target_os = "windows")] +pub use pkcs11_windows::*; + +#[cfg(target_os = "windows")] +pub const CK_UNAVAILABLE_INFORMATION: u32 = u32::MAX; + +#[cfg(not(target_os = "windows"))] +mod pkcs11_unix; +#[cfg(not(target_os = "windows"))] +pub use pkcs11_unix::*; diff --git a/pkcs11-sys/src/pkcs11_unix.rs b/pkcs11-sys/src/pkcs11_unix.rs new file mode 100644 index 0000000..6d75946 --- /dev/null +++ b/pkcs11-sys/src/pkcs11_unix.rs @@ -0,0 +1,11723 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub const NULL_PTR: u32 = 0; +pub const CRYPTOKI_VERSION_MAJOR: CK_BYTE = 3; +pub const CRYPTOKI_VERSION_MINOR: CK_BYTE = 1; +pub const CRYPTOKI_VERSION_AMENDMENT: CK_BYTE = 0; +pub const CK_TRUE: CK_BBOOL = 1; +pub const CK_FALSE: CK_BBOOL = 0; +pub const FALSE: u32 = 0; +pub const TRUE: u32 = 1; +pub const CK_UNAVAILABLE_INFORMATION: CK_ULONG = 18446744073709551615; +pub const CK_EFFECTIVELY_INFINITE: CK_ULONG = 0; +pub const CK_INVALID_HANDLE: CK_ULONG = 0; +pub const CKN_SURRENDER: CK_NOTIFICATION = 0; +pub const CKN_OTP_CHANGED: CK_NOTIFICATION = 1; +pub const CKF_TOKEN_PRESENT: CK_FLAGS = 1; +pub const CKF_REMOVABLE_DEVICE: CK_FLAGS = 2; +pub const CKF_HW_SLOT: CK_FLAGS = 4; +pub const CKF_RNG: CK_FLAGS = 1; +pub const CKF_WRITE_PROTECTED: CK_FLAGS = 2; +pub const CKF_LOGIN_REQUIRED: CK_FLAGS = 4; +pub const CKF_USER_PIN_INITIALIZED: CK_FLAGS = 8; +pub const CKF_RESTORE_KEY_NOT_NEEDED: CK_FLAGS = 32; +pub const CKF_CLOCK_ON_TOKEN: CK_FLAGS = 64; +pub const CKF_PROTECTED_AUTHENTICATION_PATH: CK_FLAGS = 256; +pub const CKF_DUAL_CRYPTO_OPERATIONS: CK_FLAGS = 512; +pub const CKF_TOKEN_INITIALIZED: CK_FLAGS = 1024; +pub const CKF_SECONDARY_AUTHENTICATION: CK_FLAGS = 2048; +pub const CKF_USER_PIN_COUNT_LOW: CK_FLAGS = 65536; +pub const CKF_USER_PIN_FINAL_TRY: CK_FLAGS = 131072; +pub const CKF_USER_PIN_LOCKED: CK_FLAGS = 262144; +pub const CKF_USER_PIN_TO_BE_CHANGED: CK_FLAGS = 524288; +pub const CKF_SO_PIN_COUNT_LOW: CK_FLAGS = 1048576; +pub const CKF_SO_PIN_FINAL_TRY: CK_FLAGS = 2097152; +pub const CKF_SO_PIN_LOCKED: CK_FLAGS = 4194304; +pub const CKF_SO_PIN_TO_BE_CHANGED: CK_FLAGS = 8388608; +pub const CKF_ERROR_STATE: CK_FLAGS = 16777216; +pub const CKU_SO: CK_USER_TYPE = 0; +pub const CKU_USER: CK_USER_TYPE = 1; +pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2; +pub const CKS_RO_PUBLIC_SESSION: CK_STATE = 0; +pub const CKS_RO_USER_FUNCTIONS: CK_STATE = 1; +pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2; +pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3; +pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4; +pub const CKF_RW_SESSION: CK_FLAGS = 2; +pub const CKF_SERIAL_SESSION: CK_FLAGS = 4; +pub const CKO_DATA: CK_OBJECT_CLASS = 0; +pub const CKO_CERTIFICATE: CK_OBJECT_CLASS = 1; +pub const CKO_PUBLIC_KEY: CK_OBJECT_CLASS = 2; +pub const CKO_PRIVATE_KEY: CK_OBJECT_CLASS = 3; +pub const CKO_SECRET_KEY: CK_OBJECT_CLASS = 4; +pub const CKO_HW_FEATURE: CK_OBJECT_CLASS = 5; +pub const CKO_DOMAIN_PARAMETERS: CK_OBJECT_CLASS = 6; +pub const CKO_MECHANISM: CK_OBJECT_CLASS = 7; +pub const CKO_OTP_KEY: CK_OBJECT_CLASS = 8; +pub const CKO_PROFILE: CK_OBJECT_CLASS = 9; +pub const CKO_VENDOR_DEFINED: CK_OBJECT_CLASS = 2147483648; +pub const CKP_INVALID_ID: CK_PROFILE_ID = 0; +pub const CKP_BASELINE_PROVIDER: CK_PROFILE_ID = 1; +pub const CKP_EXTENDED_PROVIDER: CK_PROFILE_ID = 2; +pub const CKP_AUTHENTICATION_TOKEN: CK_PROFILE_ID = 3; +pub const CKP_PUBLIC_CERTIFICATES_TOKEN: CK_PROFILE_ID = 4; +pub const CKP_COMPLETE_PROVIDER: CK_PROFILE_ID = 5; +pub const CKP_HKDF_TLS_TOKEN: CK_PROFILE_ID = 6; +pub const CKP_VENDOR_DEFINED: CK_PROFILE_ID = 2147483648; +pub const CKH_MONOTONIC_COUNTER: CK_HW_FEATURE_TYPE = 1; +pub const CKH_CLOCK: CK_HW_FEATURE_TYPE = 2; +pub const CKH_USER_INTERFACE: CK_HW_FEATURE_TYPE = 3; +pub const CKH_VENDOR_DEFINED: CK_HW_FEATURE_TYPE = 2147483648; +pub const CKK_RSA: CK_KEY_TYPE = 0; +pub const CKK_DSA: CK_KEY_TYPE = 1; +pub const CKK_DH: CK_KEY_TYPE = 2; +pub const CKK_ECDSA: CK_KEY_TYPE = 3; +pub const CKK_EC: CK_KEY_TYPE = 3; +pub const CKK_X9_42_DH: CK_KEY_TYPE = 4; +pub const CKK_KEA: CK_KEY_TYPE = 5; +pub const CKK_GENERIC_SECRET: CK_KEY_TYPE = 16; +pub const CKK_RC2: CK_KEY_TYPE = 17; +pub const CKK_RC4: CK_KEY_TYPE = 18; +pub const CKK_DES: CK_KEY_TYPE = 19; +pub const CKK_DES2: CK_KEY_TYPE = 20; +pub const CKK_DES3: CK_KEY_TYPE = 21; +pub const CKK_CAST: CK_KEY_TYPE = 22; +pub const CKK_CAST3: CK_KEY_TYPE = 23; +pub const CKK_CAST5: CK_KEY_TYPE = 24; +pub const CKK_CAST128: CK_KEY_TYPE = 24; +pub const CKK_RC5: CK_KEY_TYPE = 25; +pub const CKK_IDEA: CK_KEY_TYPE = 26; +pub const CKK_SKIPJACK: CK_KEY_TYPE = 27; +pub const CKK_BATON: CK_KEY_TYPE = 28; +pub const CKK_JUNIPER: CK_KEY_TYPE = 29; +pub const CKK_CDMF: CK_KEY_TYPE = 30; +pub const CKK_AES: CK_KEY_TYPE = 31; +pub const CKK_BLOWFISH: CK_KEY_TYPE = 32; +pub const CKK_TWOFISH: CK_KEY_TYPE = 33; +pub const CKK_SECURID: CK_KEY_TYPE = 34; +pub const CKK_HOTP: CK_KEY_TYPE = 35; +pub const CKK_ACTI: CK_KEY_TYPE = 36; +pub const CKK_CAMELLIA: CK_KEY_TYPE = 37; +pub const CKK_ARIA: CK_KEY_TYPE = 38; +pub const CKK_MD5_HMAC: CK_KEY_TYPE = 39; +pub const CKK_SHA_1_HMAC: CK_KEY_TYPE = 40; +pub const CKK_RIPEMD128_HMAC: CK_KEY_TYPE = 41; +pub const CKK_RIPEMD160_HMAC: CK_KEY_TYPE = 42; +pub const CKK_SHA256_HMAC: CK_KEY_TYPE = 43; +pub const CKK_SHA384_HMAC: CK_KEY_TYPE = 44; +pub const CKK_SHA512_HMAC: CK_KEY_TYPE = 45; +pub const CKK_SHA224_HMAC: CK_KEY_TYPE = 46; +pub const CKK_SEED: CK_KEY_TYPE = 47; +pub const CKK_GOSTR3410: CK_KEY_TYPE = 48; +pub const CKK_GOSTR3411: CK_KEY_TYPE = 49; +pub const CKK_GOST28147: CK_KEY_TYPE = 50; +pub const CKK_CHACHA20: CK_KEY_TYPE = 51; +pub const CKK_POLY1305: CK_KEY_TYPE = 52; +pub const CKK_AES_XTS: CK_KEY_TYPE = 53; +pub const CKK_SHA3_224_HMAC: CK_KEY_TYPE = 54; +pub const CKK_SHA3_256_HMAC: CK_KEY_TYPE = 55; +pub const CKK_SHA3_384_HMAC: CK_KEY_TYPE = 56; +pub const CKK_SHA3_512_HMAC: CK_KEY_TYPE = 57; +pub const CKK_BLAKE2B_160_HMAC: CK_KEY_TYPE = 58; +pub const CKK_BLAKE2B_256_HMAC: CK_KEY_TYPE = 59; +pub const CKK_BLAKE2B_384_HMAC: CK_KEY_TYPE = 60; +pub const CKK_BLAKE2B_512_HMAC: CK_KEY_TYPE = 61; +pub const CKK_SALSA20: CK_KEY_TYPE = 62; +pub const CKK_X2RATCHET: CK_KEY_TYPE = 63; +pub const CKK_EC_EDWARDS: CK_KEY_TYPE = 64; +pub const CKK_EC_MONTGOMERY: CK_KEY_TYPE = 65; +pub const CKK_HKDF: CK_KEY_TYPE = 66; +pub const CKK_SHA512_224_HMAC: CK_KEY_TYPE = 67; +pub const CKK_SHA512_256_HMAC: CK_KEY_TYPE = 68; +pub const CKK_SHA512_T_HMAC: CK_KEY_TYPE = 69; +pub const CKK_HSS: CK_KEY_TYPE = 70; +pub const CKK_VENDOR_DEFINED: CK_KEY_TYPE = 2147483648; +pub const CK_CERTIFICATE_CATEGORY_UNSPECIFIED: CK_ULONG = 0; +pub const CK_CERTIFICATE_CATEGORY_TOKEN_USER: CK_ULONG = 1; +pub const CK_CERTIFICATE_CATEGORY_AUTHORITY: CK_ULONG = 2; +pub const CK_CERTIFICATE_CATEGORY_OTHER_ENTITY: CK_ULONG = 3; +pub const CK_SECURITY_DOMAIN_UNSPECIFIED: CK_ULONG = 0; +pub const CK_SECURITY_DOMAIN_MANUFACTURER: CK_ULONG = 1; +pub const CK_SECURITY_DOMAIN_OPERATOR: CK_ULONG = 2; +pub const CK_SECURITY_DOMAIN_THIRD_PARTY: CK_ULONG = 3; +pub const CKC_X_509: CK_CERTIFICATE_TYPE = 0; +pub const CKC_X_509_ATTR_CERT: CK_CERTIFICATE_TYPE = 1; +pub const CKC_WTLS: CK_CERTIFICATE_TYPE = 2; +pub const CKC_VENDOR_DEFINED: CK_CERTIFICATE_TYPE = 2147483648; +pub const CKF_ARRAY_ATTRIBUTE: CK_FLAGS = 1073741824; +pub const CK_OTP_FORMAT_DECIMAL: CK_ULONG = 0; +pub const CK_OTP_FORMAT_HEXADECIMAL: CK_ULONG = 1; +pub const CK_OTP_FORMAT_ALPHANUMERIC: CK_ULONG = 2; +pub const CK_OTP_FORMAT_BINARY: CK_ULONG = 3; +pub const CK_OTP_PARAM_IGNORED: CK_ULONG = 0; +pub const CK_OTP_PARAM_OPTIONAL: CK_ULONG = 1; +pub const CK_OTP_PARAM_MANDATORY: CK_ULONG = 2; +pub const CKA_CLASS: CK_ATTRIBUTE_TYPE = 0; +pub const CKA_TOKEN: CK_ATTRIBUTE_TYPE = 1; +pub const CKA_PRIVATE: CK_ATTRIBUTE_TYPE = 2; +pub const CKA_LABEL: CK_ATTRIBUTE_TYPE = 3; +pub const CKA_UNIQUE_ID: CK_ATTRIBUTE_TYPE = 4; +pub const CKA_APPLICATION: CK_ATTRIBUTE_TYPE = 16; +pub const CKA_VALUE: CK_ATTRIBUTE_TYPE = 17; +pub const CKA_OBJECT_ID: CK_ATTRIBUTE_TYPE = 18; +pub const CKA_CERTIFICATE_TYPE: CK_ATTRIBUTE_TYPE = 128; +pub const CKA_ISSUER: CK_ATTRIBUTE_TYPE = 129; +pub const CKA_SERIAL_NUMBER: CK_ATTRIBUTE_TYPE = 130; +pub const CKA_AC_ISSUER: CK_ATTRIBUTE_TYPE = 131; +pub const CKA_OWNER: CK_ATTRIBUTE_TYPE = 132; +pub const CKA_ATTR_TYPES: CK_ATTRIBUTE_TYPE = 133; +pub const CKA_TRUSTED: CK_ATTRIBUTE_TYPE = 134; +pub const CKA_CERTIFICATE_CATEGORY: CK_ATTRIBUTE_TYPE = 135; +pub const CKA_JAVA_MIDP_SECURITY_DOMAIN: CK_ATTRIBUTE_TYPE = 136; +pub const CKA_URL: CK_ATTRIBUTE_TYPE = 137; +pub const CKA_HASH_OF_SUBJECT_PUBLIC_KEY: CK_ATTRIBUTE_TYPE = 138; +pub const CKA_HASH_OF_ISSUER_PUBLIC_KEY: CK_ATTRIBUTE_TYPE = 139; +pub const CKA_NAME_HASH_ALGORITHM: CK_ATTRIBUTE_TYPE = 140; +pub const CKA_CHECK_VALUE: CK_ATTRIBUTE_TYPE = 144; +pub const CKA_KEY_TYPE: CK_ATTRIBUTE_TYPE = 256; +pub const CKA_SUBJECT: CK_ATTRIBUTE_TYPE = 257; +pub const CKA_ID: CK_ATTRIBUTE_TYPE = 258; +pub const CKA_SENSITIVE: CK_ATTRIBUTE_TYPE = 259; +pub const CKA_ENCRYPT: CK_ATTRIBUTE_TYPE = 260; +pub const CKA_DECRYPT: CK_ATTRIBUTE_TYPE = 261; +pub const CKA_WRAP: CK_ATTRIBUTE_TYPE = 262; +pub const CKA_UNWRAP: CK_ATTRIBUTE_TYPE = 263; +pub const CKA_SIGN: CK_ATTRIBUTE_TYPE = 264; +pub const CKA_SIGN_RECOVER: CK_ATTRIBUTE_TYPE = 265; +pub const CKA_VERIFY: CK_ATTRIBUTE_TYPE = 266; +pub const CKA_VERIFY_RECOVER: CK_ATTRIBUTE_TYPE = 267; +pub const CKA_DERIVE: CK_ATTRIBUTE_TYPE = 268; +pub const CKA_START_DATE: CK_ATTRIBUTE_TYPE = 272; +pub const CKA_END_DATE: CK_ATTRIBUTE_TYPE = 273; +pub const CKA_MODULUS: CK_ATTRIBUTE_TYPE = 288; +pub const CKA_MODULUS_BITS: CK_ATTRIBUTE_TYPE = 289; +pub const CKA_PUBLIC_EXPONENT: CK_ATTRIBUTE_TYPE = 290; +pub const CKA_PRIVATE_EXPONENT: CK_ATTRIBUTE_TYPE = 291; +pub const CKA_PRIME_1: CK_ATTRIBUTE_TYPE = 292; +pub const CKA_PRIME_2: CK_ATTRIBUTE_TYPE = 293; +pub const CKA_EXPONENT_1: CK_ATTRIBUTE_TYPE = 294; +pub const CKA_EXPONENT_2: CK_ATTRIBUTE_TYPE = 295; +pub const CKA_COEFFICIENT: CK_ATTRIBUTE_TYPE = 296; +pub const CKA_PUBLIC_KEY_INFO: CK_ATTRIBUTE_TYPE = 297; +pub const CKA_PRIME: CK_ATTRIBUTE_TYPE = 304; +pub const CKA_SUBPRIME: CK_ATTRIBUTE_TYPE = 305; +pub const CKA_BASE: CK_ATTRIBUTE_TYPE = 306; +pub const CKA_PRIME_BITS: CK_ATTRIBUTE_TYPE = 307; +pub const CKA_SUBPRIME_BITS: CK_ATTRIBUTE_TYPE = 308; +pub const CKA_SUB_PRIME_BITS: CK_ATTRIBUTE_TYPE = 308; +pub const CKA_VALUE_BITS: CK_ATTRIBUTE_TYPE = 352; +pub const CKA_VALUE_LEN: CK_ATTRIBUTE_TYPE = 353; +pub const CKA_EXTRACTABLE: CK_ATTRIBUTE_TYPE = 354; +pub const CKA_LOCAL: CK_ATTRIBUTE_TYPE = 355; +pub const CKA_NEVER_EXTRACTABLE: CK_ATTRIBUTE_TYPE = 356; +pub const CKA_ALWAYS_SENSITIVE: CK_ATTRIBUTE_TYPE = 357; +pub const CKA_KEY_GEN_MECHANISM: CK_ATTRIBUTE_TYPE = 358; +pub const CKA_MODIFIABLE: CK_ATTRIBUTE_TYPE = 368; +pub const CKA_COPYABLE: CK_ATTRIBUTE_TYPE = 369; +pub const CKA_DESTROYABLE: CK_ATTRIBUTE_TYPE = 370; +pub const CKA_ECDSA_PARAMS: CK_ATTRIBUTE_TYPE = 384; +pub const CKA_EC_PARAMS: CK_ATTRIBUTE_TYPE = 384; +pub const CKA_EC_POINT: CK_ATTRIBUTE_TYPE = 385; +pub const CKA_SECONDARY_AUTH: CK_ATTRIBUTE_TYPE = 512; +pub const CKA_AUTH_PIN_FLAGS: CK_ATTRIBUTE_TYPE = 513; +pub const CKA_ALWAYS_AUTHENTICATE: CK_ATTRIBUTE_TYPE = 514; +pub const CKA_WRAP_WITH_TRUSTED: CK_ATTRIBUTE_TYPE = 528; +pub const CKA_WRAP_TEMPLATE: CK_ATTRIBUTE_TYPE = 1073742353; +pub const CKA_UNWRAP_TEMPLATE: CK_ATTRIBUTE_TYPE = 1073742354; +pub const CKA_DERIVE_TEMPLATE: CK_ATTRIBUTE_TYPE = 1073742355; +pub const CKA_OTP_FORMAT: CK_ATTRIBUTE_TYPE = 544; +pub const CKA_OTP_LENGTH: CK_ATTRIBUTE_TYPE = 545; +pub const CKA_OTP_TIME_INTERVAL: CK_ATTRIBUTE_TYPE = 546; +pub const CKA_OTP_USER_FRIENDLY_MODE: CK_ATTRIBUTE_TYPE = 547; +pub const CKA_OTP_CHALLENGE_REQUIREMENT: CK_ATTRIBUTE_TYPE = 548; +pub const CKA_OTP_TIME_REQUIREMENT: CK_ATTRIBUTE_TYPE = 549; +pub const CKA_OTP_COUNTER_REQUIREMENT: CK_ATTRIBUTE_TYPE = 550; +pub const CKA_OTP_PIN_REQUIREMENT: CK_ATTRIBUTE_TYPE = 551; +pub const CKA_OTP_COUNTER: CK_ATTRIBUTE_TYPE = 558; +pub const CKA_OTP_TIME: CK_ATTRIBUTE_TYPE = 559; +pub const CKA_OTP_USER_IDENTIFIER: CK_ATTRIBUTE_TYPE = 554; +pub const CKA_OTP_SERVICE_IDENTIFIER: CK_ATTRIBUTE_TYPE = 555; +pub const CKA_OTP_SERVICE_LOGO: CK_ATTRIBUTE_TYPE = 556; +pub const CKA_OTP_SERVICE_LOGO_TYPE: CK_ATTRIBUTE_TYPE = 557; +pub const CKA_GOSTR3410_PARAMS: CK_ATTRIBUTE_TYPE = 592; +pub const CKA_GOSTR3411_PARAMS: CK_ATTRIBUTE_TYPE = 593; +pub const CKA_GOST28147_PARAMS: CK_ATTRIBUTE_TYPE = 594; +pub const CKA_HW_FEATURE_TYPE: CK_ATTRIBUTE_TYPE = 768; +pub const CKA_RESET_ON_INIT: CK_ATTRIBUTE_TYPE = 769; +pub const CKA_HAS_RESET: CK_ATTRIBUTE_TYPE = 770; +pub const CKA_PIXEL_X: CK_ATTRIBUTE_TYPE = 1024; +pub const CKA_PIXEL_Y: CK_ATTRIBUTE_TYPE = 1025; +pub const CKA_RESOLUTION: CK_ATTRIBUTE_TYPE = 1026; +pub const CKA_CHAR_ROWS: CK_ATTRIBUTE_TYPE = 1027; +pub const CKA_CHAR_COLUMNS: CK_ATTRIBUTE_TYPE = 1028; +pub const CKA_COLOR: CK_ATTRIBUTE_TYPE = 1029; +pub const CKA_BITS_PER_PIXEL: CK_ATTRIBUTE_TYPE = 1030; +pub const CKA_CHAR_SETS: CK_ATTRIBUTE_TYPE = 1152; +pub const CKA_ENCODING_METHODS: CK_ATTRIBUTE_TYPE = 1153; +pub const CKA_MIME_TYPES: CK_ATTRIBUTE_TYPE = 1154; +pub const CKA_MECHANISM_TYPE: CK_ATTRIBUTE_TYPE = 1280; +pub const CKA_REQUIRED_CMS_ATTRIBUTES: CK_ATTRIBUTE_TYPE = 1281; +pub const CKA_DEFAULT_CMS_ATTRIBUTES: CK_ATTRIBUTE_TYPE = 1282; +pub const CKA_SUPPORTED_CMS_ATTRIBUTES: CK_ATTRIBUTE_TYPE = 1283; +pub const CKA_ALLOWED_MECHANISMS: CK_ATTRIBUTE_TYPE = 1073743360; +pub const CKA_PROFILE_ID: CK_ATTRIBUTE_TYPE = 1537; +pub const CKA_X2RATCHET_BAG: CK_ATTRIBUTE_TYPE = 1538; +pub const CKA_X2RATCHET_BAGSIZE: CK_ATTRIBUTE_TYPE = 1539; +pub const CKA_X2RATCHET_BOBS1STMSG: CK_ATTRIBUTE_TYPE = 1540; +pub const CKA_X2RATCHET_CKR: CK_ATTRIBUTE_TYPE = 1541; +pub const CKA_X2RATCHET_CKS: CK_ATTRIBUTE_TYPE = 1542; +pub const CKA_X2RATCHET_DHP: CK_ATTRIBUTE_TYPE = 1543; +pub const CKA_X2RATCHET_DHR: CK_ATTRIBUTE_TYPE = 1544; +pub const CKA_X2RATCHET_DHS: CK_ATTRIBUTE_TYPE = 1545; +pub const CKA_X2RATCHET_HKR: CK_ATTRIBUTE_TYPE = 1546; +pub const CKA_X2RATCHET_HKS: CK_ATTRIBUTE_TYPE = 1547; +pub const CKA_X2RATCHET_ISALICE: CK_ATTRIBUTE_TYPE = 1548; +pub const CKA_X2RATCHET_NHKR: CK_ATTRIBUTE_TYPE = 1549; +pub const CKA_X2RATCHET_NHKS: CK_ATTRIBUTE_TYPE = 1550; +pub const CKA_X2RATCHET_NR: CK_ATTRIBUTE_TYPE = 1551; +pub const CKA_X2RATCHET_NS: CK_ATTRIBUTE_TYPE = 1552; +pub const CKA_X2RATCHET_PNS: CK_ATTRIBUTE_TYPE = 1553; +pub const CKA_X2RATCHET_RK: CK_ATTRIBUTE_TYPE = 1554; +pub const CKA_HSS_LEVELS: CK_ATTRIBUTE_TYPE = 1559; +pub const CKA_HSS_LMS_TYPE: CK_ATTRIBUTE_TYPE = 1560; +pub const CKA_HSS_LMOTS_TYPE: CK_ATTRIBUTE_TYPE = 1561; +pub const CKA_HSS_LMS_TYPES: CK_ATTRIBUTE_TYPE = 1562; +pub const CKA_HSS_LMOTS_TYPES: CK_ATTRIBUTE_TYPE = 1563; +pub const CKA_HSS_KEYS_REMAINING: CK_ATTRIBUTE_TYPE = 1564; +pub const CKA_VENDOR_DEFINED: CK_ATTRIBUTE_TYPE = 2147483648; +pub const CKM_RSA_PKCS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 0; +pub const CKM_RSA_PKCS: CK_MECHANISM_TYPE = 1; +pub const CKM_RSA_9796: CK_MECHANISM_TYPE = 2; +pub const CKM_RSA_X_509: CK_MECHANISM_TYPE = 3; +pub const CKM_MD2_RSA_PKCS: CK_MECHANISM_TYPE = 4; +pub const CKM_MD5_RSA_PKCS: CK_MECHANISM_TYPE = 5; +pub const CKM_SHA1_RSA_PKCS: CK_MECHANISM_TYPE = 6; +pub const CKM_RIPEMD128_RSA_PKCS: CK_MECHANISM_TYPE = 7; +pub const CKM_RIPEMD160_RSA_PKCS: CK_MECHANISM_TYPE = 8; +pub const CKM_RSA_PKCS_OAEP: CK_MECHANISM_TYPE = 9; +pub const CKM_RSA_X9_31_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 10; +pub const CKM_RSA_X9_31: CK_MECHANISM_TYPE = 11; +pub const CKM_SHA1_RSA_X9_31: CK_MECHANISM_TYPE = 12; +pub const CKM_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 13; +pub const CKM_SHA1_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 14; +pub const CKM_DSA_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 16; +pub const CKM_DSA: CK_MECHANISM_TYPE = 17; +pub const CKM_DSA_SHA1: CK_MECHANISM_TYPE = 18; +pub const CKM_DSA_SHA224: CK_MECHANISM_TYPE = 19; +pub const CKM_DSA_SHA256: CK_MECHANISM_TYPE = 20; +pub const CKM_DSA_SHA384: CK_MECHANISM_TYPE = 21; +pub const CKM_DSA_SHA512: CK_MECHANISM_TYPE = 22; +pub const CKM_DSA_SHA3_224: CK_MECHANISM_TYPE = 24; +pub const CKM_DSA_SHA3_256: CK_MECHANISM_TYPE = 25; +pub const CKM_DSA_SHA3_384: CK_MECHANISM_TYPE = 26; +pub const CKM_DSA_SHA3_512: CK_MECHANISM_TYPE = 27; +pub const CKM_DH_PKCS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 32; +pub const CKM_DH_PKCS_DERIVE: CK_MECHANISM_TYPE = 33; +pub const CKM_X9_42_DH_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 48; +pub const CKM_X9_42_DH_DERIVE: CK_MECHANISM_TYPE = 49; +pub const CKM_X9_42_DH_HYBRID_DERIVE: CK_MECHANISM_TYPE = 50; +pub const CKM_X9_42_MQV_DERIVE: CK_MECHANISM_TYPE = 51; +pub const CKM_SHA256_RSA_PKCS: CK_MECHANISM_TYPE = 64; +pub const CKM_SHA384_RSA_PKCS: CK_MECHANISM_TYPE = 65; +pub const CKM_SHA512_RSA_PKCS: CK_MECHANISM_TYPE = 66; +pub const CKM_SHA256_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 67; +pub const CKM_SHA384_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 68; +pub const CKM_SHA512_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 69; +pub const CKM_SHA224_RSA_PKCS: CK_MECHANISM_TYPE = 70; +pub const CKM_SHA224_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 71; +pub const CKM_SHA512_224: CK_MECHANISM_TYPE = 72; +pub const CKM_SHA512_224_HMAC: CK_MECHANISM_TYPE = 73; +pub const CKM_SHA512_224_HMAC_GENERAL: CK_MECHANISM_TYPE = 74; +pub const CKM_SHA512_224_KEY_DERIVATION: CK_MECHANISM_TYPE = 75; +pub const CKM_SHA512_256: CK_MECHANISM_TYPE = 76; +pub const CKM_SHA512_256_HMAC: CK_MECHANISM_TYPE = 77; +pub const CKM_SHA512_256_HMAC_GENERAL: CK_MECHANISM_TYPE = 78; +pub const CKM_SHA512_256_KEY_DERIVATION: CK_MECHANISM_TYPE = 79; +pub const CKM_SHA512_T: CK_MECHANISM_TYPE = 80; +pub const CKM_SHA512_T_HMAC: CK_MECHANISM_TYPE = 81; +pub const CKM_SHA512_T_HMAC_GENERAL: CK_MECHANISM_TYPE = 82; +pub const CKM_SHA512_T_KEY_DERIVATION: CK_MECHANISM_TYPE = 83; +pub const CKM_SHA3_256_RSA_PKCS: CK_MECHANISM_TYPE = 96; +pub const CKM_SHA3_384_RSA_PKCS: CK_MECHANISM_TYPE = 97; +pub const CKM_SHA3_512_RSA_PKCS: CK_MECHANISM_TYPE = 98; +pub const CKM_SHA3_256_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 99; +pub const CKM_SHA3_384_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 100; +pub const CKM_SHA3_512_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 101; +pub const CKM_SHA3_224_RSA_PKCS: CK_MECHANISM_TYPE = 102; +pub const CKM_SHA3_224_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 103; +pub const CKM_RC2_KEY_GEN: CK_MECHANISM_TYPE = 256; +pub const CKM_RC2_ECB: CK_MECHANISM_TYPE = 257; +pub const CKM_RC2_CBC: CK_MECHANISM_TYPE = 258; +pub const CKM_RC2_MAC: CK_MECHANISM_TYPE = 259; +pub const CKM_RC2_MAC_GENERAL: CK_MECHANISM_TYPE = 260; +pub const CKM_RC2_CBC_PAD: CK_MECHANISM_TYPE = 261; +pub const CKM_RC4_KEY_GEN: CK_MECHANISM_TYPE = 272; +pub const CKM_RC4: CK_MECHANISM_TYPE = 273; +pub const CKM_DES_KEY_GEN: CK_MECHANISM_TYPE = 288; +pub const CKM_DES_ECB: CK_MECHANISM_TYPE = 289; +pub const CKM_DES_CBC: CK_MECHANISM_TYPE = 290; +pub const CKM_DES_MAC: CK_MECHANISM_TYPE = 291; +pub const CKM_DES_MAC_GENERAL: CK_MECHANISM_TYPE = 292; +pub const CKM_DES_CBC_PAD: CK_MECHANISM_TYPE = 293; +pub const CKM_DES2_KEY_GEN: CK_MECHANISM_TYPE = 304; +pub const CKM_DES3_KEY_GEN: CK_MECHANISM_TYPE = 305; +pub const CKM_DES3_ECB: CK_MECHANISM_TYPE = 306; +pub const CKM_DES3_CBC: CK_MECHANISM_TYPE = 307; +pub const CKM_DES3_MAC: CK_MECHANISM_TYPE = 308; +pub const CKM_DES3_MAC_GENERAL: CK_MECHANISM_TYPE = 309; +pub const CKM_DES3_CBC_PAD: CK_MECHANISM_TYPE = 310; +pub const CKM_DES3_CMAC_GENERAL: CK_MECHANISM_TYPE = 311; +pub const CKM_DES3_CMAC: CK_MECHANISM_TYPE = 312; +pub const CKM_CDMF_KEY_GEN: CK_MECHANISM_TYPE = 320; +pub const CKM_CDMF_ECB: CK_MECHANISM_TYPE = 321; +pub const CKM_CDMF_CBC: CK_MECHANISM_TYPE = 322; +pub const CKM_CDMF_MAC: CK_MECHANISM_TYPE = 323; +pub const CKM_CDMF_MAC_GENERAL: CK_MECHANISM_TYPE = 324; +pub const CKM_CDMF_CBC_PAD: CK_MECHANISM_TYPE = 325; +pub const CKM_DES_OFB64: CK_MECHANISM_TYPE = 336; +pub const CKM_DES_OFB8: CK_MECHANISM_TYPE = 337; +pub const CKM_DES_CFB64: CK_MECHANISM_TYPE = 338; +pub const CKM_DES_CFB8: CK_MECHANISM_TYPE = 339; +pub const CKM_MD2: CK_MECHANISM_TYPE = 512; +pub const CKM_MD2_HMAC: CK_MECHANISM_TYPE = 513; +pub const CKM_MD2_HMAC_GENERAL: CK_MECHANISM_TYPE = 514; +pub const CKM_MD5: CK_MECHANISM_TYPE = 528; +pub const CKM_MD5_HMAC: CK_MECHANISM_TYPE = 529; +pub const CKM_MD5_HMAC_GENERAL: CK_MECHANISM_TYPE = 530; +pub const CKM_SHA_1: CK_MECHANISM_TYPE = 544; +pub const CKM_SHA_1_HMAC: CK_MECHANISM_TYPE = 545; +pub const CKM_SHA_1_HMAC_GENERAL: CK_MECHANISM_TYPE = 546; +pub const CKM_RIPEMD128: CK_MECHANISM_TYPE = 560; +pub const CKM_RIPEMD128_HMAC: CK_MECHANISM_TYPE = 561; +pub const CKM_RIPEMD128_HMAC_GENERAL: CK_MECHANISM_TYPE = 562; +pub const CKM_RIPEMD160: CK_MECHANISM_TYPE = 576; +pub const CKM_RIPEMD160_HMAC: CK_MECHANISM_TYPE = 577; +pub const CKM_RIPEMD160_HMAC_GENERAL: CK_MECHANISM_TYPE = 578; +pub const CKM_SHA256: CK_MECHANISM_TYPE = 592; +pub const CKM_SHA256_HMAC: CK_MECHANISM_TYPE = 593; +pub const CKM_SHA256_HMAC_GENERAL: CK_MECHANISM_TYPE = 594; +pub const CKM_SHA224: CK_MECHANISM_TYPE = 597; +pub const CKM_SHA224_HMAC: CK_MECHANISM_TYPE = 598; +pub const CKM_SHA224_HMAC_GENERAL: CK_MECHANISM_TYPE = 599; +pub const CKM_SHA384: CK_MECHANISM_TYPE = 608; +pub const CKM_SHA384_HMAC: CK_MECHANISM_TYPE = 609; +pub const CKM_SHA384_HMAC_GENERAL: CK_MECHANISM_TYPE = 610; +pub const CKM_SHA512: CK_MECHANISM_TYPE = 624; +pub const CKM_SHA512_HMAC: CK_MECHANISM_TYPE = 625; +pub const CKM_SHA512_HMAC_GENERAL: CK_MECHANISM_TYPE = 626; +pub const CKM_SECURID_KEY_GEN: CK_MECHANISM_TYPE = 640; +pub const CKM_SECURID: CK_MECHANISM_TYPE = 642; +pub const CKM_HOTP_KEY_GEN: CK_MECHANISM_TYPE = 656; +pub const CKM_HOTP: CK_MECHANISM_TYPE = 657; +pub const CKM_ACTI: CK_MECHANISM_TYPE = 672; +pub const CKM_ACTI_KEY_GEN: CK_MECHANISM_TYPE = 673; +pub const CKM_SHA3_256: CK_MECHANISM_TYPE = 688; +pub const CKM_SHA3_256_HMAC: CK_MECHANISM_TYPE = 689; +pub const CKM_SHA3_256_HMAC_GENERAL: CK_MECHANISM_TYPE = 690; +pub const CKM_SHA3_256_KEY_GEN: CK_MECHANISM_TYPE = 691; +pub const CKM_SHA3_224: CK_MECHANISM_TYPE = 693; +pub const CKM_SHA3_224_HMAC: CK_MECHANISM_TYPE = 694; +pub const CKM_SHA3_224_HMAC_GENERAL: CK_MECHANISM_TYPE = 695; +pub const CKM_SHA3_224_KEY_GEN: CK_MECHANISM_TYPE = 696; +pub const CKM_SHA3_384: CK_MECHANISM_TYPE = 704; +pub const CKM_SHA3_384_HMAC: CK_MECHANISM_TYPE = 705; +pub const CKM_SHA3_384_HMAC_GENERAL: CK_MECHANISM_TYPE = 706; +pub const CKM_SHA3_384_KEY_GEN: CK_MECHANISM_TYPE = 707; +pub const CKM_SHA3_512: CK_MECHANISM_TYPE = 720; +pub const CKM_SHA3_512_HMAC: CK_MECHANISM_TYPE = 721; +pub const CKM_SHA3_512_HMAC_GENERAL: CK_MECHANISM_TYPE = 722; +pub const CKM_SHA3_512_KEY_GEN: CK_MECHANISM_TYPE = 723; +pub const CKM_CAST_KEY_GEN: CK_MECHANISM_TYPE = 768; +pub const CKM_CAST_ECB: CK_MECHANISM_TYPE = 769; +pub const CKM_CAST_CBC: CK_MECHANISM_TYPE = 770; +pub const CKM_CAST_MAC: CK_MECHANISM_TYPE = 771; +pub const CKM_CAST_MAC_GENERAL: CK_MECHANISM_TYPE = 772; +pub const CKM_CAST_CBC_PAD: CK_MECHANISM_TYPE = 773; +pub const CKM_CAST3_KEY_GEN: CK_MECHANISM_TYPE = 784; +pub const CKM_CAST3_ECB: CK_MECHANISM_TYPE = 785; +pub const CKM_CAST3_CBC: CK_MECHANISM_TYPE = 786; +pub const CKM_CAST3_MAC: CK_MECHANISM_TYPE = 787; +pub const CKM_CAST3_MAC_GENERAL: CK_MECHANISM_TYPE = 788; +pub const CKM_CAST3_CBC_PAD: CK_MECHANISM_TYPE = 789; +pub const CKM_CAST5_KEY_GEN: CK_MECHANISM_TYPE = 800; +pub const CKM_CAST128_KEY_GEN: CK_MECHANISM_TYPE = 800; +pub const CKM_CAST5_ECB: CK_MECHANISM_TYPE = 801; +pub const CKM_CAST128_ECB: CK_MECHANISM_TYPE = 801; +pub const CKM_CAST5_CBC: CK_MECHANISM_TYPE = 802; +pub const CKM_CAST128_CBC: CK_MECHANISM_TYPE = 802; +pub const CKM_CAST5_MAC: CK_MECHANISM_TYPE = 803; +pub const CKM_CAST128_MAC: CK_MECHANISM_TYPE = 803; +pub const CKM_CAST5_MAC_GENERAL: CK_MECHANISM_TYPE = 804; +pub const CKM_CAST128_MAC_GENERAL: CK_MECHANISM_TYPE = 804; +pub const CKM_CAST5_CBC_PAD: CK_MECHANISM_TYPE = 805; +pub const CKM_CAST128_CBC_PAD: CK_MECHANISM_TYPE = 805; +pub const CKM_RC5_KEY_GEN: CK_MECHANISM_TYPE = 816; +pub const CKM_RC5_ECB: CK_MECHANISM_TYPE = 817; +pub const CKM_RC5_CBC: CK_MECHANISM_TYPE = 818; +pub const CKM_RC5_MAC: CK_MECHANISM_TYPE = 819; +pub const CKM_RC5_MAC_GENERAL: CK_MECHANISM_TYPE = 820; +pub const CKM_RC5_CBC_PAD: CK_MECHANISM_TYPE = 821; +pub const CKM_IDEA_KEY_GEN: CK_MECHANISM_TYPE = 832; +pub const CKM_IDEA_ECB: CK_MECHANISM_TYPE = 833; +pub const CKM_IDEA_CBC: CK_MECHANISM_TYPE = 834; +pub const CKM_IDEA_MAC: CK_MECHANISM_TYPE = 835; +pub const CKM_IDEA_MAC_GENERAL: CK_MECHANISM_TYPE = 836; +pub const CKM_IDEA_CBC_PAD: CK_MECHANISM_TYPE = 837; +pub const CKM_GENERIC_SECRET_KEY_GEN: CK_MECHANISM_TYPE = 848; +pub const CKM_CONCATENATE_BASE_AND_KEY: CK_MECHANISM_TYPE = 864; +pub const CKM_CONCATENATE_BASE_AND_DATA: CK_MECHANISM_TYPE = 866; +pub const CKM_CONCATENATE_DATA_AND_BASE: CK_MECHANISM_TYPE = 867; +pub const CKM_XOR_BASE_AND_DATA: CK_MECHANISM_TYPE = 868; +pub const CKM_EXTRACT_KEY_FROM_KEY: CK_MECHANISM_TYPE = 869; +pub const CKM_SSL3_PRE_MASTER_KEY_GEN: CK_MECHANISM_TYPE = 880; +pub const CKM_SSL3_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 881; +pub const CKM_SSL3_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 882; +pub const CKM_SSL3_MASTER_KEY_DERIVE_DH: CK_MECHANISM_TYPE = 883; +pub const CKM_TLS_PRE_MASTER_KEY_GEN: CK_MECHANISM_TYPE = 884; +pub const CKM_TLS_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 885; +pub const CKM_TLS_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 886; +pub const CKM_TLS_MASTER_KEY_DERIVE_DH: CK_MECHANISM_TYPE = 887; +pub const CKM_TLS_PRF: CK_MECHANISM_TYPE = 888; +pub const CKM_SSL3_MD5_MAC: CK_MECHANISM_TYPE = 896; +pub const CKM_SSL3_SHA1_MAC: CK_MECHANISM_TYPE = 897; +pub const CKM_MD5_KEY_DERIVATION: CK_MECHANISM_TYPE = 912; +pub const CKM_MD2_KEY_DERIVATION: CK_MECHANISM_TYPE = 913; +pub const CKM_SHA1_KEY_DERIVATION: CK_MECHANISM_TYPE = 914; +pub const CKM_SHA256_KEY_DERIVATION: CK_MECHANISM_TYPE = 915; +pub const CKM_SHA384_KEY_DERIVATION: CK_MECHANISM_TYPE = 916; +pub const CKM_SHA512_KEY_DERIVATION: CK_MECHANISM_TYPE = 917; +pub const CKM_SHA224_KEY_DERIVATION: CK_MECHANISM_TYPE = 918; +pub const CKM_SHA3_256_KEY_DERIVATION: CK_MECHANISM_TYPE = 919; +pub const CKM_SHA3_224_KEY_DERIVATION: CK_MECHANISM_TYPE = 920; +pub const CKM_SHA3_384_KEY_DERIVATION: CK_MECHANISM_TYPE = 921; +pub const CKM_SHA3_512_KEY_DERIVATION: CK_MECHANISM_TYPE = 922; +pub const CKM_SHAKE_128_KEY_DERIVATION: CK_MECHANISM_TYPE = 923; +pub const CKM_SHAKE_256_KEY_DERIVATION: CK_MECHANISM_TYPE = 924; +pub const CKM_SHA3_256_KEY_DERIVE: CK_MECHANISM_TYPE = 919; +pub const CKM_SHA3_224_KEY_DERIVE: CK_MECHANISM_TYPE = 920; +pub const CKM_SHA3_384_KEY_DERIVE: CK_MECHANISM_TYPE = 921; +pub const CKM_SHA3_512_KEY_DERIVE: CK_MECHANISM_TYPE = 922; +pub const CKM_SHAKE_128_KEY_DERIVE: CK_MECHANISM_TYPE = 923; +pub const CKM_SHAKE_256_KEY_DERIVE: CK_MECHANISM_TYPE = 924; +pub const CKM_PBE_MD2_DES_CBC: CK_MECHANISM_TYPE = 928; +pub const CKM_PBE_MD5_DES_CBC: CK_MECHANISM_TYPE = 929; +pub const CKM_PBE_MD5_CAST_CBC: CK_MECHANISM_TYPE = 930; +pub const CKM_PBE_MD5_CAST3_CBC: CK_MECHANISM_TYPE = 931; +pub const CKM_PBE_MD5_CAST5_CBC: CK_MECHANISM_TYPE = 932; +pub const CKM_PBE_MD5_CAST128_CBC: CK_MECHANISM_TYPE = 932; +pub const CKM_PBE_SHA1_CAST5_CBC: CK_MECHANISM_TYPE = 933; +pub const CKM_PBE_SHA1_CAST128_CBC: CK_MECHANISM_TYPE = 933; +pub const CKM_PBE_SHA1_RC4_128: CK_MECHANISM_TYPE = 934; +pub const CKM_PBE_SHA1_RC4_40: CK_MECHANISM_TYPE = 935; +pub const CKM_PBE_SHA1_DES3_EDE_CBC: CK_MECHANISM_TYPE = 936; +pub const CKM_PBE_SHA1_DES2_EDE_CBC: CK_MECHANISM_TYPE = 937; +pub const CKM_PBE_SHA1_RC2_128_CBC: CK_MECHANISM_TYPE = 938; +pub const CKM_PBE_SHA1_RC2_40_CBC: CK_MECHANISM_TYPE = 939; +pub const CKM_PKCS5_PBKD2: CK_MECHANISM_TYPE = 944; +pub const CKM_PBA_SHA1_WITH_SHA1_HMAC: CK_MECHANISM_TYPE = 960; +pub const CKM_WTLS_PRE_MASTER_KEY_GEN: CK_MECHANISM_TYPE = 976; +pub const CKM_WTLS_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 977; +pub const CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC: CK_MECHANISM_TYPE = 978; +pub const CKM_WTLS_PRF: CK_MECHANISM_TYPE = 979; +pub const CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 980; +pub const CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 981; +pub const CKM_TLS10_MAC_SERVER: CK_MECHANISM_TYPE = 982; +pub const CKM_TLS10_MAC_CLIENT: CK_MECHANISM_TYPE = 983; +pub const CKM_TLS12_MAC: CK_MECHANISM_TYPE = 984; +pub const CKM_TLS12_KDF: CK_MECHANISM_TYPE = 985; +pub const CKM_TLS12_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 992; +pub const CKM_TLS12_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 993; +pub const CKM_TLS12_MASTER_KEY_DERIVE_DH: CK_MECHANISM_TYPE = 994; +pub const CKM_TLS12_KEY_SAFE_DERIVE: CK_MECHANISM_TYPE = 995; +pub const CKM_TLS_MAC: CK_MECHANISM_TYPE = 996; +pub const CKM_TLS_KDF: CK_MECHANISM_TYPE = 997; +pub const CKM_KEY_WRAP_LYNKS: CK_MECHANISM_TYPE = 1024; +pub const CKM_KEY_WRAP_SET_OAEP: CK_MECHANISM_TYPE = 1025; +pub const CKM_CMS_SIG: CK_MECHANISM_TYPE = 1280; +pub const CKM_KIP_DERIVE: CK_MECHANISM_TYPE = 1296; +pub const CKM_KIP_WRAP: CK_MECHANISM_TYPE = 1297; +pub const CKM_KIP_MAC: CK_MECHANISM_TYPE = 1298; +pub const CKM_CAMELLIA_KEY_GEN: CK_MECHANISM_TYPE = 1360; +pub const CKM_CAMELLIA_ECB: CK_MECHANISM_TYPE = 1361; +pub const CKM_CAMELLIA_CBC: CK_MECHANISM_TYPE = 1362; +pub const CKM_CAMELLIA_MAC: CK_MECHANISM_TYPE = 1363; +pub const CKM_CAMELLIA_MAC_GENERAL: CK_MECHANISM_TYPE = 1364; +pub const CKM_CAMELLIA_CBC_PAD: CK_MECHANISM_TYPE = 1365; +pub const CKM_CAMELLIA_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1366; +pub const CKM_CAMELLIA_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1367; +pub const CKM_CAMELLIA_CTR: CK_MECHANISM_TYPE = 1368; +pub const CKM_ARIA_KEY_GEN: CK_MECHANISM_TYPE = 1376; +pub const CKM_ARIA_ECB: CK_MECHANISM_TYPE = 1377; +pub const CKM_ARIA_CBC: CK_MECHANISM_TYPE = 1378; +pub const CKM_ARIA_MAC: CK_MECHANISM_TYPE = 1379; +pub const CKM_ARIA_MAC_GENERAL: CK_MECHANISM_TYPE = 1380; +pub const CKM_ARIA_CBC_PAD: CK_MECHANISM_TYPE = 1381; +pub const CKM_ARIA_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1382; +pub const CKM_ARIA_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1383; +pub const CKM_SEED_KEY_GEN: CK_MECHANISM_TYPE = 1616; +pub const CKM_SEED_ECB: CK_MECHANISM_TYPE = 1617; +pub const CKM_SEED_CBC: CK_MECHANISM_TYPE = 1618; +pub const CKM_SEED_MAC: CK_MECHANISM_TYPE = 1619; +pub const CKM_SEED_MAC_GENERAL: CK_MECHANISM_TYPE = 1620; +pub const CKM_SEED_CBC_PAD: CK_MECHANISM_TYPE = 1621; +pub const CKM_SEED_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1622; +pub const CKM_SEED_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1623; +pub const CKM_SKIPJACK_KEY_GEN: CK_MECHANISM_TYPE = 4096; +pub const CKM_SKIPJACK_ECB64: CK_MECHANISM_TYPE = 4097; +pub const CKM_SKIPJACK_CBC64: CK_MECHANISM_TYPE = 4098; +pub const CKM_SKIPJACK_OFB64: CK_MECHANISM_TYPE = 4099; +pub const CKM_SKIPJACK_CFB64: CK_MECHANISM_TYPE = 4100; +pub const CKM_SKIPJACK_CFB32: CK_MECHANISM_TYPE = 4101; +pub const CKM_SKIPJACK_CFB16: CK_MECHANISM_TYPE = 4102; +pub const CKM_SKIPJACK_CFB8: CK_MECHANISM_TYPE = 4103; +pub const CKM_SKIPJACK_WRAP: CK_MECHANISM_TYPE = 4104; +pub const CKM_SKIPJACK_PRIVATE_WRAP: CK_MECHANISM_TYPE = 4105; +pub const CKM_SKIPJACK_RELAYX: CK_MECHANISM_TYPE = 4106; +pub const CKM_KEA_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4112; +pub const CKM_KEA_KEY_DERIVE: CK_MECHANISM_TYPE = 4113; +pub const CKM_KEA_DERIVE: CK_MECHANISM_TYPE = 4114; +pub const CKM_FORTEZZA_TIMESTAMP: CK_MECHANISM_TYPE = 4128; +pub const CKM_BATON_KEY_GEN: CK_MECHANISM_TYPE = 4144; +pub const CKM_BATON_ECB128: CK_MECHANISM_TYPE = 4145; +pub const CKM_BATON_ECB96: CK_MECHANISM_TYPE = 4146; +pub const CKM_BATON_CBC128: CK_MECHANISM_TYPE = 4147; +pub const CKM_BATON_COUNTER: CK_MECHANISM_TYPE = 4148; +pub const CKM_BATON_SHUFFLE: CK_MECHANISM_TYPE = 4149; +pub const CKM_BATON_WRAP: CK_MECHANISM_TYPE = 4150; +pub const CKM_ECDSA_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4160; +pub const CKM_EC_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4160; +pub const CKM_ECDSA: CK_MECHANISM_TYPE = 4161; +pub const CKM_ECDSA_SHA1: CK_MECHANISM_TYPE = 4162; +pub const CKM_ECDSA_SHA224: CK_MECHANISM_TYPE = 4163; +pub const CKM_ECDSA_SHA256: CK_MECHANISM_TYPE = 4164; +pub const CKM_ECDSA_SHA384: CK_MECHANISM_TYPE = 4165; +pub const CKM_ECDSA_SHA512: CK_MECHANISM_TYPE = 4166; +pub const CKM_EC_KEY_PAIR_GEN_W_EXTRA_BITS: CK_MECHANISM_TYPE = 5131; +pub const CKM_ECDH1_DERIVE: CK_MECHANISM_TYPE = 4176; +pub const CKM_ECDH1_COFACTOR_DERIVE: CK_MECHANISM_TYPE = 4177; +pub const CKM_ECMQV_DERIVE: CK_MECHANISM_TYPE = 4178; +pub const CKM_ECDH_AES_KEY_WRAP: CK_MECHANISM_TYPE = 4179; +pub const CKM_RSA_AES_KEY_WRAP: CK_MECHANISM_TYPE = 4180; +pub const CKM_JUNIPER_KEY_GEN: CK_MECHANISM_TYPE = 4192; +pub const CKM_JUNIPER_ECB128: CK_MECHANISM_TYPE = 4193; +pub const CKM_JUNIPER_CBC128: CK_MECHANISM_TYPE = 4194; +pub const CKM_JUNIPER_COUNTER: CK_MECHANISM_TYPE = 4195; +pub const CKM_JUNIPER_SHUFFLE: CK_MECHANISM_TYPE = 4196; +pub const CKM_JUNIPER_WRAP: CK_MECHANISM_TYPE = 4197; +pub const CKM_FASTHASH: CK_MECHANISM_TYPE = 4208; +pub const CKM_AES_XTS: CK_MECHANISM_TYPE = 4209; +pub const CKM_AES_XTS_KEY_GEN: CK_MECHANISM_TYPE = 4210; +pub const CKM_AES_KEY_GEN: CK_MECHANISM_TYPE = 4224; +pub const CKM_AES_ECB: CK_MECHANISM_TYPE = 4225; +pub const CKM_AES_CBC: CK_MECHANISM_TYPE = 4226; +pub const CKM_AES_MAC: CK_MECHANISM_TYPE = 4227; +pub const CKM_AES_MAC_GENERAL: CK_MECHANISM_TYPE = 4228; +pub const CKM_AES_CBC_PAD: CK_MECHANISM_TYPE = 4229; +pub const CKM_AES_CTR: CK_MECHANISM_TYPE = 4230; +pub const CKM_AES_GCM: CK_MECHANISM_TYPE = 4231; +pub const CKM_AES_CCM: CK_MECHANISM_TYPE = 4232; +pub const CKM_AES_CTS: CK_MECHANISM_TYPE = 4233; +pub const CKM_AES_CMAC: CK_MECHANISM_TYPE = 4234; +pub const CKM_AES_CMAC_GENERAL: CK_MECHANISM_TYPE = 4235; +pub const CKM_AES_XCBC_MAC: CK_MECHANISM_TYPE = 4236; +pub const CKM_AES_XCBC_MAC_96: CK_MECHANISM_TYPE = 4237; +pub const CKM_AES_GMAC: CK_MECHANISM_TYPE = 4238; +pub const CKM_BLOWFISH_KEY_GEN: CK_MECHANISM_TYPE = 4240; +pub const CKM_BLOWFISH_CBC: CK_MECHANISM_TYPE = 4241; +pub const CKM_TWOFISH_KEY_GEN: CK_MECHANISM_TYPE = 4242; +pub const CKM_TWOFISH_CBC: CK_MECHANISM_TYPE = 4243; +pub const CKM_BLOWFISH_CBC_PAD: CK_MECHANISM_TYPE = 4244; +pub const CKM_TWOFISH_CBC_PAD: CK_MECHANISM_TYPE = 4245; +pub const CKM_DES_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4352; +pub const CKM_DES_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4353; +pub const CKM_DES3_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4354; +pub const CKM_DES3_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4355; +pub const CKM_AES_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4356; +pub const CKM_AES_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4357; +pub const CKM_GOSTR3410_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4608; +pub const CKM_GOSTR3410: CK_MECHANISM_TYPE = 4609; +pub const CKM_GOSTR3410_WITH_GOSTR3411: CK_MECHANISM_TYPE = 4610; +pub const CKM_GOSTR3410_KEY_WRAP: CK_MECHANISM_TYPE = 4611; +pub const CKM_GOSTR3410_DERIVE: CK_MECHANISM_TYPE = 4612; +pub const CKM_GOSTR3411: CK_MECHANISM_TYPE = 4624; +pub const CKM_GOSTR3411_HMAC: CK_MECHANISM_TYPE = 4625; +pub const CKM_GOST28147_KEY_GEN: CK_MECHANISM_TYPE = 4640; +pub const CKM_GOST28147_ECB: CK_MECHANISM_TYPE = 4641; +pub const CKM_GOST28147: CK_MECHANISM_TYPE = 4642; +pub const CKM_GOST28147_MAC: CK_MECHANISM_TYPE = 4643; +pub const CKM_GOST28147_KEY_WRAP: CK_MECHANISM_TYPE = 4644; +pub const CKM_CHACHA20_KEY_GEN: CK_MECHANISM_TYPE = 4645; +pub const CKM_CHACHA20: CK_MECHANISM_TYPE = 4646; +pub const CKM_POLY1305_KEY_GEN: CK_MECHANISM_TYPE = 4647; +pub const CKM_POLY1305: CK_MECHANISM_TYPE = 4648; +pub const CKM_DSA_PARAMETER_GEN: CK_MECHANISM_TYPE = 8192; +pub const CKM_DH_PKCS_PARAMETER_GEN: CK_MECHANISM_TYPE = 8193; +pub const CKM_X9_42_DH_PARAMETER_GEN: CK_MECHANISM_TYPE = 8194; +pub const CKM_DSA_PROBABILISTIC_PARAMETER_GEN: CK_MECHANISM_TYPE = 8195; +pub const CKM_DSA_PROBABLISTIC_PARAMETER_GEN: CK_MECHANISM_TYPE = 8195; +pub const CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN: CK_MECHANISM_TYPE = 8196; +pub const CKM_DSA_FIPS_G_GEN: CK_MECHANISM_TYPE = 8197; +pub const CKM_AES_OFB: CK_MECHANISM_TYPE = 8452; +pub const CKM_AES_CFB64: CK_MECHANISM_TYPE = 8453; +pub const CKM_AES_CFB8: CK_MECHANISM_TYPE = 8454; +pub const CKM_AES_CFB128: CK_MECHANISM_TYPE = 8455; +pub const CKM_AES_CFB1: CK_MECHANISM_TYPE = 8456; +pub const CKM_AES_KEY_WRAP: CK_MECHANISM_TYPE = 8457; +pub const CKM_AES_KEY_WRAP_PAD: CK_MECHANISM_TYPE = 8458; +pub const CKM_AES_KEY_WRAP_KWP: CK_MECHANISM_TYPE = 8459; +pub const CKM_AES_KEY_WRAP_PKCS7: CK_MECHANISM_TYPE = 8460; +pub const CKM_RSA_PKCS_TPM_1_1: CK_MECHANISM_TYPE = 16385; +pub const CKM_RSA_PKCS_OAEP_TPM_1_1: CK_MECHANISM_TYPE = 16386; +pub const CKM_SHA_1_KEY_GEN: CK_MECHANISM_TYPE = 16387; +pub const CKM_SHA224_KEY_GEN: CK_MECHANISM_TYPE = 16388; +pub const CKM_SHA256_KEY_GEN: CK_MECHANISM_TYPE = 16389; +pub const CKM_SHA384_KEY_GEN: CK_MECHANISM_TYPE = 16390; +pub const CKM_SHA512_KEY_GEN: CK_MECHANISM_TYPE = 16391; +pub const CKM_SHA512_224_KEY_GEN: CK_MECHANISM_TYPE = 16392; +pub const CKM_SHA512_256_KEY_GEN: CK_MECHANISM_TYPE = 16393; +pub const CKM_SHA512_T_KEY_GEN: CK_MECHANISM_TYPE = 16394; +pub const CKM_NULL: CK_MECHANISM_TYPE = 16395; +pub const CKM_BLAKE2B_160: CK_MECHANISM_TYPE = 16396; +pub const CKM_BLAKE2B_160_HMAC: CK_MECHANISM_TYPE = 16397; +pub const CKM_BLAKE2B_160_HMAC_GENERAL: CK_MECHANISM_TYPE = 16398; +pub const CKM_BLAKE2B_160_KEY_DERIVE: CK_MECHANISM_TYPE = 16399; +pub const CKM_BLAKE2B_160_KEY_GEN: CK_MECHANISM_TYPE = 16400; +pub const CKM_BLAKE2B_256: CK_MECHANISM_TYPE = 16401; +pub const CKM_BLAKE2B_256_HMAC: CK_MECHANISM_TYPE = 16402; +pub const CKM_BLAKE2B_256_HMAC_GENERAL: CK_MECHANISM_TYPE = 16403; +pub const CKM_BLAKE2B_256_KEY_DERIVE: CK_MECHANISM_TYPE = 16404; +pub const CKM_BLAKE2B_256_KEY_GEN: CK_MECHANISM_TYPE = 16405; +pub const CKM_BLAKE2B_384: CK_MECHANISM_TYPE = 16406; +pub const CKM_BLAKE2B_384_HMAC: CK_MECHANISM_TYPE = 16407; +pub const CKM_BLAKE2B_384_HMAC_GENERAL: CK_MECHANISM_TYPE = 16408; +pub const CKM_BLAKE2B_384_KEY_DERIVE: CK_MECHANISM_TYPE = 16409; +pub const CKM_BLAKE2B_384_KEY_GEN: CK_MECHANISM_TYPE = 16410; +pub const CKM_BLAKE2B_512: CK_MECHANISM_TYPE = 16411; +pub const CKM_BLAKE2B_512_HMAC: CK_MECHANISM_TYPE = 16412; +pub const CKM_BLAKE2B_512_HMAC_GENERAL: CK_MECHANISM_TYPE = 16413; +pub const CKM_BLAKE2B_512_KEY_DERIVE: CK_MECHANISM_TYPE = 16414; +pub const CKM_BLAKE2B_512_KEY_GEN: CK_MECHANISM_TYPE = 16415; +pub const CKM_SALSA20: CK_MECHANISM_TYPE = 16416; +pub const CKM_CHACHA20_POLY1305: CK_MECHANISM_TYPE = 16417; +pub const CKM_SALSA20_POLY1305: CK_MECHANISM_TYPE = 16418; +pub const CKM_X3DH_INITIALIZE: CK_MECHANISM_TYPE = 16419; +pub const CKM_X3DH_RESPOND: CK_MECHANISM_TYPE = 16420; +pub const CKM_X2RATCHET_INITIALIZE: CK_MECHANISM_TYPE = 16421; +pub const CKM_X2RATCHET_RESPOND: CK_MECHANISM_TYPE = 16422; +pub const CKM_X2RATCHET_ENCRYPT: CK_MECHANISM_TYPE = 16423; +pub const CKM_X2RATCHET_DECRYPT: CK_MECHANISM_TYPE = 16424; +pub const CKM_XEDDSA: CK_MECHANISM_TYPE = 16425; +pub const CKM_HKDF_DERIVE: CK_MECHANISM_TYPE = 16426; +pub const CKM_HKDF_DATA: CK_MECHANISM_TYPE = 16427; +pub const CKM_HKDF_KEY_GEN: CK_MECHANISM_TYPE = 16428; +pub const CKM_SALSA20_KEY_GEN: CK_MECHANISM_TYPE = 16429; +pub const CKM_ECDSA_SHA3_224: CK_MECHANISM_TYPE = 4167; +pub const CKM_ECDSA_SHA3_256: CK_MECHANISM_TYPE = 4168; +pub const CKM_ECDSA_SHA3_384: CK_MECHANISM_TYPE = 4169; +pub const CKM_ECDSA_SHA3_512: CK_MECHANISM_TYPE = 4170; +pub const CKM_EC_EDWARDS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4181; +pub const CKM_EC_MONTGOMERY_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4182; +pub const CKM_EDDSA: CK_MECHANISM_TYPE = 4183; +pub const CKM_SP800_108_COUNTER_KDF: CK_MECHANISM_TYPE = 940; +pub const CKM_SP800_108_FEEDBACK_KDF: CK_MECHANISM_TYPE = 941; +pub const CKM_SP800_108_DOUBLE_PIPELINE_KDF: CK_MECHANISM_TYPE = 942; +pub const CKM_IKE2_PRF_PLUS_DERIVE: CK_MECHANISM_TYPE = 16430; +pub const CKM_IKE_PRF_DERIVE: CK_MECHANISM_TYPE = 16431; +pub const CKM_IKE1_PRF_DERIVE: CK_MECHANISM_TYPE = 16432; +pub const CKM_IKE1_EXTENDED_DERIVE: CK_MECHANISM_TYPE = 16433; +pub const CKM_HSS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 16434; +pub const CKM_HSS: CK_MECHANISM_TYPE = 16435; +pub const CKM_VENDOR_DEFINED: CK_MECHANISM_TYPE = 2147483648; +pub const CKF_HW: CK_FLAGS = 1; +pub const CKF_MESSAGE_ENCRYPT: CK_FLAGS = 2; +pub const CKF_MESSAGE_DECRYPT: CK_FLAGS = 4; +pub const CKF_MESSAGE_SIGN: CK_FLAGS = 8; +pub const CKF_MESSAGE_VERIFY: CK_FLAGS = 16; +pub const CKF_MULTI_MESSAGE: CK_FLAGS = 32; +pub const CKF_MULTI_MESSGE: CK_FLAGS = 32; +pub const CKF_FIND_OBJECTS: CK_FLAGS = 64; +pub const CKF_ENCRYPT: CK_FLAGS = 256; +pub const CKF_DECRYPT: CK_FLAGS = 512; +pub const CKF_DIGEST: CK_FLAGS = 1024; +pub const CKF_SIGN: CK_FLAGS = 2048; +pub const CKF_SIGN_RECOVER: CK_FLAGS = 4096; +pub const CKF_VERIFY: CK_FLAGS = 8192; +pub const CKF_VERIFY_RECOVER: CK_FLAGS = 16384; +pub const CKF_GENERATE: CK_FLAGS = 32768; +pub const CKF_GENERATE_KEY_PAIR: CK_FLAGS = 65536; +pub const CKF_WRAP: CK_FLAGS = 131072; +pub const CKF_UNWRAP: CK_FLAGS = 262144; +pub const CKF_DERIVE: CK_FLAGS = 524288; +pub const CKF_EC_F_P: CK_FLAGS = 1048576; +pub const CKF_EC_F_2M: CK_FLAGS = 2097152; +pub const CKF_EC_ECPARAMETERS: CK_FLAGS = 4194304; +pub const CKF_EC_OID: CK_FLAGS = 8388608; +pub const CKF_EC_NAMEDCURVE: CK_FLAGS = 8388608; +pub const CKF_EC_UNCOMPRESS: CK_FLAGS = 16777216; +pub const CKF_EC_COMPRESS: CK_FLAGS = 33554432; +pub const CKF_EC_CURVENAME: CK_FLAGS = 67108864; +pub const CKF_EXTENSION: CK_FLAGS = 2147483648; +pub const CKR_OK: CK_RV = 0; +pub const CKR_CANCEL: CK_RV = 1; +pub const CKR_HOST_MEMORY: CK_RV = 2; +pub const CKR_SLOT_ID_INVALID: CK_RV = 3; +pub const CKR_GENERAL_ERROR: CK_RV = 5; +pub const CKR_FUNCTION_FAILED: CK_RV = 6; +pub const CKR_ARGUMENTS_BAD: CK_RV = 7; +pub const CKR_NO_EVENT: CK_RV = 8; +pub const CKR_NEED_TO_CREATE_THREADS: CK_RV = 9; +pub const CKR_CANT_LOCK: CK_RV = 10; +pub const CKR_ATTRIBUTE_READ_ONLY: CK_RV = 16; +pub const CKR_ATTRIBUTE_SENSITIVE: CK_RV = 17; +pub const CKR_ATTRIBUTE_TYPE_INVALID: CK_RV = 18; +pub const CKR_ATTRIBUTE_VALUE_INVALID: CK_RV = 19; +pub const CKR_ACTION_PROHIBITED: CK_RV = 27; +pub const CKR_DATA_INVALID: CK_RV = 32; +pub const CKR_DATA_LEN_RANGE: CK_RV = 33; +pub const CKR_DEVICE_ERROR: CK_RV = 48; +pub const CKR_DEVICE_MEMORY: CK_RV = 49; +pub const CKR_DEVICE_REMOVED: CK_RV = 50; +pub const CKR_ENCRYPTED_DATA_INVALID: CK_RV = 64; +pub const CKR_ENCRYPTED_DATA_LEN_RANGE: CK_RV = 65; +pub const CKR_AEAD_DECRYPT_FAILED: CK_RV = 66; +pub const CKR_FUNCTION_CANCELED: CK_RV = 80; +pub const CKR_FUNCTION_NOT_PARALLEL: CK_RV = 81; +pub const CKR_FUNCTION_NOT_SUPPORTED: CK_RV = 84; +pub const CKR_KEY_HANDLE_INVALID: CK_RV = 96; +pub const CKR_KEY_SIZE_RANGE: CK_RV = 98; +pub const CKR_KEY_TYPE_INCONSISTENT: CK_RV = 99; +pub const CKR_KEY_NOT_NEEDED: CK_RV = 100; +pub const CKR_KEY_CHANGED: CK_RV = 101; +pub const CKR_KEY_NEEDED: CK_RV = 102; +pub const CKR_KEY_INDIGESTIBLE: CK_RV = 103; +pub const CKR_KEY_FUNCTION_NOT_PERMITTED: CK_RV = 104; +pub const CKR_KEY_NOT_WRAPPABLE: CK_RV = 105; +pub const CKR_KEY_UNEXTRACTABLE: CK_RV = 106; +pub const CKR_MECHANISM_INVALID: CK_RV = 112; +pub const CKR_MECHANISM_PARAM_INVALID: CK_RV = 113; +pub const CKR_OBJECT_HANDLE_INVALID: CK_RV = 130; +pub const CKR_OPERATION_ACTIVE: CK_RV = 144; +pub const CKR_OPERATION_NOT_INITIALIZED: CK_RV = 145; +pub const CKR_PIN_INCORRECT: CK_RV = 160; +pub const CKR_PIN_INVALID: CK_RV = 161; +pub const CKR_PIN_LEN_RANGE: CK_RV = 162; +pub const CKR_PIN_EXPIRED: CK_RV = 163; +pub const CKR_PIN_LOCKED: CK_RV = 164; +pub const CKR_SESSION_CLOSED: CK_RV = 176; +pub const CKR_SESSION_COUNT: CK_RV = 177; +pub const CKR_SESSION_HANDLE_INVALID: CK_RV = 179; +pub const CKR_SESSION_PARALLEL_NOT_SUPPORTED: CK_RV = 180; +pub const CKR_SESSION_READ_ONLY: CK_RV = 181; +pub const CKR_SESSION_EXISTS: CK_RV = 182; +pub const CKR_SESSION_READ_ONLY_EXISTS: CK_RV = 183; +pub const CKR_SESSION_READ_WRITE_SO_EXISTS: CK_RV = 184; +pub const CKR_SIGNATURE_INVALID: CK_RV = 192; +pub const CKR_SIGNATURE_LEN_RANGE: CK_RV = 193; +pub const CKR_TEMPLATE_INCOMPLETE: CK_RV = 208; +pub const CKR_TEMPLATE_INCONSISTENT: CK_RV = 209; +pub const CKR_TOKEN_NOT_PRESENT: CK_RV = 224; +pub const CKR_TOKEN_NOT_RECOGNIZED: CK_RV = 225; +pub const CKR_TOKEN_WRITE_PROTECTED: CK_RV = 226; +pub const CKR_UNWRAPPING_KEY_HANDLE_INVALID: CK_RV = 240; +pub const CKR_UNWRAPPING_KEY_SIZE_RANGE: CK_RV = 241; +pub const CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT: CK_RV = 242; +pub const CKR_USER_ALREADY_LOGGED_IN: CK_RV = 256; +pub const CKR_USER_NOT_LOGGED_IN: CK_RV = 257; +pub const CKR_USER_PIN_NOT_INITIALIZED: CK_RV = 258; +pub const CKR_USER_TYPE_INVALID: CK_RV = 259; +pub const CKR_USER_ANOTHER_ALREADY_LOGGED_IN: CK_RV = 260; +pub const CKR_USER_TOO_MANY_TYPES: CK_RV = 261; +pub const CKR_WRAPPED_KEY_INVALID: CK_RV = 272; +pub const CKR_WRAPPED_KEY_LEN_RANGE: CK_RV = 274; +pub const CKR_WRAPPING_KEY_HANDLE_INVALID: CK_RV = 275; +pub const CKR_WRAPPING_KEY_SIZE_RANGE: CK_RV = 276; +pub const CKR_WRAPPING_KEY_TYPE_INCONSISTENT: CK_RV = 277; +pub const CKR_RANDOM_SEED_NOT_SUPPORTED: CK_RV = 288; +pub const CKR_RANDOM_NO_RNG: CK_RV = 289; +pub const CKR_DOMAIN_PARAMS_INVALID: CK_RV = 304; +pub const CKR_CURVE_NOT_SUPPORTED: CK_RV = 320; +pub const CKR_BUFFER_TOO_SMALL: CK_RV = 336; +pub const CKR_SAVED_STATE_INVALID: CK_RV = 352; +pub const CKR_INFORMATION_SENSITIVE: CK_RV = 368; +pub const CKR_STATE_UNSAVEABLE: CK_RV = 384; +pub const CKR_CRYPTOKI_NOT_INITIALIZED: CK_RV = 400; +pub const CKR_CRYPTOKI_ALREADY_INITIALIZED: CK_RV = 401; +pub const CKR_MUTEX_BAD: CK_RV = 416; +pub const CKR_MUTEX_NOT_LOCKED: CK_RV = 417; +pub const CKR_NEW_PIN_MODE: CK_RV = 432; +pub const CKR_NEXT_OTP: CK_RV = 433; +pub const CKR_EXCEEDED_MAX_ITERATIONS: CK_RV = 437; +pub const CKR_FIPS_SELF_TEST_FAILED: CK_RV = 438; +pub const CKR_LIBRARY_LOAD_FAILED: CK_RV = 439; +pub const CKR_PIN_TOO_WEAK: CK_RV = 440; +pub const CKR_PUBLIC_KEY_INVALID: CK_RV = 441; +pub const CKR_FUNCTION_REJECTED: CK_RV = 512; +pub const CKR_TOKEN_RESOURCE_EXCEEDED: CK_RV = 513; +pub const CKR_OPERATION_CANCEL_FAILED: CK_RV = 514; +pub const CKR_KEY_EXHAUSTED: CK_RV = 515; +pub const CKR_VENDOR_DEFINED: CK_RV = 2147483648; +pub const CKF_END_OF_MESSAGE: CK_FLAGS = 1; +pub const CKF_INTERFACE_FORK_SAFE: CK_FLAGS = 1; +pub const CKF_LIBRARY_CANT_CREATE_OS_THREADS: CK_FLAGS = 1; +pub const CKF_OS_LOCKING_OK: CK_FLAGS = 2; +pub const CKF_DONT_BLOCK: CK_FLAGS = 1; +pub const CKG_MGF1_SHA1: CK_RSA_PKCS_MGF_TYPE = 1; +pub const CKG_MGF1_SHA256: CK_RSA_PKCS_MGF_TYPE = 2; +pub const CKG_MGF1_SHA384: CK_RSA_PKCS_MGF_TYPE = 3; +pub const CKG_MGF1_SHA512: CK_RSA_PKCS_MGF_TYPE = 4; +pub const CKG_MGF1_SHA224: CK_RSA_PKCS_MGF_TYPE = 5; +pub const CKG_MGF1_SHA3_224: CK_RSA_PKCS_MGF_TYPE = 6; +pub const CKG_MGF1_SHA3_256: CK_RSA_PKCS_MGF_TYPE = 7; +pub const CKG_MGF1_SHA3_384: CK_RSA_PKCS_MGF_TYPE = 8; +pub const CKG_MGF1_SHA3_512: CK_RSA_PKCS_MGF_TYPE = 9; +pub const CKZ_DATA_SPECIFIED: CK_RSA_PKCS_OAEP_SOURCE_TYPE = 1; +pub const CKD_NULL: CK_EC_KDF_TYPE = 1; +pub const CKD_SHA1_KDF: CK_EC_KDF_TYPE = 2; +pub const CKD_SHA1_KDF_ASN1: CK_EC_KDF_TYPE = 3; +pub const CKD_SHA1_KDF_CONCATENATE: CK_EC_KDF_TYPE = 4; +pub const CKD_SHA224_KDF: CK_EC_KDF_TYPE = 5; +pub const CKD_SHA256_KDF: CK_EC_KDF_TYPE = 6; +pub const CKD_SHA384_KDF: CK_EC_KDF_TYPE = 7; +pub const CKD_SHA512_KDF: CK_EC_KDF_TYPE = 8; +pub const CKD_CPDIVERSIFY_KDF: CK_EC_KDF_TYPE = 9; +pub const CKD_SHA3_224_KDF: CK_EC_KDF_TYPE = 10; +pub const CKD_SHA3_256_KDF: CK_EC_KDF_TYPE = 11; +pub const CKD_SHA3_384_KDF: CK_EC_KDF_TYPE = 12; +pub const CKD_SHA3_512_KDF: CK_EC_KDF_TYPE = 13; +pub const CKD_SHA1_KDF_SP800: CK_EC_KDF_TYPE = 14; +pub const CKD_SHA224_KDF_SP800: CK_EC_KDF_TYPE = 15; +pub const CKD_SHA256_KDF_SP800: CK_EC_KDF_TYPE = 16; +pub const CKD_SHA384_KDF_SP800: CK_EC_KDF_TYPE = 17; +pub const CKD_SHA512_KDF_SP800: CK_EC_KDF_TYPE = 18; +pub const CKD_SHA3_224_KDF_SP800: CK_EC_KDF_TYPE = 19; +pub const CKD_SHA3_256_KDF_SP800: CK_EC_KDF_TYPE = 20; +pub const CKD_SHA3_384_KDF_SP800: CK_EC_KDF_TYPE = 21; +pub const CKD_SHA3_512_KDF_SP800: CK_EC_KDF_TYPE = 22; +pub const CKD_BLAKE2B_160_KDF: CK_EC_KDF_TYPE = 23; +pub const CKD_BLAKE2B_256_KDF: CK_EC_KDF_TYPE = 24; +pub const CKD_BLAKE2B_384_KDF: CK_EC_KDF_TYPE = 25; +pub const CKD_BLAKE2B_512_KDF: CK_EC_KDF_TYPE = 26; +pub const CKP_PKCS5_PBKD2_HMAC_SHA1: CK_PROFILE_ID = 1; +pub const CKP_PKCS5_PBKD2_HMAC_GOSTR3411: CK_PROFILE_ID = 2; +pub const CKP_PKCS5_PBKD2_HMAC_SHA224: CK_PROFILE_ID = 3; +pub const CKP_PKCS5_PBKD2_HMAC_SHA256: CK_PROFILE_ID = 4; +pub const CKP_PKCS5_PBKD2_HMAC_SHA384: CK_PROFILE_ID = 5; +pub const CKP_PKCS5_PBKD2_HMAC_SHA512: CK_PROFILE_ID = 6; +pub const CKP_PKCS5_PBKD2_HMAC_SHA512_224: CK_PROFILE_ID = 7; +pub const CKP_PKCS5_PBKD2_HMAC_SHA512_256: CK_PROFILE_ID = 8; +pub const CKZ_SALT_SPECIFIED: CK_RSA_PKCS_OAEP_SOURCE_TYPE = 1; +pub const CK_OTP_VALUE: CK_ULONG = 0; +pub const CK_OTP_PIN: CK_ULONG = 1; +pub const CK_OTP_CHALLENGE: CK_ULONG = 2; +pub const CK_OTP_TIME: CK_ULONG = 3; +pub const CK_OTP_COUNTER: CK_ULONG = 4; +pub const CK_OTP_FLAGS: CK_ULONG = 5; +pub const CK_OTP_OUTPUT_LENGTH: CK_ULONG = 6; +pub const CK_OTP_OUTPUT_FORMAT: CK_ULONG = 7; +pub const CKF_NEXT_OTP: CK_FLAGS = 1; +pub const CKF_EXCLUDE_TIME: CK_FLAGS = 2; +pub const CKF_EXCLUDE_COUNTER: CK_FLAGS = 4; +pub const CKF_EXCLUDE_CHALLENGE: CK_FLAGS = 8; +pub const CKF_EXCLUDE_PIN: CK_FLAGS = 16; +pub const CKF_USER_FRIENDLY_OTP: CK_FLAGS = 32; +pub const CKG_NO_GENERATE: CK_GENERATOR_FUNCTION = 0; +pub const CKG_GENERATE: CK_GENERATOR_FUNCTION = 1; +pub const CKG_GENERATE_COUNTER: CK_GENERATOR_FUNCTION = 2; +pub const CKG_GENERATE_RANDOM: CK_GENERATOR_FUNCTION = 3; +pub const CKG_GENERATE_COUNTER_XOR: CK_GENERATOR_FUNCTION = 4; +pub const CK_SP800_108_ITERATION_VARIABLE: CK_ULONG = 1; +pub const CK_SP800_108_OPTIONAL_COUNTER: CK_ULONG = 2; +pub const CK_SP800_108_DKM_LENGTH: CK_ULONG = 3; +pub const CK_SP800_108_BYTE_ARRAY: CK_ULONG = 4; +pub const CK_SP800_108_COUNTER: CK_ULONG = 2; +pub const CK_SP800_108_DKM_LENGTH_SUM_OF_KEYS: CK_ULONG = 1; +pub const CK_SP800_108_DKM_LENGTH_SUM_OF_SEGMENTS: CK_ULONG = 2; +pub const CKF_HKDF_SALT_NULL: CK_FLAGS = 1; +pub const CKF_HKDF_SALT_DATA: CK_FLAGS = 2; +pub const CKF_HKDF_SALT_KEY: CK_FLAGS = 4; +pub const CK_NEED_ARG_LIST: CK_ULONG = 1; +pub const CK_PKCS11_2_0_ONLY: CK_ULONG = 1; +pub type CK_BYTE = ::std::os::raw::c_uchar; +pub type CK_CHAR = CK_BYTE; +pub type CK_UTF8CHAR = CK_BYTE; +pub type CK_BBOOL = CK_BYTE; +pub type CK_ULONG = ::std::os::raw::c_ulong; +pub type CK_LONG = ::std::os::raw::c_long; +pub type CK_FLAGS = CK_ULONG; +pub type CK_BYTE_PTR = *mut CK_BYTE; +pub type CK_CHAR_PTR = *mut CK_CHAR; +pub type CK_UTF8CHAR_PTR = *mut CK_UTF8CHAR; +pub type CK_ULONG_PTR = *mut CK_ULONG; +pub type CK_VOID_PTR = *mut ::std::os::raw::c_void; +pub type CK_VOID_PTR_PTR = *mut CK_VOID_PTR; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_VERSION { + pub major: CK_BYTE, + pub minor: CK_BYTE, +} +#[test] +fn bindgen_test_layout_CK_VERSION() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(CK_VERSION)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_VERSION)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).major) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_VERSION), + "::", + stringify!(major) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).minor) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_VERSION), + "::", + stringify!(minor) + ) + ); +} +pub type CK_VERSION_PTR = *mut CK_VERSION; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_INFO { + pub cryptokiVersion: CK_VERSION, + pub manufacturerID: [CK_UTF8CHAR; 32usize], + pub flags: CK_FLAGS, + pub libraryDescription: [CK_UTF8CHAR; 32usize], + pub libraryVersion: CK_VERSION, +} +#[test] +fn bindgen_test_layout_CK_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!("Size of: ", stringify!(CK_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cryptokiVersion) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(cryptokiVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).manufacturerID) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(manufacturerID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).libraryDescription) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(libraryDescription) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).libraryVersion) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(libraryVersion) + ) + ); +} +pub type CK_INFO_PTR = *mut CK_INFO; +pub type CK_NOTIFICATION = CK_ULONG; +pub type CK_SLOT_ID = CK_ULONG; +pub type CK_SLOT_ID_PTR = *mut CK_SLOT_ID; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SLOT_INFO { + pub slotDescription: [CK_UTF8CHAR; 64usize], + pub manufacturerID: [CK_UTF8CHAR; 32usize], + pub flags: CK_FLAGS, + pub hardwareVersion: CK_VERSION, + pub firmwareVersion: CK_VERSION, +} +#[test] +fn bindgen_test_layout_CK_SLOT_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 112usize, + concat!("Size of: ", stringify!(CK_SLOT_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SLOT_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).slotDescription) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(slotDescription) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).manufacturerID) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(manufacturerID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hardwareVersion) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(hardwareVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).firmwareVersion) as usize - ptr as usize }, + 106usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(firmwareVersion) + ) + ); +} +impl Default for CK_SLOT_INFO { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SLOT_INFO_PTR = *mut CK_SLOT_INFO; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_TOKEN_INFO { + pub label: [CK_UTF8CHAR; 32usize], + pub manufacturerID: [CK_UTF8CHAR; 32usize], + pub model: [CK_UTF8CHAR; 16usize], + pub serialNumber: [CK_CHAR; 16usize], + pub flags: CK_FLAGS, + pub ulMaxSessionCount: CK_ULONG, + pub ulSessionCount: CK_ULONG, + pub ulMaxRwSessionCount: CK_ULONG, + pub ulRwSessionCount: CK_ULONG, + pub ulMaxPinLen: CK_ULONG, + pub ulMinPinLen: CK_ULONG, + pub ulTotalPublicMemory: CK_ULONG, + pub ulFreePublicMemory: CK_ULONG, + pub ulTotalPrivateMemory: CK_ULONG, + pub ulFreePrivateMemory: CK_ULONG, + pub hardwareVersion: CK_VERSION, + pub firmwareVersion: CK_VERSION, + pub utcTime: [CK_CHAR; 16usize], +} +#[test] +fn bindgen_test_layout_CK_TOKEN_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 208usize, + concat!("Size of: ", stringify!(CK_TOKEN_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_TOKEN_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).label) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(label) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).manufacturerID) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(manufacturerID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).model) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(model) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).serialNumber) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(serialNumber) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxSessionCount) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMaxSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSessionCount) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxRwSessionCount) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMaxRwSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRwSessionCount) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulRwSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxPinLen) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMaxPinLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMinPinLen) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMinPinLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTotalPublicMemory) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulTotalPublicMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulFreePublicMemory) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulFreePublicMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTotalPrivateMemory) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulTotalPrivateMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulFreePrivateMemory) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulFreePrivateMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hardwareVersion) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(hardwareVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).firmwareVersion) as usize - ptr as usize }, + 186usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(firmwareVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).utcTime) as usize - ptr as usize }, + 188usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(utcTime) + ) + ); +} +pub type CK_TOKEN_INFO_PTR = *mut CK_TOKEN_INFO; +pub type CK_SESSION_HANDLE = CK_ULONG; +pub type CK_SESSION_HANDLE_PTR = *mut CK_SESSION_HANDLE; +pub type CK_USER_TYPE = CK_ULONG; +pub type CK_STATE = CK_ULONG; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_SESSION_INFO { + pub slotID: CK_SLOT_ID, + pub state: CK_STATE, + pub flags: CK_FLAGS, + pub ulDeviceError: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SESSION_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_SESSION_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SESSION_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).slotID) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(slotID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(state) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDeviceError) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(ulDeviceError) + ) + ); +} +pub type CK_SESSION_INFO_PTR = *mut CK_SESSION_INFO; +pub type CK_OBJECT_HANDLE = CK_ULONG; +pub type CK_OBJECT_HANDLE_PTR = *mut CK_OBJECT_HANDLE; +pub type CK_OBJECT_CLASS = CK_ULONG; +pub type CK_OBJECT_CLASS_PTR = *mut CK_OBJECT_CLASS; +pub type CK_HW_FEATURE_TYPE = CK_ULONG; +pub type CK_KEY_TYPE = CK_ULONG; +pub type CK_CERTIFICATE_TYPE = CK_ULONG; +pub type CK_ATTRIBUTE_TYPE = CK_ULONG; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ATTRIBUTE { + pub type_: CK_ATTRIBUTE_TYPE, + pub pValue: CK_VOID_PTR, + pub ulValueLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_ATTRIBUTE() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_ATTRIBUTE)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_ATTRIBUTE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ATTRIBUTE), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pValue) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ATTRIBUTE), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulValueLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ATTRIBUTE), + "::", + stringify!(ulValueLen) + ) + ); +} +impl Default for CK_ATTRIBUTE { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ATTRIBUTE_PTR = *mut CK_ATTRIBUTE; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_DATE { + pub year: [CK_CHAR; 4usize], + pub month: [CK_CHAR; 2usize], + pub day: [CK_CHAR; 2usize], +} +#[test] +fn bindgen_test_layout_CK_DATE() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(CK_DATE)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_DATE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).year) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DATE), + "::", + stringify!(year) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).month) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_DATE), + "::", + stringify!(month) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).day) as usize - ptr as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(CK_DATE), + "::", + stringify!(day) + ) + ); +} +pub type CK_MECHANISM_TYPE = CK_ULONG; +pub type CK_MECHANISM_TYPE_PTR = *mut CK_MECHANISM_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_MECHANISM { + pub mechanism: CK_MECHANISM_TYPE, + pub pParameter: CK_VOID_PTR, + pub ulParameterLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_MECHANISM() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_MECHANISM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_MECHANISM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM), + "::", + stringify!(mechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pParameter) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM), + "::", + stringify!(pParameter) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulParameterLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM), + "::", + stringify!(ulParameterLen) + ) + ); +} +impl Default for CK_MECHANISM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_MECHANISM_PTR = *mut CK_MECHANISM; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_MECHANISM_INFO { + pub ulMinKeySize: CK_ULONG, + pub ulMaxKeySize: CK_ULONG, + pub flags: CK_FLAGS, +} +#[test] +fn bindgen_test_layout_CK_MECHANISM_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_MECHANISM_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_MECHANISM_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMinKeySize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM_INFO), + "::", + stringify!(ulMinKeySize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxKeySize) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM_INFO), + "::", + stringify!(ulMaxKeySize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM_INFO), + "::", + stringify!(flags) + ) + ); +} +pub type CK_MECHANISM_INFO_PTR = *mut CK_MECHANISM_INFO; +pub type CK_RV = CK_ULONG; +pub type CK_NOTIFY = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + event: CK_NOTIFICATION, + pApplication: CK_VOID_PTR, + ) -> CK_RV, +>; +pub type CK_FUNCTION_LIST_PTR = *mut CK_FUNCTION_LIST; +pub type CK_FUNCTION_LIST_3_0_PTR = *mut CK_FUNCTION_LIST_3_0; +pub type CK_FUNCTION_LIST_PTR_PTR = *mut CK_FUNCTION_LIST_PTR; +pub type CK_FUNCTION_LIST_3_0_PTR_PTR = *mut CK_FUNCTION_LIST_3_0_PTR; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_INTERFACE { + pub pInterfaceName: *mut CK_CHAR, + pub pFunctionList: CK_VOID_PTR, + pub flags: CK_FLAGS, +} +#[test] +fn bindgen_test_layout_CK_INTERFACE() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_INTERFACE)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_INTERFACE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInterfaceName) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_INTERFACE), + "::", + stringify!(pInterfaceName) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pFunctionList) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_INTERFACE), + "::", + stringify!(pFunctionList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_INTERFACE), + "::", + stringify!(flags) + ) + ); +} +impl Default for CK_INTERFACE { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_INTERFACE_PTR = *mut CK_INTERFACE; +pub type CK_INTERFACE_PTR_PTR = *mut CK_INTERFACE_PTR; +pub type CK_CREATEMUTEX = + ::std::option::Option CK_RV>; +pub type CK_DESTROYMUTEX = + ::std::option::Option CK_RV>; +pub type CK_LOCKMUTEX = ::std::option::Option CK_RV>; +pub type CK_UNLOCKMUTEX = ::std::option::Option CK_RV>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_C_INITIALIZE_ARGS { + pub CreateMutex: CK_CREATEMUTEX, + pub DestroyMutex: CK_DESTROYMUTEX, + pub LockMutex: CK_LOCKMUTEX, + pub UnlockMutex: CK_UNLOCKMUTEX, + pub flags: CK_FLAGS, + pub pReserved: CK_VOID_PTR, +} +#[test] +fn bindgen_test_layout_CK_C_INITIALIZE_ARGS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_C_INITIALIZE_ARGS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_C_INITIALIZE_ARGS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).CreateMutex) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(CreateMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DestroyMutex) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(DestroyMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).LockMutex) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(LockMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).UnlockMutex) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(UnlockMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReserved) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(pReserved) + ) + ); +} +impl Default for CK_C_INITIALIZE_ARGS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_C_INITIALIZE_ARGS_PTR = *mut CK_C_INITIALIZE_ARGS; +pub type CK_RSA_PKCS_MGF_TYPE = CK_ULONG; +pub type CK_RSA_PKCS_MGF_TYPE_PTR = *mut CK_RSA_PKCS_MGF_TYPE; +pub type CK_RSA_PKCS_OAEP_SOURCE_TYPE = CK_ULONG; +pub type CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR = *mut CK_RSA_PKCS_OAEP_SOURCE_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_RSA_PKCS_OAEP_PARAMS { + pub hashAlg: CK_MECHANISM_TYPE, + pub mgf: CK_RSA_PKCS_MGF_TYPE, + pub source: CK_RSA_PKCS_OAEP_SOURCE_TYPE, + pub pSourceData: CK_VOID_PTR, + pub ulSourceDataLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RSA_PKCS_OAEP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_RSA_PKCS_OAEP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RSA_PKCS_OAEP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hashAlg) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(hashAlg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mgf) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(mgf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(source) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSourceData) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(pSourceData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSourceDataLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(ulSourceDataLen) + ) + ); +} +impl Default for CK_RSA_PKCS_OAEP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_RSA_PKCS_OAEP_PARAMS_PTR = *mut CK_RSA_PKCS_OAEP_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RSA_PKCS_PSS_PARAMS { + pub hashAlg: CK_MECHANISM_TYPE, + pub mgf: CK_RSA_PKCS_MGF_TYPE, + pub sLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RSA_PKCS_PSS_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_RSA_PKCS_PSS_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RSA_PKCS_PSS_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hashAlg) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_PSS_PARAMS), + "::", + stringify!(hashAlg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mgf) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_PSS_PARAMS), + "::", + stringify!(mgf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).sLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_PSS_PARAMS), + "::", + stringify!(sLen) + ) + ); +} +pub type CK_RSA_PKCS_PSS_PARAMS_PTR = *mut CK_RSA_PKCS_PSS_PARAMS; +pub type CK_EC_KDF_TYPE = CK_ULONG; +pub type CK_EC_KDF_TYPE_PTR = *mut CK_EC_KDF_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECDH1_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_ECDH1_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_ECDH1_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_ECDH1_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(pSharedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); +} +impl Default for CK_ECDH1_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECDH1_DERIVE_PARAMS_PTR = *mut CK_ECDH1_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECDH2_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_ECDH2_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_ECDH2_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_ECDH2_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(pSharedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); +} +impl Default for CK_ECDH2_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECDH2_DERIVE_PARAMS_PTR = *mut CK_ECDH2_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECMQV_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, + pub publicKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_ECMQV_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(CK_ECMQV_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_ECMQV_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(pSharedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).publicKey) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(publicKey) + ) + ); +} +impl Default for CK_ECMQV_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECMQV_DERIVE_PARAMS_PTR = *mut CK_ECMQV_DERIVE_PARAMS; +pub type CK_X9_42_DH_KDF_TYPE = CK_ULONG; +pub type CK_X9_42_DH_KDF_TYPE_PTR = *mut CK_X9_42_DH_KDF_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X9_42_DH1_DERIVE_PARAMS { + pub kdf: CK_X9_42_DH_KDF_TYPE, + pub ulOtherInfoLen: CK_ULONG, + pub pOtherInfo: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_X9_42_DH1_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_X9_42_DH1_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_X9_42_DH1_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOtherInfoLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(ulOtherInfoLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOtherInfo) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(pOtherInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); +} +impl Default for CK_X9_42_DH1_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X9_42_DH1_DERIVE_PARAMS_PTR = *mut CK_X9_42_DH1_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X9_42_DH2_DERIVE_PARAMS { + pub kdf: CK_X9_42_DH_KDF_TYPE, + pub ulOtherInfoLen: CK_ULONG, + pub pOtherInfo: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_X9_42_DH2_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_X9_42_DH2_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_X9_42_DH2_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOtherInfoLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulOtherInfoLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOtherInfo) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(pOtherInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); +} +impl Default for CK_X9_42_DH2_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X9_42_DH2_DERIVE_PARAMS_PTR = *mut CK_X9_42_DH2_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X9_42_MQV_DERIVE_PARAMS { + pub kdf: CK_X9_42_DH_KDF_TYPE, + pub ulOtherInfoLen: CK_ULONG, + pub pOtherInfo: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, + pub publicKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_X9_42_MQV_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(CK_X9_42_MQV_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_X9_42_MQV_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOtherInfoLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulOtherInfoLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOtherInfo) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(pOtherInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).publicKey) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(publicKey) + ) + ); +} +impl Default for CK_X9_42_MQV_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X9_42_MQV_DERIVE_PARAMS_PTR = *mut CK_X9_42_MQV_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KEA_DERIVE_PARAMS { + pub isSender: CK_BBOOL, + pub ulRandomLen: CK_ULONG, + pub pRandomA: CK_BYTE_PTR, + pub pRandomB: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_KEA_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_KEA_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_KEA_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).isSender) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(isSender) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRandomLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(ulRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRandomA) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(pRandomA) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRandomB) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(pRandomB) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); +} +impl Default for CK_KEA_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KEA_DERIVE_PARAMS_PTR = *mut CK_KEA_DERIVE_PARAMS; +pub type CK_RC2_PARAMS = CK_ULONG; +pub type CK_RC2_PARAMS_PTR = *mut CK_RC2_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC2_CBC_PARAMS { + pub ulEffectiveBits: CK_ULONG, + pub iv: [CK_BYTE; 8usize], +} +#[test] +fn bindgen_test_layout_CK_RC2_CBC_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_RC2_CBC_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RC2_CBC_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulEffectiveBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_CBC_PARAMS), + "::", + stringify!(ulEffectiveBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_CBC_PARAMS), + "::", + stringify!(iv) + ) + ); +} +pub type CK_RC2_CBC_PARAMS_PTR = *mut CK_RC2_CBC_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC2_MAC_GENERAL_PARAMS { + pub ulEffectiveBits: CK_ULONG, + pub ulMacLength: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC2_MAC_GENERAL_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_RC2_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RC2_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulEffectiveBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_MAC_GENERAL_PARAMS), + "::", + stringify!(ulEffectiveBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacLength) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_MAC_GENERAL_PARAMS), + "::", + stringify!(ulMacLength) + ) + ); +} +pub type CK_RC2_MAC_GENERAL_PARAMS_PTR = *mut CK_RC2_MAC_GENERAL_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC5_PARAMS { + pub ulWordsize: CK_ULONG, + pub ulRounds: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC5_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_RC5_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RC5_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWordsize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_PARAMS), + "::", + stringify!(ulWordsize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRounds) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_PARAMS), + "::", + stringify!(ulRounds) + ) + ); +} +pub type CK_RC5_PARAMS_PTR = *mut CK_RC5_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_RC5_CBC_PARAMS { + pub ulWordsize: CK_ULONG, + pub ulRounds: CK_ULONG, + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC5_CBC_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_RC5_CBC_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RC5_CBC_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWordsize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(ulWordsize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRounds) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(ulRounds) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); +} +impl Default for CK_RC5_CBC_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_RC5_CBC_PARAMS_PTR = *mut CK_RC5_CBC_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC5_MAC_GENERAL_PARAMS { + pub ulWordsize: CK_ULONG, + pub ulRounds: CK_ULONG, + pub ulMacLength: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC5_MAC_GENERAL_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_RC5_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RC5_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWordsize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_MAC_GENERAL_PARAMS), + "::", + stringify!(ulWordsize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRounds) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_MAC_GENERAL_PARAMS), + "::", + stringify!(ulRounds) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacLength) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_MAC_GENERAL_PARAMS), + "::", + stringify!(ulMacLength) + ) + ); +} +pub type CK_RC5_MAC_GENERAL_PARAMS_PTR = *mut CK_RC5_MAC_GENERAL_PARAMS; +pub type CK_MAC_GENERAL_PARAMS = CK_ULONG; +pub type CK_MAC_GENERAL_PARAMS_PTR = *mut CK_MAC_GENERAL_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_DES_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 8usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_DES_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_DES_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_DES_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_AES_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_AES_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_AES_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_AES_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS { + pub ulPasswordLen: CK_ULONG, + pub pPassword: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPAndGLen: CK_ULONG, + pub ulQLen: CK_ULONG, + pub ulRandomLen: CK_ULONG, + pub pRandomA: CK_BYTE_PTR, + pub pPrimeP: CK_BYTE_PTR, + pub pBaseG: CK_BYTE_PTR, + pub pSubprimeQ: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SKIPJACK_PRIVATE_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!("Size of: ", stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPAndGLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulPAndGLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulQLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulQLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRandomLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRandomA) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pRandomA) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrimeP) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pPrimeP) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pBaseG) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pBaseG) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSubprimeQ) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pSubprimeQ) + ) + ); +} +impl Default for CK_SKIPJACK_PRIVATE_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR = *mut CK_SKIPJACK_PRIVATE_WRAP_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SKIPJACK_RELAYX_PARAMS { + pub ulOldWrappedXLen: CK_ULONG, + pub pOldWrappedX: CK_BYTE_PTR, + pub ulOldPasswordLen: CK_ULONG, + pub pOldPassword: CK_BYTE_PTR, + pub ulOldPublicDataLen: CK_ULONG, + pub pOldPublicData: CK_BYTE_PTR, + pub ulOldRandomLen: CK_ULONG, + pub pOldRandomA: CK_BYTE_PTR, + pub ulNewPasswordLen: CK_ULONG, + pub pNewPassword: CK_BYTE_PTR, + pub ulNewPublicDataLen: CK_ULONG, + pub pNewPublicData: CK_BYTE_PTR, + pub ulNewRandomLen: CK_ULONG, + pub pNewRandomA: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SKIPJACK_RELAYX_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 112usize, + concat!("Size of: ", stringify!(CK_SKIPJACK_RELAYX_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SKIPJACK_RELAYX_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldWrappedXLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldWrappedXLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldWrappedX) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldWrappedX) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldPasswordLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldPassword) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldPublicDataLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldPublicData) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldRandomLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldRandomA) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldRandomA) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNewPasswordLen) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulNewPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNewPassword) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pNewPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNewPublicDataLen) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulNewPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNewPublicData) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pNewPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNewRandomLen) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulNewRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNewRandomA) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pNewRandomA) + ) + ); +} +impl Default for CK_SKIPJACK_RELAYX_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SKIPJACK_RELAYX_PARAMS_PTR = *mut CK_SKIPJACK_RELAYX_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PBE_PARAMS { + pub pInitVector: CK_BYTE_PTR, + pub pPassword: CK_UTF8CHAR_PTR, + pub ulPasswordLen: CK_ULONG, + pub pSalt: CK_BYTE_PTR, + pub ulSaltLen: CK_ULONG, + pub ulIteration: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_PBE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_PBE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_PBE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInitVector) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(pInitVector) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(ulPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSalt) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(pSalt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(ulSaltLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIteration) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(ulIteration) + ) + ); +} +impl Default for CK_PBE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PBE_PARAMS_PTR = *mut CK_PBE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KEY_WRAP_SET_OAEP_PARAMS { + pub bBC: CK_BYTE, + pub pX: CK_BYTE_PTR, + pub ulXLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_KEY_WRAP_SET_OAEP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bBC) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS), + "::", + stringify!(bBC) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pX) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS), + "::", + stringify!(pX) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulXLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS), + "::", + stringify!(ulXLen) + ) + ); +} +impl Default for CK_KEY_WRAP_SET_OAEP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KEY_WRAP_SET_OAEP_PARAMS_PTR = *mut CK_KEY_WRAP_SET_OAEP_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_RANDOM_DATA { + pub pClientRandom: CK_BYTE_PTR, + pub ulClientRandomLen: CK_ULONG, + pub pServerRandom: CK_BYTE_PTR, + pub ulServerRandomLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SSL3_RANDOM_DATA() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_SSL3_RANDOM_DATA)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SSL3_RANDOM_DATA)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pClientRandom) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(pClientRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulClientRandomLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(ulClientRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pServerRandom) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(pServerRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulServerRandomLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(ulServerRandomLen) + ) + ); +} +impl Default for CK_SSL3_RANDOM_DATA { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS { + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pVersion: CK_VERSION_PTR, +} +#[test] +fn bindgen_test_layout_CK_SSL3_MASTER_KEY_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pVersion) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(pVersion) + ) + ); +} +impl Default for CK_SSL3_MASTER_KEY_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR = *mut CK_SSL3_MASTER_KEY_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_KEY_MAT_OUT { + pub hClientMacSecret: CK_OBJECT_HANDLE, + pub hServerMacSecret: CK_OBJECT_HANDLE, + pub hClientKey: CK_OBJECT_HANDLE, + pub hServerKey: CK_OBJECT_HANDLE, + pub pIVClient: CK_BYTE_PTR, + pub pIVServer: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SSL3_KEY_MAT_OUT() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_SSL3_KEY_MAT_OUT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SSL3_KEY_MAT_OUT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hClientMacSecret) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hClientMacSecret) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hServerMacSecret) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hServerMacSecret) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hClientKey) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hClientKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hServerKey) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hServerKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIVClient) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(pIVClient) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIVServer) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(pIVServer) + ) + ); +} +impl Default for CK_SSL3_KEY_MAT_OUT { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SSL3_KEY_MAT_OUT_PTR = *mut CK_SSL3_KEY_MAT_OUT; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_KEY_MAT_PARAMS { + pub ulMacSizeInBits: CK_ULONG, + pub ulKeySizeInBits: CK_ULONG, + pub ulIVSizeInBits: CK_ULONG, + pub bIsExport: CK_BBOOL, + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pReturnedKeyMaterial: CK_SSL3_KEY_MAT_OUT_PTR, +} +#[test] +fn bindgen_test_layout_CK_SSL3_KEY_MAT_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_SSL3_KEY_MAT_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SSL3_KEY_MAT_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacSizeInBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(ulMacSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulKeySizeInBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(ulKeySizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVSizeInBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(ulIVSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bIsExport) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(bIsExport) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReturnedKeyMaterial) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(pReturnedKeyMaterial) + ) + ); +} +impl Default for CK_SSL3_KEY_MAT_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SSL3_KEY_MAT_PARAMS_PTR = *mut CK_SSL3_KEY_MAT_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS_PRF_PARAMS { + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, + pub pLabel: CK_BYTE_PTR, + pub ulLabelLen: CK_ULONG, + pub pOutput: CK_BYTE_PTR, + pub pulOutputLen: CK_ULONG_PTR, +} +#[test] +fn bindgen_test_layout_CK_TLS_PRF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_TLS_PRF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_TLS_PRF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(ulSeedLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pLabel) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pLabel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLabelLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(ulLabelLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOutput) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pOutput) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pulOutputLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pulOutputLen) + ) + ); +} +impl Default for CK_TLS_PRF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS_PRF_PARAMS_PTR = *mut CK_TLS_PRF_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_RANDOM_DATA { + pub pClientRandom: CK_BYTE_PTR, + pub ulClientRandomLen: CK_ULONG, + pub pServerRandom: CK_BYTE_PTR, + pub ulServerRandomLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_WTLS_RANDOM_DATA() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_WTLS_RANDOM_DATA)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_WTLS_RANDOM_DATA)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pClientRandom) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(pClientRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulClientRandomLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(ulClientRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pServerRandom) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(pServerRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulServerRandomLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(ulServerRandomLen) + ) + ); +} +impl Default for CK_WTLS_RANDOM_DATA { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_RANDOM_DATA_PTR = *mut CK_WTLS_RANDOM_DATA; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS { + pub DigestMechanism: CK_MECHANISM_TYPE, + pub RandomInfo: CK_WTLS_RANDOM_DATA, + pub pVersion: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_MASTER_KEY_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DigestMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(DigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pVersion) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(pVersion) + ) + ); +} +impl Default for CK_WTLS_MASTER_KEY_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR = *mut CK_WTLS_MASTER_KEY_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_PRF_PARAMS { + pub DigestMechanism: CK_MECHANISM_TYPE, + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, + pub pLabel: CK_BYTE_PTR, + pub ulLabelLen: CK_ULONG, + pub pOutput: CK_BYTE_PTR, + pub pulOutputLen: CK_ULONG_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_PRF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(CK_WTLS_PRF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_WTLS_PRF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DigestMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(DigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(ulSeedLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pLabel) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pLabel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLabelLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(ulLabelLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOutput) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pOutput) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pulOutputLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pulOutputLen) + ) + ); +} +impl Default for CK_WTLS_PRF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_PRF_PARAMS_PTR = *mut CK_WTLS_PRF_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_KEY_MAT_OUT { + pub hMacSecret: CK_OBJECT_HANDLE, + pub hKey: CK_OBJECT_HANDLE, + pub pIV: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_KEY_MAT_OUT() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_WTLS_KEY_MAT_OUT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_WTLS_KEY_MAT_OUT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hMacSecret) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_OUT), + "::", + stringify!(hMacSecret) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_OUT), + "::", + stringify!(hKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIV) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_OUT), + "::", + stringify!(pIV) + ) + ); +} +impl Default for CK_WTLS_KEY_MAT_OUT { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_KEY_MAT_OUT_PTR = *mut CK_WTLS_KEY_MAT_OUT; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_KEY_MAT_PARAMS { + pub DigestMechanism: CK_MECHANISM_TYPE, + pub ulMacSizeInBits: CK_ULONG, + pub ulKeySizeInBits: CK_ULONG, + pub ulIVSizeInBits: CK_ULONG, + pub ulSequenceNumber: CK_ULONG, + pub bIsExport: CK_BBOOL, + pub RandomInfo: CK_WTLS_RANDOM_DATA, + pub pReturnedKeyMaterial: CK_WTLS_KEY_MAT_OUT_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_KEY_MAT_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 88usize, + concat!("Size of: ", stringify!(CK_WTLS_KEY_MAT_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_WTLS_KEY_MAT_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DigestMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(DigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacSizeInBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulMacSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulKeySizeInBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulKeySizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVSizeInBits) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulIVSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSequenceNumber) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulSequenceNumber) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bIsExport) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(bIsExport) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReturnedKeyMaterial) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(pReturnedKeyMaterial) + ) + ); +} +impl Default for CK_WTLS_KEY_MAT_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_KEY_MAT_PARAMS_PTR = *mut CK_WTLS_KEY_MAT_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CMS_SIG_PARAMS { + pub certificateHandle: CK_OBJECT_HANDLE, + pub pSigningMechanism: CK_MECHANISM_PTR, + pub pDigestMechanism: CK_MECHANISM_PTR, + pub pContentType: CK_UTF8CHAR_PTR, + pub pRequestedAttributes: CK_BYTE_PTR, + pub ulRequestedAttributesLen: CK_ULONG, + pub pRequiredAttributes: CK_BYTE_PTR, + pub ulRequiredAttributesLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CMS_SIG_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(CK_CMS_SIG_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_CMS_SIG_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).certificateHandle) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(certificateHandle) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSigningMechanism) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pSigningMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pDigestMechanism) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pDigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pContentType) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pContentType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRequestedAttributes) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pRequestedAttributes) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRequestedAttributesLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(ulRequestedAttributesLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRequiredAttributes) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pRequiredAttributes) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRequiredAttributesLen) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(ulRequiredAttributesLen) + ) + ); +} +impl Default for CK_CMS_SIG_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CMS_SIG_PARAMS_PTR = *mut CK_CMS_SIG_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KEY_DERIVATION_STRING_DATA { + pub pData: CK_BYTE_PTR, + pub ulLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_KEY_DERIVATION_STRING_DATA() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_KEY_DERIVATION_STRING_DATA)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_KEY_DERIVATION_STRING_DATA)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_DERIVATION_STRING_DATA), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_DERIVATION_STRING_DATA), + "::", + stringify!(ulLen) + ) + ); +} +impl Default for CK_KEY_DERIVATION_STRING_DATA { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KEY_DERIVATION_STRING_DATA_PTR = *mut CK_KEY_DERIVATION_STRING_DATA; +pub type CK_EXTRACT_PARAMS = CK_ULONG; +pub type CK_EXTRACT_PARAMS_PTR = *mut CK_EXTRACT_PARAMS; +pub type CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE = CK_ULONG; +pub type CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR = + *mut CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; +pub type CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE = CK_ULONG; +pub type CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR = *mut CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PKCS5_PBKD2_PARAMS { + pub saltSource: CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE, + pub pSaltSourceData: CK_VOID_PTR, + pub ulSaltSourceDataLen: CK_ULONG, + pub iterations: CK_ULONG, + pub prf: CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE, + pub pPrfData: CK_VOID_PTR, + pub ulPrfDataLen: CK_ULONG, + pub pPassword: CK_UTF8CHAR_PTR, + pub ulPasswordLen: CK_ULONG_PTR, +} +#[test] +fn bindgen_test_layout_CK_PKCS5_PBKD2_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_PKCS5_PBKD2_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_PKCS5_PBKD2_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).saltSource) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(saltSource) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSaltSourceData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(pSaltSourceData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltSourceDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(ulSaltSourceDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iterations) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(iterations) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prf) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(prf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrfData) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(pPrfData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrfDataLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(ulPrfDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(ulPasswordLen) + ) + ); +} +impl Default for CK_PKCS5_PBKD2_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PKCS5_PBKD2_PARAMS_PTR = *mut CK_PKCS5_PBKD2_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PKCS5_PBKD2_PARAMS2 { + pub saltSource: CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE, + pub pSaltSourceData: CK_VOID_PTR, + pub ulSaltSourceDataLen: CK_ULONG, + pub iterations: CK_ULONG, + pub prf: CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE, + pub pPrfData: CK_VOID_PTR, + pub ulPrfDataLen: CK_ULONG, + pub pPassword: CK_UTF8CHAR_PTR, + pub ulPasswordLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_PKCS5_PBKD2_PARAMS2() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_PKCS5_PBKD2_PARAMS2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_PKCS5_PBKD2_PARAMS2)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).saltSource) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(saltSource) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSaltSourceData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(pSaltSourceData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltSourceDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(ulSaltSourceDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iterations) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(iterations) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prf) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(prf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrfData) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(pPrfData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrfDataLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(ulPrfDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(ulPasswordLen) + ) + ); +} +impl Default for CK_PKCS5_PBKD2_PARAMS2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PKCS5_PBKD2_PARAMS2_PTR = *mut CK_PKCS5_PBKD2_PARAMS2; +pub type CK_OTP_PARAM_TYPE = CK_ULONG; +pub type CK_PARAM_TYPE = CK_OTP_PARAM_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_OTP_PARAM { + pub type_: CK_OTP_PARAM_TYPE, + pub pValue: CK_VOID_PTR, + pub ulValueLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_OTP_PARAM() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_OTP_PARAM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_OTP_PARAM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAM), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pValue) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAM), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulValueLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAM), + "::", + stringify!(ulValueLen) + ) + ); +} +impl Default for CK_OTP_PARAM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_OTP_PARAM_PTR = *mut CK_OTP_PARAM; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_OTP_PARAMS { + pub pParams: CK_OTP_PARAM_PTR, + pub ulCount: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_OTP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_OTP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_OTP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pParams) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAMS), + "::", + stringify!(pParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCount) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAMS), + "::", + stringify!(ulCount) + ) + ); +} +impl Default for CK_OTP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_OTP_PARAMS_PTR = *mut CK_OTP_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_OTP_SIGNATURE_INFO { + pub pParams: CK_OTP_PARAM_PTR, + pub ulCount: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_OTP_SIGNATURE_INFO() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_OTP_SIGNATURE_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_OTP_SIGNATURE_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pParams) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_SIGNATURE_INFO), + "::", + stringify!(pParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCount) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_SIGNATURE_INFO), + "::", + stringify!(ulCount) + ) + ); +} +impl Default for CK_OTP_SIGNATURE_INFO { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_OTP_SIGNATURE_INFO_PTR = *mut CK_OTP_SIGNATURE_INFO; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KIP_PARAMS { + pub pMechanism: CK_MECHANISM_PTR, + pub hKey: CK_OBJECT_HANDLE, + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_KIP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_KIP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_KIP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(pMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(hKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(ulSeedLen) + ) + ); +} +impl Default for CK_KIP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KIP_PARAMS_PTR = *mut CK_KIP_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_AES_CTR_PARAMS { + pub ulCounterBits: CK_ULONG, + pub cb: [CK_BYTE; 16usize], +} +#[test] +fn bindgen_test_layout_CK_AES_CTR_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_AES_CTR_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_AES_CTR_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCounterBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CTR_PARAMS), + "::", + stringify!(ulCounterBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cb) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CTR_PARAMS), + "::", + stringify!(cb) + ) + ); +} +pub type CK_AES_CTR_PARAMS_PTR = *mut CK_AES_CTR_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GCM_PARAMS { + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, + pub ulIvBits: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulTagBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_GCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_GCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_GCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulIvBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTagBits) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulTagBits) + ) + ); +} +impl Default for CK_GCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GCM_PARAMS_PTR = *mut CK_GCM_PARAMS; +pub type CK_GENERATOR_FUNCTION = CK_ULONG; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GCM_MESSAGE_PARAMS { + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, + pub ulIvFixedBits: CK_ULONG, + pub ivGenerator: CK_GENERATOR_FUNCTION, + pub pTag: CK_BYTE_PTR, + pub ulTagBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_GCM_MESSAGE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_GCM_MESSAGE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_GCM_MESSAGE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvFixedBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ulIvFixedBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ivGenerator) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ivGenerator) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pTag) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(pTag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTagBits) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ulTagBits) + ) + ); +} +impl Default for CK_GCM_MESSAGE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GCM_MESSAGE_PARAMS_PTR = *mut CK_GCM_MESSAGE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CCM_PARAMS { + pub ulDataLen: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulMACLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_CCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_CCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDataLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMACLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulMACLen) + ) + ); +} +impl Default for CK_CCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CCM_PARAMS_PTR = *mut CK_CCM_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CCM_MESSAGE_PARAMS { + pub ulDataLen: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub ulNonceFixedBits: CK_ULONG, + pub nonceGenerator: CK_GENERATOR_FUNCTION, + pub pMAC: CK_BYTE_PTR, + pub ulMACLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CCM_MESSAGE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(CK_CCM_MESSAGE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_CCM_MESSAGE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDataLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceFixedBits) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulNonceFixedBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nonceGenerator) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(nonceGenerator) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pMAC) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(pMAC) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMACLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulMACLen) + ) + ); +} +impl Default for CK_CCM_MESSAGE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CCM_MESSAGE_PARAMS_PTR = *mut CK_CCM_MESSAGE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_AES_GCM_PARAMS { + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, + pub ulIvBits: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulTagBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_AES_GCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_AES_GCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_AES_GCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulIvBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTagBits) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulTagBits) + ) + ); +} +impl Default for CK_AES_GCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_AES_GCM_PARAMS_PTR = *mut CK_AES_GCM_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_AES_CCM_PARAMS { + pub ulDataLen: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulMACLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_AES_CCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_AES_CCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_AES_CCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDataLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMACLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulMACLen) + ) + ); +} +impl Default for CK_AES_CCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_AES_CCM_PARAMS_PTR = *mut CK_AES_CCM_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_CAMELLIA_CTR_PARAMS { + pub ulCounterBits: CK_ULONG, + pub cb: [CK_BYTE; 16usize], +} +#[test] +fn bindgen_test_layout_CK_CAMELLIA_CTR_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_CAMELLIA_CTR_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_CAMELLIA_CTR_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCounterBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CTR_PARAMS), + "::", + stringify!(ulCounterBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cb) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CTR_PARAMS), + "::", + stringify!(cb) + ) + ); +} +pub type CK_CAMELLIA_CTR_PARAMS_PTR = *mut CK_CAMELLIA_CTR_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_ARIA_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_ARIA_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_DSA_PARAMETER_GEN_PARAM { + pub hash: CK_MECHANISM_TYPE, + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, + pub ulIndex: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_DSA_PARAMETER_GEN_PARAM() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_DSA_PARAMETER_GEN_PARAM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_DSA_PARAMETER_GEN_PARAM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(hash) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(ulSeedLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIndex) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(ulIndex) + ) + ); +} +impl Default for CK_DSA_PARAMETER_GEN_PARAM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_DSA_PARAMETER_GEN_PARAM_PTR = *mut CK_DSA_PARAMETER_GEN_PARAM; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECDH_AES_KEY_WRAP_PARAMS { + pub ulAESKeyBits: CK_ULONG, + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_ECDH_AES_KEY_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAESKeyBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(ulAESKeyBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(pSharedData) + ) + ); +} +impl Default for CK_ECDH_AES_KEY_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECDH_AES_KEY_WRAP_PARAMS_PTR = *mut CK_ECDH_AES_KEY_WRAP_PARAMS; +pub type CK_JAVA_MIDP_SECURITY_DOMAIN = CK_ULONG; +pub type CK_CERTIFICATE_CATEGORY = CK_ULONG; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_RSA_AES_KEY_WRAP_PARAMS { + pub ulAESKeyBits: CK_ULONG, + pub pOAEPParams: CK_RSA_PKCS_OAEP_PARAMS_PTR, +} +#[test] +fn bindgen_test_layout_CK_RSA_AES_KEY_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_RSA_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_RSA_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAESKeyBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_AES_KEY_WRAP_PARAMS), + "::", + stringify!(ulAESKeyBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOAEPParams) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_AES_KEY_WRAP_PARAMS), + "::", + stringify!(pOAEPParams) + ) + ); +} +impl Default for CK_RSA_AES_KEY_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_RSA_AES_KEY_WRAP_PARAMS_PTR = *mut CK_RSA_AES_KEY_WRAP_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS12_MASTER_KEY_DERIVE_PARAMS { + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pVersion: CK_VERSION_PTR, + pub prfHashMechanism: CK_MECHANISM_TYPE, +} +#[test] +fn bindgen_test_layout_CK_TLS12_MASTER_KEY_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pVersion) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(pVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); +} +impl Default for CK_TLS12_MASTER_KEY_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR = *mut CK_TLS12_MASTER_KEY_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS12_KEY_MAT_PARAMS { + pub ulMacSizeInBits: CK_ULONG, + pub ulKeySizeInBits: CK_ULONG, + pub ulIVSizeInBits: CK_ULONG, + pub bIsExport: CK_BBOOL, + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pReturnedKeyMaterial: CK_SSL3_KEY_MAT_OUT_PTR, + pub prfHashMechanism: CK_MECHANISM_TYPE, +} +#[test] +fn bindgen_test_layout_CK_TLS12_KEY_MAT_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(CK_TLS12_KEY_MAT_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_TLS12_KEY_MAT_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacSizeInBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(ulMacSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulKeySizeInBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(ulKeySizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVSizeInBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(ulIVSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bIsExport) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(bIsExport) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReturnedKeyMaterial) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(pReturnedKeyMaterial) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); +} +impl Default for CK_TLS12_KEY_MAT_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS12_KEY_MAT_PARAMS_PTR = *mut CK_TLS12_KEY_MAT_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS_KDF_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub pLabel: CK_BYTE_PTR, + pub ulLabelLength: CK_ULONG, + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pContextData: CK_BYTE_PTR, + pub ulContextDataLength: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_TLS_KDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_TLS_KDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_TLS_KDF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pLabel) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(pLabel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLabelLength) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(ulLabelLength) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pContextData) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(pContextData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulContextDataLength) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(ulContextDataLength) + ) + ); +} +impl Default for CK_TLS_KDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS_KDF_PARAMS_PTR = *mut CK_TLS_KDF_PARAMS; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_TLS_MAC_PARAMS { + pub prfHashMechanism: CK_MECHANISM_TYPE, + pub ulMacLength: CK_ULONG, + pub ulServerOrClient: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_TLS_MAC_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_TLS_MAC_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_TLS_MAC_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_MAC_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacLength) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_MAC_PARAMS), + "::", + stringify!(ulMacLength) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulServerOrClient) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_MAC_PARAMS), + "::", + stringify!(ulServerOrClient) + ) + ); +} +pub type CK_TLS_MAC_PARAMS_PTR = *mut CK_TLS_MAC_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GOSTR3410_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub pPublicData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pUKM: CK_BYTE_PTR, + pub ulUKMLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_GOSTR3410_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_GOSTR3410_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_GOSTR3410_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pUKM) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(pUKM) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulUKMLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(ulUKMLen) + ) + ); +} +impl Default for CK_GOSTR3410_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GOSTR3410_DERIVE_PARAMS_PTR = *mut CK_GOSTR3410_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GOSTR3410_KEY_WRAP_PARAMS { + pub pWrapOID: CK_BYTE_PTR, + pub ulWrapOIDLen: CK_ULONG, + pub pUKM: CK_BYTE_PTR, + pub ulUKMLen: CK_ULONG, + pub hKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_GOSTR3410_KEY_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pWrapOID) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(pWrapOID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWrapOIDLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(ulWrapOIDLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pUKM) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(pUKM) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulUKMLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(ulUKMLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKey) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(hKey) + ) + ); +} +impl Default for CK_GOSTR3410_KEY_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GOSTR3410_KEY_WRAP_PARAMS_PTR = *mut CK_GOSTR3410_KEY_WRAP_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SEED_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_SEED_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SEED_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_SEED_CBC_ENCRYPT_DATA_PARAMS; +pub type CK_PROFILE_ID = CK_ULONG; +pub type CK_PROFILE_ID_PTR = *mut CK_PROFILE_ID; +pub type CK_PRF_DATA_TYPE = CK_ULONG; +pub type CK_SP800_108_PRF_TYPE = CK_MECHANISM_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PRF_DATA_PARAM { + pub type_: CK_PRF_DATA_TYPE, + pub pValue: CK_VOID_PTR, + pub ulValueLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_PRF_DATA_PARAM() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_PRF_DATA_PARAM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_PRF_DATA_PARAM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PRF_DATA_PARAM), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pValue) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_PRF_DATA_PARAM), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulValueLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_PRF_DATA_PARAM), + "::", + stringify!(ulValueLen) + ) + ); +} +impl Default for CK_PRF_DATA_PARAM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PRF_DATA_PARAM_PTR = *mut CK_PRF_DATA_PARAM; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_SP800_108_COUNTER_FORMAT { + pub bLittleEndian: CK_BBOOL, + pub ulWidthInBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_COUNTER_FORMAT() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_SP800_108_COUNTER_FORMAT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SP800_108_COUNTER_FORMAT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bLittleEndian) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_COUNTER_FORMAT), + "::", + stringify!(bLittleEndian) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWidthInBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_COUNTER_FORMAT), + "::", + stringify!(ulWidthInBits) + ) + ); +} +pub type CK_SP800_108_COUNTER_FORMAT_PTR = *mut CK_SP800_108_COUNTER_FORMAT; +pub type CK_SP800_108_DKM_LENGTH_METHOD = CK_ULONG; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_SP800_108_DKM_LENGTH_FORMAT { + pub dkmLengthMethod: CK_SP800_108_DKM_LENGTH_METHOD, + pub bLittleEndian: CK_BBOOL, + pub ulWidthInBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_DKM_LENGTH_FORMAT() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_SP800_108_DKM_LENGTH_FORMAT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SP800_108_DKM_LENGTH_FORMAT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dkmLengthMethod) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_DKM_LENGTH_FORMAT), + "::", + stringify!(dkmLengthMethod) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bLittleEndian) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_DKM_LENGTH_FORMAT), + "::", + stringify!(bLittleEndian) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWidthInBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_DKM_LENGTH_FORMAT), + "::", + stringify!(ulWidthInBits) + ) + ); +} +pub type CK_SP800_108_DKM_LENGTH_FORMAT_PTR = *mut CK_SP800_108_DKM_LENGTH_FORMAT; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_DERIVED_KEY { + pub pTemplate: CK_ATTRIBUTE_PTR, + pub ulAttributeCount: CK_ULONG, + pub phKey: CK_OBJECT_HANDLE_PTR, +} +#[test] +fn bindgen_test_layout_CK_DERIVED_KEY() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_DERIVED_KEY)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_DERIVED_KEY)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pTemplate) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DERIVED_KEY), + "::", + stringify!(pTemplate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAttributeCount) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_DERIVED_KEY), + "::", + stringify!(ulAttributeCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).phKey) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_DERIVED_KEY), + "::", + stringify!(phKey) + ) + ); +} +impl Default for CK_DERIVED_KEY { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_DERIVED_KEY_PTR = *mut CK_DERIVED_KEY; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SP800_108_KDF_PARAMS { + pub prfType: CK_SP800_108_PRF_TYPE, + pub ulNumberOfDataParams: CK_ULONG, + pub pDataParams: CK_PRF_DATA_PARAM_PTR, + pub ulAdditionalDerivedKeys: CK_ULONG, + pub pAdditionalDerivedKeys: CK_DERIVED_KEY_PTR, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_KDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_SP800_108_KDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SP800_108_KDF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfType) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(prfType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNumberOfDataParams) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(ulNumberOfDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pDataParams) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(pDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAdditionalDerivedKeys) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(ulAdditionalDerivedKeys) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAdditionalDerivedKeys) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(pAdditionalDerivedKeys) + ) + ); +} +impl Default for CK_SP800_108_KDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SP800_108_KDF_PARAMS_PTR = *mut CK_SP800_108_KDF_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SP800_108_FEEDBACK_KDF_PARAMS { + pub prfType: CK_SP800_108_PRF_TYPE, + pub ulNumberOfDataParams: CK_ULONG, + pub pDataParams: CK_PRF_DATA_PARAM_PTR, + pub ulIVLen: CK_ULONG, + pub pIV: CK_BYTE_PTR, + pub ulAdditionalDerivedKeys: CK_ULONG, + pub pAdditionalDerivedKeys: CK_DERIVED_KEY_PTR, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_FEEDBACK_KDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfType) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(prfType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNumberOfDataParams) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(ulNumberOfDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pDataParams) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(pDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(ulIVLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIV) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(pIV) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAdditionalDerivedKeys) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(ulAdditionalDerivedKeys) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAdditionalDerivedKeys) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(pAdditionalDerivedKeys) + ) + ); +} +impl Default for CK_SP800_108_FEEDBACK_KDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SP800_108_FEEDBACK_KDF_PARAMS_PTR = *mut CK_SP800_108_FEEDBACK_KDF_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_EDDSA_PARAMS { + pub phFlag: CK_BBOOL, + pub ulContextDataLen: CK_ULONG, + pub pContextData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_EDDSA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_EDDSA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_EDDSA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).phFlag) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_EDDSA_PARAMS), + "::", + stringify!(phFlag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulContextDataLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_EDDSA_PARAMS), + "::", + stringify!(ulContextDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pContextData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_EDDSA_PARAMS), + "::", + stringify!(pContextData) + ) + ); +} +impl Default for CK_EDDSA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_EDDSA_PARAMS_PTR = *mut CK_EDDSA_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CHACHA20_PARAMS { + pub pBlockCounter: CK_BYTE_PTR, + pub blockCounterBits: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CHACHA20_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_CHACHA20_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_CHACHA20_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pBlockCounter) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(pBlockCounter) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).blockCounterBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(blockCounterBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceBits) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(ulNonceBits) + ) + ); +} +impl Default for CK_CHACHA20_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CHACHA20_PARAMS_PTR = *mut CK_CHACHA20_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SALSA20_PARAMS { + pub pBlockCounter: CK_BYTE_PTR, + pub pNonce: CK_BYTE_PTR, + pub ulNonceBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SALSA20_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_SALSA20_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_SALSA20_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pBlockCounter) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_PARAMS), + "::", + stringify!(pBlockCounter) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_PARAMS), + "::", + stringify!(ulNonceBits) + ) + ); +} +impl Default for CK_SALSA20_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SALSA20_PARAMS_PTR = *mut CK_SALSA20_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SALSA20_CHACHA20_POLY1305_PARAMS { + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SALSA20_CHACHA20_POLY1305_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); +} +impl Default for CK_SALSA20_CHACHA20_POLY1305_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SALSA20_CHACHA20_POLY1305_PARAMS_PTR = *mut CK_SALSA20_CHACHA20_POLY1305_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS { + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pTag: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!( + "Size of: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pTag) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS), + "::", + stringify!(pTag) + ) + ); +} +impl Default for CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS_PTR = *mut CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS; +pub type CK_X3DH_KDF_TYPE = CK_ULONG; +pub type CK_X3DH_KDF_TYPE_PTR = *mut CK_X3DH_KDF_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X3DH_INITIATE_PARAMS { + pub kdf: CK_X3DH_KDF_TYPE, + pub pPeer_identity: CK_OBJECT_HANDLE, + pub pPeer_prekey: CK_OBJECT_HANDLE, + pub pPrekey_signature: CK_BYTE_PTR, + pub pOnetime_key: CK_BYTE_PTR, + pub pOwn_identity: CK_OBJECT_HANDLE, + pub pOwn_ephemeral: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_X3DH_INITIATE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(CK_X3DH_INITIATE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_X3DH_INITIATE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPeer_identity) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pPeer_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPeer_prekey) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pPeer_prekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrekey_signature) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pPrekey_signature) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOnetime_key) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pOnetime_key) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOwn_identity) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pOwn_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOwn_ephemeral) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pOwn_ephemeral) + ) + ); +} +impl Default for CK_X3DH_INITIATE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X3DH_RESPOND_PARAMS { + pub kdf: CK_X3DH_KDF_TYPE, + pub pIdentity_id: CK_BYTE_PTR, + pub pPrekey_id: CK_BYTE_PTR, + pub pOnetime_id: CK_BYTE_PTR, + pub pInitiator_identity: CK_OBJECT_HANDLE, + pub pInitiator_ephemeral: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_X3DH_RESPOND_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_X3DH_RESPOND_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_X3DH_RESPOND_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIdentity_id) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pIdentity_id) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrekey_id) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pPrekey_id) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOnetime_id) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pOnetime_id) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInitiator_identity) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pInitiator_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInitiator_ephemeral) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pInitiator_ephemeral) + ) + ); +} +impl Default for CK_X3DH_RESPOND_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X2RATCHET_KDF_TYPE = CK_ULONG; +pub type CK_X2RATCHET_KDF_TYPE_PTR = *mut CK_X2RATCHET_KDF_TYPE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X2RATCHET_INITIALIZE_PARAMS { + pub sk: CK_BYTE_PTR, + pub peer_public_prekey: CK_OBJECT_HANDLE, + pub peer_public_identity: CK_OBJECT_HANDLE, + pub own_public_identity: CK_OBJECT_HANDLE, + pub bEncryptedHeader: CK_BBOOL, + pub eCurve: CK_ULONG, + pub aeadMechanism: CK_MECHANISM_TYPE, + pub kdfMechanism: CK_X2RATCHET_KDF_TYPE, +} +#[test] +fn bindgen_test_layout_CK_X2RATCHET_INITIALIZE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(CK_X2RATCHET_INITIALIZE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_X2RATCHET_INITIALIZE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).sk) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(sk) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).peer_public_prekey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(peer_public_prekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).peer_public_identity) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(peer_public_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).own_public_identity) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(own_public_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bEncryptedHeader) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(bEncryptedHeader) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eCurve) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(eCurve) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).aeadMechanism) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(aeadMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdfMechanism) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(kdfMechanism) + ) + ); +} +impl Default for CK_X2RATCHET_INITIALIZE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X2RATCHET_INITIALIZE_PARAMS_PTR = *mut CK_X2RATCHET_INITIALIZE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X2RATCHET_RESPOND_PARAMS { + pub sk: CK_BYTE_PTR, + pub own_prekey: CK_OBJECT_HANDLE, + pub initiator_identity: CK_OBJECT_HANDLE, + pub own_public_identity: CK_OBJECT_HANDLE, + pub bEncryptedHeader: CK_BBOOL, + pub eCurve: CK_ULONG, + pub aeadMechanism: CK_MECHANISM_TYPE, + pub kdfMechanism: CK_X2RATCHET_KDF_TYPE, +} +#[test] +fn bindgen_test_layout_CK_X2RATCHET_RESPOND_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(CK_X2RATCHET_RESPOND_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_X2RATCHET_RESPOND_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).sk) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(sk) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).own_prekey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(own_prekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).initiator_identity) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(initiator_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).own_public_identity) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(own_public_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bEncryptedHeader) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(bEncryptedHeader) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eCurve) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(eCurve) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).aeadMechanism) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(aeadMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdfMechanism) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(kdfMechanism) + ) + ); +} +impl Default for CK_X2RATCHET_RESPOND_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X2RATCHET_RESPOND_PARAMS_PTR = *mut CK_X2RATCHET_RESPOND_PARAMS; +pub type CK_XEDDSA_HASH_TYPE = CK_ULONG; +pub type CK_XEDDSA_HASH_TYPE_PTR = *mut CK_XEDDSA_HASH_TYPE; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_XEDDSA_PARAMS { + pub hash: CK_XEDDSA_HASH_TYPE, +} +#[test] +fn bindgen_test_layout_CK_XEDDSA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(CK_XEDDSA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_XEDDSA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_XEDDSA_PARAMS), + "::", + stringify!(hash) + ) + ); +} +pub type CK_XEDDSA_PARAMS_PTR = *mut CK_XEDDSA_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_HKDF_PARAMS { + pub bExtract: CK_BBOOL, + pub bExpand: CK_BBOOL, + pub prfHashMechanism: CK_MECHANISM_TYPE, + pub ulSaltType: CK_ULONG, + pub pSalt: CK_BYTE_PTR, + pub ulSaltLen: CK_ULONG, + pub hSaltKey: CK_OBJECT_HANDLE, + pub pInfo: CK_BYTE_PTR, + pub ulInfoLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_HKDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(CK_HKDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_HKDF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bExtract) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(bExtract) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bExpand) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(bExpand) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltType) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(ulSaltType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSalt) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(pSalt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(ulSaltLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hSaltKey) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(hSaltKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInfo) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(pInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulInfoLen) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(ulInfoLen) + ) + ); +} +impl Default for CK_HKDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_HKDF_PARAMS_PTR = *mut CK_HKDF_PARAMS; +pub type CK_HSS_LEVELS = CK_ULONG; +pub type CK_LMS_TYPE = CK_ULONG; +pub type CK_LMOTS_TYPE = CK_ULONG; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct specifiedParams { + pub levels: CK_HSS_LEVELS, + pub lm_type: [CK_LMS_TYPE; 8usize], + pub lm_ots_type: [CK_LMOTS_TYPE; 8usize], +} +#[test] +fn bindgen_test_layout_specifiedParams() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 136usize, + concat!("Size of: ", stringify!(specifiedParams)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(specifiedParams)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).levels) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(specifiedParams), + "::", + stringify!(levels) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lm_type) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(specifiedParams), + "::", + stringify!(lm_type) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lm_ots_type) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(specifiedParams), + "::", + stringify!(lm_ots_type) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE2_PRF_PLUS_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bHasSeedKey: CK_BBOOL, + pub hSeedKey: CK_OBJECT_HANDLE, + pub pSeedData: CK_BYTE_PTR, + pub ulSeedDataLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_IKE2_PRF_PLUS_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bHasSeedKey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(bHasSeedKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hSeedKey) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(hSeedKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeedData) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(pSeedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedDataLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(ulSeedDataLen) + ) + ); +} +impl Default for CK_IKE2_PRF_PLUS_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE2_PRF_PLUS_DERIVE_PARAMS_PTR = *mut CK_IKE2_PRF_PLUS_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE_PRF_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bDataAsKey: CK_BBOOL, + pub bRekey: CK_BBOOL, + pub pNi: CK_BYTE_PTR, + pub ulNiLen: CK_ULONG, + pub pNr: CK_BYTE_PTR, + pub ulNrLen: CK_ULONG, + pub hNewKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_IKE_PRF_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(CK_IKE_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_IKE_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bDataAsKey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(bDataAsKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bRekey) as usize - ptr as usize }, + 9usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(bRekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNi) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(pNi) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNiLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(ulNiLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNr) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(pNr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNrLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(ulNrLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hNewKey) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(hNewKey) + ) + ); +} +impl Default for CK_IKE_PRF_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE_PRF_DERIVE_PARAMS_PTR = *mut CK_IKE_PRF_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE1_PRF_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bHasPrevKey: CK_BBOOL, + pub hKeygxy: CK_OBJECT_HANDLE, + pub hPrevKey: CK_OBJECT_HANDLE, + pub pCKYi: CK_BYTE_PTR, + pub ulCKYiLen: CK_ULONG, + pub pCKYr: CK_BYTE_PTR, + pub ulCKYrLen: CK_ULONG, + pub keyNumber: CK_BYTE, +} +#[test] +fn bindgen_test_layout_CK_IKE1_PRF_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_IKE1_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_IKE1_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bHasPrevKey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(bHasPrevKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKeygxy) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(hKeygxy) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrevKey) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(hPrevKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pCKYi) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(pCKYi) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCKYiLen) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(ulCKYiLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pCKYr) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(pCKYr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCKYrLen) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(ulCKYrLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyNumber) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(keyNumber) + ) + ); +} +impl Default for CK_IKE1_PRF_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE1_PRF_DERIVE_PARAMS_PTR = *mut CK_IKE1_PRF_DERIVE_PARAMS; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE1_EXTENDED_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bHasKeygxy: CK_BBOOL, + pub hKeygxy: CK_OBJECT_HANDLE, + pub pExtraData: CK_BYTE_PTR, + pub ulExtraDataLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_IKE1_EXTENDED_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bHasKeygxy) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(bHasKeygxy) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKeygxy) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(hKeygxy) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pExtraData) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(pExtraData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulExtraDataLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(ulExtraDataLen) + ) + ); +} +impl Default for CK_IKE1_EXTENDED_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE1_EXTENDED_DERIVE_PARAMS_PTR = *mut CK_IKE1_EXTENDED_DERIVE_PARAMS; +extern "C" { + pub fn C_Initialize(pInitArgs: CK_VOID_PTR) -> CK_RV; +} +extern "C" { + pub fn C_Finalize(pReserved: CK_VOID_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetInfo(pInfo: CK_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetFunctionList(ppFunctionList: CK_FUNCTION_LIST_PTR_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetSlotList( + tokenPresent: CK_BBOOL, + pSlotList: CK_SLOT_ID_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetSlotInfo(slotID: CK_SLOT_ID, pInfo: CK_SLOT_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetTokenInfo(slotID: CK_SLOT_ID, pInfo: CK_TOKEN_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetMechanismList( + slotID: CK_SLOT_ID, + pMechanismList: CK_MECHANISM_TYPE_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetMechanismInfo( + slotID: CK_SLOT_ID, + type_: CK_MECHANISM_TYPE, + pInfo: CK_MECHANISM_INFO_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_InitToken( + slotID: CK_SLOT_ID, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pLabel: CK_UTF8CHAR_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_InitPIN( + hSession: CK_SESSION_HANDLE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SetPIN( + hSession: CK_SESSION_HANDLE, + pOldPin: CK_UTF8CHAR_PTR, + ulOldLen: CK_ULONG, + pNewPin: CK_UTF8CHAR_PTR, + ulNewLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_OpenSession( + slotID: CK_SLOT_ID, + flags: CK_FLAGS, + pApplication: CK_VOID_PTR, + Notify: CK_NOTIFY, + phSession: CK_SESSION_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_CloseSession(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_CloseAllSessions(slotID: CK_SLOT_ID) -> CK_RV; +} +extern "C" { + pub fn C_GetSessionInfo(hSession: CK_SESSION_HANDLE, pInfo: CK_SESSION_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetOperationState( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + pulOperationStateLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SetOperationState( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + ulOperationStateLen: CK_ULONG, + hEncryptionKey: CK_OBJECT_HANDLE, + hAuthenticationKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Login( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_Logout(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_CreateObject( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_CopyObject( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phNewObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DestroyObject(hSession: CK_SESSION_HANDLE, hObject: CK_OBJECT_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_GetObjectSize( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pulSize: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetAttributeValue( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SetAttributeValue( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_FindObjectsInit( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_FindObjects( + hSession: CK_SESSION_HANDLE, + phObject: CK_OBJECT_HANDLE_PTR, + ulMaxObjectCount: CK_ULONG, + pulObjectCount: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_FindObjectsFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_EncryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Encrypt( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pEncryptedData: CK_BYTE_PTR, + pulEncryptedDataLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptFinal( + hSession: CK_SESSION_HANDLE, + pLastEncryptedPart: CK_BYTE_PTR, + pulLastEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Decrypt( + hSession: CK_SESSION_HANDLE, + pEncryptedData: CK_BYTE_PTR, + ulEncryptedDataLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptUpdate( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptFinal( + hSession: CK_SESSION_HANDLE, + pLastPart: CK_BYTE_PTR, + pulLastPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestInit(hSession: CK_SESSION_HANDLE, pMechanism: CK_MECHANISM_PTR) -> CK_RV; +} +extern "C" { + pub fn C_Digest( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestKey(hSession: CK_SESSION_HANDLE, hKey: CK_OBJECT_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_DigestFinal( + hSession: CK_SESSION_HANDLE, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Sign( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignFinal( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignRecoverInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignRecover( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Verify( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyFinal( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyRecoverInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyRecover( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestEncryptUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptDigestUpdate( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignEncryptUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptVerifyUpdate( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GenerateKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GenerateKeyPair( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pPublicKeyTemplate: CK_ATTRIBUTE_PTR, + ulPublicKeyAttributeCount: CK_ULONG, + pPrivateKeyTemplate: CK_ATTRIBUTE_PTR, + ulPrivateKeyAttributeCount: CK_ULONG, + phPublicKey: CK_OBJECT_HANDLE_PTR, + phPrivateKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_WrapKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hWrappingKey: CK_OBJECT_HANDLE, + hKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + pulWrappedKeyLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_UnwrapKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hUnwrappingKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + ulWrappedKeyLen: CK_ULONG, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DeriveKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hBaseKey: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SeedRandom( + hSession: CK_SESSION_HANDLE, + pSeed: CK_BYTE_PTR, + ulSeedLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_GenerateRandom( + hSession: CK_SESSION_HANDLE, + RandomData: CK_BYTE_PTR, + ulRandomLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetFunctionStatus(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_CancelFunction(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_WaitForSlotEvent( + flags: CK_FLAGS, + pSlot: CK_SLOT_ID_PTR, + pRserved: CK_VOID_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetInterfaceList(pInterfacesList: CK_INTERFACE_PTR, pulCount: CK_ULONG_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetInterface( + pInterfaceName: CK_UTF8CHAR_PTR, + pVersion: CK_VERSION_PTR, + ppInterface: CK_INTERFACE_PTR_PTR, + flags: CK_FLAGS, + ) -> CK_RV; +} +extern "C" { + pub fn C_LoginUser( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pUsername: CK_UTF8CHAR_PTR, + ulUsernameLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SessionCancel(hSession: CK_SESSION_HANDLE, flags: CK_FLAGS) -> CK_RV; +} +extern "C" { + pub fn C_MessageEncryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + ulPlaintextLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + pulCiphertextLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + ulPlaintextPartLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + pulCiphertextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageEncryptFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_MessageDecryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + ulCiphertextLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + pulPlaintextLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + ulCiphertextPartLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + pulPlaintextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageDecryptFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_MessageSignInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageSignFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_MessageVerifyInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageVerifyFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +pub type CK_C_Initialize = + ::std::option::Option CK_RV>; +pub type CK_C_Finalize = + ::std::option::Option CK_RV>; +pub type CK_C_GetInfo = ::std::option::Option CK_RV>; +pub type CK_C_GetFunctionList = + ::std::option::Option CK_RV>; +pub type CK_C_GetSlotList = ::std::option::Option< + unsafe extern "C" fn( + tokenPresent: CK_BBOOL, + pSlotList: CK_SLOT_ID_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GetSlotInfo = ::std::option::Option< + unsafe extern "C" fn(slotID: CK_SLOT_ID, pInfo: CK_SLOT_INFO_PTR) -> CK_RV, +>; +pub type CK_C_GetTokenInfo = ::std::option::Option< + unsafe extern "C" fn(slotID: CK_SLOT_ID, pInfo: CK_TOKEN_INFO_PTR) -> CK_RV, +>; +pub type CK_C_GetMechanismList = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + pMechanismList: CK_MECHANISM_TYPE_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GetMechanismInfo = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + type_: CK_MECHANISM_TYPE, + pInfo: CK_MECHANISM_INFO_PTR, + ) -> CK_RV, +>; +pub type CK_C_InitToken = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pLabel: CK_UTF8CHAR_PTR, + ) -> CK_RV, +>; +pub type CK_C_InitPIN = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SetPIN = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pOldPin: CK_UTF8CHAR_PTR, + ulOldLen: CK_ULONG, + pNewPin: CK_UTF8CHAR_PTR, + ulNewLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_OpenSession = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + flags: CK_FLAGS, + pApplication: CK_VOID_PTR, + Notify: CK_NOTIFY, + phSession: CK_SESSION_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_CloseSession = + ::std::option::Option CK_RV>; +pub type CK_C_CloseAllSessions = + ::std::option::Option CK_RV>; +pub type CK_C_GetSessionInfo = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, pInfo: CK_SESSION_INFO_PTR) -> CK_RV, +>; +pub type CK_C_GetOperationState = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + pulOperationStateLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SetOperationState = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + ulOperationStateLen: CK_ULONG, + hEncryptionKey: CK_OBJECT_HANDLE, + hAuthenticationKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Login = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_Logout = + ::std::option::Option CK_RV>; +pub type CK_C_CreateObject = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_CopyObject = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phNewObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_DestroyObject = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, hObject: CK_OBJECT_HANDLE) -> CK_RV, +>; +pub type CK_C_GetObjectSize = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pulSize: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GetAttributeValue = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SetAttributeValue = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_FindObjectsInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_FindObjects = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + phObject: CK_OBJECT_HANDLE_PTR, + ulMaxObjectCount: CK_ULONG, + pulObjectCount: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_FindObjectsFinal = + ::std::option::Option CK_RV>; +pub type CK_C_EncryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Encrypt = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pEncryptedData: CK_BYTE_PTR, + pulEncryptedDataLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_EncryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_EncryptFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pLastEncryptedPart: CK_BYTE_PTR, + pulLastEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Decrypt = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedData: CK_BYTE_PTR, + ulEncryptedDataLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pLastPart: CK_BYTE_PTR, + pulLastPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DigestInit = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, pMechanism: CK_MECHANISM_PTR) -> CK_RV, +>; +pub type CK_C_Digest = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DigestUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_DigestKey = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, hKey: CK_OBJECT_HANDLE) -> CK_RV, +>; +pub type CK_C_DigestFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Sign = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SignFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignRecoverInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_SignRecover = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_VerifyInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Verify = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyRecoverInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_VerifyRecover = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DigestEncryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptDigestUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignEncryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptVerifyUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GenerateKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_GenerateKeyPair = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pPublicKeyTemplate: CK_ATTRIBUTE_PTR, + ulPublicKeyAttributeCount: CK_ULONG, + pPrivateKeyTemplate: CK_ATTRIBUTE_PTR, + ulPrivateKeyAttributeCount: CK_ULONG, + phPublicKey: CK_OBJECT_HANDLE_PTR, + phPrivateKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_WrapKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hWrappingKey: CK_OBJECT_HANDLE, + hKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + pulWrappedKeyLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_UnwrapKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hUnwrappingKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + ulWrappedKeyLen: CK_ULONG, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_DeriveKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hBaseKey: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_SeedRandom = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSeed: CK_BYTE_PTR, + ulSeedLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_GenerateRandom = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + RandomData: CK_BYTE_PTR, + ulRandomLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_GetFunctionStatus = + ::std::option::Option CK_RV>; +pub type CK_C_CancelFunction = + ::std::option::Option CK_RV>; +pub type CK_C_WaitForSlotEvent = ::std::option::Option< + unsafe extern "C" fn(flags: CK_FLAGS, pSlot: CK_SLOT_ID_PTR, pRserved: CK_VOID_PTR) -> CK_RV, +>; +pub type CK_C_GetInterfaceList = ::std::option::Option< + unsafe extern "C" fn(pInterfacesList: CK_INTERFACE_PTR, pulCount: CK_ULONG_PTR) -> CK_RV, +>; +pub type CK_C_GetInterface = ::std::option::Option< + unsafe extern "C" fn( + pInterfaceName: CK_UTF8CHAR_PTR, + pVersion: CK_VERSION_PTR, + ppInterface: CK_INTERFACE_PTR_PTR, + flags: CK_FLAGS, + ) -> CK_RV, +>; +pub type CK_C_LoginUser = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pUsername: CK_UTF8CHAR_PTR, + ulUsernameLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SessionCancel = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, flags: CK_FLAGS) -> CK_RV, +>; +pub type CK_C_MessageEncryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_EncryptMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + ulPlaintextLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + pulCiphertextLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_EncryptMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_EncryptMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + ulPlaintextPartLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + pulCiphertextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV, +>; +pub type CK_C_MessageEncryptFinal = + ::std::option::Option CK_RV>; +pub type CK_C_MessageDecryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_DecryptMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + ulCiphertextLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + pulPlaintextLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_DecryptMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + ulCiphertextPartLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + pulPlaintextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV, +>; +pub type CK_C_MessageDecryptFinal = + ::std::option::Option CK_RV>; +pub type CK_C_MessageSignInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_SignMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SignMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_MessageSignFinal = + ::std::option::Option CK_RV>; +pub type CK_C_MessageVerifyInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_VerifyMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_MessageVerifyFinal = + ::std::option::Option CK_RV>; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_FUNCTION_LIST_3_0 { + pub version: CK_VERSION, + pub C_Initialize: CK_C_Initialize, + pub C_Finalize: CK_C_Finalize, + pub C_GetInfo: CK_C_GetInfo, + pub C_GetFunctionList: CK_C_GetFunctionList, + pub C_GetSlotList: CK_C_GetSlotList, + pub C_GetSlotInfo: CK_C_GetSlotInfo, + pub C_GetTokenInfo: CK_C_GetTokenInfo, + pub C_GetMechanismList: CK_C_GetMechanismList, + pub C_GetMechanismInfo: CK_C_GetMechanismInfo, + pub C_InitToken: CK_C_InitToken, + pub C_InitPIN: CK_C_InitPIN, + pub C_SetPIN: CK_C_SetPIN, + pub C_OpenSession: CK_C_OpenSession, + pub C_CloseSession: CK_C_CloseSession, + pub C_CloseAllSessions: CK_C_CloseAllSessions, + pub C_GetSessionInfo: CK_C_GetSessionInfo, + pub C_GetOperationState: CK_C_GetOperationState, + pub C_SetOperationState: CK_C_SetOperationState, + pub C_Login: CK_C_Login, + pub C_Logout: CK_C_Logout, + pub C_CreateObject: CK_C_CreateObject, + pub C_CopyObject: CK_C_CopyObject, + pub C_DestroyObject: CK_C_DestroyObject, + pub C_GetObjectSize: CK_C_GetObjectSize, + pub C_GetAttributeValue: CK_C_GetAttributeValue, + pub C_SetAttributeValue: CK_C_SetAttributeValue, + pub C_FindObjectsInit: CK_C_FindObjectsInit, + pub C_FindObjects: CK_C_FindObjects, + pub C_FindObjectsFinal: CK_C_FindObjectsFinal, + pub C_EncryptInit: CK_C_EncryptInit, + pub C_Encrypt: CK_C_Encrypt, + pub C_EncryptUpdate: CK_C_EncryptUpdate, + pub C_EncryptFinal: CK_C_EncryptFinal, + pub C_DecryptInit: CK_C_DecryptInit, + pub C_Decrypt: CK_C_Decrypt, + pub C_DecryptUpdate: CK_C_DecryptUpdate, + pub C_DecryptFinal: CK_C_DecryptFinal, + pub C_DigestInit: CK_C_DigestInit, + pub C_Digest: CK_C_Digest, + pub C_DigestUpdate: CK_C_DigestUpdate, + pub C_DigestKey: CK_C_DigestKey, + pub C_DigestFinal: CK_C_DigestFinal, + pub C_SignInit: CK_C_SignInit, + pub C_Sign: CK_C_Sign, + pub C_SignUpdate: CK_C_SignUpdate, + pub C_SignFinal: CK_C_SignFinal, + pub C_SignRecoverInit: CK_C_SignRecoverInit, + pub C_SignRecover: CK_C_SignRecover, + pub C_VerifyInit: CK_C_VerifyInit, + pub C_Verify: CK_C_Verify, + pub C_VerifyUpdate: CK_C_VerifyUpdate, + pub C_VerifyFinal: CK_C_VerifyFinal, + pub C_VerifyRecoverInit: CK_C_VerifyRecoverInit, + pub C_VerifyRecover: CK_C_VerifyRecover, + pub C_DigestEncryptUpdate: CK_C_DigestEncryptUpdate, + pub C_DecryptDigestUpdate: CK_C_DecryptDigestUpdate, + pub C_SignEncryptUpdate: CK_C_SignEncryptUpdate, + pub C_DecryptVerifyUpdate: CK_C_DecryptVerifyUpdate, + pub C_GenerateKey: CK_C_GenerateKey, + pub C_GenerateKeyPair: CK_C_GenerateKeyPair, + pub C_WrapKey: CK_C_WrapKey, + pub C_UnwrapKey: CK_C_UnwrapKey, + pub C_DeriveKey: CK_C_DeriveKey, + pub C_SeedRandom: CK_C_SeedRandom, + pub C_GenerateRandom: CK_C_GenerateRandom, + pub C_GetFunctionStatus: CK_C_GetFunctionStatus, + pub C_CancelFunction: CK_C_CancelFunction, + pub C_WaitForSlotEvent: CK_C_WaitForSlotEvent, + pub C_GetInterfaceList: CK_C_GetInterfaceList, + pub C_GetInterface: CK_C_GetInterface, + pub C_LoginUser: CK_C_LoginUser, + pub C_SessionCancel: CK_C_SessionCancel, + pub C_MessageEncryptInit: CK_C_MessageEncryptInit, + pub C_EncryptMessage: CK_C_EncryptMessage, + pub C_EncryptMessageBegin: CK_C_EncryptMessageBegin, + pub C_EncryptMessageNext: CK_C_EncryptMessageNext, + pub C_MessageEncryptFinal: CK_C_MessageEncryptFinal, + pub C_MessageDecryptInit: CK_C_MessageDecryptInit, + pub C_DecryptMessage: CK_C_DecryptMessage, + pub C_DecryptMessageBegin: CK_C_DecryptMessageBegin, + pub C_DecryptMessageNext: CK_C_DecryptMessageNext, + pub C_MessageDecryptFinal: CK_C_MessageDecryptFinal, + pub C_MessageSignInit: CK_C_MessageSignInit, + pub C_SignMessage: CK_C_SignMessage, + pub C_SignMessageBegin: CK_C_SignMessageBegin, + pub C_SignMessageNext: CK_C_SignMessageNext, + pub C_MessageSignFinal: CK_C_MessageSignFinal, + pub C_MessageVerifyInit: CK_C_MessageVerifyInit, + pub C_VerifyMessage: CK_C_VerifyMessage, + pub C_VerifyMessageBegin: CK_C_VerifyMessageBegin, + pub C_VerifyMessageNext: CK_C_VerifyMessageNext, + pub C_MessageVerifyFinal: CK_C_MessageVerifyFinal, +} +#[test] +fn bindgen_test_layout_CK_FUNCTION_LIST_3_0() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 744usize, + concat!("Size of: ", stringify!(CK_FUNCTION_LIST_3_0)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_FUNCTION_LIST_3_0)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Initialize) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Initialize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Finalize) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Finalize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInfo) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionList) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetFunctionList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotList) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetSlotList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotInfo) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetSlotInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetTokenInfo) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetTokenInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismList) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetMechanismList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismInfo) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetMechanismInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitToken) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_InitToken) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitPIN) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_InitPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetPIN) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SetPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_OpenSession) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_OpenSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseSession) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CloseSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseAllSessions) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CloseAllSessions) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSessionInfo) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetSessionInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetOperationState) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetOperationState) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Login) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Login) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Logout) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Logout) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CreateObject) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CreateObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CopyObject) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CopyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DestroyObject) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DestroyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetObjectSize) as usize - ptr as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetObjectSize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetAttributeValue) as usize - ptr as usize }, + 200usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetAttributeValue) as usize - ptr as usize }, + 208usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsInit) as usize - ptr as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_FindObjectsInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjects) as usize - ptr as usize }, + 224usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_FindObjects) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsFinal) as usize - ptr as usize }, + 232usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_FindObjectsFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptInit) as usize - ptr as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Encrypt) as usize - ptr as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Encrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptUpdate) as usize - ptr as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptFinal) as usize - ptr as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptInit) as usize - ptr as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Decrypt) as usize - ptr as usize }, + 280usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Decrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptUpdate) as usize - ptr as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptFinal) as usize - ptr as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestInit) as usize - ptr as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Digest) as usize - ptr as usize }, + 312usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Digest) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestUpdate) as usize - ptr as usize }, + 320usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestKey) as usize - ptr as usize }, + 328usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestFinal) as usize - ptr as usize }, + 336usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignInit) as usize - ptr as usize }, + 344usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Sign) as usize - ptr as usize }, + 352usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Sign) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignUpdate) as usize - ptr as usize }, + 360usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignFinal) as usize - ptr as usize }, + 368usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecoverInit) as usize - ptr as usize }, + 376usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecover) as usize - ptr as usize }, + 384usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyInit) as usize - ptr as usize }, + 392usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Verify) as usize - ptr as usize }, + 400usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Verify) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyUpdate) as usize - ptr as usize }, + 408usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyFinal) as usize - ptr as usize }, + 416usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecoverInit) as usize - ptr as usize }, + 424usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecover) as usize - ptr as usize }, + 432usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestEncryptUpdate) as usize - ptr as usize }, + 440usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptDigestUpdate) as usize - ptr as usize }, + 448usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptDigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignEncryptUpdate) as usize - ptr as usize }, + 456usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptVerifyUpdate) as usize - ptr as usize }, + 464usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptVerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKey) as usize - ptr as usize }, + 472usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GenerateKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKeyPair) as usize - ptr as usize }, + 480usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GenerateKeyPair) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WrapKey) as usize - ptr as usize }, + 488usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_WrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_UnwrapKey) as usize - ptr as usize }, + 496usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_UnwrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DeriveKey) as usize - ptr as usize }, + 504usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DeriveKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SeedRandom) as usize - ptr as usize }, + 512usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SeedRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateRandom) as usize - ptr as usize }, + 520usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GenerateRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionStatus) as usize - ptr as usize }, + 528usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetFunctionStatus) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CancelFunction) as usize - ptr as usize }, + 536usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CancelFunction) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WaitForSlotEvent) as usize - ptr as usize }, + 544usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_WaitForSlotEvent) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInterfaceList) as usize - ptr as usize }, + 552usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetInterfaceList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInterface) as usize - ptr as usize }, + 560usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetInterface) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_LoginUser) as usize - ptr as usize }, + 568usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_LoginUser) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SessionCancel) as usize - ptr as usize }, + 576usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SessionCancel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageEncryptInit) as usize - ptr as usize }, + 584usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageEncryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptMessage) as usize - ptr as usize }, + 592usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptMessageBegin) as usize - ptr as usize }, + 600usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptMessageNext) as usize - ptr as usize }, + 608usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageEncryptFinal) as usize - ptr as usize }, + 616usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageEncryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageDecryptInit) as usize - ptr as usize }, + 624usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageDecryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptMessage) as usize - ptr as usize }, + 632usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptMessageBegin) as usize - ptr as usize }, + 640usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptMessageNext) as usize - ptr as usize }, + 648usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageDecryptFinal) as usize - ptr as usize }, + 656usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageDecryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageSignInit) as usize - ptr as usize }, + 664usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageSignInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignMessage) as usize - ptr as usize }, + 672usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignMessageBegin) as usize - ptr as usize }, + 680usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignMessageNext) as usize - ptr as usize }, + 688usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageSignFinal) as usize - ptr as usize }, + 696usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageSignFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageVerifyInit) as usize - ptr as usize }, + 704usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageVerifyInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyMessage) as usize - ptr as usize }, + 712usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyMessageBegin) as usize - ptr as usize }, + 720usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyMessageNext) as usize - ptr as usize }, + 728usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageVerifyFinal) as usize - ptr as usize }, + 736usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageVerifyFinal) + ) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_FUNCTION_LIST { + pub version: CK_VERSION, + pub C_Initialize: CK_C_Initialize, + pub C_Finalize: CK_C_Finalize, + pub C_GetInfo: CK_C_GetInfo, + pub C_GetFunctionList: CK_C_GetFunctionList, + pub C_GetSlotList: CK_C_GetSlotList, + pub C_GetSlotInfo: CK_C_GetSlotInfo, + pub C_GetTokenInfo: CK_C_GetTokenInfo, + pub C_GetMechanismList: CK_C_GetMechanismList, + pub C_GetMechanismInfo: CK_C_GetMechanismInfo, + pub C_InitToken: CK_C_InitToken, + pub C_InitPIN: CK_C_InitPIN, + pub C_SetPIN: CK_C_SetPIN, + pub C_OpenSession: CK_C_OpenSession, + pub C_CloseSession: CK_C_CloseSession, + pub C_CloseAllSessions: CK_C_CloseAllSessions, + pub C_GetSessionInfo: CK_C_GetSessionInfo, + pub C_GetOperationState: CK_C_GetOperationState, + pub C_SetOperationState: CK_C_SetOperationState, + pub C_Login: CK_C_Login, + pub C_Logout: CK_C_Logout, + pub C_CreateObject: CK_C_CreateObject, + pub C_CopyObject: CK_C_CopyObject, + pub C_DestroyObject: CK_C_DestroyObject, + pub C_GetObjectSize: CK_C_GetObjectSize, + pub C_GetAttributeValue: CK_C_GetAttributeValue, + pub C_SetAttributeValue: CK_C_SetAttributeValue, + pub C_FindObjectsInit: CK_C_FindObjectsInit, + pub C_FindObjects: CK_C_FindObjects, + pub C_FindObjectsFinal: CK_C_FindObjectsFinal, + pub C_EncryptInit: CK_C_EncryptInit, + pub C_Encrypt: CK_C_Encrypt, + pub C_EncryptUpdate: CK_C_EncryptUpdate, + pub C_EncryptFinal: CK_C_EncryptFinal, + pub C_DecryptInit: CK_C_DecryptInit, + pub C_Decrypt: CK_C_Decrypt, + pub C_DecryptUpdate: CK_C_DecryptUpdate, + pub C_DecryptFinal: CK_C_DecryptFinal, + pub C_DigestInit: CK_C_DigestInit, + pub C_Digest: CK_C_Digest, + pub C_DigestUpdate: CK_C_DigestUpdate, + pub C_DigestKey: CK_C_DigestKey, + pub C_DigestFinal: CK_C_DigestFinal, + pub C_SignInit: CK_C_SignInit, + pub C_Sign: CK_C_Sign, + pub C_SignUpdate: CK_C_SignUpdate, + pub C_SignFinal: CK_C_SignFinal, + pub C_SignRecoverInit: CK_C_SignRecoverInit, + pub C_SignRecover: CK_C_SignRecover, + pub C_VerifyInit: CK_C_VerifyInit, + pub C_Verify: CK_C_Verify, + pub C_VerifyUpdate: CK_C_VerifyUpdate, + pub C_VerifyFinal: CK_C_VerifyFinal, + pub C_VerifyRecoverInit: CK_C_VerifyRecoverInit, + pub C_VerifyRecover: CK_C_VerifyRecover, + pub C_DigestEncryptUpdate: CK_C_DigestEncryptUpdate, + pub C_DecryptDigestUpdate: CK_C_DecryptDigestUpdate, + pub C_SignEncryptUpdate: CK_C_SignEncryptUpdate, + pub C_DecryptVerifyUpdate: CK_C_DecryptVerifyUpdate, + pub C_GenerateKey: CK_C_GenerateKey, + pub C_GenerateKeyPair: CK_C_GenerateKeyPair, + pub C_WrapKey: CK_C_WrapKey, + pub C_UnwrapKey: CK_C_UnwrapKey, + pub C_DeriveKey: CK_C_DeriveKey, + pub C_SeedRandom: CK_C_SeedRandom, + pub C_GenerateRandom: CK_C_GenerateRandom, + pub C_GetFunctionStatus: CK_C_GetFunctionStatus, + pub C_CancelFunction: CK_C_CancelFunction, + pub C_WaitForSlotEvent: CK_C_WaitForSlotEvent, +} +#[test] +fn bindgen_test_layout_CK_FUNCTION_LIST() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 552usize, + concat!("Size of: ", stringify!(CK_FUNCTION_LIST)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(CK_FUNCTION_LIST)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Initialize) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Initialize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Finalize) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Finalize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInfo) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionList) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetFunctionList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotList) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetSlotList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotInfo) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetSlotInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetTokenInfo) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetTokenInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismList) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetMechanismList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismInfo) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetMechanismInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitToken) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_InitToken) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitPIN) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_InitPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetPIN) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SetPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_OpenSession) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_OpenSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseSession) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CloseSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseAllSessions) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CloseAllSessions) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSessionInfo) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetSessionInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetOperationState) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetOperationState) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Login) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Login) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Logout) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Logout) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CreateObject) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CreateObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CopyObject) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CopyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DestroyObject) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DestroyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetObjectSize) as usize - ptr as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetObjectSize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetAttributeValue) as usize - ptr as usize }, + 200usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetAttributeValue) as usize - ptr as usize }, + 208usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsInit) as usize - ptr as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_FindObjectsInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjects) as usize - ptr as usize }, + 224usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_FindObjects) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsFinal) as usize - ptr as usize }, + 232usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_FindObjectsFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptInit) as usize - ptr as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_EncryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Encrypt) as usize - ptr as usize }, + 248usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Encrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptUpdate) as usize - ptr as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_EncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptFinal) as usize - ptr as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_EncryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptInit) as usize - ptr as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Decrypt) as usize - ptr as usize }, + 280usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Decrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptUpdate) as usize - ptr as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptFinal) as usize - ptr as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestInit) as usize - ptr as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Digest) as usize - ptr as usize }, + 312usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Digest) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestUpdate) as usize - ptr as usize }, + 320usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestKey) as usize - ptr as usize }, + 328usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestFinal) as usize - ptr as usize }, + 336usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignInit) as usize - ptr as usize }, + 344usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Sign) as usize - ptr as usize }, + 352usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Sign) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignUpdate) as usize - ptr as usize }, + 360usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignFinal) as usize - ptr as usize }, + 368usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecoverInit) as usize - ptr as usize }, + 376usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecover) as usize - ptr as usize }, + 384usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyInit) as usize - ptr as usize }, + 392usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Verify) as usize - ptr as usize }, + 400usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Verify) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyUpdate) as usize - ptr as usize }, + 408usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyFinal) as usize - ptr as usize }, + 416usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecoverInit) as usize - ptr as usize }, + 424usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecover) as usize - ptr as usize }, + 432usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestEncryptUpdate) as usize - ptr as usize }, + 440usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptDigestUpdate) as usize - ptr as usize }, + 448usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptDigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignEncryptUpdate) as usize - ptr as usize }, + 456usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptVerifyUpdate) as usize - ptr as usize }, + 464usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptVerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKey) as usize - ptr as usize }, + 472usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GenerateKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKeyPair) as usize - ptr as usize }, + 480usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GenerateKeyPair) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WrapKey) as usize - ptr as usize }, + 488usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_WrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_UnwrapKey) as usize - ptr as usize }, + 496usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_UnwrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DeriveKey) as usize - ptr as usize }, + 504usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DeriveKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SeedRandom) as usize - ptr as usize }, + 512usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SeedRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateRandom) as usize - ptr as usize }, + 520usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GenerateRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionStatus) as usize - ptr as usize }, + 528usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetFunctionStatus) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CancelFunction) as usize - ptr as usize }, + 536usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CancelFunction) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WaitForSlotEvent) as usize - ptr as usize }, + 544usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_WaitForSlotEvent) + ) + ); +} diff --git a/pkcs11-sys/src/pkcs11_windows.rs b/pkcs11-sys/src/pkcs11_windows.rs new file mode 100644 index 0000000..b8c62e8 --- /dev/null +++ b/pkcs11-sys/src/pkcs11_windows.rs @@ -0,0 +1,11722 @@ +/* automatically generated by rust-bindgen 0.63.0 */ + +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub const NULL_PTR: u32 = 0; +pub const CRYPTOKI_VERSION_MAJOR: CK_BYTE = 3; +pub const CRYPTOKI_VERSION_MINOR: CK_BYTE = 1; +pub const CRYPTOKI_VERSION_AMENDMENT: CK_BYTE = 0; +pub const CK_TRUE: CK_BBOOL = 1; +pub const CK_FALSE: CK_BBOOL = 0; +pub const FALSE: u32 = 0; +pub const TRUE: u32 = 1; +pub const CK_EFFECTIVELY_INFINITE: CK_ULONG = 0; +pub const CK_INVALID_HANDLE: CK_ULONG = 0; +pub const CKN_SURRENDER: CK_NOTIFICATION = 0; +pub const CKN_OTP_CHANGED: CK_NOTIFICATION = 1; +pub const CKF_TOKEN_PRESENT: CK_FLAGS = 1; +pub const CKF_REMOVABLE_DEVICE: CK_FLAGS = 2; +pub const CKF_HW_SLOT: CK_FLAGS = 4; +pub const CKF_RNG: CK_FLAGS = 1; +pub const CKF_WRITE_PROTECTED: CK_FLAGS = 2; +pub const CKF_LOGIN_REQUIRED: CK_FLAGS = 4; +pub const CKF_USER_PIN_INITIALIZED: CK_FLAGS = 8; +pub const CKF_RESTORE_KEY_NOT_NEEDED: CK_FLAGS = 32; +pub const CKF_CLOCK_ON_TOKEN: CK_FLAGS = 64; +pub const CKF_PROTECTED_AUTHENTICATION_PATH: CK_FLAGS = 256; +pub const CKF_DUAL_CRYPTO_OPERATIONS: CK_FLAGS = 512; +pub const CKF_TOKEN_INITIALIZED: CK_FLAGS = 1024; +pub const CKF_SECONDARY_AUTHENTICATION: CK_FLAGS = 2048; +pub const CKF_USER_PIN_COUNT_LOW: CK_FLAGS = 65536; +pub const CKF_USER_PIN_FINAL_TRY: CK_FLAGS = 131072; +pub const CKF_USER_PIN_LOCKED: CK_FLAGS = 262144; +pub const CKF_USER_PIN_TO_BE_CHANGED: CK_FLAGS = 524288; +pub const CKF_SO_PIN_COUNT_LOW: CK_FLAGS = 1048576; +pub const CKF_SO_PIN_FINAL_TRY: CK_FLAGS = 2097152; +pub const CKF_SO_PIN_LOCKED: CK_FLAGS = 4194304; +pub const CKF_SO_PIN_TO_BE_CHANGED: CK_FLAGS = 8388608; +pub const CKF_ERROR_STATE: CK_FLAGS = 16777216; +pub const CKU_SO: CK_USER_TYPE = 0; +pub const CKU_USER: CK_USER_TYPE = 1; +pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2; +pub const CKS_RO_PUBLIC_SESSION: CK_STATE = 0; +pub const CKS_RO_USER_FUNCTIONS: CK_STATE = 1; +pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2; +pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3; +pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4; +pub const CKF_RW_SESSION: CK_FLAGS = 2; +pub const CKF_SERIAL_SESSION: CK_FLAGS = 4; +pub const CKO_DATA: CK_OBJECT_CLASS = 0; +pub const CKO_CERTIFICATE: CK_OBJECT_CLASS = 1; +pub const CKO_PUBLIC_KEY: CK_OBJECT_CLASS = 2; +pub const CKO_PRIVATE_KEY: CK_OBJECT_CLASS = 3; +pub const CKO_SECRET_KEY: CK_OBJECT_CLASS = 4; +pub const CKO_HW_FEATURE: CK_OBJECT_CLASS = 5; +pub const CKO_DOMAIN_PARAMETERS: CK_OBJECT_CLASS = 6; +pub const CKO_MECHANISM: CK_OBJECT_CLASS = 7; +pub const CKO_OTP_KEY: CK_OBJECT_CLASS = 8; +pub const CKO_PROFILE: CK_OBJECT_CLASS = 9; +pub const CKO_VENDOR_DEFINED: CK_OBJECT_CLASS = 2147483648; +pub const CKP_INVALID_ID: CK_PROFILE_ID = 0; +pub const CKP_BASELINE_PROVIDER: CK_PROFILE_ID = 1; +pub const CKP_EXTENDED_PROVIDER: CK_PROFILE_ID = 2; +pub const CKP_AUTHENTICATION_TOKEN: CK_PROFILE_ID = 3; +pub const CKP_PUBLIC_CERTIFICATES_TOKEN: CK_PROFILE_ID = 4; +pub const CKP_COMPLETE_PROVIDER: CK_PROFILE_ID = 5; +pub const CKP_HKDF_TLS_TOKEN: CK_PROFILE_ID = 6; +pub const CKP_VENDOR_DEFINED: CK_PROFILE_ID = 2147483648; +pub const CKH_MONOTONIC_COUNTER: CK_HW_FEATURE_TYPE = 1; +pub const CKH_CLOCK: CK_HW_FEATURE_TYPE = 2; +pub const CKH_USER_INTERFACE: CK_HW_FEATURE_TYPE = 3; +pub const CKH_VENDOR_DEFINED: CK_HW_FEATURE_TYPE = 2147483648; +pub const CKK_RSA: CK_KEY_TYPE = 0; +pub const CKK_DSA: CK_KEY_TYPE = 1; +pub const CKK_DH: CK_KEY_TYPE = 2; +pub const CKK_ECDSA: CK_KEY_TYPE = 3; +pub const CKK_EC: CK_KEY_TYPE = 3; +pub const CKK_X9_42_DH: CK_KEY_TYPE = 4; +pub const CKK_KEA: CK_KEY_TYPE = 5; +pub const CKK_GENERIC_SECRET: CK_KEY_TYPE = 16; +pub const CKK_RC2: CK_KEY_TYPE = 17; +pub const CKK_RC4: CK_KEY_TYPE = 18; +pub const CKK_DES: CK_KEY_TYPE = 19; +pub const CKK_DES2: CK_KEY_TYPE = 20; +pub const CKK_DES3: CK_KEY_TYPE = 21; +pub const CKK_CAST: CK_KEY_TYPE = 22; +pub const CKK_CAST3: CK_KEY_TYPE = 23; +pub const CKK_CAST5: CK_KEY_TYPE = 24; +pub const CKK_CAST128: CK_KEY_TYPE = 24; +pub const CKK_RC5: CK_KEY_TYPE = 25; +pub const CKK_IDEA: CK_KEY_TYPE = 26; +pub const CKK_SKIPJACK: CK_KEY_TYPE = 27; +pub const CKK_BATON: CK_KEY_TYPE = 28; +pub const CKK_JUNIPER: CK_KEY_TYPE = 29; +pub const CKK_CDMF: CK_KEY_TYPE = 30; +pub const CKK_AES: CK_KEY_TYPE = 31; +pub const CKK_BLOWFISH: CK_KEY_TYPE = 32; +pub const CKK_TWOFISH: CK_KEY_TYPE = 33; +pub const CKK_SECURID: CK_KEY_TYPE = 34; +pub const CKK_HOTP: CK_KEY_TYPE = 35; +pub const CKK_ACTI: CK_KEY_TYPE = 36; +pub const CKK_CAMELLIA: CK_KEY_TYPE = 37; +pub const CKK_ARIA: CK_KEY_TYPE = 38; +pub const CKK_MD5_HMAC: CK_KEY_TYPE = 39; +pub const CKK_SHA_1_HMAC: CK_KEY_TYPE = 40; +pub const CKK_RIPEMD128_HMAC: CK_KEY_TYPE = 41; +pub const CKK_RIPEMD160_HMAC: CK_KEY_TYPE = 42; +pub const CKK_SHA256_HMAC: CK_KEY_TYPE = 43; +pub const CKK_SHA384_HMAC: CK_KEY_TYPE = 44; +pub const CKK_SHA512_HMAC: CK_KEY_TYPE = 45; +pub const CKK_SHA224_HMAC: CK_KEY_TYPE = 46; +pub const CKK_SEED: CK_KEY_TYPE = 47; +pub const CKK_GOSTR3410: CK_KEY_TYPE = 48; +pub const CKK_GOSTR3411: CK_KEY_TYPE = 49; +pub const CKK_GOST28147: CK_KEY_TYPE = 50; +pub const CKK_CHACHA20: CK_KEY_TYPE = 51; +pub const CKK_POLY1305: CK_KEY_TYPE = 52; +pub const CKK_AES_XTS: CK_KEY_TYPE = 53; +pub const CKK_SHA3_224_HMAC: CK_KEY_TYPE = 54; +pub const CKK_SHA3_256_HMAC: CK_KEY_TYPE = 55; +pub const CKK_SHA3_384_HMAC: CK_KEY_TYPE = 56; +pub const CKK_SHA3_512_HMAC: CK_KEY_TYPE = 57; +pub const CKK_BLAKE2B_160_HMAC: CK_KEY_TYPE = 58; +pub const CKK_BLAKE2B_256_HMAC: CK_KEY_TYPE = 59; +pub const CKK_BLAKE2B_384_HMAC: CK_KEY_TYPE = 60; +pub const CKK_BLAKE2B_512_HMAC: CK_KEY_TYPE = 61; +pub const CKK_SALSA20: CK_KEY_TYPE = 62; +pub const CKK_X2RATCHET: CK_KEY_TYPE = 63; +pub const CKK_EC_EDWARDS: CK_KEY_TYPE = 64; +pub const CKK_EC_MONTGOMERY: CK_KEY_TYPE = 65; +pub const CKK_HKDF: CK_KEY_TYPE = 66; +pub const CKK_SHA512_224_HMAC: CK_KEY_TYPE = 67; +pub const CKK_SHA512_256_HMAC: CK_KEY_TYPE = 68; +pub const CKK_SHA512_T_HMAC: CK_KEY_TYPE = 69; +pub const CKK_HSS: CK_KEY_TYPE = 70; +pub const CKK_VENDOR_DEFINED: CK_KEY_TYPE = 2147483648; +pub const CK_CERTIFICATE_CATEGORY_UNSPECIFIED: CK_ULONG = 0; +pub const CK_CERTIFICATE_CATEGORY_TOKEN_USER: CK_ULONG = 1; +pub const CK_CERTIFICATE_CATEGORY_AUTHORITY: CK_ULONG = 2; +pub const CK_CERTIFICATE_CATEGORY_OTHER_ENTITY: CK_ULONG = 3; +pub const CK_SECURITY_DOMAIN_UNSPECIFIED: CK_ULONG = 0; +pub const CK_SECURITY_DOMAIN_MANUFACTURER: CK_ULONG = 1; +pub const CK_SECURITY_DOMAIN_OPERATOR: CK_ULONG = 2; +pub const CK_SECURITY_DOMAIN_THIRD_PARTY: CK_ULONG = 3; +pub const CKC_X_509: CK_CERTIFICATE_TYPE = 0; +pub const CKC_X_509_ATTR_CERT: CK_CERTIFICATE_TYPE = 1; +pub const CKC_WTLS: CK_CERTIFICATE_TYPE = 2; +pub const CKC_VENDOR_DEFINED: CK_CERTIFICATE_TYPE = 2147483648; +pub const CKF_ARRAY_ATTRIBUTE: CK_FLAGS = 1073741824; +pub const CK_OTP_FORMAT_DECIMAL: CK_ULONG = 0; +pub const CK_OTP_FORMAT_HEXADECIMAL: CK_ULONG = 1; +pub const CK_OTP_FORMAT_ALPHANUMERIC: CK_ULONG = 2; +pub const CK_OTP_FORMAT_BINARY: CK_ULONG = 3; +pub const CK_OTP_PARAM_IGNORED: CK_ULONG = 0; +pub const CK_OTP_PARAM_OPTIONAL: CK_ULONG = 1; +pub const CK_OTP_PARAM_MANDATORY: CK_ULONG = 2; +pub const CKA_CLASS: CK_ATTRIBUTE_TYPE = 0; +pub const CKA_TOKEN: CK_ATTRIBUTE_TYPE = 1; +pub const CKA_PRIVATE: CK_ATTRIBUTE_TYPE = 2; +pub const CKA_LABEL: CK_ATTRIBUTE_TYPE = 3; +pub const CKA_UNIQUE_ID: CK_ATTRIBUTE_TYPE = 4; +pub const CKA_APPLICATION: CK_ATTRIBUTE_TYPE = 16; +pub const CKA_VALUE: CK_ATTRIBUTE_TYPE = 17; +pub const CKA_OBJECT_ID: CK_ATTRIBUTE_TYPE = 18; +pub const CKA_CERTIFICATE_TYPE: CK_ATTRIBUTE_TYPE = 128; +pub const CKA_ISSUER: CK_ATTRIBUTE_TYPE = 129; +pub const CKA_SERIAL_NUMBER: CK_ATTRIBUTE_TYPE = 130; +pub const CKA_AC_ISSUER: CK_ATTRIBUTE_TYPE = 131; +pub const CKA_OWNER: CK_ATTRIBUTE_TYPE = 132; +pub const CKA_ATTR_TYPES: CK_ATTRIBUTE_TYPE = 133; +pub const CKA_TRUSTED: CK_ATTRIBUTE_TYPE = 134; +pub const CKA_CERTIFICATE_CATEGORY: CK_ATTRIBUTE_TYPE = 135; +pub const CKA_JAVA_MIDP_SECURITY_DOMAIN: CK_ATTRIBUTE_TYPE = 136; +pub const CKA_URL: CK_ATTRIBUTE_TYPE = 137; +pub const CKA_HASH_OF_SUBJECT_PUBLIC_KEY: CK_ATTRIBUTE_TYPE = 138; +pub const CKA_HASH_OF_ISSUER_PUBLIC_KEY: CK_ATTRIBUTE_TYPE = 139; +pub const CKA_NAME_HASH_ALGORITHM: CK_ATTRIBUTE_TYPE = 140; +pub const CKA_CHECK_VALUE: CK_ATTRIBUTE_TYPE = 144; +pub const CKA_KEY_TYPE: CK_ATTRIBUTE_TYPE = 256; +pub const CKA_SUBJECT: CK_ATTRIBUTE_TYPE = 257; +pub const CKA_ID: CK_ATTRIBUTE_TYPE = 258; +pub const CKA_SENSITIVE: CK_ATTRIBUTE_TYPE = 259; +pub const CKA_ENCRYPT: CK_ATTRIBUTE_TYPE = 260; +pub const CKA_DECRYPT: CK_ATTRIBUTE_TYPE = 261; +pub const CKA_WRAP: CK_ATTRIBUTE_TYPE = 262; +pub const CKA_UNWRAP: CK_ATTRIBUTE_TYPE = 263; +pub const CKA_SIGN: CK_ATTRIBUTE_TYPE = 264; +pub const CKA_SIGN_RECOVER: CK_ATTRIBUTE_TYPE = 265; +pub const CKA_VERIFY: CK_ATTRIBUTE_TYPE = 266; +pub const CKA_VERIFY_RECOVER: CK_ATTRIBUTE_TYPE = 267; +pub const CKA_DERIVE: CK_ATTRIBUTE_TYPE = 268; +pub const CKA_START_DATE: CK_ATTRIBUTE_TYPE = 272; +pub const CKA_END_DATE: CK_ATTRIBUTE_TYPE = 273; +pub const CKA_MODULUS: CK_ATTRIBUTE_TYPE = 288; +pub const CKA_MODULUS_BITS: CK_ATTRIBUTE_TYPE = 289; +pub const CKA_PUBLIC_EXPONENT: CK_ATTRIBUTE_TYPE = 290; +pub const CKA_PRIVATE_EXPONENT: CK_ATTRIBUTE_TYPE = 291; +pub const CKA_PRIME_1: CK_ATTRIBUTE_TYPE = 292; +pub const CKA_PRIME_2: CK_ATTRIBUTE_TYPE = 293; +pub const CKA_EXPONENT_1: CK_ATTRIBUTE_TYPE = 294; +pub const CKA_EXPONENT_2: CK_ATTRIBUTE_TYPE = 295; +pub const CKA_COEFFICIENT: CK_ATTRIBUTE_TYPE = 296; +pub const CKA_PUBLIC_KEY_INFO: CK_ATTRIBUTE_TYPE = 297; +pub const CKA_PRIME: CK_ATTRIBUTE_TYPE = 304; +pub const CKA_SUBPRIME: CK_ATTRIBUTE_TYPE = 305; +pub const CKA_BASE: CK_ATTRIBUTE_TYPE = 306; +pub const CKA_PRIME_BITS: CK_ATTRIBUTE_TYPE = 307; +pub const CKA_SUBPRIME_BITS: CK_ATTRIBUTE_TYPE = 308; +pub const CKA_SUB_PRIME_BITS: CK_ATTRIBUTE_TYPE = 308; +pub const CKA_VALUE_BITS: CK_ATTRIBUTE_TYPE = 352; +pub const CKA_VALUE_LEN: CK_ATTRIBUTE_TYPE = 353; +pub const CKA_EXTRACTABLE: CK_ATTRIBUTE_TYPE = 354; +pub const CKA_LOCAL: CK_ATTRIBUTE_TYPE = 355; +pub const CKA_NEVER_EXTRACTABLE: CK_ATTRIBUTE_TYPE = 356; +pub const CKA_ALWAYS_SENSITIVE: CK_ATTRIBUTE_TYPE = 357; +pub const CKA_KEY_GEN_MECHANISM: CK_ATTRIBUTE_TYPE = 358; +pub const CKA_MODIFIABLE: CK_ATTRIBUTE_TYPE = 368; +pub const CKA_COPYABLE: CK_ATTRIBUTE_TYPE = 369; +pub const CKA_DESTROYABLE: CK_ATTRIBUTE_TYPE = 370; +pub const CKA_ECDSA_PARAMS: CK_ATTRIBUTE_TYPE = 384; +pub const CKA_EC_PARAMS: CK_ATTRIBUTE_TYPE = 384; +pub const CKA_EC_POINT: CK_ATTRIBUTE_TYPE = 385; +pub const CKA_SECONDARY_AUTH: CK_ATTRIBUTE_TYPE = 512; +pub const CKA_AUTH_PIN_FLAGS: CK_ATTRIBUTE_TYPE = 513; +pub const CKA_ALWAYS_AUTHENTICATE: CK_ATTRIBUTE_TYPE = 514; +pub const CKA_WRAP_WITH_TRUSTED: CK_ATTRIBUTE_TYPE = 528; +pub const CKA_WRAP_TEMPLATE: CK_ATTRIBUTE_TYPE = 1073742353; +pub const CKA_UNWRAP_TEMPLATE: CK_ATTRIBUTE_TYPE = 1073742354; +pub const CKA_DERIVE_TEMPLATE: CK_ATTRIBUTE_TYPE = 1073742355; +pub const CKA_OTP_FORMAT: CK_ATTRIBUTE_TYPE = 544; +pub const CKA_OTP_LENGTH: CK_ATTRIBUTE_TYPE = 545; +pub const CKA_OTP_TIME_INTERVAL: CK_ATTRIBUTE_TYPE = 546; +pub const CKA_OTP_USER_FRIENDLY_MODE: CK_ATTRIBUTE_TYPE = 547; +pub const CKA_OTP_CHALLENGE_REQUIREMENT: CK_ATTRIBUTE_TYPE = 548; +pub const CKA_OTP_TIME_REQUIREMENT: CK_ATTRIBUTE_TYPE = 549; +pub const CKA_OTP_COUNTER_REQUIREMENT: CK_ATTRIBUTE_TYPE = 550; +pub const CKA_OTP_PIN_REQUIREMENT: CK_ATTRIBUTE_TYPE = 551; +pub const CKA_OTP_COUNTER: CK_ATTRIBUTE_TYPE = 558; +pub const CKA_OTP_TIME: CK_ATTRIBUTE_TYPE = 559; +pub const CKA_OTP_USER_IDENTIFIER: CK_ATTRIBUTE_TYPE = 554; +pub const CKA_OTP_SERVICE_IDENTIFIER: CK_ATTRIBUTE_TYPE = 555; +pub const CKA_OTP_SERVICE_LOGO: CK_ATTRIBUTE_TYPE = 556; +pub const CKA_OTP_SERVICE_LOGO_TYPE: CK_ATTRIBUTE_TYPE = 557; +pub const CKA_GOSTR3410_PARAMS: CK_ATTRIBUTE_TYPE = 592; +pub const CKA_GOSTR3411_PARAMS: CK_ATTRIBUTE_TYPE = 593; +pub const CKA_GOST28147_PARAMS: CK_ATTRIBUTE_TYPE = 594; +pub const CKA_HW_FEATURE_TYPE: CK_ATTRIBUTE_TYPE = 768; +pub const CKA_RESET_ON_INIT: CK_ATTRIBUTE_TYPE = 769; +pub const CKA_HAS_RESET: CK_ATTRIBUTE_TYPE = 770; +pub const CKA_PIXEL_X: CK_ATTRIBUTE_TYPE = 1024; +pub const CKA_PIXEL_Y: CK_ATTRIBUTE_TYPE = 1025; +pub const CKA_RESOLUTION: CK_ATTRIBUTE_TYPE = 1026; +pub const CKA_CHAR_ROWS: CK_ATTRIBUTE_TYPE = 1027; +pub const CKA_CHAR_COLUMNS: CK_ATTRIBUTE_TYPE = 1028; +pub const CKA_COLOR: CK_ATTRIBUTE_TYPE = 1029; +pub const CKA_BITS_PER_PIXEL: CK_ATTRIBUTE_TYPE = 1030; +pub const CKA_CHAR_SETS: CK_ATTRIBUTE_TYPE = 1152; +pub const CKA_ENCODING_METHODS: CK_ATTRIBUTE_TYPE = 1153; +pub const CKA_MIME_TYPES: CK_ATTRIBUTE_TYPE = 1154; +pub const CKA_MECHANISM_TYPE: CK_ATTRIBUTE_TYPE = 1280; +pub const CKA_REQUIRED_CMS_ATTRIBUTES: CK_ATTRIBUTE_TYPE = 1281; +pub const CKA_DEFAULT_CMS_ATTRIBUTES: CK_ATTRIBUTE_TYPE = 1282; +pub const CKA_SUPPORTED_CMS_ATTRIBUTES: CK_ATTRIBUTE_TYPE = 1283; +pub const CKA_ALLOWED_MECHANISMS: CK_ATTRIBUTE_TYPE = 1073743360; +pub const CKA_PROFILE_ID: CK_ATTRIBUTE_TYPE = 1537; +pub const CKA_X2RATCHET_BAG: CK_ATTRIBUTE_TYPE = 1538; +pub const CKA_X2RATCHET_BAGSIZE: CK_ATTRIBUTE_TYPE = 1539; +pub const CKA_X2RATCHET_BOBS1STMSG: CK_ATTRIBUTE_TYPE = 1540; +pub const CKA_X2RATCHET_CKR: CK_ATTRIBUTE_TYPE = 1541; +pub const CKA_X2RATCHET_CKS: CK_ATTRIBUTE_TYPE = 1542; +pub const CKA_X2RATCHET_DHP: CK_ATTRIBUTE_TYPE = 1543; +pub const CKA_X2RATCHET_DHR: CK_ATTRIBUTE_TYPE = 1544; +pub const CKA_X2RATCHET_DHS: CK_ATTRIBUTE_TYPE = 1545; +pub const CKA_X2RATCHET_HKR: CK_ATTRIBUTE_TYPE = 1546; +pub const CKA_X2RATCHET_HKS: CK_ATTRIBUTE_TYPE = 1547; +pub const CKA_X2RATCHET_ISALICE: CK_ATTRIBUTE_TYPE = 1548; +pub const CKA_X2RATCHET_NHKR: CK_ATTRIBUTE_TYPE = 1549; +pub const CKA_X2RATCHET_NHKS: CK_ATTRIBUTE_TYPE = 1550; +pub const CKA_X2RATCHET_NR: CK_ATTRIBUTE_TYPE = 1551; +pub const CKA_X2RATCHET_NS: CK_ATTRIBUTE_TYPE = 1552; +pub const CKA_X2RATCHET_PNS: CK_ATTRIBUTE_TYPE = 1553; +pub const CKA_X2RATCHET_RK: CK_ATTRIBUTE_TYPE = 1554; +pub const CKA_HSS_LEVELS: CK_ATTRIBUTE_TYPE = 1559; +pub const CKA_HSS_LMS_TYPE: CK_ATTRIBUTE_TYPE = 1560; +pub const CKA_HSS_LMOTS_TYPE: CK_ATTRIBUTE_TYPE = 1561; +pub const CKA_HSS_LMS_TYPES: CK_ATTRIBUTE_TYPE = 1562; +pub const CKA_HSS_LMOTS_TYPES: CK_ATTRIBUTE_TYPE = 1563; +pub const CKA_HSS_KEYS_REMAINING: CK_ATTRIBUTE_TYPE = 1564; +pub const CKA_VENDOR_DEFINED: CK_ATTRIBUTE_TYPE = 2147483648; +pub const CKM_RSA_PKCS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 0; +pub const CKM_RSA_PKCS: CK_MECHANISM_TYPE = 1; +pub const CKM_RSA_9796: CK_MECHANISM_TYPE = 2; +pub const CKM_RSA_X_509: CK_MECHANISM_TYPE = 3; +pub const CKM_MD2_RSA_PKCS: CK_MECHANISM_TYPE = 4; +pub const CKM_MD5_RSA_PKCS: CK_MECHANISM_TYPE = 5; +pub const CKM_SHA1_RSA_PKCS: CK_MECHANISM_TYPE = 6; +pub const CKM_RIPEMD128_RSA_PKCS: CK_MECHANISM_TYPE = 7; +pub const CKM_RIPEMD160_RSA_PKCS: CK_MECHANISM_TYPE = 8; +pub const CKM_RSA_PKCS_OAEP: CK_MECHANISM_TYPE = 9; +pub const CKM_RSA_X9_31_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 10; +pub const CKM_RSA_X9_31: CK_MECHANISM_TYPE = 11; +pub const CKM_SHA1_RSA_X9_31: CK_MECHANISM_TYPE = 12; +pub const CKM_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 13; +pub const CKM_SHA1_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 14; +pub const CKM_DSA_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 16; +pub const CKM_DSA: CK_MECHANISM_TYPE = 17; +pub const CKM_DSA_SHA1: CK_MECHANISM_TYPE = 18; +pub const CKM_DSA_SHA224: CK_MECHANISM_TYPE = 19; +pub const CKM_DSA_SHA256: CK_MECHANISM_TYPE = 20; +pub const CKM_DSA_SHA384: CK_MECHANISM_TYPE = 21; +pub const CKM_DSA_SHA512: CK_MECHANISM_TYPE = 22; +pub const CKM_DSA_SHA3_224: CK_MECHANISM_TYPE = 24; +pub const CKM_DSA_SHA3_256: CK_MECHANISM_TYPE = 25; +pub const CKM_DSA_SHA3_384: CK_MECHANISM_TYPE = 26; +pub const CKM_DSA_SHA3_512: CK_MECHANISM_TYPE = 27; +pub const CKM_DH_PKCS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 32; +pub const CKM_DH_PKCS_DERIVE: CK_MECHANISM_TYPE = 33; +pub const CKM_X9_42_DH_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 48; +pub const CKM_X9_42_DH_DERIVE: CK_MECHANISM_TYPE = 49; +pub const CKM_X9_42_DH_HYBRID_DERIVE: CK_MECHANISM_TYPE = 50; +pub const CKM_X9_42_MQV_DERIVE: CK_MECHANISM_TYPE = 51; +pub const CKM_SHA256_RSA_PKCS: CK_MECHANISM_TYPE = 64; +pub const CKM_SHA384_RSA_PKCS: CK_MECHANISM_TYPE = 65; +pub const CKM_SHA512_RSA_PKCS: CK_MECHANISM_TYPE = 66; +pub const CKM_SHA256_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 67; +pub const CKM_SHA384_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 68; +pub const CKM_SHA512_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 69; +pub const CKM_SHA224_RSA_PKCS: CK_MECHANISM_TYPE = 70; +pub const CKM_SHA224_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 71; +pub const CKM_SHA512_224: CK_MECHANISM_TYPE = 72; +pub const CKM_SHA512_224_HMAC: CK_MECHANISM_TYPE = 73; +pub const CKM_SHA512_224_HMAC_GENERAL: CK_MECHANISM_TYPE = 74; +pub const CKM_SHA512_224_KEY_DERIVATION: CK_MECHANISM_TYPE = 75; +pub const CKM_SHA512_256: CK_MECHANISM_TYPE = 76; +pub const CKM_SHA512_256_HMAC: CK_MECHANISM_TYPE = 77; +pub const CKM_SHA512_256_HMAC_GENERAL: CK_MECHANISM_TYPE = 78; +pub const CKM_SHA512_256_KEY_DERIVATION: CK_MECHANISM_TYPE = 79; +pub const CKM_SHA512_T: CK_MECHANISM_TYPE = 80; +pub const CKM_SHA512_T_HMAC: CK_MECHANISM_TYPE = 81; +pub const CKM_SHA512_T_HMAC_GENERAL: CK_MECHANISM_TYPE = 82; +pub const CKM_SHA512_T_KEY_DERIVATION: CK_MECHANISM_TYPE = 83; +pub const CKM_SHA3_256_RSA_PKCS: CK_MECHANISM_TYPE = 96; +pub const CKM_SHA3_384_RSA_PKCS: CK_MECHANISM_TYPE = 97; +pub const CKM_SHA3_512_RSA_PKCS: CK_MECHANISM_TYPE = 98; +pub const CKM_SHA3_256_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 99; +pub const CKM_SHA3_384_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 100; +pub const CKM_SHA3_512_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 101; +pub const CKM_SHA3_224_RSA_PKCS: CK_MECHANISM_TYPE = 102; +pub const CKM_SHA3_224_RSA_PKCS_PSS: CK_MECHANISM_TYPE = 103; +pub const CKM_RC2_KEY_GEN: CK_MECHANISM_TYPE = 256; +pub const CKM_RC2_ECB: CK_MECHANISM_TYPE = 257; +pub const CKM_RC2_CBC: CK_MECHANISM_TYPE = 258; +pub const CKM_RC2_MAC: CK_MECHANISM_TYPE = 259; +pub const CKM_RC2_MAC_GENERAL: CK_MECHANISM_TYPE = 260; +pub const CKM_RC2_CBC_PAD: CK_MECHANISM_TYPE = 261; +pub const CKM_RC4_KEY_GEN: CK_MECHANISM_TYPE = 272; +pub const CKM_RC4: CK_MECHANISM_TYPE = 273; +pub const CKM_DES_KEY_GEN: CK_MECHANISM_TYPE = 288; +pub const CKM_DES_ECB: CK_MECHANISM_TYPE = 289; +pub const CKM_DES_CBC: CK_MECHANISM_TYPE = 290; +pub const CKM_DES_MAC: CK_MECHANISM_TYPE = 291; +pub const CKM_DES_MAC_GENERAL: CK_MECHANISM_TYPE = 292; +pub const CKM_DES_CBC_PAD: CK_MECHANISM_TYPE = 293; +pub const CKM_DES2_KEY_GEN: CK_MECHANISM_TYPE = 304; +pub const CKM_DES3_KEY_GEN: CK_MECHANISM_TYPE = 305; +pub const CKM_DES3_ECB: CK_MECHANISM_TYPE = 306; +pub const CKM_DES3_CBC: CK_MECHANISM_TYPE = 307; +pub const CKM_DES3_MAC: CK_MECHANISM_TYPE = 308; +pub const CKM_DES3_MAC_GENERAL: CK_MECHANISM_TYPE = 309; +pub const CKM_DES3_CBC_PAD: CK_MECHANISM_TYPE = 310; +pub const CKM_DES3_CMAC_GENERAL: CK_MECHANISM_TYPE = 311; +pub const CKM_DES3_CMAC: CK_MECHANISM_TYPE = 312; +pub const CKM_CDMF_KEY_GEN: CK_MECHANISM_TYPE = 320; +pub const CKM_CDMF_ECB: CK_MECHANISM_TYPE = 321; +pub const CKM_CDMF_CBC: CK_MECHANISM_TYPE = 322; +pub const CKM_CDMF_MAC: CK_MECHANISM_TYPE = 323; +pub const CKM_CDMF_MAC_GENERAL: CK_MECHANISM_TYPE = 324; +pub const CKM_CDMF_CBC_PAD: CK_MECHANISM_TYPE = 325; +pub const CKM_DES_OFB64: CK_MECHANISM_TYPE = 336; +pub const CKM_DES_OFB8: CK_MECHANISM_TYPE = 337; +pub const CKM_DES_CFB64: CK_MECHANISM_TYPE = 338; +pub const CKM_DES_CFB8: CK_MECHANISM_TYPE = 339; +pub const CKM_MD2: CK_MECHANISM_TYPE = 512; +pub const CKM_MD2_HMAC: CK_MECHANISM_TYPE = 513; +pub const CKM_MD2_HMAC_GENERAL: CK_MECHANISM_TYPE = 514; +pub const CKM_MD5: CK_MECHANISM_TYPE = 528; +pub const CKM_MD5_HMAC: CK_MECHANISM_TYPE = 529; +pub const CKM_MD5_HMAC_GENERAL: CK_MECHANISM_TYPE = 530; +pub const CKM_SHA_1: CK_MECHANISM_TYPE = 544; +pub const CKM_SHA_1_HMAC: CK_MECHANISM_TYPE = 545; +pub const CKM_SHA_1_HMAC_GENERAL: CK_MECHANISM_TYPE = 546; +pub const CKM_RIPEMD128: CK_MECHANISM_TYPE = 560; +pub const CKM_RIPEMD128_HMAC: CK_MECHANISM_TYPE = 561; +pub const CKM_RIPEMD128_HMAC_GENERAL: CK_MECHANISM_TYPE = 562; +pub const CKM_RIPEMD160: CK_MECHANISM_TYPE = 576; +pub const CKM_RIPEMD160_HMAC: CK_MECHANISM_TYPE = 577; +pub const CKM_RIPEMD160_HMAC_GENERAL: CK_MECHANISM_TYPE = 578; +pub const CKM_SHA256: CK_MECHANISM_TYPE = 592; +pub const CKM_SHA256_HMAC: CK_MECHANISM_TYPE = 593; +pub const CKM_SHA256_HMAC_GENERAL: CK_MECHANISM_TYPE = 594; +pub const CKM_SHA224: CK_MECHANISM_TYPE = 597; +pub const CKM_SHA224_HMAC: CK_MECHANISM_TYPE = 598; +pub const CKM_SHA224_HMAC_GENERAL: CK_MECHANISM_TYPE = 599; +pub const CKM_SHA384: CK_MECHANISM_TYPE = 608; +pub const CKM_SHA384_HMAC: CK_MECHANISM_TYPE = 609; +pub const CKM_SHA384_HMAC_GENERAL: CK_MECHANISM_TYPE = 610; +pub const CKM_SHA512: CK_MECHANISM_TYPE = 624; +pub const CKM_SHA512_HMAC: CK_MECHANISM_TYPE = 625; +pub const CKM_SHA512_HMAC_GENERAL: CK_MECHANISM_TYPE = 626; +pub const CKM_SECURID_KEY_GEN: CK_MECHANISM_TYPE = 640; +pub const CKM_SECURID: CK_MECHANISM_TYPE = 642; +pub const CKM_HOTP_KEY_GEN: CK_MECHANISM_TYPE = 656; +pub const CKM_HOTP: CK_MECHANISM_TYPE = 657; +pub const CKM_ACTI: CK_MECHANISM_TYPE = 672; +pub const CKM_ACTI_KEY_GEN: CK_MECHANISM_TYPE = 673; +pub const CKM_SHA3_256: CK_MECHANISM_TYPE = 688; +pub const CKM_SHA3_256_HMAC: CK_MECHANISM_TYPE = 689; +pub const CKM_SHA3_256_HMAC_GENERAL: CK_MECHANISM_TYPE = 690; +pub const CKM_SHA3_256_KEY_GEN: CK_MECHANISM_TYPE = 691; +pub const CKM_SHA3_224: CK_MECHANISM_TYPE = 693; +pub const CKM_SHA3_224_HMAC: CK_MECHANISM_TYPE = 694; +pub const CKM_SHA3_224_HMAC_GENERAL: CK_MECHANISM_TYPE = 695; +pub const CKM_SHA3_224_KEY_GEN: CK_MECHANISM_TYPE = 696; +pub const CKM_SHA3_384: CK_MECHANISM_TYPE = 704; +pub const CKM_SHA3_384_HMAC: CK_MECHANISM_TYPE = 705; +pub const CKM_SHA3_384_HMAC_GENERAL: CK_MECHANISM_TYPE = 706; +pub const CKM_SHA3_384_KEY_GEN: CK_MECHANISM_TYPE = 707; +pub const CKM_SHA3_512: CK_MECHANISM_TYPE = 720; +pub const CKM_SHA3_512_HMAC: CK_MECHANISM_TYPE = 721; +pub const CKM_SHA3_512_HMAC_GENERAL: CK_MECHANISM_TYPE = 722; +pub const CKM_SHA3_512_KEY_GEN: CK_MECHANISM_TYPE = 723; +pub const CKM_CAST_KEY_GEN: CK_MECHANISM_TYPE = 768; +pub const CKM_CAST_ECB: CK_MECHANISM_TYPE = 769; +pub const CKM_CAST_CBC: CK_MECHANISM_TYPE = 770; +pub const CKM_CAST_MAC: CK_MECHANISM_TYPE = 771; +pub const CKM_CAST_MAC_GENERAL: CK_MECHANISM_TYPE = 772; +pub const CKM_CAST_CBC_PAD: CK_MECHANISM_TYPE = 773; +pub const CKM_CAST3_KEY_GEN: CK_MECHANISM_TYPE = 784; +pub const CKM_CAST3_ECB: CK_MECHANISM_TYPE = 785; +pub const CKM_CAST3_CBC: CK_MECHANISM_TYPE = 786; +pub const CKM_CAST3_MAC: CK_MECHANISM_TYPE = 787; +pub const CKM_CAST3_MAC_GENERAL: CK_MECHANISM_TYPE = 788; +pub const CKM_CAST3_CBC_PAD: CK_MECHANISM_TYPE = 789; +pub const CKM_CAST5_KEY_GEN: CK_MECHANISM_TYPE = 800; +pub const CKM_CAST128_KEY_GEN: CK_MECHANISM_TYPE = 800; +pub const CKM_CAST5_ECB: CK_MECHANISM_TYPE = 801; +pub const CKM_CAST128_ECB: CK_MECHANISM_TYPE = 801; +pub const CKM_CAST5_CBC: CK_MECHANISM_TYPE = 802; +pub const CKM_CAST128_CBC: CK_MECHANISM_TYPE = 802; +pub const CKM_CAST5_MAC: CK_MECHANISM_TYPE = 803; +pub const CKM_CAST128_MAC: CK_MECHANISM_TYPE = 803; +pub const CKM_CAST5_MAC_GENERAL: CK_MECHANISM_TYPE = 804; +pub const CKM_CAST128_MAC_GENERAL: CK_MECHANISM_TYPE = 804; +pub const CKM_CAST5_CBC_PAD: CK_MECHANISM_TYPE = 805; +pub const CKM_CAST128_CBC_PAD: CK_MECHANISM_TYPE = 805; +pub const CKM_RC5_KEY_GEN: CK_MECHANISM_TYPE = 816; +pub const CKM_RC5_ECB: CK_MECHANISM_TYPE = 817; +pub const CKM_RC5_CBC: CK_MECHANISM_TYPE = 818; +pub const CKM_RC5_MAC: CK_MECHANISM_TYPE = 819; +pub const CKM_RC5_MAC_GENERAL: CK_MECHANISM_TYPE = 820; +pub const CKM_RC5_CBC_PAD: CK_MECHANISM_TYPE = 821; +pub const CKM_IDEA_KEY_GEN: CK_MECHANISM_TYPE = 832; +pub const CKM_IDEA_ECB: CK_MECHANISM_TYPE = 833; +pub const CKM_IDEA_CBC: CK_MECHANISM_TYPE = 834; +pub const CKM_IDEA_MAC: CK_MECHANISM_TYPE = 835; +pub const CKM_IDEA_MAC_GENERAL: CK_MECHANISM_TYPE = 836; +pub const CKM_IDEA_CBC_PAD: CK_MECHANISM_TYPE = 837; +pub const CKM_GENERIC_SECRET_KEY_GEN: CK_MECHANISM_TYPE = 848; +pub const CKM_CONCATENATE_BASE_AND_KEY: CK_MECHANISM_TYPE = 864; +pub const CKM_CONCATENATE_BASE_AND_DATA: CK_MECHANISM_TYPE = 866; +pub const CKM_CONCATENATE_DATA_AND_BASE: CK_MECHANISM_TYPE = 867; +pub const CKM_XOR_BASE_AND_DATA: CK_MECHANISM_TYPE = 868; +pub const CKM_EXTRACT_KEY_FROM_KEY: CK_MECHANISM_TYPE = 869; +pub const CKM_SSL3_PRE_MASTER_KEY_GEN: CK_MECHANISM_TYPE = 880; +pub const CKM_SSL3_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 881; +pub const CKM_SSL3_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 882; +pub const CKM_SSL3_MASTER_KEY_DERIVE_DH: CK_MECHANISM_TYPE = 883; +pub const CKM_TLS_PRE_MASTER_KEY_GEN: CK_MECHANISM_TYPE = 884; +pub const CKM_TLS_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 885; +pub const CKM_TLS_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 886; +pub const CKM_TLS_MASTER_KEY_DERIVE_DH: CK_MECHANISM_TYPE = 887; +pub const CKM_TLS_PRF: CK_MECHANISM_TYPE = 888; +pub const CKM_SSL3_MD5_MAC: CK_MECHANISM_TYPE = 896; +pub const CKM_SSL3_SHA1_MAC: CK_MECHANISM_TYPE = 897; +pub const CKM_MD5_KEY_DERIVATION: CK_MECHANISM_TYPE = 912; +pub const CKM_MD2_KEY_DERIVATION: CK_MECHANISM_TYPE = 913; +pub const CKM_SHA1_KEY_DERIVATION: CK_MECHANISM_TYPE = 914; +pub const CKM_SHA256_KEY_DERIVATION: CK_MECHANISM_TYPE = 915; +pub const CKM_SHA384_KEY_DERIVATION: CK_MECHANISM_TYPE = 916; +pub const CKM_SHA512_KEY_DERIVATION: CK_MECHANISM_TYPE = 917; +pub const CKM_SHA224_KEY_DERIVATION: CK_MECHANISM_TYPE = 918; +pub const CKM_SHA3_256_KEY_DERIVATION: CK_MECHANISM_TYPE = 919; +pub const CKM_SHA3_224_KEY_DERIVATION: CK_MECHANISM_TYPE = 920; +pub const CKM_SHA3_384_KEY_DERIVATION: CK_MECHANISM_TYPE = 921; +pub const CKM_SHA3_512_KEY_DERIVATION: CK_MECHANISM_TYPE = 922; +pub const CKM_SHAKE_128_KEY_DERIVATION: CK_MECHANISM_TYPE = 923; +pub const CKM_SHAKE_256_KEY_DERIVATION: CK_MECHANISM_TYPE = 924; +pub const CKM_SHA3_256_KEY_DERIVE: CK_MECHANISM_TYPE = 919; +pub const CKM_SHA3_224_KEY_DERIVE: CK_MECHANISM_TYPE = 920; +pub const CKM_SHA3_384_KEY_DERIVE: CK_MECHANISM_TYPE = 921; +pub const CKM_SHA3_512_KEY_DERIVE: CK_MECHANISM_TYPE = 922; +pub const CKM_SHAKE_128_KEY_DERIVE: CK_MECHANISM_TYPE = 923; +pub const CKM_SHAKE_256_KEY_DERIVE: CK_MECHANISM_TYPE = 924; +pub const CKM_PBE_MD2_DES_CBC: CK_MECHANISM_TYPE = 928; +pub const CKM_PBE_MD5_DES_CBC: CK_MECHANISM_TYPE = 929; +pub const CKM_PBE_MD5_CAST_CBC: CK_MECHANISM_TYPE = 930; +pub const CKM_PBE_MD5_CAST3_CBC: CK_MECHANISM_TYPE = 931; +pub const CKM_PBE_MD5_CAST5_CBC: CK_MECHANISM_TYPE = 932; +pub const CKM_PBE_MD5_CAST128_CBC: CK_MECHANISM_TYPE = 932; +pub const CKM_PBE_SHA1_CAST5_CBC: CK_MECHANISM_TYPE = 933; +pub const CKM_PBE_SHA1_CAST128_CBC: CK_MECHANISM_TYPE = 933; +pub const CKM_PBE_SHA1_RC4_128: CK_MECHANISM_TYPE = 934; +pub const CKM_PBE_SHA1_RC4_40: CK_MECHANISM_TYPE = 935; +pub const CKM_PBE_SHA1_DES3_EDE_CBC: CK_MECHANISM_TYPE = 936; +pub const CKM_PBE_SHA1_DES2_EDE_CBC: CK_MECHANISM_TYPE = 937; +pub const CKM_PBE_SHA1_RC2_128_CBC: CK_MECHANISM_TYPE = 938; +pub const CKM_PBE_SHA1_RC2_40_CBC: CK_MECHANISM_TYPE = 939; +pub const CKM_PKCS5_PBKD2: CK_MECHANISM_TYPE = 944; +pub const CKM_PBA_SHA1_WITH_SHA1_HMAC: CK_MECHANISM_TYPE = 960; +pub const CKM_WTLS_PRE_MASTER_KEY_GEN: CK_MECHANISM_TYPE = 976; +pub const CKM_WTLS_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 977; +pub const CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC: CK_MECHANISM_TYPE = 978; +pub const CKM_WTLS_PRF: CK_MECHANISM_TYPE = 979; +pub const CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 980; +pub const CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 981; +pub const CKM_TLS10_MAC_SERVER: CK_MECHANISM_TYPE = 982; +pub const CKM_TLS10_MAC_CLIENT: CK_MECHANISM_TYPE = 983; +pub const CKM_TLS12_MAC: CK_MECHANISM_TYPE = 984; +pub const CKM_TLS12_KDF: CK_MECHANISM_TYPE = 985; +pub const CKM_TLS12_MASTER_KEY_DERIVE: CK_MECHANISM_TYPE = 992; +pub const CKM_TLS12_KEY_AND_MAC_DERIVE: CK_MECHANISM_TYPE = 993; +pub const CKM_TLS12_MASTER_KEY_DERIVE_DH: CK_MECHANISM_TYPE = 994; +pub const CKM_TLS12_KEY_SAFE_DERIVE: CK_MECHANISM_TYPE = 995; +pub const CKM_TLS_MAC: CK_MECHANISM_TYPE = 996; +pub const CKM_TLS_KDF: CK_MECHANISM_TYPE = 997; +pub const CKM_KEY_WRAP_LYNKS: CK_MECHANISM_TYPE = 1024; +pub const CKM_KEY_WRAP_SET_OAEP: CK_MECHANISM_TYPE = 1025; +pub const CKM_CMS_SIG: CK_MECHANISM_TYPE = 1280; +pub const CKM_KIP_DERIVE: CK_MECHANISM_TYPE = 1296; +pub const CKM_KIP_WRAP: CK_MECHANISM_TYPE = 1297; +pub const CKM_KIP_MAC: CK_MECHANISM_TYPE = 1298; +pub const CKM_CAMELLIA_KEY_GEN: CK_MECHANISM_TYPE = 1360; +pub const CKM_CAMELLIA_ECB: CK_MECHANISM_TYPE = 1361; +pub const CKM_CAMELLIA_CBC: CK_MECHANISM_TYPE = 1362; +pub const CKM_CAMELLIA_MAC: CK_MECHANISM_TYPE = 1363; +pub const CKM_CAMELLIA_MAC_GENERAL: CK_MECHANISM_TYPE = 1364; +pub const CKM_CAMELLIA_CBC_PAD: CK_MECHANISM_TYPE = 1365; +pub const CKM_CAMELLIA_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1366; +pub const CKM_CAMELLIA_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1367; +pub const CKM_CAMELLIA_CTR: CK_MECHANISM_TYPE = 1368; +pub const CKM_ARIA_KEY_GEN: CK_MECHANISM_TYPE = 1376; +pub const CKM_ARIA_ECB: CK_MECHANISM_TYPE = 1377; +pub const CKM_ARIA_CBC: CK_MECHANISM_TYPE = 1378; +pub const CKM_ARIA_MAC: CK_MECHANISM_TYPE = 1379; +pub const CKM_ARIA_MAC_GENERAL: CK_MECHANISM_TYPE = 1380; +pub const CKM_ARIA_CBC_PAD: CK_MECHANISM_TYPE = 1381; +pub const CKM_ARIA_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1382; +pub const CKM_ARIA_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1383; +pub const CKM_SEED_KEY_GEN: CK_MECHANISM_TYPE = 1616; +pub const CKM_SEED_ECB: CK_MECHANISM_TYPE = 1617; +pub const CKM_SEED_CBC: CK_MECHANISM_TYPE = 1618; +pub const CKM_SEED_MAC: CK_MECHANISM_TYPE = 1619; +pub const CKM_SEED_MAC_GENERAL: CK_MECHANISM_TYPE = 1620; +pub const CKM_SEED_CBC_PAD: CK_MECHANISM_TYPE = 1621; +pub const CKM_SEED_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1622; +pub const CKM_SEED_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 1623; +pub const CKM_SKIPJACK_KEY_GEN: CK_MECHANISM_TYPE = 4096; +pub const CKM_SKIPJACK_ECB64: CK_MECHANISM_TYPE = 4097; +pub const CKM_SKIPJACK_CBC64: CK_MECHANISM_TYPE = 4098; +pub const CKM_SKIPJACK_OFB64: CK_MECHANISM_TYPE = 4099; +pub const CKM_SKIPJACK_CFB64: CK_MECHANISM_TYPE = 4100; +pub const CKM_SKIPJACK_CFB32: CK_MECHANISM_TYPE = 4101; +pub const CKM_SKIPJACK_CFB16: CK_MECHANISM_TYPE = 4102; +pub const CKM_SKIPJACK_CFB8: CK_MECHANISM_TYPE = 4103; +pub const CKM_SKIPJACK_WRAP: CK_MECHANISM_TYPE = 4104; +pub const CKM_SKIPJACK_PRIVATE_WRAP: CK_MECHANISM_TYPE = 4105; +pub const CKM_SKIPJACK_RELAYX: CK_MECHANISM_TYPE = 4106; +pub const CKM_KEA_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4112; +pub const CKM_KEA_KEY_DERIVE: CK_MECHANISM_TYPE = 4113; +pub const CKM_KEA_DERIVE: CK_MECHANISM_TYPE = 4114; +pub const CKM_FORTEZZA_TIMESTAMP: CK_MECHANISM_TYPE = 4128; +pub const CKM_BATON_KEY_GEN: CK_MECHANISM_TYPE = 4144; +pub const CKM_BATON_ECB128: CK_MECHANISM_TYPE = 4145; +pub const CKM_BATON_ECB96: CK_MECHANISM_TYPE = 4146; +pub const CKM_BATON_CBC128: CK_MECHANISM_TYPE = 4147; +pub const CKM_BATON_COUNTER: CK_MECHANISM_TYPE = 4148; +pub const CKM_BATON_SHUFFLE: CK_MECHANISM_TYPE = 4149; +pub const CKM_BATON_WRAP: CK_MECHANISM_TYPE = 4150; +pub const CKM_ECDSA_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4160; +pub const CKM_EC_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4160; +pub const CKM_ECDSA: CK_MECHANISM_TYPE = 4161; +pub const CKM_ECDSA_SHA1: CK_MECHANISM_TYPE = 4162; +pub const CKM_ECDSA_SHA224: CK_MECHANISM_TYPE = 4163; +pub const CKM_ECDSA_SHA256: CK_MECHANISM_TYPE = 4164; +pub const CKM_ECDSA_SHA384: CK_MECHANISM_TYPE = 4165; +pub const CKM_ECDSA_SHA512: CK_MECHANISM_TYPE = 4166; +pub const CKM_EC_KEY_PAIR_GEN_W_EXTRA_BITS: CK_MECHANISM_TYPE = 5131; +pub const CKM_ECDH1_DERIVE: CK_MECHANISM_TYPE = 4176; +pub const CKM_ECDH1_COFACTOR_DERIVE: CK_MECHANISM_TYPE = 4177; +pub const CKM_ECMQV_DERIVE: CK_MECHANISM_TYPE = 4178; +pub const CKM_ECDH_AES_KEY_WRAP: CK_MECHANISM_TYPE = 4179; +pub const CKM_RSA_AES_KEY_WRAP: CK_MECHANISM_TYPE = 4180; +pub const CKM_JUNIPER_KEY_GEN: CK_MECHANISM_TYPE = 4192; +pub const CKM_JUNIPER_ECB128: CK_MECHANISM_TYPE = 4193; +pub const CKM_JUNIPER_CBC128: CK_MECHANISM_TYPE = 4194; +pub const CKM_JUNIPER_COUNTER: CK_MECHANISM_TYPE = 4195; +pub const CKM_JUNIPER_SHUFFLE: CK_MECHANISM_TYPE = 4196; +pub const CKM_JUNIPER_WRAP: CK_MECHANISM_TYPE = 4197; +pub const CKM_FASTHASH: CK_MECHANISM_TYPE = 4208; +pub const CKM_AES_XTS: CK_MECHANISM_TYPE = 4209; +pub const CKM_AES_XTS_KEY_GEN: CK_MECHANISM_TYPE = 4210; +pub const CKM_AES_KEY_GEN: CK_MECHANISM_TYPE = 4224; +pub const CKM_AES_ECB: CK_MECHANISM_TYPE = 4225; +pub const CKM_AES_CBC: CK_MECHANISM_TYPE = 4226; +pub const CKM_AES_MAC: CK_MECHANISM_TYPE = 4227; +pub const CKM_AES_MAC_GENERAL: CK_MECHANISM_TYPE = 4228; +pub const CKM_AES_CBC_PAD: CK_MECHANISM_TYPE = 4229; +pub const CKM_AES_CTR: CK_MECHANISM_TYPE = 4230; +pub const CKM_AES_GCM: CK_MECHANISM_TYPE = 4231; +pub const CKM_AES_CCM: CK_MECHANISM_TYPE = 4232; +pub const CKM_AES_CTS: CK_MECHANISM_TYPE = 4233; +pub const CKM_AES_CMAC: CK_MECHANISM_TYPE = 4234; +pub const CKM_AES_CMAC_GENERAL: CK_MECHANISM_TYPE = 4235; +pub const CKM_AES_XCBC_MAC: CK_MECHANISM_TYPE = 4236; +pub const CKM_AES_XCBC_MAC_96: CK_MECHANISM_TYPE = 4237; +pub const CKM_AES_GMAC: CK_MECHANISM_TYPE = 4238; +pub const CKM_BLOWFISH_KEY_GEN: CK_MECHANISM_TYPE = 4240; +pub const CKM_BLOWFISH_CBC: CK_MECHANISM_TYPE = 4241; +pub const CKM_TWOFISH_KEY_GEN: CK_MECHANISM_TYPE = 4242; +pub const CKM_TWOFISH_CBC: CK_MECHANISM_TYPE = 4243; +pub const CKM_BLOWFISH_CBC_PAD: CK_MECHANISM_TYPE = 4244; +pub const CKM_TWOFISH_CBC_PAD: CK_MECHANISM_TYPE = 4245; +pub const CKM_DES_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4352; +pub const CKM_DES_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4353; +pub const CKM_DES3_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4354; +pub const CKM_DES3_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4355; +pub const CKM_AES_ECB_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4356; +pub const CKM_AES_CBC_ENCRYPT_DATA: CK_MECHANISM_TYPE = 4357; +pub const CKM_GOSTR3410_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4608; +pub const CKM_GOSTR3410: CK_MECHANISM_TYPE = 4609; +pub const CKM_GOSTR3410_WITH_GOSTR3411: CK_MECHANISM_TYPE = 4610; +pub const CKM_GOSTR3410_KEY_WRAP: CK_MECHANISM_TYPE = 4611; +pub const CKM_GOSTR3410_DERIVE: CK_MECHANISM_TYPE = 4612; +pub const CKM_GOSTR3411: CK_MECHANISM_TYPE = 4624; +pub const CKM_GOSTR3411_HMAC: CK_MECHANISM_TYPE = 4625; +pub const CKM_GOST28147_KEY_GEN: CK_MECHANISM_TYPE = 4640; +pub const CKM_GOST28147_ECB: CK_MECHANISM_TYPE = 4641; +pub const CKM_GOST28147: CK_MECHANISM_TYPE = 4642; +pub const CKM_GOST28147_MAC: CK_MECHANISM_TYPE = 4643; +pub const CKM_GOST28147_KEY_WRAP: CK_MECHANISM_TYPE = 4644; +pub const CKM_CHACHA20_KEY_GEN: CK_MECHANISM_TYPE = 4645; +pub const CKM_CHACHA20: CK_MECHANISM_TYPE = 4646; +pub const CKM_POLY1305_KEY_GEN: CK_MECHANISM_TYPE = 4647; +pub const CKM_POLY1305: CK_MECHANISM_TYPE = 4648; +pub const CKM_DSA_PARAMETER_GEN: CK_MECHANISM_TYPE = 8192; +pub const CKM_DH_PKCS_PARAMETER_GEN: CK_MECHANISM_TYPE = 8193; +pub const CKM_X9_42_DH_PARAMETER_GEN: CK_MECHANISM_TYPE = 8194; +pub const CKM_DSA_PROBABILISTIC_PARAMETER_GEN: CK_MECHANISM_TYPE = 8195; +pub const CKM_DSA_PROBABLISTIC_PARAMETER_GEN: CK_MECHANISM_TYPE = 8195; +pub const CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN: CK_MECHANISM_TYPE = 8196; +pub const CKM_DSA_FIPS_G_GEN: CK_MECHANISM_TYPE = 8197; +pub const CKM_AES_OFB: CK_MECHANISM_TYPE = 8452; +pub const CKM_AES_CFB64: CK_MECHANISM_TYPE = 8453; +pub const CKM_AES_CFB8: CK_MECHANISM_TYPE = 8454; +pub const CKM_AES_CFB128: CK_MECHANISM_TYPE = 8455; +pub const CKM_AES_CFB1: CK_MECHANISM_TYPE = 8456; +pub const CKM_AES_KEY_WRAP: CK_MECHANISM_TYPE = 8457; +pub const CKM_AES_KEY_WRAP_PAD: CK_MECHANISM_TYPE = 8458; +pub const CKM_AES_KEY_WRAP_KWP: CK_MECHANISM_TYPE = 8459; +pub const CKM_AES_KEY_WRAP_PKCS7: CK_MECHANISM_TYPE = 8460; +pub const CKM_RSA_PKCS_TPM_1_1: CK_MECHANISM_TYPE = 16385; +pub const CKM_RSA_PKCS_OAEP_TPM_1_1: CK_MECHANISM_TYPE = 16386; +pub const CKM_SHA_1_KEY_GEN: CK_MECHANISM_TYPE = 16387; +pub const CKM_SHA224_KEY_GEN: CK_MECHANISM_TYPE = 16388; +pub const CKM_SHA256_KEY_GEN: CK_MECHANISM_TYPE = 16389; +pub const CKM_SHA384_KEY_GEN: CK_MECHANISM_TYPE = 16390; +pub const CKM_SHA512_KEY_GEN: CK_MECHANISM_TYPE = 16391; +pub const CKM_SHA512_224_KEY_GEN: CK_MECHANISM_TYPE = 16392; +pub const CKM_SHA512_256_KEY_GEN: CK_MECHANISM_TYPE = 16393; +pub const CKM_SHA512_T_KEY_GEN: CK_MECHANISM_TYPE = 16394; +pub const CKM_NULL: CK_MECHANISM_TYPE = 16395; +pub const CKM_BLAKE2B_160: CK_MECHANISM_TYPE = 16396; +pub const CKM_BLAKE2B_160_HMAC: CK_MECHANISM_TYPE = 16397; +pub const CKM_BLAKE2B_160_HMAC_GENERAL: CK_MECHANISM_TYPE = 16398; +pub const CKM_BLAKE2B_160_KEY_DERIVE: CK_MECHANISM_TYPE = 16399; +pub const CKM_BLAKE2B_160_KEY_GEN: CK_MECHANISM_TYPE = 16400; +pub const CKM_BLAKE2B_256: CK_MECHANISM_TYPE = 16401; +pub const CKM_BLAKE2B_256_HMAC: CK_MECHANISM_TYPE = 16402; +pub const CKM_BLAKE2B_256_HMAC_GENERAL: CK_MECHANISM_TYPE = 16403; +pub const CKM_BLAKE2B_256_KEY_DERIVE: CK_MECHANISM_TYPE = 16404; +pub const CKM_BLAKE2B_256_KEY_GEN: CK_MECHANISM_TYPE = 16405; +pub const CKM_BLAKE2B_384: CK_MECHANISM_TYPE = 16406; +pub const CKM_BLAKE2B_384_HMAC: CK_MECHANISM_TYPE = 16407; +pub const CKM_BLAKE2B_384_HMAC_GENERAL: CK_MECHANISM_TYPE = 16408; +pub const CKM_BLAKE2B_384_KEY_DERIVE: CK_MECHANISM_TYPE = 16409; +pub const CKM_BLAKE2B_384_KEY_GEN: CK_MECHANISM_TYPE = 16410; +pub const CKM_BLAKE2B_512: CK_MECHANISM_TYPE = 16411; +pub const CKM_BLAKE2B_512_HMAC: CK_MECHANISM_TYPE = 16412; +pub const CKM_BLAKE2B_512_HMAC_GENERAL: CK_MECHANISM_TYPE = 16413; +pub const CKM_BLAKE2B_512_KEY_DERIVE: CK_MECHANISM_TYPE = 16414; +pub const CKM_BLAKE2B_512_KEY_GEN: CK_MECHANISM_TYPE = 16415; +pub const CKM_SALSA20: CK_MECHANISM_TYPE = 16416; +pub const CKM_CHACHA20_POLY1305: CK_MECHANISM_TYPE = 16417; +pub const CKM_SALSA20_POLY1305: CK_MECHANISM_TYPE = 16418; +pub const CKM_X3DH_INITIALIZE: CK_MECHANISM_TYPE = 16419; +pub const CKM_X3DH_RESPOND: CK_MECHANISM_TYPE = 16420; +pub const CKM_X2RATCHET_INITIALIZE: CK_MECHANISM_TYPE = 16421; +pub const CKM_X2RATCHET_RESPOND: CK_MECHANISM_TYPE = 16422; +pub const CKM_X2RATCHET_ENCRYPT: CK_MECHANISM_TYPE = 16423; +pub const CKM_X2RATCHET_DECRYPT: CK_MECHANISM_TYPE = 16424; +pub const CKM_XEDDSA: CK_MECHANISM_TYPE = 16425; +pub const CKM_HKDF_DERIVE: CK_MECHANISM_TYPE = 16426; +pub const CKM_HKDF_DATA: CK_MECHANISM_TYPE = 16427; +pub const CKM_HKDF_KEY_GEN: CK_MECHANISM_TYPE = 16428; +pub const CKM_SALSA20_KEY_GEN: CK_MECHANISM_TYPE = 16429; +pub const CKM_ECDSA_SHA3_224: CK_MECHANISM_TYPE = 4167; +pub const CKM_ECDSA_SHA3_256: CK_MECHANISM_TYPE = 4168; +pub const CKM_ECDSA_SHA3_384: CK_MECHANISM_TYPE = 4169; +pub const CKM_ECDSA_SHA3_512: CK_MECHANISM_TYPE = 4170; +pub const CKM_EC_EDWARDS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4181; +pub const CKM_EC_MONTGOMERY_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 4182; +pub const CKM_EDDSA: CK_MECHANISM_TYPE = 4183; +pub const CKM_SP800_108_COUNTER_KDF: CK_MECHANISM_TYPE = 940; +pub const CKM_SP800_108_FEEDBACK_KDF: CK_MECHANISM_TYPE = 941; +pub const CKM_SP800_108_DOUBLE_PIPELINE_KDF: CK_MECHANISM_TYPE = 942; +pub const CKM_IKE2_PRF_PLUS_DERIVE: CK_MECHANISM_TYPE = 16430; +pub const CKM_IKE_PRF_DERIVE: CK_MECHANISM_TYPE = 16431; +pub const CKM_IKE1_PRF_DERIVE: CK_MECHANISM_TYPE = 16432; +pub const CKM_IKE1_EXTENDED_DERIVE: CK_MECHANISM_TYPE = 16433; +pub const CKM_HSS_KEY_PAIR_GEN: CK_MECHANISM_TYPE = 16434; +pub const CKM_HSS: CK_MECHANISM_TYPE = 16435; +pub const CKM_VENDOR_DEFINED: CK_MECHANISM_TYPE = 2147483648; +pub const CKF_HW: CK_FLAGS = 1; +pub const CKF_MESSAGE_ENCRYPT: CK_FLAGS = 2; +pub const CKF_MESSAGE_DECRYPT: CK_FLAGS = 4; +pub const CKF_MESSAGE_SIGN: CK_FLAGS = 8; +pub const CKF_MESSAGE_VERIFY: CK_FLAGS = 16; +pub const CKF_MULTI_MESSAGE: CK_FLAGS = 32; +pub const CKF_MULTI_MESSGE: CK_FLAGS = 32; +pub const CKF_FIND_OBJECTS: CK_FLAGS = 64; +pub const CKF_ENCRYPT: CK_FLAGS = 256; +pub const CKF_DECRYPT: CK_FLAGS = 512; +pub const CKF_DIGEST: CK_FLAGS = 1024; +pub const CKF_SIGN: CK_FLAGS = 2048; +pub const CKF_SIGN_RECOVER: CK_FLAGS = 4096; +pub const CKF_VERIFY: CK_FLAGS = 8192; +pub const CKF_VERIFY_RECOVER: CK_FLAGS = 16384; +pub const CKF_GENERATE: CK_FLAGS = 32768; +pub const CKF_GENERATE_KEY_PAIR: CK_FLAGS = 65536; +pub const CKF_WRAP: CK_FLAGS = 131072; +pub const CKF_UNWRAP: CK_FLAGS = 262144; +pub const CKF_DERIVE: CK_FLAGS = 524288; +pub const CKF_EC_F_P: CK_FLAGS = 1048576; +pub const CKF_EC_F_2M: CK_FLAGS = 2097152; +pub const CKF_EC_ECPARAMETERS: CK_FLAGS = 4194304; +pub const CKF_EC_OID: CK_FLAGS = 8388608; +pub const CKF_EC_NAMEDCURVE: CK_FLAGS = 8388608; +pub const CKF_EC_UNCOMPRESS: CK_FLAGS = 16777216; +pub const CKF_EC_COMPRESS: CK_FLAGS = 33554432; +pub const CKF_EC_CURVENAME: CK_FLAGS = 67108864; +pub const CKF_EXTENSION: CK_FLAGS = 2147483648; +pub const CKR_OK: CK_RV = 0; +pub const CKR_CANCEL: CK_RV = 1; +pub const CKR_HOST_MEMORY: CK_RV = 2; +pub const CKR_SLOT_ID_INVALID: CK_RV = 3; +pub const CKR_GENERAL_ERROR: CK_RV = 5; +pub const CKR_FUNCTION_FAILED: CK_RV = 6; +pub const CKR_ARGUMENTS_BAD: CK_RV = 7; +pub const CKR_NO_EVENT: CK_RV = 8; +pub const CKR_NEED_TO_CREATE_THREADS: CK_RV = 9; +pub const CKR_CANT_LOCK: CK_RV = 10; +pub const CKR_ATTRIBUTE_READ_ONLY: CK_RV = 16; +pub const CKR_ATTRIBUTE_SENSITIVE: CK_RV = 17; +pub const CKR_ATTRIBUTE_TYPE_INVALID: CK_RV = 18; +pub const CKR_ATTRIBUTE_VALUE_INVALID: CK_RV = 19; +pub const CKR_ACTION_PROHIBITED: CK_RV = 27; +pub const CKR_DATA_INVALID: CK_RV = 32; +pub const CKR_DATA_LEN_RANGE: CK_RV = 33; +pub const CKR_DEVICE_ERROR: CK_RV = 48; +pub const CKR_DEVICE_MEMORY: CK_RV = 49; +pub const CKR_DEVICE_REMOVED: CK_RV = 50; +pub const CKR_ENCRYPTED_DATA_INVALID: CK_RV = 64; +pub const CKR_ENCRYPTED_DATA_LEN_RANGE: CK_RV = 65; +pub const CKR_AEAD_DECRYPT_FAILED: CK_RV = 66; +pub const CKR_FUNCTION_CANCELED: CK_RV = 80; +pub const CKR_FUNCTION_NOT_PARALLEL: CK_RV = 81; +pub const CKR_FUNCTION_NOT_SUPPORTED: CK_RV = 84; +pub const CKR_KEY_HANDLE_INVALID: CK_RV = 96; +pub const CKR_KEY_SIZE_RANGE: CK_RV = 98; +pub const CKR_KEY_TYPE_INCONSISTENT: CK_RV = 99; +pub const CKR_KEY_NOT_NEEDED: CK_RV = 100; +pub const CKR_KEY_CHANGED: CK_RV = 101; +pub const CKR_KEY_NEEDED: CK_RV = 102; +pub const CKR_KEY_INDIGESTIBLE: CK_RV = 103; +pub const CKR_KEY_FUNCTION_NOT_PERMITTED: CK_RV = 104; +pub const CKR_KEY_NOT_WRAPPABLE: CK_RV = 105; +pub const CKR_KEY_UNEXTRACTABLE: CK_RV = 106; +pub const CKR_MECHANISM_INVALID: CK_RV = 112; +pub const CKR_MECHANISM_PARAM_INVALID: CK_RV = 113; +pub const CKR_OBJECT_HANDLE_INVALID: CK_RV = 130; +pub const CKR_OPERATION_ACTIVE: CK_RV = 144; +pub const CKR_OPERATION_NOT_INITIALIZED: CK_RV = 145; +pub const CKR_PIN_INCORRECT: CK_RV = 160; +pub const CKR_PIN_INVALID: CK_RV = 161; +pub const CKR_PIN_LEN_RANGE: CK_RV = 162; +pub const CKR_PIN_EXPIRED: CK_RV = 163; +pub const CKR_PIN_LOCKED: CK_RV = 164; +pub const CKR_SESSION_CLOSED: CK_RV = 176; +pub const CKR_SESSION_COUNT: CK_RV = 177; +pub const CKR_SESSION_HANDLE_INVALID: CK_RV = 179; +pub const CKR_SESSION_PARALLEL_NOT_SUPPORTED: CK_RV = 180; +pub const CKR_SESSION_READ_ONLY: CK_RV = 181; +pub const CKR_SESSION_EXISTS: CK_RV = 182; +pub const CKR_SESSION_READ_ONLY_EXISTS: CK_RV = 183; +pub const CKR_SESSION_READ_WRITE_SO_EXISTS: CK_RV = 184; +pub const CKR_SIGNATURE_INVALID: CK_RV = 192; +pub const CKR_SIGNATURE_LEN_RANGE: CK_RV = 193; +pub const CKR_TEMPLATE_INCOMPLETE: CK_RV = 208; +pub const CKR_TEMPLATE_INCONSISTENT: CK_RV = 209; +pub const CKR_TOKEN_NOT_PRESENT: CK_RV = 224; +pub const CKR_TOKEN_NOT_RECOGNIZED: CK_RV = 225; +pub const CKR_TOKEN_WRITE_PROTECTED: CK_RV = 226; +pub const CKR_UNWRAPPING_KEY_HANDLE_INVALID: CK_RV = 240; +pub const CKR_UNWRAPPING_KEY_SIZE_RANGE: CK_RV = 241; +pub const CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT: CK_RV = 242; +pub const CKR_USER_ALREADY_LOGGED_IN: CK_RV = 256; +pub const CKR_USER_NOT_LOGGED_IN: CK_RV = 257; +pub const CKR_USER_PIN_NOT_INITIALIZED: CK_RV = 258; +pub const CKR_USER_TYPE_INVALID: CK_RV = 259; +pub const CKR_USER_ANOTHER_ALREADY_LOGGED_IN: CK_RV = 260; +pub const CKR_USER_TOO_MANY_TYPES: CK_RV = 261; +pub const CKR_WRAPPED_KEY_INVALID: CK_RV = 272; +pub const CKR_WRAPPED_KEY_LEN_RANGE: CK_RV = 274; +pub const CKR_WRAPPING_KEY_HANDLE_INVALID: CK_RV = 275; +pub const CKR_WRAPPING_KEY_SIZE_RANGE: CK_RV = 276; +pub const CKR_WRAPPING_KEY_TYPE_INCONSISTENT: CK_RV = 277; +pub const CKR_RANDOM_SEED_NOT_SUPPORTED: CK_RV = 288; +pub const CKR_RANDOM_NO_RNG: CK_RV = 289; +pub const CKR_DOMAIN_PARAMS_INVALID: CK_RV = 304; +pub const CKR_CURVE_NOT_SUPPORTED: CK_RV = 320; +pub const CKR_BUFFER_TOO_SMALL: CK_RV = 336; +pub const CKR_SAVED_STATE_INVALID: CK_RV = 352; +pub const CKR_INFORMATION_SENSITIVE: CK_RV = 368; +pub const CKR_STATE_UNSAVEABLE: CK_RV = 384; +pub const CKR_CRYPTOKI_NOT_INITIALIZED: CK_RV = 400; +pub const CKR_CRYPTOKI_ALREADY_INITIALIZED: CK_RV = 401; +pub const CKR_MUTEX_BAD: CK_RV = 416; +pub const CKR_MUTEX_NOT_LOCKED: CK_RV = 417; +pub const CKR_NEW_PIN_MODE: CK_RV = 432; +pub const CKR_NEXT_OTP: CK_RV = 433; +pub const CKR_EXCEEDED_MAX_ITERATIONS: CK_RV = 437; +pub const CKR_FIPS_SELF_TEST_FAILED: CK_RV = 438; +pub const CKR_LIBRARY_LOAD_FAILED: CK_RV = 439; +pub const CKR_PIN_TOO_WEAK: CK_RV = 440; +pub const CKR_PUBLIC_KEY_INVALID: CK_RV = 441; +pub const CKR_FUNCTION_REJECTED: CK_RV = 512; +pub const CKR_TOKEN_RESOURCE_EXCEEDED: CK_RV = 513; +pub const CKR_OPERATION_CANCEL_FAILED: CK_RV = 514; +pub const CKR_KEY_EXHAUSTED: CK_RV = 515; +pub const CKR_VENDOR_DEFINED: CK_RV = 2147483648; +pub const CKF_END_OF_MESSAGE: CK_FLAGS = 1; +pub const CKF_INTERFACE_FORK_SAFE: CK_FLAGS = 1; +pub const CKF_LIBRARY_CANT_CREATE_OS_THREADS: CK_FLAGS = 1; +pub const CKF_OS_LOCKING_OK: CK_FLAGS = 2; +pub const CKF_DONT_BLOCK: CK_FLAGS = 1; +pub const CKG_MGF1_SHA1: CK_RSA_PKCS_MGF_TYPE = 1; +pub const CKG_MGF1_SHA256: CK_RSA_PKCS_MGF_TYPE = 2; +pub const CKG_MGF1_SHA384: CK_RSA_PKCS_MGF_TYPE = 3; +pub const CKG_MGF1_SHA512: CK_RSA_PKCS_MGF_TYPE = 4; +pub const CKG_MGF1_SHA224: CK_RSA_PKCS_MGF_TYPE = 5; +pub const CKG_MGF1_SHA3_224: CK_RSA_PKCS_MGF_TYPE = 6; +pub const CKG_MGF1_SHA3_256: CK_RSA_PKCS_MGF_TYPE = 7; +pub const CKG_MGF1_SHA3_384: CK_RSA_PKCS_MGF_TYPE = 8; +pub const CKG_MGF1_SHA3_512: CK_RSA_PKCS_MGF_TYPE = 9; +pub const CKZ_DATA_SPECIFIED: CK_RSA_PKCS_OAEP_SOURCE_TYPE = 1; +pub const CKD_NULL: CK_EC_KDF_TYPE = 1; +pub const CKD_SHA1_KDF: CK_EC_KDF_TYPE = 2; +pub const CKD_SHA1_KDF_ASN1: CK_EC_KDF_TYPE = 3; +pub const CKD_SHA1_KDF_CONCATENATE: CK_EC_KDF_TYPE = 4; +pub const CKD_SHA224_KDF: CK_EC_KDF_TYPE = 5; +pub const CKD_SHA256_KDF: CK_EC_KDF_TYPE = 6; +pub const CKD_SHA384_KDF: CK_EC_KDF_TYPE = 7; +pub const CKD_SHA512_KDF: CK_EC_KDF_TYPE = 8; +pub const CKD_CPDIVERSIFY_KDF: CK_EC_KDF_TYPE = 9; +pub const CKD_SHA3_224_KDF: CK_EC_KDF_TYPE = 10; +pub const CKD_SHA3_256_KDF: CK_EC_KDF_TYPE = 11; +pub const CKD_SHA3_384_KDF: CK_EC_KDF_TYPE = 12; +pub const CKD_SHA3_512_KDF: CK_EC_KDF_TYPE = 13; +pub const CKD_SHA1_KDF_SP800: CK_EC_KDF_TYPE = 14; +pub const CKD_SHA224_KDF_SP800: CK_EC_KDF_TYPE = 15; +pub const CKD_SHA256_KDF_SP800: CK_EC_KDF_TYPE = 16; +pub const CKD_SHA384_KDF_SP800: CK_EC_KDF_TYPE = 17; +pub const CKD_SHA512_KDF_SP800: CK_EC_KDF_TYPE = 18; +pub const CKD_SHA3_224_KDF_SP800: CK_EC_KDF_TYPE = 19; +pub const CKD_SHA3_256_KDF_SP800: CK_EC_KDF_TYPE = 20; +pub const CKD_SHA3_384_KDF_SP800: CK_EC_KDF_TYPE = 21; +pub const CKD_SHA3_512_KDF_SP800: CK_EC_KDF_TYPE = 22; +pub const CKD_BLAKE2B_160_KDF: CK_EC_KDF_TYPE = 23; +pub const CKD_BLAKE2B_256_KDF: CK_EC_KDF_TYPE = 24; +pub const CKD_BLAKE2B_384_KDF: CK_EC_KDF_TYPE = 25; +pub const CKD_BLAKE2B_512_KDF: CK_EC_KDF_TYPE = 26; +pub const CKP_PKCS5_PBKD2_HMAC_SHA1: CK_PROFILE_ID = 1; +pub const CKP_PKCS5_PBKD2_HMAC_GOSTR3411: CK_PROFILE_ID = 2; +pub const CKP_PKCS5_PBKD2_HMAC_SHA224: CK_PROFILE_ID = 3; +pub const CKP_PKCS5_PBKD2_HMAC_SHA256: CK_PROFILE_ID = 4; +pub const CKP_PKCS5_PBKD2_HMAC_SHA384: CK_PROFILE_ID = 5; +pub const CKP_PKCS5_PBKD2_HMAC_SHA512: CK_PROFILE_ID = 6; +pub const CKP_PKCS5_PBKD2_HMAC_SHA512_224: CK_PROFILE_ID = 7; +pub const CKP_PKCS5_PBKD2_HMAC_SHA512_256: CK_PROFILE_ID = 8; +pub const CKZ_SALT_SPECIFIED: CK_RSA_PKCS_OAEP_SOURCE_TYPE = 1; +pub const CK_OTP_VALUE: CK_ULONG = 0; +pub const CK_OTP_PIN: CK_ULONG = 1; +pub const CK_OTP_CHALLENGE: CK_ULONG = 2; +pub const CK_OTP_TIME: CK_ULONG = 3; +pub const CK_OTP_COUNTER: CK_ULONG = 4; +pub const CK_OTP_FLAGS: CK_ULONG = 5; +pub const CK_OTP_OUTPUT_LENGTH: CK_ULONG = 6; +pub const CK_OTP_OUTPUT_FORMAT: CK_ULONG = 7; +pub const CKF_NEXT_OTP: CK_FLAGS = 1; +pub const CKF_EXCLUDE_TIME: CK_FLAGS = 2; +pub const CKF_EXCLUDE_COUNTER: CK_FLAGS = 4; +pub const CKF_EXCLUDE_CHALLENGE: CK_FLAGS = 8; +pub const CKF_EXCLUDE_PIN: CK_FLAGS = 16; +pub const CKF_USER_FRIENDLY_OTP: CK_FLAGS = 32; +pub const CKG_NO_GENERATE: CK_GENERATOR_FUNCTION = 0; +pub const CKG_GENERATE: CK_GENERATOR_FUNCTION = 1; +pub const CKG_GENERATE_COUNTER: CK_GENERATOR_FUNCTION = 2; +pub const CKG_GENERATE_RANDOM: CK_GENERATOR_FUNCTION = 3; +pub const CKG_GENERATE_COUNTER_XOR: CK_GENERATOR_FUNCTION = 4; +pub const CK_SP800_108_ITERATION_VARIABLE: CK_ULONG = 1; +pub const CK_SP800_108_OPTIONAL_COUNTER: CK_ULONG = 2; +pub const CK_SP800_108_DKM_LENGTH: CK_ULONG = 3; +pub const CK_SP800_108_BYTE_ARRAY: CK_ULONG = 4; +pub const CK_SP800_108_COUNTER: CK_ULONG = 2; +pub const CK_SP800_108_DKM_LENGTH_SUM_OF_KEYS: CK_ULONG = 1; +pub const CK_SP800_108_DKM_LENGTH_SUM_OF_SEGMENTS: CK_ULONG = 2; +pub const CKF_HKDF_SALT_NULL: CK_FLAGS = 1; +pub const CKF_HKDF_SALT_DATA: CK_FLAGS = 2; +pub const CKF_HKDF_SALT_KEY: CK_FLAGS = 4; +pub const CK_NEED_ARG_LIST: CK_ULONG = 1; +pub const CK_PKCS11_2_0_ONLY: CK_ULONG = 1; +pub type CK_BYTE = ::std::os::raw::c_uchar; +pub type CK_CHAR = CK_BYTE; +pub type CK_UTF8CHAR = CK_BYTE; +pub type CK_BBOOL = CK_BYTE; +pub type CK_ULONG = ::std::os::raw::c_ulong; +pub type CK_LONG = ::std::os::raw::c_long; +pub type CK_FLAGS = CK_ULONG; +pub type CK_BYTE_PTR = *mut CK_BYTE; +pub type CK_CHAR_PTR = *mut CK_CHAR; +pub type CK_UTF8CHAR_PTR = *mut CK_UTF8CHAR; +pub type CK_ULONG_PTR = *mut CK_ULONG; +pub type CK_VOID_PTR = *mut ::std::os::raw::c_void; +pub type CK_VOID_PTR_PTR = *mut CK_VOID_PTR; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_VERSION { + pub major: CK_BYTE, + pub minor: CK_BYTE, +} +#[test] +fn bindgen_test_layout_CK_VERSION() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(CK_VERSION)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_VERSION)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).major) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_VERSION), + "::", + stringify!(major) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).minor) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_VERSION), + "::", + stringify!(minor) + ) + ); +} +pub type CK_VERSION_PTR = *mut CK_VERSION; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_INFO { + pub cryptokiVersion: CK_VERSION, + pub manufacturerID: [CK_UTF8CHAR; 32usize], + pub flags: CK_FLAGS, + pub libraryDescription: [CK_UTF8CHAR; 32usize], + pub libraryVersion: CK_VERSION, +} +#[test] +fn bindgen_test_layout_CK_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(CK_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cryptokiVersion) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(cryptokiVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).manufacturerID) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(manufacturerID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).libraryDescription) as usize - ptr as usize }, + 38usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(libraryDescription) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).libraryVersion) as usize - ptr as usize }, + 70usize, + concat!( + "Offset of field: ", + stringify!(CK_INFO), + "::", + stringify!(libraryVersion) + ) + ); +} +pub type CK_INFO_PTR = *mut CK_INFO; +pub type CK_NOTIFICATION = CK_ULONG; +pub type CK_SLOT_ID = CK_ULONG; +pub type CK_SLOT_ID_PTR = *mut CK_SLOT_ID; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SLOT_INFO { + pub slotDescription: [CK_UTF8CHAR; 64usize], + pub manufacturerID: [CK_UTF8CHAR; 32usize], + pub flags: CK_FLAGS, + pub hardwareVersion: CK_VERSION, + pub firmwareVersion: CK_VERSION, +} +#[test] +fn bindgen_test_layout_CK_SLOT_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(CK_SLOT_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SLOT_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).slotDescription) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(slotDescription) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).manufacturerID) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(manufacturerID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hardwareVersion) as usize - ptr as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(hardwareVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).firmwareVersion) as usize - ptr as usize }, + 102usize, + concat!( + "Offset of field: ", + stringify!(CK_SLOT_INFO), + "::", + stringify!(firmwareVersion) + ) + ); +} +impl Default for CK_SLOT_INFO { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SLOT_INFO_PTR = *mut CK_SLOT_INFO; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_TOKEN_INFO { + pub label: [CK_UTF8CHAR; 32usize], + pub manufacturerID: [CK_UTF8CHAR; 32usize], + pub model: [CK_UTF8CHAR; 16usize], + pub serialNumber: [CK_CHAR; 16usize], + pub flags: CK_FLAGS, + pub ulMaxSessionCount: CK_ULONG, + pub ulSessionCount: CK_ULONG, + pub ulMaxRwSessionCount: CK_ULONG, + pub ulRwSessionCount: CK_ULONG, + pub ulMaxPinLen: CK_ULONG, + pub ulMinPinLen: CK_ULONG, + pub ulTotalPublicMemory: CK_ULONG, + pub ulFreePublicMemory: CK_ULONG, + pub ulTotalPrivateMemory: CK_ULONG, + pub ulFreePrivateMemory: CK_ULONG, + pub hardwareVersion: CK_VERSION, + pub firmwareVersion: CK_VERSION, + pub utcTime: [CK_CHAR; 16usize], +} +#[test] +fn bindgen_test_layout_CK_TOKEN_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 160usize, + concat!("Size of: ", stringify!(CK_TOKEN_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_TOKEN_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).label) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(label) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).manufacturerID) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(manufacturerID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).model) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(model) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).serialNumber) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(serialNumber) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxSessionCount) as usize - ptr as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMaxSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSessionCount) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxRwSessionCount) as usize - ptr as usize }, + 108usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMaxRwSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRwSessionCount) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulRwSessionCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxPinLen) as usize - ptr as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMaxPinLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMinPinLen) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulMinPinLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTotalPublicMemory) as usize - ptr as usize }, + 124usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulTotalPublicMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulFreePublicMemory) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulFreePublicMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTotalPrivateMemory) as usize - ptr as usize }, + 132usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulTotalPrivateMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulFreePrivateMemory) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(ulFreePrivateMemory) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hardwareVersion) as usize - ptr as usize }, + 140usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(hardwareVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).firmwareVersion) as usize - ptr as usize }, + 142usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(firmwareVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).utcTime) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(CK_TOKEN_INFO), + "::", + stringify!(utcTime) + ) + ); +} +pub type CK_TOKEN_INFO_PTR = *mut CK_TOKEN_INFO; +pub type CK_SESSION_HANDLE = CK_ULONG; +pub type CK_SESSION_HANDLE_PTR = *mut CK_SESSION_HANDLE; +pub type CK_USER_TYPE = CK_ULONG; +pub type CK_STATE = CK_ULONG; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_SESSION_INFO { + pub slotID: CK_SLOT_ID, + pub state: CK_STATE, + pub flags: CK_FLAGS, + pub ulDeviceError: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SESSION_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_SESSION_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SESSION_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).slotID) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(slotID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).state) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(state) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDeviceError) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SESSION_INFO), + "::", + stringify!(ulDeviceError) + ) + ); +} +pub type CK_SESSION_INFO_PTR = *mut CK_SESSION_INFO; +pub type CK_OBJECT_HANDLE = CK_ULONG; +pub type CK_OBJECT_HANDLE_PTR = *mut CK_OBJECT_HANDLE; +pub type CK_OBJECT_CLASS = CK_ULONG; +pub type CK_OBJECT_CLASS_PTR = *mut CK_OBJECT_CLASS; +pub type CK_HW_FEATURE_TYPE = CK_ULONG; +pub type CK_KEY_TYPE = CK_ULONG; +pub type CK_CERTIFICATE_TYPE = CK_ULONG; +pub type CK_ATTRIBUTE_TYPE = CK_ULONG; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ATTRIBUTE { + pub type_: CK_ATTRIBUTE_TYPE, + pub pValue: CK_VOID_PTR, + pub ulValueLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_ATTRIBUTE() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_ATTRIBUTE)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_ATTRIBUTE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ATTRIBUTE), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pValue) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_ATTRIBUTE), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulValueLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_ATTRIBUTE), + "::", + stringify!(ulValueLen) + ) + ); +} +impl Default for CK_ATTRIBUTE { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ATTRIBUTE_PTR = *mut CK_ATTRIBUTE; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_DATE { + pub year: [CK_CHAR; 4usize], + pub month: [CK_CHAR; 2usize], + pub day: [CK_CHAR; 2usize], +} +#[test] +fn bindgen_test_layout_CK_DATE() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(CK_DATE)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_DATE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).year) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DATE), + "::", + stringify!(year) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).month) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_DATE), + "::", + stringify!(month) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).day) as usize - ptr as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(CK_DATE), + "::", + stringify!(day) + ) + ); +} +pub type CK_MECHANISM_TYPE = CK_ULONG; +pub type CK_MECHANISM_TYPE_PTR = *mut CK_MECHANISM_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_MECHANISM { + pub mechanism: CK_MECHANISM_TYPE, + pub pParameter: CK_VOID_PTR, + pub ulParameterLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_MECHANISM() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_MECHANISM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_MECHANISM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM), + "::", + stringify!(mechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pParameter) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM), + "::", + stringify!(pParameter) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulParameterLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM), + "::", + stringify!(ulParameterLen) + ) + ); +} +impl Default for CK_MECHANISM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_MECHANISM_PTR = *mut CK_MECHANISM; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_MECHANISM_INFO { + pub ulMinKeySize: CK_ULONG, + pub ulMaxKeySize: CK_ULONG, + pub flags: CK_FLAGS, +} +#[test] +fn bindgen_test_layout_CK_MECHANISM_INFO() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_MECHANISM_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_MECHANISM_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMinKeySize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM_INFO), + "::", + stringify!(ulMinKeySize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMaxKeySize) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM_INFO), + "::", + stringify!(ulMaxKeySize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_MECHANISM_INFO), + "::", + stringify!(flags) + ) + ); +} +pub type CK_MECHANISM_INFO_PTR = *mut CK_MECHANISM_INFO; +pub type CK_RV = CK_ULONG; +pub type CK_NOTIFY = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + event: CK_NOTIFICATION, + pApplication: CK_VOID_PTR, + ) -> CK_RV, +>; +pub type CK_FUNCTION_LIST_PTR = *mut CK_FUNCTION_LIST; +pub type CK_FUNCTION_LIST_3_0_PTR = *mut CK_FUNCTION_LIST_3_0; +pub type CK_FUNCTION_LIST_PTR_PTR = *mut CK_FUNCTION_LIST_PTR; +pub type CK_FUNCTION_LIST_3_0_PTR_PTR = *mut CK_FUNCTION_LIST_3_0_PTR; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_INTERFACE { + pub pInterfaceName: *mut CK_CHAR, + pub pFunctionList: CK_VOID_PTR, + pub flags: CK_FLAGS, +} +#[test] +fn bindgen_test_layout_CK_INTERFACE() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_INTERFACE)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_INTERFACE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInterfaceName) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_INTERFACE), + "::", + stringify!(pInterfaceName) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pFunctionList) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_INTERFACE), + "::", + stringify!(pFunctionList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_INTERFACE), + "::", + stringify!(flags) + ) + ); +} +impl Default for CK_INTERFACE { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_INTERFACE_PTR = *mut CK_INTERFACE; +pub type CK_INTERFACE_PTR_PTR = *mut CK_INTERFACE_PTR; +pub type CK_CREATEMUTEX = + ::std::option::Option CK_RV>; +pub type CK_DESTROYMUTEX = + ::std::option::Option CK_RV>; +pub type CK_LOCKMUTEX = ::std::option::Option CK_RV>; +pub type CK_UNLOCKMUTEX = ::std::option::Option CK_RV>; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_C_INITIALIZE_ARGS { + pub CreateMutex: CK_CREATEMUTEX, + pub DestroyMutex: CK_DESTROYMUTEX, + pub LockMutex: CK_LOCKMUTEX, + pub UnlockMutex: CK_UNLOCKMUTEX, + pub flags: CK_FLAGS, + pub pReserved: CK_VOID_PTR, +} +#[test] +fn bindgen_test_layout_CK_C_INITIALIZE_ARGS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(CK_C_INITIALIZE_ARGS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_C_INITIALIZE_ARGS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).CreateMutex) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(CreateMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DestroyMutex) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(DestroyMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).LockMutex) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(LockMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).UnlockMutex) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(UnlockMutex) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReserved) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_C_INITIALIZE_ARGS), + "::", + stringify!(pReserved) + ) + ); +} +impl Default for CK_C_INITIALIZE_ARGS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_C_INITIALIZE_ARGS_PTR = *mut CK_C_INITIALIZE_ARGS; +pub type CK_RSA_PKCS_MGF_TYPE = CK_ULONG; +pub type CK_RSA_PKCS_MGF_TYPE_PTR = *mut CK_RSA_PKCS_MGF_TYPE; +pub type CK_RSA_PKCS_OAEP_SOURCE_TYPE = CK_ULONG; +pub type CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR = *mut CK_RSA_PKCS_OAEP_SOURCE_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_RSA_PKCS_OAEP_PARAMS { + pub hashAlg: CK_MECHANISM_TYPE, + pub mgf: CK_RSA_PKCS_MGF_TYPE, + pub source: CK_RSA_PKCS_OAEP_SOURCE_TYPE, + pub pSourceData: CK_VOID_PTR, + pub ulSourceDataLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RSA_PKCS_OAEP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_RSA_PKCS_OAEP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RSA_PKCS_OAEP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hashAlg) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(hashAlg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mgf) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(mgf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).source) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(source) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSourceData) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(pSourceData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSourceDataLen) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_OAEP_PARAMS), + "::", + stringify!(ulSourceDataLen) + ) + ); +} +impl Default for CK_RSA_PKCS_OAEP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_RSA_PKCS_OAEP_PARAMS_PTR = *mut CK_RSA_PKCS_OAEP_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RSA_PKCS_PSS_PARAMS { + pub hashAlg: CK_MECHANISM_TYPE, + pub mgf: CK_RSA_PKCS_MGF_TYPE, + pub sLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RSA_PKCS_PSS_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_RSA_PKCS_PSS_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RSA_PKCS_PSS_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hashAlg) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_PSS_PARAMS), + "::", + stringify!(hashAlg) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).mgf) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_PSS_PARAMS), + "::", + stringify!(mgf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).sLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_PKCS_PSS_PARAMS), + "::", + stringify!(sLen) + ) + ); +} +pub type CK_RSA_PKCS_PSS_PARAMS_PTR = *mut CK_RSA_PKCS_PSS_PARAMS; +pub type CK_EC_KDF_TYPE = CK_ULONG; +pub type CK_EC_KDF_TYPE_PTR = *mut CK_EC_KDF_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECDH1_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_ECDH1_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_ECDH1_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_ECDH1_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(pSharedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH1_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); +} +impl Default for CK_ECDH1_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECDH1_DERIVE_PARAMS_PTR = *mut CK_ECDH1_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECDH2_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_ECDH2_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_ECDH2_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_ECDH2_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(pSharedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); +} +impl Default for CK_ECDH2_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECDH2_DERIVE_PARAMS_PTR = *mut CK_ECDH2_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECMQV_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, + pub publicKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_ECMQV_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(CK_ECMQV_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_ECMQV_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(pSharedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).publicKey) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_ECMQV_DERIVE_PARAMS), + "::", + stringify!(publicKey) + ) + ); +} +impl Default for CK_ECMQV_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECMQV_DERIVE_PARAMS_PTR = *mut CK_ECMQV_DERIVE_PARAMS; +pub type CK_X9_42_DH_KDF_TYPE = CK_ULONG; +pub type CK_X9_42_DH_KDF_TYPE_PTR = *mut CK_X9_42_DH_KDF_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X9_42_DH1_DERIVE_PARAMS { + pub kdf: CK_X9_42_DH_KDF_TYPE, + pub ulOtherInfoLen: CK_ULONG, + pub pOtherInfo: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_X9_42_DH1_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_X9_42_DH1_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_X9_42_DH1_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOtherInfoLen) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(ulOtherInfoLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOtherInfo) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(pOtherInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH1_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); +} +impl Default for CK_X9_42_DH1_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X9_42_DH1_DERIVE_PARAMS_PTR = *mut CK_X9_42_DH1_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X9_42_DH2_DERIVE_PARAMS { + pub kdf: CK_X9_42_DH_KDF_TYPE, + pub ulOtherInfoLen: CK_ULONG, + pub pOtherInfo: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_X9_42_DH2_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_X9_42_DH2_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_X9_42_DH2_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOtherInfoLen) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulOtherInfoLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOtherInfo) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(pOtherInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_DH2_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); +} +impl Default for CK_X9_42_DH2_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X9_42_DH2_DERIVE_PARAMS_PTR = *mut CK_X9_42_DH2_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X9_42_MQV_DERIVE_PARAMS { + pub kdf: CK_X9_42_DH_KDF_TYPE, + pub ulOtherInfoLen: CK_ULONG, + pub pOtherInfo: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPrivateDataLen: CK_ULONG, + pub hPrivateData: CK_OBJECT_HANDLE, + pub ulPublicDataLen2: CK_ULONG, + pub pPublicData2: CK_BYTE_PTR, + pub publicKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_X9_42_MQV_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(CK_X9_42_MQV_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_X9_42_MQV_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOtherInfoLen) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulOtherInfoLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOtherInfo) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(pOtherInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrivateDataLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulPrivateDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrivateData) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(hPrivateData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen2) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData2) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(pPublicData2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).publicKey) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_X9_42_MQV_DERIVE_PARAMS), + "::", + stringify!(publicKey) + ) + ); +} +impl Default for CK_X9_42_MQV_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X9_42_MQV_DERIVE_PARAMS_PTR = *mut CK_X9_42_MQV_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KEA_DERIVE_PARAMS { + pub isSender: CK_BBOOL, + pub ulRandomLen: CK_ULONG, + pub pRandomA: CK_BYTE_PTR, + pub pRandomB: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_KEA_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 33usize, + concat!("Size of: ", stringify!(CK_KEA_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_KEA_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).isSender) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(isSender) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRandomLen) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(ulRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRandomA) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(pRandomA) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRandomB) as usize - ptr as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(pRandomB) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 21usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 25usize, + concat!( + "Offset of field: ", + stringify!(CK_KEA_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); +} +impl Default for CK_KEA_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KEA_DERIVE_PARAMS_PTR = *mut CK_KEA_DERIVE_PARAMS; +pub type CK_RC2_PARAMS = CK_ULONG; +pub type CK_RC2_PARAMS_PTR = *mut CK_RC2_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC2_CBC_PARAMS { + pub ulEffectiveBits: CK_ULONG, + pub iv: [CK_BYTE; 8usize], +} +#[test] +fn bindgen_test_layout_CK_RC2_CBC_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_RC2_CBC_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RC2_CBC_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulEffectiveBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_CBC_PARAMS), + "::", + stringify!(ulEffectiveBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_CBC_PARAMS), + "::", + stringify!(iv) + ) + ); +} +pub type CK_RC2_CBC_PARAMS_PTR = *mut CK_RC2_CBC_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC2_MAC_GENERAL_PARAMS { + pub ulEffectiveBits: CK_ULONG, + pub ulMacLength: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC2_MAC_GENERAL_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(CK_RC2_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RC2_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulEffectiveBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_MAC_GENERAL_PARAMS), + "::", + stringify!(ulEffectiveBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacLength) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RC2_MAC_GENERAL_PARAMS), + "::", + stringify!(ulMacLength) + ) + ); +} +pub type CK_RC2_MAC_GENERAL_PARAMS_PTR = *mut CK_RC2_MAC_GENERAL_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC5_PARAMS { + pub ulWordsize: CK_ULONG, + pub ulRounds: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC5_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(CK_RC5_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RC5_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWordsize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_PARAMS), + "::", + stringify!(ulWordsize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRounds) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_PARAMS), + "::", + stringify!(ulRounds) + ) + ); +} +pub type CK_RC5_PARAMS_PTR = *mut CK_RC5_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_RC5_CBC_PARAMS { + pub ulWordsize: CK_ULONG, + pub ulRounds: CK_ULONG, + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC5_CBC_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_RC5_CBC_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RC5_CBC_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWordsize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(ulWordsize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRounds) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(ulRounds) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_CBC_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); +} +impl Default for CK_RC5_CBC_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_RC5_CBC_PARAMS_PTR = *mut CK_RC5_CBC_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_RC5_MAC_GENERAL_PARAMS { + pub ulWordsize: CK_ULONG, + pub ulRounds: CK_ULONG, + pub ulMacLength: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_RC5_MAC_GENERAL_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_RC5_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RC5_MAC_GENERAL_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWordsize) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_MAC_GENERAL_PARAMS), + "::", + stringify!(ulWordsize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRounds) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_MAC_GENERAL_PARAMS), + "::", + stringify!(ulRounds) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacLength) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_RC5_MAC_GENERAL_PARAMS), + "::", + stringify!(ulMacLength) + ) + ); +} +pub type CK_RC5_MAC_GENERAL_PARAMS_PTR = *mut CK_RC5_MAC_GENERAL_PARAMS; +pub type CK_MAC_GENERAL_PARAMS = CK_ULONG; +pub type CK_MAC_GENERAL_PARAMS_PTR = *mut CK_MAC_GENERAL_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_DES_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 8usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_DES_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_DES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_DES_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_DES_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_AES_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_AES_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_AES_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_AES_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS { + pub ulPasswordLen: CK_ULONG, + pub pPassword: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pPublicData: CK_BYTE_PTR, + pub ulPAndGLen: CK_ULONG, + pub ulQLen: CK_ULONG, + pub ulRandomLen: CK_ULONG, + pub pRandomA: CK_BYTE_PTR, + pub pPrimeP: CK_BYTE_PTR, + pub pBaseG: CK_BYTE_PTR, + pub pSubprimeQ: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SKIPJACK_PRIVATE_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 68usize, + concat!("Size of: ", stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPAndGLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulPAndGLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulQLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulQLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRandomLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(ulRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRandomA) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pRandomA) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrimeP) as usize - ptr as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pPrimeP) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pBaseG) as usize - ptr as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pBaseG) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSubprimeQ) as usize - ptr as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_PRIVATE_WRAP_PARAMS), + "::", + stringify!(pSubprimeQ) + ) + ); +} +impl Default for CK_SKIPJACK_PRIVATE_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR = *mut CK_SKIPJACK_PRIVATE_WRAP_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SKIPJACK_RELAYX_PARAMS { + pub ulOldWrappedXLen: CK_ULONG, + pub pOldWrappedX: CK_BYTE_PTR, + pub ulOldPasswordLen: CK_ULONG, + pub pOldPassword: CK_BYTE_PTR, + pub ulOldPublicDataLen: CK_ULONG, + pub pOldPublicData: CK_BYTE_PTR, + pub ulOldRandomLen: CK_ULONG, + pub pOldRandomA: CK_BYTE_PTR, + pub ulNewPasswordLen: CK_ULONG, + pub pNewPassword: CK_BYTE_PTR, + pub ulNewPublicDataLen: CK_ULONG, + pub pNewPublicData: CK_BYTE_PTR, + pub ulNewRandomLen: CK_ULONG, + pub pNewRandomA: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SKIPJACK_RELAYX_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 84usize, + concat!("Size of: ", stringify!(CK_SKIPJACK_RELAYX_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SKIPJACK_RELAYX_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldWrappedXLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldWrappedXLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldWrappedX) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldWrappedX) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldPasswordLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldPassword) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldPublicDataLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldPublicData) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulOldRandomLen) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulOldRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOldRandomA) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pOldRandomA) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNewPasswordLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulNewPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNewPassword) as usize - ptr as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pNewPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNewPublicDataLen) as usize - ptr as usize }, + 60usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulNewPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNewPublicData) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pNewPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNewRandomLen) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(ulNewRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNewRandomA) as usize - ptr as usize }, + 76usize, + concat!( + "Offset of field: ", + stringify!(CK_SKIPJACK_RELAYX_PARAMS), + "::", + stringify!(pNewRandomA) + ) + ); +} +impl Default for CK_SKIPJACK_RELAYX_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SKIPJACK_RELAYX_PARAMS_PTR = *mut CK_SKIPJACK_RELAYX_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PBE_PARAMS { + pub pInitVector: CK_BYTE_PTR, + pub pPassword: CK_UTF8CHAR_PTR, + pub ulPasswordLen: CK_ULONG, + pub pSalt: CK_BYTE_PTR, + pub ulSaltLen: CK_ULONG, + pub ulIteration: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_PBE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 36usize, + concat!("Size of: ", stringify!(CK_PBE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_PBE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInitVector) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(pInitVector) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(ulPasswordLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSalt) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(pSalt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(ulSaltLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIteration) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_PBE_PARAMS), + "::", + stringify!(ulIteration) + ) + ); +} +impl Default for CK_PBE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PBE_PARAMS_PTR = *mut CK_PBE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KEY_WRAP_SET_OAEP_PARAMS { + pub bBC: CK_BYTE, + pub pX: CK_BYTE_PTR, + pub ulXLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_KEY_WRAP_SET_OAEP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 13usize, + concat!("Size of: ", stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bBC) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS), + "::", + stringify!(bBC) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pX) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS), + "::", + stringify!(pX) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulXLen) as usize - ptr as usize }, + 9usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_WRAP_SET_OAEP_PARAMS), + "::", + stringify!(ulXLen) + ) + ); +} +impl Default for CK_KEY_WRAP_SET_OAEP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KEY_WRAP_SET_OAEP_PARAMS_PTR = *mut CK_KEY_WRAP_SET_OAEP_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_RANDOM_DATA { + pub pClientRandom: CK_BYTE_PTR, + pub ulClientRandomLen: CK_ULONG, + pub pServerRandom: CK_BYTE_PTR, + pub ulServerRandomLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SSL3_RANDOM_DATA() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_SSL3_RANDOM_DATA)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SSL3_RANDOM_DATA)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pClientRandom) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(pClientRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulClientRandomLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(ulClientRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pServerRandom) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(pServerRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulServerRandomLen) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_RANDOM_DATA), + "::", + stringify!(ulServerRandomLen) + ) + ); +} +impl Default for CK_SSL3_RANDOM_DATA { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS { + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pVersion: CK_VERSION_PTR, +} +#[test] +fn bindgen_test_layout_CK_SSL3_MASTER_KEY_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pVersion) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(pVersion) + ) + ); +} +impl Default for CK_SSL3_MASTER_KEY_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR = *mut CK_SSL3_MASTER_KEY_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_KEY_MAT_OUT { + pub hClientMacSecret: CK_OBJECT_HANDLE, + pub hServerMacSecret: CK_OBJECT_HANDLE, + pub hClientKey: CK_OBJECT_HANDLE, + pub hServerKey: CK_OBJECT_HANDLE, + pub pIVClient: CK_BYTE_PTR, + pub pIVServer: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SSL3_KEY_MAT_OUT() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_SSL3_KEY_MAT_OUT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SSL3_KEY_MAT_OUT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hClientMacSecret) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hClientMacSecret) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hServerMacSecret) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hServerMacSecret) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hClientKey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hClientKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hServerKey) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(hServerKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIVClient) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(pIVClient) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIVServer) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_OUT), + "::", + stringify!(pIVServer) + ) + ); +} +impl Default for CK_SSL3_KEY_MAT_OUT { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SSL3_KEY_MAT_OUT_PTR = *mut CK_SSL3_KEY_MAT_OUT; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SSL3_KEY_MAT_PARAMS { + pub ulMacSizeInBits: CK_ULONG, + pub ulKeySizeInBits: CK_ULONG, + pub ulIVSizeInBits: CK_ULONG, + pub bIsExport: CK_BBOOL, + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pReturnedKeyMaterial: CK_SSL3_KEY_MAT_OUT_PTR, +} +#[test] +fn bindgen_test_layout_CK_SSL3_KEY_MAT_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 45usize, + concat!("Size of: ", stringify!(CK_SSL3_KEY_MAT_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SSL3_KEY_MAT_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacSizeInBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(ulMacSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulKeySizeInBits) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(ulKeySizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVSizeInBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(ulIVSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bIsExport) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(bIsExport) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReturnedKeyMaterial) as usize - ptr as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(CK_SSL3_KEY_MAT_PARAMS), + "::", + stringify!(pReturnedKeyMaterial) + ) + ); +} +impl Default for CK_SSL3_KEY_MAT_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SSL3_KEY_MAT_PARAMS_PTR = *mut CK_SSL3_KEY_MAT_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS_PRF_PARAMS { + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, + pub pLabel: CK_BYTE_PTR, + pub ulLabelLen: CK_ULONG, + pub pOutput: CK_BYTE_PTR, + pub pulOutputLen: CK_ULONG_PTR, +} +#[test] +fn bindgen_test_layout_CK_TLS_PRF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_TLS_PRF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_TLS_PRF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(ulSeedLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pLabel) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pLabel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLabelLen) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(ulLabelLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOutput) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pOutput) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pulOutputLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_PRF_PARAMS), + "::", + stringify!(pulOutputLen) + ) + ); +} +impl Default for CK_TLS_PRF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS_PRF_PARAMS_PTR = *mut CK_TLS_PRF_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_RANDOM_DATA { + pub pClientRandom: CK_BYTE_PTR, + pub ulClientRandomLen: CK_ULONG, + pub pServerRandom: CK_BYTE_PTR, + pub ulServerRandomLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_WTLS_RANDOM_DATA() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_WTLS_RANDOM_DATA)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_WTLS_RANDOM_DATA)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pClientRandom) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(pClientRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulClientRandomLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(ulClientRandomLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pServerRandom) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(pServerRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulServerRandomLen) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_RANDOM_DATA), + "::", + stringify!(ulServerRandomLen) + ) + ); +} +impl Default for CK_WTLS_RANDOM_DATA { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_RANDOM_DATA_PTR = *mut CK_WTLS_RANDOM_DATA; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS { + pub DigestMechanism: CK_MECHANISM_TYPE, + pub RandomInfo: CK_WTLS_RANDOM_DATA, + pub pVersion: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_MASTER_KEY_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 36usize, + concat!("Size of: ", stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DigestMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(DigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pVersion) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(pVersion) + ) + ); +} +impl Default for CK_WTLS_MASTER_KEY_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR = *mut CK_WTLS_MASTER_KEY_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_PRF_PARAMS { + pub DigestMechanism: CK_MECHANISM_TYPE, + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, + pub pLabel: CK_BYTE_PTR, + pub ulLabelLen: CK_ULONG, + pub pOutput: CK_BYTE_PTR, + pub pulOutputLen: CK_ULONG_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_PRF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(CK_WTLS_PRF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_WTLS_PRF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DigestMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(DigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(ulSeedLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pLabel) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pLabel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLabelLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(ulLabelLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOutput) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pOutput) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pulOutputLen) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_PRF_PARAMS), + "::", + stringify!(pulOutputLen) + ) + ); +} +impl Default for CK_WTLS_PRF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_PRF_PARAMS_PTR = *mut CK_WTLS_PRF_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_KEY_MAT_OUT { + pub hMacSecret: CK_OBJECT_HANDLE, + pub hKey: CK_OBJECT_HANDLE, + pub pIV: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_KEY_MAT_OUT() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_WTLS_KEY_MAT_OUT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_WTLS_KEY_MAT_OUT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hMacSecret) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_OUT), + "::", + stringify!(hMacSecret) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKey) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_OUT), + "::", + stringify!(hKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIV) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_OUT), + "::", + stringify!(pIV) + ) + ); +} +impl Default for CK_WTLS_KEY_MAT_OUT { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_KEY_MAT_OUT_PTR = *mut CK_WTLS_KEY_MAT_OUT; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_WTLS_KEY_MAT_PARAMS { + pub DigestMechanism: CK_MECHANISM_TYPE, + pub ulMacSizeInBits: CK_ULONG, + pub ulKeySizeInBits: CK_ULONG, + pub ulIVSizeInBits: CK_ULONG, + pub ulSequenceNumber: CK_ULONG, + pub bIsExport: CK_BBOOL, + pub RandomInfo: CK_WTLS_RANDOM_DATA, + pub pReturnedKeyMaterial: CK_WTLS_KEY_MAT_OUT_PTR, +} +#[test] +fn bindgen_test_layout_CK_WTLS_KEY_MAT_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 53usize, + concat!("Size of: ", stringify!(CK_WTLS_KEY_MAT_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_WTLS_KEY_MAT_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).DigestMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(DigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacSizeInBits) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulMacSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulKeySizeInBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulKeySizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVSizeInBits) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulIVSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSequenceNumber) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(ulSequenceNumber) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bIsExport) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(bIsExport) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 21usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReturnedKeyMaterial) as usize - ptr as usize }, + 45usize, + concat!( + "Offset of field: ", + stringify!(CK_WTLS_KEY_MAT_PARAMS), + "::", + stringify!(pReturnedKeyMaterial) + ) + ); +} +impl Default for CK_WTLS_KEY_MAT_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_WTLS_KEY_MAT_PARAMS_PTR = *mut CK_WTLS_KEY_MAT_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CMS_SIG_PARAMS { + pub certificateHandle: CK_OBJECT_HANDLE, + pub pSigningMechanism: CK_MECHANISM_PTR, + pub pDigestMechanism: CK_MECHANISM_PTR, + pub pContentType: CK_UTF8CHAR_PTR, + pub pRequestedAttributes: CK_BYTE_PTR, + pub ulRequestedAttributesLen: CK_ULONG, + pub pRequiredAttributes: CK_BYTE_PTR, + pub ulRequiredAttributesLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CMS_SIG_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(CK_CMS_SIG_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_CMS_SIG_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).certificateHandle) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(certificateHandle) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSigningMechanism) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pSigningMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pDigestMechanism) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pDigestMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pContentType) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pContentType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRequestedAttributes) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pRequestedAttributes) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRequestedAttributesLen) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(ulRequestedAttributesLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pRequiredAttributes) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(pRequiredAttributes) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulRequiredAttributesLen) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_CMS_SIG_PARAMS), + "::", + stringify!(ulRequiredAttributesLen) + ) + ); +} +impl Default for CK_CMS_SIG_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CMS_SIG_PARAMS_PTR = *mut CK_CMS_SIG_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KEY_DERIVATION_STRING_DATA { + pub pData: CK_BYTE_PTR, + pub ulLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_KEY_DERIVATION_STRING_DATA() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_KEY_DERIVATION_STRING_DATA)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_KEY_DERIVATION_STRING_DATA)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_DERIVATION_STRING_DATA), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_KEY_DERIVATION_STRING_DATA), + "::", + stringify!(ulLen) + ) + ); +} +impl Default for CK_KEY_DERIVATION_STRING_DATA { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KEY_DERIVATION_STRING_DATA_PTR = *mut CK_KEY_DERIVATION_STRING_DATA; +pub type CK_EXTRACT_PARAMS = CK_ULONG; +pub type CK_EXTRACT_PARAMS_PTR = *mut CK_EXTRACT_PARAMS; +pub type CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE = CK_ULONG; +pub type CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR = + *mut CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; +pub type CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE = CK_ULONG; +pub type CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR = *mut CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PKCS5_PBKD2_PARAMS { + pub saltSource: CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE, + pub pSaltSourceData: CK_VOID_PTR, + pub ulSaltSourceDataLen: CK_ULONG, + pub iterations: CK_ULONG, + pub prf: CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE, + pub pPrfData: CK_VOID_PTR, + pub ulPrfDataLen: CK_ULONG, + pub pPassword: CK_UTF8CHAR_PTR, + pub ulPasswordLen: CK_ULONG_PTR, +} +#[test] +fn bindgen_test_layout_CK_PKCS5_PBKD2_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(CK_PKCS5_PBKD2_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_PKCS5_PBKD2_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).saltSource) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(saltSource) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSaltSourceData) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(pSaltSourceData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltSourceDataLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(ulSaltSourceDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iterations) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(iterations) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prf) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(prf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrfData) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(pPrfData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrfDataLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(ulPrfDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS), + "::", + stringify!(ulPasswordLen) + ) + ); +} +impl Default for CK_PKCS5_PBKD2_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PKCS5_PBKD2_PARAMS_PTR = *mut CK_PKCS5_PBKD2_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PKCS5_PBKD2_PARAMS2 { + pub saltSource: CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE, + pub pSaltSourceData: CK_VOID_PTR, + pub ulSaltSourceDataLen: CK_ULONG, + pub iterations: CK_ULONG, + pub prf: CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE, + pub pPrfData: CK_VOID_PTR, + pub ulPrfDataLen: CK_ULONG, + pub pPassword: CK_UTF8CHAR_PTR, + pub ulPasswordLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_PKCS5_PBKD2_PARAMS2() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(CK_PKCS5_PBKD2_PARAMS2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_PKCS5_PBKD2_PARAMS2)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).saltSource) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(saltSource) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSaltSourceData) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(pSaltSourceData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltSourceDataLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(ulSaltSourceDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iterations) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(iterations) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prf) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(prf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrfData) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(pPrfData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPrfDataLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(ulPrfDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPassword) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(pPassword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPasswordLen) as usize - ptr as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(CK_PKCS5_PBKD2_PARAMS2), + "::", + stringify!(ulPasswordLen) + ) + ); +} +impl Default for CK_PKCS5_PBKD2_PARAMS2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PKCS5_PBKD2_PARAMS2_PTR = *mut CK_PKCS5_PBKD2_PARAMS2; +pub type CK_OTP_PARAM_TYPE = CK_ULONG; +pub type CK_PARAM_TYPE = CK_OTP_PARAM_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_OTP_PARAM { + pub type_: CK_OTP_PARAM_TYPE, + pub pValue: CK_VOID_PTR, + pub ulValueLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_OTP_PARAM() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_OTP_PARAM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_OTP_PARAM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAM), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pValue) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAM), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulValueLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAM), + "::", + stringify!(ulValueLen) + ) + ); +} +impl Default for CK_OTP_PARAM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_OTP_PARAM_PTR = *mut CK_OTP_PARAM; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_OTP_PARAMS { + pub pParams: CK_OTP_PARAM_PTR, + pub ulCount: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_OTP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_OTP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_OTP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pParams) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAMS), + "::", + stringify!(pParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCount) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_PARAMS), + "::", + stringify!(ulCount) + ) + ); +} +impl Default for CK_OTP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_OTP_PARAMS_PTR = *mut CK_OTP_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_OTP_SIGNATURE_INFO { + pub pParams: CK_OTP_PARAM_PTR, + pub ulCount: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_OTP_SIGNATURE_INFO() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_OTP_SIGNATURE_INFO)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_OTP_SIGNATURE_INFO)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pParams) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_SIGNATURE_INFO), + "::", + stringify!(pParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCount) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_OTP_SIGNATURE_INFO), + "::", + stringify!(ulCount) + ) + ); +} +impl Default for CK_OTP_SIGNATURE_INFO { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_OTP_SIGNATURE_INFO_PTR = *mut CK_OTP_SIGNATURE_INFO; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_KIP_PARAMS { + pub pMechanism: CK_MECHANISM_PTR, + pub hKey: CK_OBJECT_HANDLE, + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_KIP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_KIP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_KIP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(pMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(hKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_KIP_PARAMS), + "::", + stringify!(ulSeedLen) + ) + ); +} +impl Default for CK_KIP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_KIP_PARAMS_PTR = *mut CK_KIP_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_AES_CTR_PARAMS { + pub ulCounterBits: CK_ULONG, + pub cb: [CK_BYTE; 16usize], +} +#[test] +fn bindgen_test_layout_CK_AES_CTR_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_AES_CTR_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_AES_CTR_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCounterBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CTR_PARAMS), + "::", + stringify!(ulCounterBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cb) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CTR_PARAMS), + "::", + stringify!(cb) + ) + ); +} +pub type CK_AES_CTR_PARAMS_PTR = *mut CK_AES_CTR_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GCM_PARAMS { + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, + pub ulIvBits: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulTagBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_GCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_GCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_GCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvBits) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulIvBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTagBits) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_PARAMS), + "::", + stringify!(ulTagBits) + ) + ); +} +impl Default for CK_GCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GCM_PARAMS_PTR = *mut CK_GCM_PARAMS; +pub type CK_GENERATOR_FUNCTION = CK_ULONG; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GCM_MESSAGE_PARAMS { + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, + pub ulIvFixedBits: CK_ULONG, + pub ivGenerator: CK_GENERATOR_FUNCTION, + pub pTag: CK_BYTE_PTR, + pub ulTagBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_GCM_MESSAGE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_GCM_MESSAGE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_GCM_MESSAGE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvFixedBits) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ulIvFixedBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ivGenerator) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ivGenerator) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pTag) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(pTag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTagBits) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_GCM_MESSAGE_PARAMS), + "::", + stringify!(ulTagBits) + ) + ); +} +impl Default for CK_GCM_MESSAGE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GCM_MESSAGE_PARAMS_PTR = *mut CK_GCM_MESSAGE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CCM_PARAMS { + pub ulDataLen: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulMACLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_CCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_CCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDataLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMACLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_PARAMS), + "::", + stringify!(ulMACLen) + ) + ); +} +impl Default for CK_CCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CCM_PARAMS_PTR = *mut CK_CCM_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CCM_MESSAGE_PARAMS { + pub ulDataLen: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub ulNonceFixedBits: CK_ULONG, + pub nonceGenerator: CK_GENERATOR_FUNCTION, + pub pMAC: CK_BYTE_PTR, + pub ulMACLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CCM_MESSAGE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 36usize, + concat!("Size of: ", stringify!(CK_CCM_MESSAGE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_CCM_MESSAGE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDataLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceFixedBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulNonceFixedBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).nonceGenerator) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(nonceGenerator) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pMAC) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(pMAC) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMACLen) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_CCM_MESSAGE_PARAMS), + "::", + stringify!(ulMACLen) + ) + ); +} +impl Default for CK_CCM_MESSAGE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CCM_MESSAGE_PARAMS_PTR = *mut CK_CCM_MESSAGE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_AES_GCM_PARAMS { + pub pIv: CK_BYTE_PTR, + pub ulIvLen: CK_ULONG, + pub ulIvBits: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulTagBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_AES_GCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_AES_GCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_AES_GCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(pIv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulIvLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIvBits) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulIvBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulTagBits) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_GCM_PARAMS), + "::", + stringify!(ulTagBits) + ) + ); +} +impl Default for CK_AES_GCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_AES_GCM_PARAMS_PTR = *mut CK_AES_GCM_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_AES_CCM_PARAMS { + pub ulDataLen: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, + pub ulMACLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_AES_CCM_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(CK_AES_CCM_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_AES_CCM_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulDataLen) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMACLen) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_AES_CCM_PARAMS), + "::", + stringify!(ulMACLen) + ) + ); +} +impl Default for CK_AES_CCM_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_AES_CCM_PARAMS_PTR = *mut CK_AES_CCM_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_CAMELLIA_CTR_PARAMS { + pub ulCounterBits: CK_ULONG, + pub cb: [CK_BYTE; 16usize], +} +#[test] +fn bindgen_test_layout_CK_CAMELLIA_CTR_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_CAMELLIA_CTR_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_CAMELLIA_CTR_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCounterBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CTR_PARAMS), + "::", + stringify!(ulCounterBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).cb) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CTR_PARAMS), + "::", + stringify!(cb) + ) + ); +} +pub type CK_CAMELLIA_CTR_PARAMS_PTR = *mut CK_CAMELLIA_CTR_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_ARIA_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_ARIA_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_ARIA_CBC_ENCRYPT_DATA_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_DSA_PARAMETER_GEN_PARAM { + pub hash: CK_MECHANISM_TYPE, + pub pSeed: CK_BYTE_PTR, + pub ulSeedLen: CK_ULONG, + pub ulIndex: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_DSA_PARAMETER_GEN_PARAM() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_DSA_PARAMETER_GEN_PARAM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_DSA_PARAMETER_GEN_PARAM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(hash) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeed) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(pSeed) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(ulSeedLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIndex) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_DSA_PARAMETER_GEN_PARAM), + "::", + stringify!(ulIndex) + ) + ); +} +impl Default for CK_DSA_PARAMETER_GEN_PARAM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_DSA_PARAMETER_GEN_PARAM_PTR = *mut CK_DSA_PARAMETER_GEN_PARAM; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_ECDH_AES_KEY_WRAP_PARAMS { + pub ulAESKeyBits: CK_ULONG, + pub kdf: CK_EC_KDF_TYPE, + pub ulSharedDataLen: CK_ULONG, + pub pSharedData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_ECDH_AES_KEY_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAESKeyBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(ulAESKeyBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSharedDataLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(ulSharedDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSharedData) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_ECDH_AES_KEY_WRAP_PARAMS), + "::", + stringify!(pSharedData) + ) + ); +} +impl Default for CK_ECDH_AES_KEY_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_ECDH_AES_KEY_WRAP_PARAMS_PTR = *mut CK_ECDH_AES_KEY_WRAP_PARAMS; +pub type CK_JAVA_MIDP_SECURITY_DOMAIN = CK_ULONG; +pub type CK_CERTIFICATE_CATEGORY = CK_ULONG; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_RSA_AES_KEY_WRAP_PARAMS { + pub ulAESKeyBits: CK_ULONG, + pub pOAEPParams: CK_RSA_PKCS_OAEP_PARAMS_PTR, +} +#[test] +fn bindgen_test_layout_CK_RSA_AES_KEY_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_RSA_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_RSA_AES_KEY_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAESKeyBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_AES_KEY_WRAP_PARAMS), + "::", + stringify!(ulAESKeyBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOAEPParams) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_RSA_AES_KEY_WRAP_PARAMS), + "::", + stringify!(pOAEPParams) + ) + ); +} +impl Default for CK_RSA_AES_KEY_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_RSA_AES_KEY_WRAP_PARAMS_PTR = *mut CK_RSA_AES_KEY_WRAP_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS12_MASTER_KEY_DERIVE_PARAMS { + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pVersion: CK_VERSION_PTR, + pub prfHashMechanism: CK_MECHANISM_TYPE, +} +#[test] +fn bindgen_test_layout_CK_TLS12_MASTER_KEY_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 36usize, + concat!("Size of: ", stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pVersion) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(pVersion) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_MASTER_KEY_DERIVE_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); +} +impl Default for CK_TLS12_MASTER_KEY_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR = *mut CK_TLS12_MASTER_KEY_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS12_KEY_MAT_PARAMS { + pub ulMacSizeInBits: CK_ULONG, + pub ulKeySizeInBits: CK_ULONG, + pub ulIVSizeInBits: CK_ULONG, + pub bIsExport: CK_BBOOL, + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pReturnedKeyMaterial: CK_SSL3_KEY_MAT_OUT_PTR, + pub prfHashMechanism: CK_MECHANISM_TYPE, +} +#[test] +fn bindgen_test_layout_CK_TLS12_KEY_MAT_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 49usize, + concat!("Size of: ", stringify!(CK_TLS12_KEY_MAT_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_TLS12_KEY_MAT_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacSizeInBits) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(ulMacSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulKeySizeInBits) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(ulKeySizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVSizeInBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(ulIVSizeInBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bIsExport) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(bIsExport) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pReturnedKeyMaterial) as usize - ptr as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(pReturnedKeyMaterial) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 45usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS12_KEY_MAT_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); +} +impl Default for CK_TLS12_KEY_MAT_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS12_KEY_MAT_PARAMS_PTR = *mut CK_TLS12_KEY_MAT_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_TLS_KDF_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub pLabel: CK_BYTE_PTR, + pub ulLabelLength: CK_ULONG, + pub RandomInfo: CK_SSL3_RANDOM_DATA, + pub pContextData: CK_BYTE_PTR, + pub ulContextDataLength: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_TLS_KDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(CK_TLS_KDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_TLS_KDF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pLabel) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(pLabel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulLabelLength) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(ulLabelLength) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).RandomInfo) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(RandomInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pContextData) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(pContextData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulContextDataLength) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_KDF_PARAMS), + "::", + stringify!(ulContextDataLength) + ) + ); +} +impl Default for CK_TLS_KDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_TLS_KDF_PARAMS_PTR = *mut CK_TLS_KDF_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_TLS_MAC_PARAMS { + pub prfHashMechanism: CK_MECHANISM_TYPE, + pub ulMacLength: CK_ULONG, + pub ulServerOrClient: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_TLS_MAC_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(CK_TLS_MAC_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_TLS_MAC_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_MAC_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulMacLength) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_MAC_PARAMS), + "::", + stringify!(ulMacLength) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulServerOrClient) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_TLS_MAC_PARAMS), + "::", + stringify!(ulServerOrClient) + ) + ); +} +pub type CK_TLS_MAC_PARAMS_PTR = *mut CK_TLS_MAC_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GOSTR3410_DERIVE_PARAMS { + pub kdf: CK_EC_KDF_TYPE, + pub pPublicData: CK_BYTE_PTR, + pub ulPublicDataLen: CK_ULONG, + pub pUKM: CK_BYTE_PTR, + pub ulUKMLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_GOSTR3410_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_GOSTR3410_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_GOSTR3410_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPublicData) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(pPublicData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulPublicDataLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(ulPublicDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pUKM) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(pUKM) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulUKMLen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_DERIVE_PARAMS), + "::", + stringify!(ulUKMLen) + ) + ); +} +impl Default for CK_GOSTR3410_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GOSTR3410_DERIVE_PARAMS_PTR = *mut CK_GOSTR3410_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_GOSTR3410_KEY_WRAP_PARAMS { + pub pWrapOID: CK_BYTE_PTR, + pub ulWrapOIDLen: CK_ULONG, + pub pUKM: CK_BYTE_PTR, + pub ulUKMLen: CK_ULONG, + pub hKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_GOSTR3410_KEY_WRAP_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pWrapOID) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(pWrapOID) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWrapOIDLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(ulWrapOIDLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pUKM) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(pUKM) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulUKMLen) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(ulUKMLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKey) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_GOSTR3410_KEY_WRAP_PARAMS), + "::", + stringify!(hKey) + ) + ); +} +impl Default for CK_GOSTR3410_KEY_WRAP_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_GOSTR3410_KEY_WRAP_PARAMS_PTR = *mut CK_GOSTR3410_KEY_WRAP_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS { + pub iv: [CK_BYTE; 16usize], + pub pData: CK_BYTE_PTR, + pub length: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SEED_CBC_ENCRYPT_DATA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).iv) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(iv) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pData) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(pData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(CK_SEED_CBC_ENCRYPT_DATA_PARAMS), + "::", + stringify!(length) + ) + ); +} +impl Default for CK_SEED_CBC_ENCRYPT_DATA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SEED_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut CK_SEED_CBC_ENCRYPT_DATA_PARAMS; +pub type CK_PROFILE_ID = CK_ULONG; +pub type CK_PROFILE_ID_PTR = *mut CK_PROFILE_ID; +pub type CK_PRF_DATA_TYPE = CK_ULONG; +pub type CK_SP800_108_PRF_TYPE = CK_MECHANISM_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_PRF_DATA_PARAM { + pub type_: CK_PRF_DATA_TYPE, + pub pValue: CK_VOID_PTR, + pub ulValueLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_PRF_DATA_PARAM() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(CK_PRF_DATA_PARAM)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_PRF_DATA_PARAM)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_PRF_DATA_PARAM), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pValue) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_PRF_DATA_PARAM), + "::", + stringify!(pValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulValueLen) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_PRF_DATA_PARAM), + "::", + stringify!(ulValueLen) + ) + ); +} +impl Default for CK_PRF_DATA_PARAM { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_PRF_DATA_PARAM_PTR = *mut CK_PRF_DATA_PARAM; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_SP800_108_COUNTER_FORMAT { + pub bLittleEndian: CK_BBOOL, + pub ulWidthInBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_COUNTER_FORMAT() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 5usize, + concat!("Size of: ", stringify!(CK_SP800_108_COUNTER_FORMAT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SP800_108_COUNTER_FORMAT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bLittleEndian) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_COUNTER_FORMAT), + "::", + stringify!(bLittleEndian) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWidthInBits) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_COUNTER_FORMAT), + "::", + stringify!(ulWidthInBits) + ) + ); +} +pub type CK_SP800_108_COUNTER_FORMAT_PTR = *mut CK_SP800_108_COUNTER_FORMAT; +pub type CK_SP800_108_DKM_LENGTH_METHOD = CK_ULONG; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_SP800_108_DKM_LENGTH_FORMAT { + pub dkmLengthMethod: CK_SP800_108_DKM_LENGTH_METHOD, + pub bLittleEndian: CK_BBOOL, + pub ulWidthInBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_DKM_LENGTH_FORMAT() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 9usize, + concat!("Size of: ", stringify!(CK_SP800_108_DKM_LENGTH_FORMAT)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SP800_108_DKM_LENGTH_FORMAT)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dkmLengthMethod) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_DKM_LENGTH_FORMAT), + "::", + stringify!(dkmLengthMethod) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bLittleEndian) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_DKM_LENGTH_FORMAT), + "::", + stringify!(bLittleEndian) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulWidthInBits) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_DKM_LENGTH_FORMAT), + "::", + stringify!(ulWidthInBits) + ) + ); +} +pub type CK_SP800_108_DKM_LENGTH_FORMAT_PTR = *mut CK_SP800_108_DKM_LENGTH_FORMAT; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_DERIVED_KEY { + pub pTemplate: CK_ATTRIBUTE_PTR, + pub ulAttributeCount: CK_ULONG, + pub phKey: CK_OBJECT_HANDLE_PTR, +} +#[test] +fn bindgen_test_layout_CK_DERIVED_KEY() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_DERIVED_KEY)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_DERIVED_KEY)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pTemplate) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_DERIVED_KEY), + "::", + stringify!(pTemplate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAttributeCount) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_DERIVED_KEY), + "::", + stringify!(ulAttributeCount) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).phKey) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_DERIVED_KEY), + "::", + stringify!(phKey) + ) + ); +} +impl Default for CK_DERIVED_KEY { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_DERIVED_KEY_PTR = *mut CK_DERIVED_KEY; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SP800_108_KDF_PARAMS { + pub prfType: CK_SP800_108_PRF_TYPE, + pub ulNumberOfDataParams: CK_ULONG, + pub pDataParams: CK_PRF_DATA_PARAM_PTR, + pub ulAdditionalDerivedKeys: CK_ULONG, + pub pAdditionalDerivedKeys: CK_DERIVED_KEY_PTR, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_KDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(CK_SP800_108_KDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SP800_108_KDF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfType) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(prfType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNumberOfDataParams) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(ulNumberOfDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pDataParams) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(pDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAdditionalDerivedKeys) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(ulAdditionalDerivedKeys) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAdditionalDerivedKeys) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_KDF_PARAMS), + "::", + stringify!(pAdditionalDerivedKeys) + ) + ); +} +impl Default for CK_SP800_108_KDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SP800_108_KDF_PARAMS_PTR = *mut CK_SP800_108_KDF_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SP800_108_FEEDBACK_KDF_PARAMS { + pub prfType: CK_SP800_108_PRF_TYPE, + pub ulNumberOfDataParams: CK_ULONG, + pub pDataParams: CK_PRF_DATA_PARAM_PTR, + pub ulIVLen: CK_ULONG, + pub pIV: CK_BYTE_PTR, + pub ulAdditionalDerivedKeys: CK_ULONG, + pub pAdditionalDerivedKeys: CK_DERIVED_KEY_PTR, +} +#[test] +fn bindgen_test_layout_CK_SP800_108_FEEDBACK_KDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfType) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(prfType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNumberOfDataParams) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(ulNumberOfDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pDataParams) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(pDataParams) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulIVLen) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(ulIVLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIV) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(pIV) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAdditionalDerivedKeys) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(ulAdditionalDerivedKeys) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAdditionalDerivedKeys) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_SP800_108_FEEDBACK_KDF_PARAMS), + "::", + stringify!(pAdditionalDerivedKeys) + ) + ); +} +impl Default for CK_SP800_108_FEEDBACK_KDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SP800_108_FEEDBACK_KDF_PARAMS_PTR = *mut CK_SP800_108_FEEDBACK_KDF_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_EDDSA_PARAMS { + pub phFlag: CK_BBOOL, + pub ulContextDataLen: CK_ULONG, + pub pContextData: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_EDDSA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 13usize, + concat!("Size of: ", stringify!(CK_EDDSA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_EDDSA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).phFlag) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_EDDSA_PARAMS), + "::", + stringify!(phFlag) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulContextDataLen) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_EDDSA_PARAMS), + "::", + stringify!(ulContextDataLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pContextData) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(CK_EDDSA_PARAMS), + "::", + stringify!(pContextData) + ) + ); +} +impl Default for CK_EDDSA_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_EDDSA_PARAMS_PTR = *mut CK_EDDSA_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_CHACHA20_PARAMS { + pub pBlockCounter: CK_BYTE_PTR, + pub blockCounterBits: CK_ULONG, + pub pNonce: CK_BYTE_PTR, + pub ulNonceBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_CHACHA20_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_CHACHA20_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_CHACHA20_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pBlockCounter) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(pBlockCounter) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).blockCounterBits) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(blockCounterBits) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceBits) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_CHACHA20_PARAMS), + "::", + stringify!(ulNonceBits) + ) + ); +} +impl Default for CK_CHACHA20_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_CHACHA20_PARAMS_PTR = *mut CK_CHACHA20_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SALSA20_PARAMS { + pub pBlockCounter: CK_BYTE_PTR, + pub pNonce: CK_BYTE_PTR, + pub ulNonceBits: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SALSA20_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(CK_SALSA20_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_SALSA20_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pBlockCounter) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_PARAMS), + "::", + stringify!(pBlockCounter) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceBits) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_PARAMS), + "::", + stringify!(ulNonceBits) + ) + ); +} +impl Default for CK_SALSA20_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SALSA20_PARAMS_PTR = *mut CK_SALSA20_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SALSA20_CHACHA20_POLY1305_PARAMS { + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pAAD: CK_BYTE_PTR, + pub ulAADLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_SALSA20_CHACHA20_POLY1305_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pAAD) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(pAAD) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulAADLen) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_PARAMS), + "::", + stringify!(ulAADLen) + ) + ); +} +impl Default for CK_SALSA20_CHACHA20_POLY1305_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SALSA20_CHACHA20_POLY1305_PARAMS_PTR = *mut CK_SALSA20_CHACHA20_POLY1305_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS { + pub pNonce: CK_BYTE_PTR, + pub ulNonceLen: CK_ULONG, + pub pTag: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!( + "Size of: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNonce) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS), + "::", + stringify!(pNonce) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNonceLen) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS), + "::", + stringify!(ulNonceLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pTag) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS), + "::", + stringify!(pTag) + ) + ); +} +impl Default for CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS_PTR = *mut CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS; +pub type CK_X3DH_KDF_TYPE = CK_ULONG; +pub type CK_X3DH_KDF_TYPE_PTR = *mut CK_X3DH_KDF_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X3DH_INITIATE_PARAMS { + pub kdf: CK_X3DH_KDF_TYPE, + pub pPeer_identity: CK_OBJECT_HANDLE, + pub pPeer_prekey: CK_OBJECT_HANDLE, + pub pPrekey_signature: CK_BYTE_PTR, + pub pOnetime_key: CK_BYTE_PTR, + pub pOwn_identity: CK_OBJECT_HANDLE, + pub pOwn_ephemeral: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_X3DH_INITIATE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 36usize, + concat!("Size of: ", stringify!(CK_X3DH_INITIATE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_X3DH_INITIATE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPeer_identity) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pPeer_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPeer_prekey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pPeer_prekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrekey_signature) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pPrekey_signature) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOnetime_key) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pOnetime_key) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOwn_identity) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pOwn_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOwn_ephemeral) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_INITIATE_PARAMS), + "::", + stringify!(pOwn_ephemeral) + ) + ); +} +impl Default for CK_X3DH_INITIATE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X3DH_RESPOND_PARAMS { + pub kdf: CK_X3DH_KDF_TYPE, + pub pIdentity_id: CK_BYTE_PTR, + pub pPrekey_id: CK_BYTE_PTR, + pub pOnetime_id: CK_BYTE_PTR, + pub pInitiator_identity: CK_OBJECT_HANDLE, + pub pInitiator_ephemeral: CK_BYTE_PTR, +} +#[test] +fn bindgen_test_layout_CK_X3DH_RESPOND_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(CK_X3DH_RESPOND_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_X3DH_RESPOND_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdf) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(kdf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pIdentity_id) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pIdentity_id) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pPrekey_id) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pPrekey_id) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pOnetime_id) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pOnetime_id) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInitiator_identity) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pInitiator_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInitiator_ephemeral) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(CK_X3DH_RESPOND_PARAMS), + "::", + stringify!(pInitiator_ephemeral) + ) + ); +} +impl Default for CK_X3DH_RESPOND_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X2RATCHET_KDF_TYPE = CK_ULONG; +pub type CK_X2RATCHET_KDF_TYPE_PTR = *mut CK_X2RATCHET_KDF_TYPE; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X2RATCHET_INITIALIZE_PARAMS { + pub sk: CK_BYTE_PTR, + pub peer_public_prekey: CK_OBJECT_HANDLE, + pub peer_public_identity: CK_OBJECT_HANDLE, + pub own_public_identity: CK_OBJECT_HANDLE, + pub bEncryptedHeader: CK_BBOOL, + pub eCurve: CK_ULONG, + pub aeadMechanism: CK_MECHANISM_TYPE, + pub kdfMechanism: CK_X2RATCHET_KDF_TYPE, +} +#[test] +fn bindgen_test_layout_CK_X2RATCHET_INITIALIZE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 33usize, + concat!("Size of: ", stringify!(CK_X2RATCHET_INITIALIZE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_X2RATCHET_INITIALIZE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).sk) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(sk) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).peer_public_prekey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(peer_public_prekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).peer_public_identity) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(peer_public_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).own_public_identity) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(own_public_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bEncryptedHeader) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(bEncryptedHeader) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eCurve) as usize - ptr as usize }, + 21usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(eCurve) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).aeadMechanism) as usize - ptr as usize }, + 25usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(aeadMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdfMechanism) as usize - ptr as usize }, + 29usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_INITIALIZE_PARAMS), + "::", + stringify!(kdfMechanism) + ) + ); +} +impl Default for CK_X2RATCHET_INITIALIZE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X2RATCHET_INITIALIZE_PARAMS_PTR = *mut CK_X2RATCHET_INITIALIZE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_X2RATCHET_RESPOND_PARAMS { + pub sk: CK_BYTE_PTR, + pub own_prekey: CK_OBJECT_HANDLE, + pub initiator_identity: CK_OBJECT_HANDLE, + pub own_public_identity: CK_OBJECT_HANDLE, + pub bEncryptedHeader: CK_BBOOL, + pub eCurve: CK_ULONG, + pub aeadMechanism: CK_MECHANISM_TYPE, + pub kdfMechanism: CK_X2RATCHET_KDF_TYPE, +} +#[test] +fn bindgen_test_layout_CK_X2RATCHET_RESPOND_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 33usize, + concat!("Size of: ", stringify!(CK_X2RATCHET_RESPOND_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_X2RATCHET_RESPOND_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).sk) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(sk) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).own_prekey) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(own_prekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).initiator_identity) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(initiator_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).own_public_identity) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(own_public_identity) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bEncryptedHeader) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(bEncryptedHeader) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).eCurve) as usize - ptr as usize }, + 21usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(eCurve) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).aeadMechanism) as usize - ptr as usize }, + 25usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(aeadMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).kdfMechanism) as usize - ptr as usize }, + 29usize, + concat!( + "Offset of field: ", + stringify!(CK_X2RATCHET_RESPOND_PARAMS), + "::", + stringify!(kdfMechanism) + ) + ); +} +impl Default for CK_X2RATCHET_RESPOND_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_X2RATCHET_RESPOND_PARAMS_PTR = *mut CK_X2RATCHET_RESPOND_PARAMS; +pub type CK_XEDDSA_HASH_TYPE = CK_ULONG; +pub type CK_XEDDSA_HASH_TYPE_PTR = *mut CK_XEDDSA_HASH_TYPE; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_XEDDSA_PARAMS { + pub hash: CK_XEDDSA_HASH_TYPE, +} +#[test] +fn bindgen_test_layout_CK_XEDDSA_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(CK_XEDDSA_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_XEDDSA_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hash) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_XEDDSA_PARAMS), + "::", + stringify!(hash) + ) + ); +} +pub type CK_XEDDSA_PARAMS_PTR = *mut CK_XEDDSA_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_HKDF_PARAMS { + pub bExtract: CK_BBOOL, + pub bExpand: CK_BBOOL, + pub prfHashMechanism: CK_MECHANISM_TYPE, + pub ulSaltType: CK_ULONG, + pub pSalt: CK_BYTE_PTR, + pub ulSaltLen: CK_ULONG, + pub hSaltKey: CK_OBJECT_HANDLE, + pub pInfo: CK_BYTE_PTR, + pub ulInfoLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_HKDF_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 38usize, + concat!("Size of: ", stringify!(CK_HKDF_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_HKDF_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bExtract) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(bExtract) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bExpand) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(bExpand) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfHashMechanism) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(prfHashMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltType) as usize - ptr as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(ulSaltType) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSalt) as usize - ptr as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(pSalt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSaltLen) as usize - ptr as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(ulSaltLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hSaltKey) as usize - ptr as usize }, + 22usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(hSaltKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pInfo) as usize - ptr as usize }, + 26usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(pInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulInfoLen) as usize - ptr as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(CK_HKDF_PARAMS), + "::", + stringify!(ulInfoLen) + ) + ); +} +impl Default for CK_HKDF_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_HKDF_PARAMS_PTR = *mut CK_HKDF_PARAMS; +pub type CK_HSS_LEVELS = CK_ULONG; +pub type CK_LMS_TYPE = CK_ULONG; +pub type CK_LMOTS_TYPE = CK_ULONG; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct specifiedParams { + pub levels: CK_HSS_LEVELS, + pub lm_type: [CK_LMS_TYPE; 8usize], + pub lm_ots_type: [CK_LMOTS_TYPE; 8usize], +} +#[test] +fn bindgen_test_layout_specifiedParams() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 68usize, + concat!("Size of: ", stringify!(specifiedParams)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(specifiedParams)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).levels) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(specifiedParams), + "::", + stringify!(levels) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lm_type) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(specifiedParams), + "::", + stringify!(lm_type) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).lm_ots_type) as usize - ptr as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(specifiedParams), + "::", + stringify!(lm_ots_type) + ) + ); +} +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE2_PRF_PLUS_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bHasSeedKey: CK_BBOOL, + pub hSeedKey: CK_OBJECT_HANDLE, + pub pSeedData: CK_BYTE_PTR, + pub ulSeedDataLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_IKE2_PRF_PLUS_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 21usize, + concat!("Size of: ", stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bHasSeedKey) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(bHasSeedKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hSeedKey) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(hSeedKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pSeedData) as usize - ptr as usize }, + 9usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(pSeedData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulSeedDataLen) as usize - ptr as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE2_PRF_PLUS_DERIVE_PARAMS), + "::", + stringify!(ulSeedDataLen) + ) + ); +} +impl Default for CK_IKE2_PRF_PLUS_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE2_PRF_PLUS_DERIVE_PARAMS_PTR = *mut CK_IKE2_PRF_PLUS_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE_PRF_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bDataAsKey: CK_BBOOL, + pub bRekey: CK_BBOOL, + pub pNi: CK_BYTE_PTR, + pub ulNiLen: CK_ULONG, + pub pNr: CK_BYTE_PTR, + pub ulNrLen: CK_ULONG, + pub hNewKey: CK_OBJECT_HANDLE, +} +#[test] +fn bindgen_test_layout_CK_IKE_PRF_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 34usize, + concat!("Size of: ", stringify!(CK_IKE_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_IKE_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bDataAsKey) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(bDataAsKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bRekey) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(bRekey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNi) as usize - ptr as usize }, + 6usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(pNi) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNiLen) as usize - ptr as usize }, + 14usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(ulNiLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pNr) as usize - ptr as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(pNr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulNrLen) as usize - ptr as usize }, + 26usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(ulNrLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hNewKey) as usize - ptr as usize }, + 30usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE_PRF_DERIVE_PARAMS), + "::", + stringify!(hNewKey) + ) + ); +} +impl Default for CK_IKE_PRF_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE_PRF_DERIVE_PARAMS_PTR = *mut CK_IKE_PRF_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE1_PRF_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bHasPrevKey: CK_BBOOL, + pub hKeygxy: CK_OBJECT_HANDLE, + pub hPrevKey: CK_OBJECT_HANDLE, + pub pCKYi: CK_BYTE_PTR, + pub ulCKYiLen: CK_ULONG, + pub pCKYr: CK_BYTE_PTR, + pub ulCKYrLen: CK_ULONG, + pub keyNumber: CK_BYTE, +} +#[test] +fn bindgen_test_layout_CK_IKE1_PRF_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 38usize, + concat!("Size of: ", stringify!(CK_IKE1_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_IKE1_PRF_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bHasPrevKey) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(bHasPrevKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKeygxy) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(hKeygxy) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hPrevKey) as usize - ptr as usize }, + 9usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(hPrevKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pCKYi) as usize - ptr as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(pCKYi) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCKYiLen) as usize - ptr as usize }, + 21usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(ulCKYiLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pCKYr) as usize - ptr as usize }, + 25usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(pCKYr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulCKYrLen) as usize - ptr as usize }, + 33usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(ulCKYrLen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyNumber) as usize - ptr as usize }, + 37usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_PRF_DERIVE_PARAMS), + "::", + stringify!(keyNumber) + ) + ); +} +impl Default for CK_IKE1_PRF_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE1_PRF_DERIVE_PARAMS_PTR = *mut CK_IKE1_PRF_DERIVE_PARAMS; +#[repr(C, packed)] +#[derive(Debug, Copy, Clone)] +pub struct CK_IKE1_EXTENDED_DERIVE_PARAMS { + pub prfMechanism: CK_MECHANISM_TYPE, + pub bHasKeygxy: CK_BBOOL, + pub hKeygxy: CK_OBJECT_HANDLE, + pub pExtraData: CK_BYTE_PTR, + pub ulExtraDataLen: CK_ULONG, +} +#[test] +fn bindgen_test_layout_CK_IKE1_EXTENDED_DERIVE_PARAMS() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 21usize, + concat!("Size of: ", stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).prfMechanism) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(prfMechanism) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).bHasKeygxy) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(bHasKeygxy) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).hKeygxy) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(hKeygxy) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pExtraData) as usize - ptr as usize }, + 9usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(pExtraData) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ulExtraDataLen) as usize - ptr as usize }, + 17usize, + concat!( + "Offset of field: ", + stringify!(CK_IKE1_EXTENDED_DERIVE_PARAMS), + "::", + stringify!(ulExtraDataLen) + ) + ); +} +impl Default for CK_IKE1_EXTENDED_DERIVE_PARAMS { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type CK_IKE1_EXTENDED_DERIVE_PARAMS_PTR = *mut CK_IKE1_EXTENDED_DERIVE_PARAMS; +extern "C" { + pub fn C_Initialize(pInitArgs: CK_VOID_PTR) -> CK_RV; +} +extern "C" { + pub fn C_Finalize(pReserved: CK_VOID_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetInfo(pInfo: CK_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetFunctionList(ppFunctionList: CK_FUNCTION_LIST_PTR_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetSlotList( + tokenPresent: CK_BBOOL, + pSlotList: CK_SLOT_ID_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetSlotInfo(slotID: CK_SLOT_ID, pInfo: CK_SLOT_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetTokenInfo(slotID: CK_SLOT_ID, pInfo: CK_TOKEN_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetMechanismList( + slotID: CK_SLOT_ID, + pMechanismList: CK_MECHANISM_TYPE_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetMechanismInfo( + slotID: CK_SLOT_ID, + type_: CK_MECHANISM_TYPE, + pInfo: CK_MECHANISM_INFO_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_InitToken( + slotID: CK_SLOT_ID, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pLabel: CK_UTF8CHAR_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_InitPIN( + hSession: CK_SESSION_HANDLE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SetPIN( + hSession: CK_SESSION_HANDLE, + pOldPin: CK_UTF8CHAR_PTR, + ulOldLen: CK_ULONG, + pNewPin: CK_UTF8CHAR_PTR, + ulNewLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_OpenSession( + slotID: CK_SLOT_ID, + flags: CK_FLAGS, + pApplication: CK_VOID_PTR, + Notify: CK_NOTIFY, + phSession: CK_SESSION_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_CloseSession(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_CloseAllSessions(slotID: CK_SLOT_ID) -> CK_RV; +} +extern "C" { + pub fn C_GetSessionInfo(hSession: CK_SESSION_HANDLE, pInfo: CK_SESSION_INFO_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetOperationState( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + pulOperationStateLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SetOperationState( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + ulOperationStateLen: CK_ULONG, + hEncryptionKey: CK_OBJECT_HANDLE, + hAuthenticationKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Login( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_Logout(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_CreateObject( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_CopyObject( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phNewObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DestroyObject(hSession: CK_SESSION_HANDLE, hObject: CK_OBJECT_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_GetObjectSize( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pulSize: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetAttributeValue( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SetAttributeValue( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_FindObjectsInit( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_FindObjects( + hSession: CK_SESSION_HANDLE, + phObject: CK_OBJECT_HANDLE_PTR, + ulMaxObjectCount: CK_ULONG, + pulObjectCount: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_FindObjectsFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_EncryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Encrypt( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pEncryptedData: CK_BYTE_PTR, + pulEncryptedDataLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptFinal( + hSession: CK_SESSION_HANDLE, + pLastEncryptedPart: CK_BYTE_PTR, + pulLastEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Decrypt( + hSession: CK_SESSION_HANDLE, + pEncryptedData: CK_BYTE_PTR, + ulEncryptedDataLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptUpdate( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptFinal( + hSession: CK_SESSION_HANDLE, + pLastPart: CK_BYTE_PTR, + pulLastPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestInit(hSession: CK_SESSION_HANDLE, pMechanism: CK_MECHANISM_PTR) -> CK_RV; +} +extern "C" { + pub fn C_Digest( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestKey(hSession: CK_SESSION_HANDLE, hKey: CK_OBJECT_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_DigestFinal( + hSession: CK_SESSION_HANDLE, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Sign( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignFinal( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignRecoverInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignRecover( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_Verify( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyFinal( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyRecoverInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyRecover( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DigestEncryptUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptDigestUpdate( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignEncryptUpdate( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptVerifyUpdate( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GenerateKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GenerateKeyPair( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pPublicKeyTemplate: CK_ATTRIBUTE_PTR, + ulPublicKeyAttributeCount: CK_ULONG, + pPrivateKeyTemplate: CK_ATTRIBUTE_PTR, + ulPrivateKeyAttributeCount: CK_ULONG, + phPublicKey: CK_OBJECT_HANDLE_PTR, + phPrivateKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_WrapKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hWrappingKey: CK_OBJECT_HANDLE, + hKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + pulWrappedKeyLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_UnwrapKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hUnwrappingKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + ulWrappedKeyLen: CK_ULONG, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DeriveKey( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hBaseKey: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SeedRandom( + hSession: CK_SESSION_HANDLE, + pSeed: CK_BYTE_PTR, + ulSeedLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_GenerateRandom( + hSession: CK_SESSION_HANDLE, + RandomData: CK_BYTE_PTR, + ulRandomLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetFunctionStatus(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_CancelFunction(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_WaitForSlotEvent( + flags: CK_FLAGS, + pSlot: CK_SLOT_ID_PTR, + pRserved: CK_VOID_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_GetInterfaceList(pInterfacesList: CK_INTERFACE_PTR, pulCount: CK_ULONG_PTR) -> CK_RV; +} +extern "C" { + pub fn C_GetInterface( + pInterfaceName: CK_UTF8CHAR_PTR, + pVersion: CK_VERSION_PTR, + ppInterface: CK_INTERFACE_PTR_PTR, + flags: CK_FLAGS, + ) -> CK_RV; +} +extern "C" { + pub fn C_LoginUser( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pUsername: CK_UTF8CHAR_PTR, + ulUsernameLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SessionCancel(hSession: CK_SESSION_HANDLE, flags: CK_FLAGS) -> CK_RV; +} +extern "C" { + pub fn C_MessageEncryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + ulPlaintextLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + pulCiphertextLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_EncryptMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + ulPlaintextPartLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + pulCiphertextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageEncryptFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_MessageDecryptInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + ulCiphertextLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + pulPlaintextLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_DecryptMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + ulCiphertextPartLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + pulPlaintextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageDecryptFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_MessageSignInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_SignMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageSignFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +extern "C" { + pub fn C_MessageVerifyInit( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyMessage( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyMessageBegin( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_VerifyMessageNext( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV; +} +extern "C" { + pub fn C_MessageVerifyFinal(hSession: CK_SESSION_HANDLE) -> CK_RV; +} +pub type CK_C_Initialize = + ::std::option::Option CK_RV>; +pub type CK_C_Finalize = + ::std::option::Option CK_RV>; +pub type CK_C_GetInfo = ::std::option::Option CK_RV>; +pub type CK_C_GetFunctionList = + ::std::option::Option CK_RV>; +pub type CK_C_GetSlotList = ::std::option::Option< + unsafe extern "C" fn( + tokenPresent: CK_BBOOL, + pSlotList: CK_SLOT_ID_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GetSlotInfo = ::std::option::Option< + unsafe extern "C" fn(slotID: CK_SLOT_ID, pInfo: CK_SLOT_INFO_PTR) -> CK_RV, +>; +pub type CK_C_GetTokenInfo = ::std::option::Option< + unsafe extern "C" fn(slotID: CK_SLOT_ID, pInfo: CK_TOKEN_INFO_PTR) -> CK_RV, +>; +pub type CK_C_GetMechanismList = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + pMechanismList: CK_MECHANISM_TYPE_PTR, + pulCount: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GetMechanismInfo = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + type_: CK_MECHANISM_TYPE, + pInfo: CK_MECHANISM_INFO_PTR, + ) -> CK_RV, +>; +pub type CK_C_InitToken = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pLabel: CK_UTF8CHAR_PTR, + ) -> CK_RV, +>; +pub type CK_C_InitPIN = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SetPIN = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pOldPin: CK_UTF8CHAR_PTR, + ulOldLen: CK_ULONG, + pNewPin: CK_UTF8CHAR_PTR, + ulNewLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_OpenSession = ::std::option::Option< + unsafe extern "C" fn( + slotID: CK_SLOT_ID, + flags: CK_FLAGS, + pApplication: CK_VOID_PTR, + Notify: CK_NOTIFY, + phSession: CK_SESSION_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_CloseSession = + ::std::option::Option CK_RV>; +pub type CK_C_CloseAllSessions = + ::std::option::Option CK_RV>; +pub type CK_C_GetSessionInfo = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, pInfo: CK_SESSION_INFO_PTR) -> CK_RV, +>; +pub type CK_C_GetOperationState = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + pulOperationStateLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SetOperationState = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pOperationState: CK_BYTE_PTR, + ulOperationStateLen: CK_ULONG, + hEncryptionKey: CK_OBJECT_HANDLE, + hAuthenticationKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Login = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_Logout = + ::std::option::Option CK_RV>; +pub type CK_C_CreateObject = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_CopyObject = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phNewObject: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_DestroyObject = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, hObject: CK_OBJECT_HANDLE) -> CK_RV, +>; +pub type CK_C_GetObjectSize = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pulSize: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GetAttributeValue = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SetAttributeValue = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + hObject: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_FindObjectsInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_FindObjects = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + phObject: CK_OBJECT_HANDLE_PTR, + ulMaxObjectCount: CK_ULONG, + pulObjectCount: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_FindObjectsFinal = + ::std::option::Option CK_RV>; +pub type CK_C_EncryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Encrypt = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pEncryptedData: CK_BYTE_PTR, + pulEncryptedDataLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_EncryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_EncryptFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pLastEncryptedPart: CK_BYTE_PTR, + pulLastEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Decrypt = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedData: CK_BYTE_PTR, + ulEncryptedDataLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pLastPart: CK_BYTE_PTR, + pulLastPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DigestInit = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, pMechanism: CK_MECHANISM_PTR) -> CK_RV, +>; +pub type CK_C_Digest = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DigestUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_DigestKey = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, hKey: CK_OBJECT_HANDLE) -> CK_RV, +>; +pub type CK_C_DigestFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pDigest: CK_BYTE_PTR, + pulDigestLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Sign = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SignFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignRecoverInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_SignRecover = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_VerifyInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_Verify = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyFinal = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyRecoverInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_VerifyRecover = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + pData: CK_BYTE_PTR, + pulDataLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DigestEncryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptDigestUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignEncryptUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pPart: CK_BYTE_PTR, + ulPartLen: CK_ULONG, + pEncryptedPart: CK_BYTE_PTR, + pulEncryptedPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptVerifyUpdate = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pEncryptedPart: CK_BYTE_PTR, + ulEncryptedPartLen: CK_ULONG, + pPart: CK_BYTE_PTR, + pulPartLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_GenerateKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pTemplate: CK_ATTRIBUTE_PTR, + ulCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_GenerateKeyPair = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + pPublicKeyTemplate: CK_ATTRIBUTE_PTR, + ulPublicKeyAttributeCount: CK_ULONG, + pPrivateKeyTemplate: CK_ATTRIBUTE_PTR, + ulPrivateKeyAttributeCount: CK_ULONG, + phPublicKey: CK_OBJECT_HANDLE_PTR, + phPrivateKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_WrapKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hWrappingKey: CK_OBJECT_HANDLE, + hKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + pulWrappedKeyLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_UnwrapKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hUnwrappingKey: CK_OBJECT_HANDLE, + pWrappedKey: CK_BYTE_PTR, + ulWrappedKeyLen: CK_ULONG, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_DeriveKey = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hBaseKey: CK_OBJECT_HANDLE, + pTemplate: CK_ATTRIBUTE_PTR, + ulAttributeCount: CK_ULONG, + phKey: CK_OBJECT_HANDLE_PTR, + ) -> CK_RV, +>; +pub type CK_C_SeedRandom = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pSeed: CK_BYTE_PTR, + ulSeedLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_GenerateRandom = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + RandomData: CK_BYTE_PTR, + ulRandomLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_GetFunctionStatus = + ::std::option::Option CK_RV>; +pub type CK_C_CancelFunction = + ::std::option::Option CK_RV>; +pub type CK_C_WaitForSlotEvent = ::std::option::Option< + unsafe extern "C" fn(flags: CK_FLAGS, pSlot: CK_SLOT_ID_PTR, pRserved: CK_VOID_PTR) -> CK_RV, +>; +pub type CK_C_GetInterfaceList = ::std::option::Option< + unsafe extern "C" fn(pInterfacesList: CK_INTERFACE_PTR, pulCount: CK_ULONG_PTR) -> CK_RV, +>; +pub type CK_C_GetInterface = ::std::option::Option< + unsafe extern "C" fn( + pInterfaceName: CK_UTF8CHAR_PTR, + pVersion: CK_VERSION_PTR, + ppInterface: CK_INTERFACE_PTR_PTR, + flags: CK_FLAGS, + ) -> CK_RV, +>; +pub type CK_C_LoginUser = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + userType: CK_USER_TYPE, + pPin: CK_UTF8CHAR_PTR, + ulPinLen: CK_ULONG, + pUsername: CK_UTF8CHAR_PTR, + ulUsernameLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SessionCancel = ::std::option::Option< + unsafe extern "C" fn(hSession: CK_SESSION_HANDLE, flags: CK_FLAGS) -> CK_RV, +>; +pub type CK_C_MessageEncryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_EncryptMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + ulPlaintextLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + pulCiphertextLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_EncryptMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_EncryptMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + ulPlaintextPartLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + pulCiphertextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV, +>; +pub type CK_C_MessageEncryptFinal = + ::std::option::Option CK_RV>; +pub type CK_C_MessageDecryptInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_DecryptMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + pCiphertext: CK_BYTE_PTR, + ulCiphertextLen: CK_ULONG, + pPlaintext: CK_BYTE_PTR, + pulPlaintextLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_DecryptMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pAssociatedData: CK_BYTE_PTR, + ulAssociatedDataLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_DecryptMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pCiphertextPart: CK_BYTE_PTR, + ulCiphertextPartLen: CK_ULONG, + pPlaintextPart: CK_BYTE_PTR, + pulPlaintextPartLen: CK_ULONG_PTR, + flags: CK_FLAGS, + ) -> CK_RV, +>; +pub type CK_C_MessageDecryptFinal = + ::std::option::Option CK_RV>; +pub type CK_C_MessageSignInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_SignMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_SignMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_SignMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + pulSignatureLen: CK_ULONG_PTR, + ) -> CK_RV, +>; +pub type CK_C_MessageSignFinal = + ::std::option::Option CK_RV>; +pub type CK_C_MessageVerifyInit = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pMechanism: CK_MECHANISM_PTR, + hKey: CK_OBJECT_HANDLE, + ) -> CK_RV, +>; +pub type CK_C_VerifyMessage = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyMessageBegin = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_VerifyMessageNext = ::std::option::Option< + unsafe extern "C" fn( + hSession: CK_SESSION_HANDLE, + pParameter: CK_VOID_PTR, + ulParameterLen: CK_ULONG, + pData: CK_BYTE_PTR, + ulDataLen: CK_ULONG, + pSignature: CK_BYTE_PTR, + ulSignatureLen: CK_ULONG, + ) -> CK_RV, +>; +pub type CK_C_MessageVerifyFinal = + ::std::option::Option CK_RV>; +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_FUNCTION_LIST_3_0 { + pub version: CK_VERSION, + pub C_Initialize: CK_C_Initialize, + pub C_Finalize: CK_C_Finalize, + pub C_GetInfo: CK_C_GetInfo, + pub C_GetFunctionList: CK_C_GetFunctionList, + pub C_GetSlotList: CK_C_GetSlotList, + pub C_GetSlotInfo: CK_C_GetSlotInfo, + pub C_GetTokenInfo: CK_C_GetTokenInfo, + pub C_GetMechanismList: CK_C_GetMechanismList, + pub C_GetMechanismInfo: CK_C_GetMechanismInfo, + pub C_InitToken: CK_C_InitToken, + pub C_InitPIN: CK_C_InitPIN, + pub C_SetPIN: CK_C_SetPIN, + pub C_OpenSession: CK_C_OpenSession, + pub C_CloseSession: CK_C_CloseSession, + pub C_CloseAllSessions: CK_C_CloseAllSessions, + pub C_GetSessionInfo: CK_C_GetSessionInfo, + pub C_GetOperationState: CK_C_GetOperationState, + pub C_SetOperationState: CK_C_SetOperationState, + pub C_Login: CK_C_Login, + pub C_Logout: CK_C_Logout, + pub C_CreateObject: CK_C_CreateObject, + pub C_CopyObject: CK_C_CopyObject, + pub C_DestroyObject: CK_C_DestroyObject, + pub C_GetObjectSize: CK_C_GetObjectSize, + pub C_GetAttributeValue: CK_C_GetAttributeValue, + pub C_SetAttributeValue: CK_C_SetAttributeValue, + pub C_FindObjectsInit: CK_C_FindObjectsInit, + pub C_FindObjects: CK_C_FindObjects, + pub C_FindObjectsFinal: CK_C_FindObjectsFinal, + pub C_EncryptInit: CK_C_EncryptInit, + pub C_Encrypt: CK_C_Encrypt, + pub C_EncryptUpdate: CK_C_EncryptUpdate, + pub C_EncryptFinal: CK_C_EncryptFinal, + pub C_DecryptInit: CK_C_DecryptInit, + pub C_Decrypt: CK_C_Decrypt, + pub C_DecryptUpdate: CK_C_DecryptUpdate, + pub C_DecryptFinal: CK_C_DecryptFinal, + pub C_DigestInit: CK_C_DigestInit, + pub C_Digest: CK_C_Digest, + pub C_DigestUpdate: CK_C_DigestUpdate, + pub C_DigestKey: CK_C_DigestKey, + pub C_DigestFinal: CK_C_DigestFinal, + pub C_SignInit: CK_C_SignInit, + pub C_Sign: CK_C_Sign, + pub C_SignUpdate: CK_C_SignUpdate, + pub C_SignFinal: CK_C_SignFinal, + pub C_SignRecoverInit: CK_C_SignRecoverInit, + pub C_SignRecover: CK_C_SignRecover, + pub C_VerifyInit: CK_C_VerifyInit, + pub C_Verify: CK_C_Verify, + pub C_VerifyUpdate: CK_C_VerifyUpdate, + pub C_VerifyFinal: CK_C_VerifyFinal, + pub C_VerifyRecoverInit: CK_C_VerifyRecoverInit, + pub C_VerifyRecover: CK_C_VerifyRecover, + pub C_DigestEncryptUpdate: CK_C_DigestEncryptUpdate, + pub C_DecryptDigestUpdate: CK_C_DecryptDigestUpdate, + pub C_SignEncryptUpdate: CK_C_SignEncryptUpdate, + pub C_DecryptVerifyUpdate: CK_C_DecryptVerifyUpdate, + pub C_GenerateKey: CK_C_GenerateKey, + pub C_GenerateKeyPair: CK_C_GenerateKeyPair, + pub C_WrapKey: CK_C_WrapKey, + pub C_UnwrapKey: CK_C_UnwrapKey, + pub C_DeriveKey: CK_C_DeriveKey, + pub C_SeedRandom: CK_C_SeedRandom, + pub C_GenerateRandom: CK_C_GenerateRandom, + pub C_GetFunctionStatus: CK_C_GetFunctionStatus, + pub C_CancelFunction: CK_C_CancelFunction, + pub C_WaitForSlotEvent: CK_C_WaitForSlotEvent, + pub C_GetInterfaceList: CK_C_GetInterfaceList, + pub C_GetInterface: CK_C_GetInterface, + pub C_LoginUser: CK_C_LoginUser, + pub C_SessionCancel: CK_C_SessionCancel, + pub C_MessageEncryptInit: CK_C_MessageEncryptInit, + pub C_EncryptMessage: CK_C_EncryptMessage, + pub C_EncryptMessageBegin: CK_C_EncryptMessageBegin, + pub C_EncryptMessageNext: CK_C_EncryptMessageNext, + pub C_MessageEncryptFinal: CK_C_MessageEncryptFinal, + pub C_MessageDecryptInit: CK_C_MessageDecryptInit, + pub C_DecryptMessage: CK_C_DecryptMessage, + pub C_DecryptMessageBegin: CK_C_DecryptMessageBegin, + pub C_DecryptMessageNext: CK_C_DecryptMessageNext, + pub C_MessageDecryptFinal: CK_C_MessageDecryptFinal, + pub C_MessageSignInit: CK_C_MessageSignInit, + pub C_SignMessage: CK_C_SignMessage, + pub C_SignMessageBegin: CK_C_SignMessageBegin, + pub C_SignMessageNext: CK_C_SignMessageNext, + pub C_MessageSignFinal: CK_C_MessageSignFinal, + pub C_MessageVerifyInit: CK_C_MessageVerifyInit, + pub C_VerifyMessage: CK_C_VerifyMessage, + pub C_VerifyMessageBegin: CK_C_VerifyMessageBegin, + pub C_VerifyMessageNext: CK_C_VerifyMessageNext, + pub C_MessageVerifyFinal: CK_C_MessageVerifyFinal, +} +#[test] +fn bindgen_test_layout_CK_FUNCTION_LIST_3_0() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 738usize, + concat!("Size of: ", stringify!(CK_FUNCTION_LIST_3_0)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_FUNCTION_LIST_3_0)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Initialize) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Initialize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Finalize) as usize - ptr as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Finalize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInfo) as usize - ptr as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionList) as usize - ptr as usize }, + 26usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetFunctionList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotList) as usize - ptr as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetSlotList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotInfo) as usize - ptr as usize }, + 42usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetSlotInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetTokenInfo) as usize - ptr as usize }, + 50usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetTokenInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismList) as usize - ptr as usize }, + 58usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetMechanismList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismInfo) as usize - ptr as usize }, + 66usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetMechanismInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitToken) as usize - ptr as usize }, + 74usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_InitToken) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitPIN) as usize - ptr as usize }, + 82usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_InitPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetPIN) as usize - ptr as usize }, + 90usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SetPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_OpenSession) as usize - ptr as usize }, + 98usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_OpenSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseSession) as usize - ptr as usize }, + 106usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CloseSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseAllSessions) as usize - ptr as usize }, + 114usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CloseAllSessions) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSessionInfo) as usize - ptr as usize }, + 122usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetSessionInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetOperationState) as usize - ptr as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetOperationState) as usize - ptr as usize }, + 138usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Login) as usize - ptr as usize }, + 146usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Login) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Logout) as usize - ptr as usize }, + 154usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Logout) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CreateObject) as usize - ptr as usize }, + 162usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CreateObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CopyObject) as usize - ptr as usize }, + 170usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CopyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DestroyObject) as usize - ptr as usize }, + 178usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DestroyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetObjectSize) as usize - ptr as usize }, + 186usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetObjectSize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetAttributeValue) as usize - ptr as usize }, + 194usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetAttributeValue) as usize - ptr as usize }, + 202usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsInit) as usize - ptr as usize }, + 210usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_FindObjectsInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjects) as usize - ptr as usize }, + 218usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_FindObjects) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsFinal) as usize - ptr as usize }, + 226usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_FindObjectsFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptInit) as usize - ptr as usize }, + 234usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Encrypt) as usize - ptr as usize }, + 242usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Encrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptUpdate) as usize - ptr as usize }, + 250usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptFinal) as usize - ptr as usize }, + 258usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptInit) as usize - ptr as usize }, + 266usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Decrypt) as usize - ptr as usize }, + 274usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Decrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptUpdate) as usize - ptr as usize }, + 282usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptFinal) as usize - ptr as usize }, + 290usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestInit) as usize - ptr as usize }, + 298usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Digest) as usize - ptr as usize }, + 306usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Digest) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestUpdate) as usize - ptr as usize }, + 314usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestKey) as usize - ptr as usize }, + 322usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestFinal) as usize - ptr as usize }, + 330usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignInit) as usize - ptr as usize }, + 338usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Sign) as usize - ptr as usize }, + 346usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Sign) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignUpdate) as usize - ptr as usize }, + 354usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignFinal) as usize - ptr as usize }, + 362usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecoverInit) as usize - ptr as usize }, + 370usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecover) as usize - ptr as usize }, + 378usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyInit) as usize - ptr as usize }, + 386usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Verify) as usize - ptr as usize }, + 394usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_Verify) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyUpdate) as usize - ptr as usize }, + 402usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyFinal) as usize - ptr as usize }, + 410usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecoverInit) as usize - ptr as usize }, + 418usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecover) as usize - ptr as usize }, + 426usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestEncryptUpdate) as usize - ptr as usize }, + 434usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DigestEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptDigestUpdate) as usize - ptr as usize }, + 442usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptDigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignEncryptUpdate) as usize - ptr as usize }, + 450usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptVerifyUpdate) as usize - ptr as usize }, + 458usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptVerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKey) as usize - ptr as usize }, + 466usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GenerateKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKeyPair) as usize - ptr as usize }, + 474usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GenerateKeyPair) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WrapKey) as usize - ptr as usize }, + 482usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_WrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_UnwrapKey) as usize - ptr as usize }, + 490usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_UnwrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DeriveKey) as usize - ptr as usize }, + 498usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DeriveKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SeedRandom) as usize - ptr as usize }, + 506usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SeedRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateRandom) as usize - ptr as usize }, + 514usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GenerateRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionStatus) as usize - ptr as usize }, + 522usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetFunctionStatus) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CancelFunction) as usize - ptr as usize }, + 530usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_CancelFunction) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WaitForSlotEvent) as usize - ptr as usize }, + 538usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_WaitForSlotEvent) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInterfaceList) as usize - ptr as usize }, + 546usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetInterfaceList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInterface) as usize - ptr as usize }, + 554usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_GetInterface) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_LoginUser) as usize - ptr as usize }, + 562usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_LoginUser) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SessionCancel) as usize - ptr as usize }, + 570usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SessionCancel) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageEncryptInit) as usize - ptr as usize }, + 578usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageEncryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptMessage) as usize - ptr as usize }, + 586usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptMessageBegin) as usize - ptr as usize }, + 594usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptMessageNext) as usize - ptr as usize }, + 602usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_EncryptMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageEncryptFinal) as usize - ptr as usize }, + 610usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageEncryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageDecryptInit) as usize - ptr as usize }, + 618usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageDecryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptMessage) as usize - ptr as usize }, + 626usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptMessageBegin) as usize - ptr as usize }, + 634usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptMessageNext) as usize - ptr as usize }, + 642usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_DecryptMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageDecryptFinal) as usize - ptr as usize }, + 650usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageDecryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageSignInit) as usize - ptr as usize }, + 658usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageSignInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignMessage) as usize - ptr as usize }, + 666usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignMessageBegin) as usize - ptr as usize }, + 674usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignMessageNext) as usize - ptr as usize }, + 682usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_SignMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageSignFinal) as usize - ptr as usize }, + 690usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageSignFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageVerifyInit) as usize - ptr as usize }, + 698usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageVerifyInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyMessage) as usize - ptr as usize }, + 706usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyMessage) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyMessageBegin) as usize - ptr as usize }, + 714usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyMessageBegin) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyMessageNext) as usize - ptr as usize }, + 722usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_VerifyMessageNext) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_MessageVerifyFinal) as usize - ptr as usize }, + 730usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST_3_0), + "::", + stringify!(C_MessageVerifyFinal) + ) + ); +} +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone)] +pub struct CK_FUNCTION_LIST { + pub version: CK_VERSION, + pub C_Initialize: CK_C_Initialize, + pub C_Finalize: CK_C_Finalize, + pub C_GetInfo: CK_C_GetInfo, + pub C_GetFunctionList: CK_C_GetFunctionList, + pub C_GetSlotList: CK_C_GetSlotList, + pub C_GetSlotInfo: CK_C_GetSlotInfo, + pub C_GetTokenInfo: CK_C_GetTokenInfo, + pub C_GetMechanismList: CK_C_GetMechanismList, + pub C_GetMechanismInfo: CK_C_GetMechanismInfo, + pub C_InitToken: CK_C_InitToken, + pub C_InitPIN: CK_C_InitPIN, + pub C_SetPIN: CK_C_SetPIN, + pub C_OpenSession: CK_C_OpenSession, + pub C_CloseSession: CK_C_CloseSession, + pub C_CloseAllSessions: CK_C_CloseAllSessions, + pub C_GetSessionInfo: CK_C_GetSessionInfo, + pub C_GetOperationState: CK_C_GetOperationState, + pub C_SetOperationState: CK_C_SetOperationState, + pub C_Login: CK_C_Login, + pub C_Logout: CK_C_Logout, + pub C_CreateObject: CK_C_CreateObject, + pub C_CopyObject: CK_C_CopyObject, + pub C_DestroyObject: CK_C_DestroyObject, + pub C_GetObjectSize: CK_C_GetObjectSize, + pub C_GetAttributeValue: CK_C_GetAttributeValue, + pub C_SetAttributeValue: CK_C_SetAttributeValue, + pub C_FindObjectsInit: CK_C_FindObjectsInit, + pub C_FindObjects: CK_C_FindObjects, + pub C_FindObjectsFinal: CK_C_FindObjectsFinal, + pub C_EncryptInit: CK_C_EncryptInit, + pub C_Encrypt: CK_C_Encrypt, + pub C_EncryptUpdate: CK_C_EncryptUpdate, + pub C_EncryptFinal: CK_C_EncryptFinal, + pub C_DecryptInit: CK_C_DecryptInit, + pub C_Decrypt: CK_C_Decrypt, + pub C_DecryptUpdate: CK_C_DecryptUpdate, + pub C_DecryptFinal: CK_C_DecryptFinal, + pub C_DigestInit: CK_C_DigestInit, + pub C_Digest: CK_C_Digest, + pub C_DigestUpdate: CK_C_DigestUpdate, + pub C_DigestKey: CK_C_DigestKey, + pub C_DigestFinal: CK_C_DigestFinal, + pub C_SignInit: CK_C_SignInit, + pub C_Sign: CK_C_Sign, + pub C_SignUpdate: CK_C_SignUpdate, + pub C_SignFinal: CK_C_SignFinal, + pub C_SignRecoverInit: CK_C_SignRecoverInit, + pub C_SignRecover: CK_C_SignRecover, + pub C_VerifyInit: CK_C_VerifyInit, + pub C_Verify: CK_C_Verify, + pub C_VerifyUpdate: CK_C_VerifyUpdate, + pub C_VerifyFinal: CK_C_VerifyFinal, + pub C_VerifyRecoverInit: CK_C_VerifyRecoverInit, + pub C_VerifyRecover: CK_C_VerifyRecover, + pub C_DigestEncryptUpdate: CK_C_DigestEncryptUpdate, + pub C_DecryptDigestUpdate: CK_C_DecryptDigestUpdate, + pub C_SignEncryptUpdate: CK_C_SignEncryptUpdate, + pub C_DecryptVerifyUpdate: CK_C_DecryptVerifyUpdate, + pub C_GenerateKey: CK_C_GenerateKey, + pub C_GenerateKeyPair: CK_C_GenerateKeyPair, + pub C_WrapKey: CK_C_WrapKey, + pub C_UnwrapKey: CK_C_UnwrapKey, + pub C_DeriveKey: CK_C_DeriveKey, + pub C_SeedRandom: CK_C_SeedRandom, + pub C_GenerateRandom: CK_C_GenerateRandom, + pub C_GetFunctionStatus: CK_C_GetFunctionStatus, + pub C_CancelFunction: CK_C_CancelFunction, + pub C_WaitForSlotEvent: CK_C_WaitForSlotEvent, +} +#[test] +fn bindgen_test_layout_CK_FUNCTION_LIST() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 546usize, + concat!("Size of: ", stringify!(CK_FUNCTION_LIST)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(CK_FUNCTION_LIST)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Initialize) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Initialize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Finalize) as usize - ptr as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Finalize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetInfo) as usize - ptr as usize }, + 18usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionList) as usize - ptr as usize }, + 26usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetFunctionList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotList) as usize - ptr as usize }, + 34usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetSlotList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSlotInfo) as usize - ptr as usize }, + 42usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetSlotInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetTokenInfo) as usize - ptr as usize }, + 50usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetTokenInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismList) as usize - ptr as usize }, + 58usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetMechanismList) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetMechanismInfo) as usize - ptr as usize }, + 66usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetMechanismInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitToken) as usize - ptr as usize }, + 74usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_InitToken) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_InitPIN) as usize - ptr as usize }, + 82usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_InitPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetPIN) as usize - ptr as usize }, + 90usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SetPIN) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_OpenSession) as usize - ptr as usize }, + 98usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_OpenSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseSession) as usize - ptr as usize }, + 106usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CloseSession) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CloseAllSessions) as usize - ptr as usize }, + 114usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CloseAllSessions) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetSessionInfo) as usize - ptr as usize }, + 122usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetSessionInfo) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetOperationState) as usize - ptr as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetOperationState) as usize - ptr as usize }, + 138usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SetOperationState) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Login) as usize - ptr as usize }, + 146usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Login) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Logout) as usize - ptr as usize }, + 154usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Logout) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CreateObject) as usize - ptr as usize }, + 162usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CreateObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CopyObject) as usize - ptr as usize }, + 170usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CopyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DestroyObject) as usize - ptr as usize }, + 178usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DestroyObject) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetObjectSize) as usize - ptr as usize }, + 186usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetObjectSize) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetAttributeValue) as usize - ptr as usize }, + 194usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SetAttributeValue) as usize - ptr as usize }, + 202usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SetAttributeValue) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsInit) as usize - ptr as usize }, + 210usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_FindObjectsInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjects) as usize - ptr as usize }, + 218usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_FindObjects) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_FindObjectsFinal) as usize - ptr as usize }, + 226usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_FindObjectsFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptInit) as usize - ptr as usize }, + 234usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_EncryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Encrypt) as usize - ptr as usize }, + 242usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Encrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptUpdate) as usize - ptr as usize }, + 250usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_EncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_EncryptFinal) as usize - ptr as usize }, + 258usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_EncryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptInit) as usize - ptr as usize }, + 266usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Decrypt) as usize - ptr as usize }, + 274usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Decrypt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptUpdate) as usize - ptr as usize }, + 282usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptFinal) as usize - ptr as usize }, + 290usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestInit) as usize - ptr as usize }, + 298usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Digest) as usize - ptr as usize }, + 306usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Digest) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestUpdate) as usize - ptr as usize }, + 314usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestKey) as usize - ptr as usize }, + 322usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestFinal) as usize - ptr as usize }, + 330usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignInit) as usize - ptr as usize }, + 338usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Sign) as usize - ptr as usize }, + 346usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Sign) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignUpdate) as usize - ptr as usize }, + 354usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignFinal) as usize - ptr as usize }, + 362usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecoverInit) as usize - ptr as usize }, + 370usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignRecover) as usize - ptr as usize }, + 378usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyInit) as usize - ptr as usize }, + 386usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_Verify) as usize - ptr as usize }, + 394usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_Verify) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyUpdate) as usize - ptr as usize }, + 402usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyFinal) as usize - ptr as usize }, + 410usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyFinal) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecoverInit) as usize - ptr as usize }, + 418usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyRecoverInit) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_VerifyRecover) as usize - ptr as usize }, + 426usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_VerifyRecover) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DigestEncryptUpdate) as usize - ptr as usize }, + 434usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DigestEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptDigestUpdate) as usize - ptr as usize }, + 442usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptDigestUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SignEncryptUpdate) as usize - ptr as usize }, + 450usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SignEncryptUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DecryptVerifyUpdate) as usize - ptr as usize }, + 458usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DecryptVerifyUpdate) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKey) as usize - ptr as usize }, + 466usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GenerateKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateKeyPair) as usize - ptr as usize }, + 474usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GenerateKeyPair) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WrapKey) as usize - ptr as usize }, + 482usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_WrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_UnwrapKey) as usize - ptr as usize }, + 490usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_UnwrapKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_DeriveKey) as usize - ptr as usize }, + 498usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_DeriveKey) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_SeedRandom) as usize - ptr as usize }, + 506usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_SeedRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GenerateRandom) as usize - ptr as usize }, + 514usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GenerateRandom) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_GetFunctionStatus) as usize - ptr as usize }, + 522usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_GetFunctionStatus) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_CancelFunction) as usize - ptr as usize }, + 530usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_CancelFunction) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).C_WaitForSlotEvent) as usize - ptr as usize }, + 538usize, + concat!( + "Offset of field: ", + stringify!(CK_FUNCTION_LIST), + "::", + stringify!(C_WaitForSlotEvent) + ) + ); +} diff --git a/pkcs11-sys/third_party b/pkcs11-sys/third_party new file mode 120000 index 0000000..d838c05 --- /dev/null +++ b/pkcs11-sys/third_party @@ -0,0 +1 @@ +../third_party \ No newline at end of file diff --git a/third_party/pkcs11/LICENSE b/third_party/pkcs11/LICENSE new file mode 100644 index 0000000..72ab7f3 --- /dev/null +++ b/third_party/pkcs11/LICENSE @@ -0,0 +1,20 @@ +Copyright © OASIS Open 2022. All Rights Reserved. + +All capitalized terms in the following text have the meanings assigned to them in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The full Policy may be found at the OASIS website: [https://www.oasis-open.org/policies-guidelines/ipr/]. + +This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published, and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this section are included on all such copies and derivative works. However, this document itself may not be modified in any way, including by removing the copyright notice or references to OASIS, except as needed for the purpose of developing any document or deliverable produced by an OASIS Technical Committee (in which case the rules applicable to copyrights, as set forth in the OASIS IPR Policy, must be followed) or as required to translate it into languages other than English. + +The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or assigns. + +This document and the information contained herein is provided on an "AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. OASIS AND ITS MEMBERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THIS DOCUMENT OR ANY PART THEREOF. + +As stated in the OASIS IPR Policy, the following three paragraphs in brackets apply to OASIS Standards Final Deliverable documents (Committee Specifications, OASIS Standards, or Approved Errata). + +[OASIS requests that any OASIS Party or any other party that believes it has patent claims that would necessarily be infringed by implementations of this OASIS Standards Final Deliverable, to notify OASIS TC Administrator and provide an indication of its willingness to grant patent licenses to such patent claims in a manner consistent with the IPR Mode of the OASIS Technical Committee that produced this deliverable.] + +[OASIS invites any party to contact the OASIS TC Administrator if it is aware of a claim of ownership of any patent claims that would necessarily be infringed by implementations of this OASIS Standards Final Deliverable by a patent holder that is not willing to provide a license to such patent claims in a manner consistent with the IPR Mode of the OASIS Technical Committee that produced this OASIS Standards Final Deliverable. OASIS may include such claims on its website, but disclaims any obligation to do so.] + +[OASIS takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this OASIS Standards Final Deliverable or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on OASIS' procedures with respect to rights in any document or deliverable produced by an OASIS Technical Committee can be found on the OASIS website. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this OASIS Standards Final Deliverable, can be obtained from the OASIS TC Administrator. OASIS makes no representation that any information or list of intellectual property rights will at any time be complete, or that any claims in such list are, in fact, Essential Claims.] + +The name "OASIS" is a trademark of OASIS, the owner and developer of this document, and should be used only to refer to the organization and its official outputs. OASIS welcomes reference to, and implementation and use of, documents, while reserving the right to enforce its marks against misleading uses. Please see https://www.oasis-open.org/policies-guidelines/trademark/ for above guidance. + diff --git a/third_party/pkcs11/pkcs11.h b/third_party/pkcs11/pkcs11.h new file mode 100755 index 0000000..4c0fad4 --- /dev/null +++ b/third_party/pkcs11/pkcs11.h @@ -0,0 +1,246 @@ +/* + * PKCS #11 Specification Version 3.1 + * Committee Specification 01 + * 11 August 2022 + * Copyright (c) OASIS Open 2022. All Rights Reserved. + * Source: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/cs01/include/pkcs11-v3.1/ + * Latest stage of narrative specification: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/pkcs11-spec-v3.1.html + * TC IPR Statement: https://www.oasis-open.org/committees/pkcs11/ipr.php + */ + +#ifndef _PKCS11_H_ +#define _PKCS11_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Before including this file (pkcs11.h) (or pkcs11t.h by + * itself), 5 platform-specific macros must be defined. These + * macros are described below, and typical definitions for them + * are also given. Be advised that these definitions can depend + * on both the platform and the compiler used (and possibly also + * on whether a Cryptoki library is linked statically or + * dynamically). + * + * In addition to defining these 5 macros, the packing convention + * for Cryptoki structures should be set. The Cryptoki + * convention on packing is that structures should be 1-byte + * aligned. + * + * If you're using Windows this might be done by using the following + * preprocessor directive before including pkcs11.h or pkcs11t.h: + * + * #pragma pack(push, cryptoki, 1) + * + * and using the following preprocessor directive after including + * pkcs11.h or pkcs11t.h: + * + * #pragma pack(pop, cryptoki) + * + * In a UNIX environment, you're on your own for this. You might + * not need to do (or be able to do!) anything. + * + * + * Now for the macros: + * + * + * 1. CK_PTR: The indirection string for making a pointer to an + * object. It can be used like this: + * + * typedef CK_BYTE CK_PTR CK_BYTE_PTR; + * + * If you're using Windows, it might be defined by: + * + * #define CK_PTR * + * + * In a typical UNIX environment, it might be defined by: + * + * #define CK_PTR * + * + * + * 2. CK_DECLARE_FUNCTION(returnType, name): A macro which makes + * an importable Cryptoki library function declaration out of a + * return type and a function name. It should be used in the + * following fashion: + * + * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)( + * CK_VOID_PTR pReserved + * ); + * + * If you're using Windows to declare a function in a Win32 Cryptoki .dll, + * it might be defined by: + * + * #define CK_DECLARE_FUNCTION(returnType, name) \ + * returnType __declspec(dllimport) name + * + * In a UNIX environment, it might be defined by: + * + * #define CK_DECLARE_FUNCTION(returnType, name) \ + * returnType name + * + * + * 3. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro + * which makes a Cryptoki API function pointer declaration or + * function pointer type declaration out of a return type and a + * function name. It should be used in the following fashion: + * + * // Define funcPtr to be a pointer to a Cryptoki API function + * // taking arguments args and returning CK_RV. + * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args); + * + * or + * + * // Define funcPtrType to be the type of a pointer to a + * // Cryptoki API function taking arguments args and returning + * // CK_RV, and then define funcPtr to be a variable of type + * // funcPtrType. + * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args); + * funcPtrType funcPtr; + * + * If you're using Windows to access + * functions in a Win32 Cryptoki .dll, in might be defined by: + * + * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ + * returnType __declspec(dllimport) (* name) + * + * In a UNIX environment, it might be defined by: + * + * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ + * returnType (* name) + * + * + * 4. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes + * a function pointer type for an application callback out of + * a return type for the callback and a name for the callback. + * It should be used in the following fashion: + * + * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args); + * + * to declare a function pointer, myCallback, to a callback + * which takes arguments args and returns a CK_RV. It can also + * be used like this: + * + * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args); + * myCallbackType myCallback; + * + * If you're using Windows, it might be defined by: + * + * #define CK_CALLBACK_FUNCTION(returnType, name) \ + * returnType (* name) + * + * In a UNIX environment, it might be defined by: + * + * #define CK_CALLBACK_FUNCTION(returnType, name) \ + * returnType (* name) + * + * + * 5. NULL_PTR: This macro is the value of a NULL pointer. + * + * In any ANSI/ISO C environment (and in many others as well), + * this should best be defined by + * + * #ifndef NULL_PTR + * #define NULL_PTR 0 + * #endif + */ + + +/* All the various Cryptoki types and #define'd values are in the + * file pkcs11t.h. + */ +#include "pkcs11t.h" + +#define __PASTE(x,y) x##y + + +/* ============================================================== + * Define the "extern" form of all the entry points. + * ============================================================== + */ + +#define CK_NEED_ARG_LIST 1 +#define CK_PKCS11_FUNCTION_INFO(name) \ + extern CK_DECLARE_FUNCTION(CK_RV, name) + +/* pkcs11f.h has all the information about the Cryptoki + * function prototypes. + */ +#include "pkcs11f.h" + +#undef CK_NEED_ARG_LIST +#undef CK_PKCS11_FUNCTION_INFO + + +/* ============================================================== + * Define the typedef form of all the entry points. That is, for + * each Cryptoki function C_XXX, define a type CK_C_XXX which is + * a pointer to that kind of function. + * ============================================================== + */ + +#define CK_NEED_ARG_LIST 1 +#define CK_PKCS11_FUNCTION_INFO(name) \ + typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name)) + +/* pkcs11f.h has all the information about the Cryptoki + * function prototypes. + */ +#include "pkcs11f.h" + +#undef CK_NEED_ARG_LIST +#undef CK_PKCS11_FUNCTION_INFO + + +/* ============================================================== + * Define structed vector of entry points. A CK_FUNCTION_LIST + * contains a CK_VERSION indicating a library's Cryptoki version + * and then a whole slew of function pointers to the routines in + * the library. This type was declared, but not defined, in + * pkcs11t.h. + * ============================================================== + */ + +#define CK_PKCS11_FUNCTION_INFO(name) \ + __PASTE(CK_,name) name; + +/* Create the 3.0 Function list */ +struct CK_FUNCTION_LIST_3_0 { + + CK_VERSION version; /* Cryptoki version */ + +/* Pile all the function pointers into the CK_FUNCTION_LIST. */ +/* pkcs11f.h has all the information about the Cryptoki + * function prototypes. + */ +#include "pkcs11f.h" + +}; + +#define CK_PKCS11_2_0_ONLY 1 + +/* Continue to define the old CK_FUNCTION_LIST */ +struct CK_FUNCTION_LIST { + + CK_VERSION version; /* Cryptoki version */ + +/* Pile all the function pointers into the CK_FUNCTION_LIST. */ +/* pkcs11f.h has all the information about the Cryptoki + * function prototypes. + */ +#include "pkcs11f.h" + +}; + +#undef CK_PKCS11_FUNCTION_INFO +#undef CK_PKCS11_2_0_ONLY + + +#undef __PASTE + +#ifdef __cplusplus +} +#endif + +#endif /* _PKCS11_H_ */ + diff --git a/third_party/pkcs11/pkcs11f.h b/third_party/pkcs11/pkcs11f.h new file mode 100755 index 0000000..a409082 --- /dev/null +++ b/third_party/pkcs11/pkcs11f.h @@ -0,0 +1,1195 @@ +/* + * PKCS #11 Specification Version 3.1 + * Committee Specification 01 + * 11 August 2022 + * Copyright (c) OASIS Open 2022. All Rights Reserved. + * Source: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/cs01/include/pkcs11-v3.1/ + * Latest stage of narrative specification: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/pkcs11-spec-v3.1.html + * TC IPR Statement: https://www.oasis-open.org/committees/pkcs11/ipr.php + */ + +/* This header file contains pretty much everything about all the + * Cryptoki function prototypes. Because this information is + * used for more than just declaring function prototypes, the + * order of the functions appearing herein is important, and + * should not be altered. + */ + +/* General-purpose */ + +/* C_Initialize initializes the Cryptoki library. */ +CK_PKCS11_FUNCTION_INFO(C_Initialize) +#ifdef CK_NEED_ARG_LIST +( + CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets + * cast to CK_C_INITIALIZE_ARGS_PTR + * and dereferenced + */ +); +#endif + + +/* C_Finalize indicates that an application is done with the + * Cryptoki library. + */ +CK_PKCS11_FUNCTION_INFO(C_Finalize) +#ifdef CK_NEED_ARG_LIST +( + CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */ +); +#endif + + +/* C_GetInfo returns general information about Cryptoki. */ +CK_PKCS11_FUNCTION_INFO(C_GetInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_INFO_PTR pInfo /* location that receives information */ +); +#endif + + +/* C_GetFunctionList returns the function list. */ +CK_PKCS11_FUNCTION_INFO(C_GetFunctionList) +#ifdef CK_NEED_ARG_LIST +( + CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to + * function list + */ +); +#endif + + + +/* Slot and token management */ + +/* C_GetSlotList obtains a list of slots in the system. */ +CK_PKCS11_FUNCTION_INFO(C_GetSlotList) +#ifdef CK_NEED_ARG_LIST +( + CK_BBOOL tokenPresent, /* only slots with tokens */ + CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */ + CK_ULONG_PTR pulCount /* receives number of slots */ +); +#endif + + +/* C_GetSlotInfo obtains information about a particular slot in + * the system. + */ +CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* the ID of the slot */ + CK_SLOT_INFO_PTR pInfo /* receives the slot information */ +); +#endif + + +/* C_GetTokenInfo obtains information about a particular token + * in the system. + */ +CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* ID of the token's slot */ + CK_TOKEN_INFO_PTR pInfo /* receives the token information */ +); +#endif + + +/* C_GetMechanismList obtains a list of mechanism types + * supported by a token. + */ +CK_PKCS11_FUNCTION_INFO(C_GetMechanismList) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* ID of token's slot */ + CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */ + CK_ULONG_PTR pulCount /* gets # of mechs. */ +); +#endif + + +/* C_GetMechanismInfo obtains information about a particular + * mechanism possibly supported by a token. + */ +CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* ID of the token's slot */ + CK_MECHANISM_TYPE type, /* type of mechanism */ + CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */ +); +#endif + + +/* C_InitToken initializes a token. */ +CK_PKCS11_FUNCTION_INFO(C_InitToken) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* ID of the token's slot */ + CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */ + CK_ULONG ulPinLen, /* length in bytes of the PIN */ + CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */ +); +#endif + + +/* C_InitPIN initializes the normal user's PIN. */ +CK_PKCS11_FUNCTION_INFO(C_InitPIN) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */ + CK_ULONG ulPinLen /* length in bytes of the PIN */ +); +#endif + + +/* C_SetPIN modifies the PIN of the user who is logged in. */ +CK_PKCS11_FUNCTION_INFO(C_SetPIN) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_UTF8CHAR_PTR pOldPin, /* the old PIN */ + CK_ULONG ulOldLen, /* length of the old PIN */ + CK_UTF8CHAR_PTR pNewPin, /* the new PIN */ + CK_ULONG ulNewLen /* length of the new PIN */ +); +#endif + + + +/* Session management */ + +/* C_OpenSession opens a session between an application and a + * token. + */ +CK_PKCS11_FUNCTION_INFO(C_OpenSession) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* the slot's ID */ + CK_FLAGS flags, /* from CK_SESSION_INFO */ + CK_VOID_PTR pApplication, /* passed to callback */ + CK_NOTIFY Notify, /* callback function */ + CK_SESSION_HANDLE_PTR phSession /* gets session handle */ +); +#endif + + +/* C_CloseSession closes a session between an application and a + * token. + */ +CK_PKCS11_FUNCTION_INFO(C_CloseSession) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + +/* C_CloseAllSessions closes all sessions with a token. */ +CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID /* the token's slot */ +); +#endif + + +/* C_GetSessionInfo obtains information about the session. */ +CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_SESSION_INFO_PTR pInfo /* receives session info */ +); +#endif + + +/* C_GetOperationState obtains the state of the cryptographic operation + * in a session. + */ +CK_PKCS11_FUNCTION_INFO(C_GetOperationState) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pOperationState, /* gets state */ + CK_ULONG_PTR pulOperationStateLen /* gets state length */ +); +#endif + + +/* C_SetOperationState restores the state of the cryptographic + * operation in a session. + */ +CK_PKCS11_FUNCTION_INFO(C_SetOperationState) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pOperationState, /* holds state */ + CK_ULONG ulOperationStateLen, /* holds state length */ + CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */ + CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */ +); +#endif + + +/* C_Login logs a user into a token. */ +CK_PKCS11_FUNCTION_INFO(C_Login) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_USER_TYPE userType, /* the user type */ + CK_UTF8CHAR_PTR pPin, /* the user's PIN */ + CK_ULONG ulPinLen /* the length of the PIN */ +); +#endif + + +/* C_Logout logs a user out from a token. */ +CK_PKCS11_FUNCTION_INFO(C_Logout) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + + +/* Object management */ + +/* C_CreateObject creates a new object. */ +CK_PKCS11_FUNCTION_INFO(C_CreateObject) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* the object's template */ + CK_ULONG ulCount, /* attributes in template */ + CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */ +); +#endif + + +/* C_CopyObject copies an object, creating a new object for the + * copy. + */ +CK_PKCS11_FUNCTION_INFO(C_CopyObject) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* template for new object */ + CK_ULONG ulCount, /* attributes in template */ + CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */ +); +#endif + + +/* C_DestroyObject destroys an object. */ +CK_PKCS11_FUNCTION_INFO(C_DestroyObject) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject /* the object's handle */ +); +#endif + + +/* C_GetObjectSize gets the size of an object in bytes. */ +CK_PKCS11_FUNCTION_INFO(C_GetObjectSize) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ULONG_PTR pulSize /* receives size of object */ +); +#endif + + +/* C_GetAttributeValue obtains the value of one or more object + * attributes. + */ +CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */ + CK_ULONG ulCount /* attributes in template */ +); +#endif + + +/* C_SetAttributeValue modifies the value of one or more object + * attributes. + */ +CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */ + CK_ULONG ulCount /* attributes in template */ +); +#endif + + +/* C_FindObjectsInit initializes a search for token and session + * objects that match a template. + */ +CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */ + CK_ULONG ulCount /* attrs in search template */ +); +#endif + + +/* C_FindObjects continues a search for token and session + * objects that match a template, obtaining additional object + * handles. + */ +CK_PKCS11_FUNCTION_INFO(C_FindObjects) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */ + CK_ULONG ulMaxObjectCount, /* max handles to get */ + CK_ULONG_PTR pulObjectCount /* actual # returned */ +); +#endif + + +/* C_FindObjectsFinal finishes a search for token and session + * objects. + */ +CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + + +/* Encryption and decryption */ + +/* C_EncryptInit initializes an encryption operation. */ +CK_PKCS11_FUNCTION_INFO(C_EncryptInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */ + CK_OBJECT_HANDLE hKey /* handle of encryption key */ +); +#endif + + +/* C_Encrypt encrypts single-part data. */ +CK_PKCS11_FUNCTION_INFO(C_Encrypt) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pData, /* the plaintext data */ + CK_ULONG ulDataLen, /* bytes of plaintext */ + CK_BYTE_PTR pEncryptedData, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */ +); +#endif + + +/* C_EncryptUpdate continues a multiple-part encryption + * operation. + */ +CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pPart, /* the plaintext data */ + CK_ULONG ulPartLen, /* plaintext data len */ + CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */ +); +#endif + + +/* C_EncryptFinal finishes a multiple-part encryption + * operation. + */ +CK_PKCS11_FUNCTION_INFO(C_EncryptFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session handle */ + CK_BYTE_PTR pLastEncryptedPart, /* last c-text */ + CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */ +); +#endif + + +/* C_DecryptInit initializes a decryption operation. */ +CK_PKCS11_FUNCTION_INFO(C_DecryptInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */ + CK_OBJECT_HANDLE hKey /* handle of decryption key */ +); +#endif + + +/* C_Decrypt decrypts encrypted data in a single part. */ +CK_PKCS11_FUNCTION_INFO(C_Decrypt) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedData, /* ciphertext */ + CK_ULONG ulEncryptedDataLen, /* ciphertext length */ + CK_BYTE_PTR pData, /* gets plaintext */ + CK_ULONG_PTR pulDataLen /* gets p-text size */ +); +#endif + + +/* C_DecryptUpdate continues a multiple-part decryption + * operation. + */ +CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedPart, /* encrypted data */ + CK_ULONG ulEncryptedPartLen, /* input length */ + CK_BYTE_PTR pPart, /* gets plaintext */ + CK_ULONG_PTR pulPartLen /* p-text size */ +); +#endif + + +/* C_DecryptFinal finishes a multiple-part decryption + * operation. + */ +CK_PKCS11_FUNCTION_INFO(C_DecryptFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pLastPart, /* gets plaintext */ + CK_ULONG_PTR pulLastPartLen /* p-text size */ +); +#endif + + + +/* Message digesting */ + +/* C_DigestInit initializes a message-digesting operation. */ +CK_PKCS11_FUNCTION_INFO(C_DigestInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism /* the digesting mechanism */ +); +#endif + + +/* C_Digest digests data in a single part. */ +CK_PKCS11_FUNCTION_INFO(C_Digest) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* data to be digested */ + CK_ULONG ulDataLen, /* bytes of data to digest */ + CK_BYTE_PTR pDigest, /* gets the message digest */ + CK_ULONG_PTR pulDigestLen /* gets digest length */ +); +#endif + + +/* C_DigestUpdate continues a multiple-part message-digesting + * operation. + */ +CK_PKCS11_FUNCTION_INFO(C_DigestUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pPart, /* data to be digested */ + CK_ULONG ulPartLen /* bytes of data to be digested */ +); +#endif + + +/* C_DigestKey continues a multi-part message-digesting + * operation, by digesting the value of a secret key as part of + * the data already digested. + */ +CK_PKCS11_FUNCTION_INFO(C_DigestKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hKey /* secret key to digest */ +); +#endif + + +/* C_DigestFinal finishes a multiple-part message-digesting + * operation. + */ +CK_PKCS11_FUNCTION_INFO(C_DigestFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pDigest, /* gets the message digest */ + CK_ULONG_PTR pulDigestLen /* gets byte count of digest */ +); +#endif + + + +/* Signing and MACing */ + +/* C_SignInit initializes a signature (private key encryption) + * operation, where the signature is (will be) an appendix to + * the data, and plaintext cannot be recovered from the + * signature. + */ +CK_PKCS11_FUNCTION_INFO(C_SignInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ + CK_OBJECT_HANDLE hKey /* handle of signature key */ +); +#endif + + +/* C_Sign signs (encrypts with private key) data in a single + * part, where the signature is (will be) an appendix to the + * data, and plaintext cannot be recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_Sign) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* the data to sign */ + CK_ULONG ulDataLen, /* count of bytes to sign */ + CK_BYTE_PTR pSignature, /* gets the signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + + +/* C_SignUpdate continues a multiple-part signature operation, + * where the signature is (will be) an appendix to the data, + * and plaintext cannot be recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_SignUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pPart, /* the data to sign */ + CK_ULONG ulPartLen /* count of bytes to sign */ +); +#endif + + +/* C_SignFinal finishes a multiple-part signature operation, + * returning the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_SignFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSignature, /* gets the signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + + +/* C_SignRecoverInit initializes a signature operation, where + * the data can be recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ + CK_OBJECT_HANDLE hKey /* handle of the signature key */ +); +#endif + + +/* C_SignRecover signs data in a single operation, where the + * data can be recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_SignRecover) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* the data to sign */ + CK_ULONG ulDataLen, /* count of bytes to sign */ + CK_BYTE_PTR pSignature, /* gets the signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + + + +/* Verifying signatures and MACs */ + +/* C_VerifyInit initializes a verification operation, where the + * signature is an appendix to the data, and plaintext cannot + * cannot be recovered from the signature (e.g. DSA). + */ +CK_PKCS11_FUNCTION_INFO(C_VerifyInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ + CK_OBJECT_HANDLE hKey /* verification key */ +); +#endif + + +/* C_Verify verifies a signature in a single-part operation, + * where the signature is an appendix to the data, and plaintext + * cannot be recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_Verify) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* signed data */ + CK_ULONG ulDataLen, /* length of signed data */ + CK_BYTE_PTR pSignature, /* signature */ + CK_ULONG ulSignatureLen /* signature length*/ +); +#endif + + +/* C_VerifyUpdate continues a multiple-part verification + * operation, where the signature is an appendix to the data, + * and plaintext cannot be recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pPart, /* signed data */ + CK_ULONG ulPartLen /* length of signed data */ +); +#endif + + +/* C_VerifyFinal finishes a multiple-part verification + * operation, checking the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_VerifyFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSignature, /* signature to verify */ + CK_ULONG ulSignatureLen /* signature length */ +); +#endif + + +/* C_VerifyRecoverInit initializes a signature verification + * operation, where the data is recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ + CK_OBJECT_HANDLE hKey /* verification key */ +); +#endif + + +/* C_VerifyRecover verifies a signature in a single-part + * operation, where the data is recovered from the signature. + */ +CK_PKCS11_FUNCTION_INFO(C_VerifyRecover) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSignature, /* signature to verify */ + CK_ULONG ulSignatureLen, /* signature length */ + CK_BYTE_PTR pData, /* gets signed data */ + CK_ULONG_PTR pulDataLen /* gets signed data len */ +); +#endif + + + +/* Dual-function cryptographic operations */ + +/* C_DigestEncryptUpdate continues a multiple-part digesting + * and encryption operation. + */ +CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pPart, /* the plaintext data */ + CK_ULONG ulPartLen, /* plaintext length */ + CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ +); +#endif + + +/* C_DecryptDigestUpdate continues a multiple-part decryption and + * digesting operation. + */ +CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedPart, /* ciphertext */ + CK_ULONG ulEncryptedPartLen, /* ciphertext length */ + CK_BYTE_PTR pPart, /* gets plaintext */ + CK_ULONG_PTR pulPartLen /* gets plaintext len */ +); +#endif + + +/* C_SignEncryptUpdate continues a multiple-part signing and + * encryption operation. + */ +CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pPart, /* the plaintext data */ + CK_ULONG ulPartLen, /* plaintext length */ + CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ +); +#endif + + +/* C_DecryptVerifyUpdate continues a multiple-part decryption and + * verify operation. + */ +CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedPart, /* ciphertext */ + CK_ULONG ulEncryptedPartLen, /* ciphertext length */ + CK_BYTE_PTR pPart, /* gets plaintext */ + CK_ULONG_PTR pulPartLen /* gets p-text length */ +); +#endif + + + +/* Key management */ + +/* C_GenerateKey generates a secret key, creating a new key + * object. + */ +CK_PKCS11_FUNCTION_INFO(C_GenerateKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* key generation mech. */ + CK_ATTRIBUTE_PTR pTemplate, /* template for new key */ + CK_ULONG ulCount, /* # of attrs in template */ + CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */ +); +#endif + + +/* C_GenerateKeyPair generates a public-key/private-key pair, + * creating new key objects. + */ +CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session handle */ + CK_MECHANISM_PTR pMechanism, /* key-gen mech. */ + CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template for pub. key */ + CK_ULONG ulPublicKeyAttributeCount, /* # pub. attrs. */ + CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template for priv. key */ + CK_ULONG ulPrivateKeyAttributeCount, /* # priv. attrs. */ + CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. key handle */ + CK_OBJECT_HANDLE_PTR phPrivateKey /* gets priv. key handle */ +); +#endif + + +/* C_WrapKey wraps (i.e., encrypts) a key. */ +CK_PKCS11_FUNCTION_INFO(C_WrapKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */ + CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */ + CK_OBJECT_HANDLE hKey, /* key to be wrapped */ + CK_BYTE_PTR pWrappedKey, /* gets wrapped key */ + CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */ +); +#endif + + +/* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new + * key object. + */ +CK_PKCS11_FUNCTION_INFO(C_UnwrapKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */ + CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */ + CK_BYTE_PTR pWrappedKey, /* the wrapped key */ + CK_ULONG ulWrappedKeyLen, /* wrapped key len */ + CK_ATTRIBUTE_PTR pTemplate, /* new key template */ + CK_ULONG ulAttributeCount, /* template length */ + CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ +); +#endif + + +/* C_DeriveKey derives a key from a base key, creating a new key + * object. + */ +CK_PKCS11_FUNCTION_INFO(C_DeriveKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */ + CK_OBJECT_HANDLE hBaseKey, /* base key */ + CK_ATTRIBUTE_PTR pTemplate, /* new key template */ + CK_ULONG ulAttributeCount, /* template length */ + CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ +); +#endif + + + +/* Random number generation */ + +/* C_SeedRandom mixes additional seed material into the token's + * random number generator. + */ +CK_PKCS11_FUNCTION_INFO(C_SeedRandom) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSeed, /* the seed material */ + CK_ULONG ulSeedLen /* length of seed material */ +); +#endif + + +/* C_GenerateRandom generates random data. */ +CK_PKCS11_FUNCTION_INFO(C_GenerateRandom) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR RandomData, /* receives the random data */ + CK_ULONG ulRandomLen /* # of bytes to generate */ +); +#endif + + + +/* Parallel function management */ + +/* C_GetFunctionStatus is a legacy function; it obtains an + * updated status of a function running in parallel with an + * application. + */ +CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + +/* C_CancelFunction is a legacy function; it cancels a function + * running in parallel. + */ +CK_PKCS11_FUNCTION_INFO(C_CancelFunction) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + +/* C_WaitForSlotEvent waits for a slot event (token insertion, + * removal, etc.) to occur. + */ +CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent) +#ifdef CK_NEED_ARG_LIST +( + CK_FLAGS flags, /* blocking/nonblocking flag */ + CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */ + CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */ +); +#endif + +#ifndef CK_PKCS11_2_0_ONLY +/* C_GetInterfaceList returns all the interfaces supported by the module*/ +CK_PKCS11_FUNCTION_INFO(C_GetInterfaceList) +#ifdef CK_NEED_ARG_LIST +( + CK_INTERFACE_PTR pInterfacesList, /* returned interfaces */ + CK_ULONG_PTR pulCount /* number of interfaces returned */ +); +#endif + +/* C_GetInterface returns a specific interface from the module. */ +CK_PKCS11_FUNCTION_INFO(C_GetInterface) +#ifdef CK_NEED_ARG_LIST +( + CK_UTF8CHAR_PTR pInterfaceName, /* name of the interface */ + CK_VERSION_PTR pVersion, /* version of the interface */ + CK_INTERFACE_PTR_PTR ppInterface, /* returned interface */ + CK_FLAGS flags /* flags controlling the semantics + * of the interface */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_LoginUser) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_USER_TYPE userType, /* the user type */ + CK_UTF8CHAR_PTR pPin, /* the user's PIN */ + CK_ULONG ulPinLen, /* the length of the PIN */ + CK_UTF8CHAR_PTR pUsername, /* the user's name */ + CK_ULONG ulUsernameLen /*the length of the user's name */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_SessionCancel) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_FLAGS flags /* flags control which sessions are cancelled */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageEncryptInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */ + CK_OBJECT_HANDLE hKey /* handle of encryption key */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_EncryptMessage) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ + CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */ + CK_BYTE_PTR pPlaintext, /* plain text */ + CK_ULONG ulPlaintextLen, /* plain text length */ + CK_BYTE_PTR pCiphertext, /* gets cipher text */ + CK_ULONG_PTR pulCiphertextLen /* gets cipher text length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_EncryptMessageBegin) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ + CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_EncryptMessageNext) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pPlaintextPart, /* plain text */ + CK_ULONG ulPlaintextPartLen, /* plain text length */ + CK_BYTE_PTR pCiphertextPart, /* gets cipher text */ + CK_ULONG_PTR pulCiphertextPartLen, /* gets cipher text length */ + CK_FLAGS flags /* multi mode flag */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageEncryptFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageDecryptInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */ + CK_OBJECT_HANDLE hKey /* handle of decryption key */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_DecryptMessage) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ + CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */ + CK_BYTE_PTR pCiphertext, /* cipher text */ + CK_ULONG ulCiphertextLen, /* cipher text length */ + CK_BYTE_PTR pPlaintext, /* gets plain text */ + CK_ULONG_PTR pulPlaintextLen /* gets plain text length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_DecryptMessageBegin) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */ + CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_DecryptMessageNext) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pCiphertextPart, /* cipher text */ + CK_ULONG ulCiphertextPartLen, /* cipher text length */ + CK_BYTE_PTR pPlaintextPart, /* gets plain text */ + CK_ULONG_PTR pulPlaintextPartLen, /* gets plain text length */ + CK_FLAGS flags /* multi mode flag */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageDecryptFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageSignInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the signing mechanism */ + CK_OBJECT_HANDLE hKey /* handle of signing key */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_SignMessage) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pData, /* data to sign */ + CK_ULONG ulDataLen, /* data to sign length */ + CK_BYTE_PTR pSignature, /* gets signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_SignMessageBegin) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen /* length of message specific parameter */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_SignMessageNext) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pData, /* data to sign */ + CK_ULONG ulDataLen, /* data to sign length */ + CK_BYTE_PTR pSignature, /* gets signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageSignFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageVerifyInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the signing mechanism */ + CK_OBJECT_HANDLE hKey /* handle of signing key */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_VerifyMessage) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pData, /* data to sign */ + CK_ULONG ulDataLen, /* data to sign length */ + CK_BYTE_PTR pSignature, /* signature */ + CK_ULONG ulSignatureLen /* signature length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_VerifyMessageBegin) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen /* length of message specific parameter */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_VerifyMessageNext) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_VOID_PTR pParameter, /* message specific parameter */ + CK_ULONG ulParameterLen, /* length of message specific parameter */ + CK_BYTE_PTR pData, /* data to sign */ + CK_ULONG ulDataLen, /* data to sign length */ + CK_BYTE_PTR pSignature, /* signature */ + CK_ULONG ulSignatureLen /* signature length */ +); +#endif + +CK_PKCS11_FUNCTION_INFO(C_MessageVerifyFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + +#endif /* CK_PKCS11_2_0_ONLY */ diff --git a/third_party/pkcs11/pkcs11t.h b/third_party/pkcs11/pkcs11t.h new file mode 100755 index 0000000..d7e66d4 --- /dev/null +++ b/third_party/pkcs11/pkcs11t.h @@ -0,0 +1,2523 @@ +/* + * PKCS #11 Specification Version 3.1 + * Committee Specification 01 + * 11 August 2022 + * Copyright (c) OASIS Open 2022. All Rights Reserved. + * Source: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/cs01/include/pkcs11-v3.1/ + * Latest stage of narrative specification: https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.1/pkcs11-spec-v3.1.html + * TC IPR Statement: https://www.oasis-open.org/committees/pkcs11/ipr.php + */ + +/* See top of pkcs11.h for information about the macros that + * must be defined and the structure-packing conventions that + * must be set before including this file. + */ + +#ifndef _PKCS11T_H_ +#define _PKCS11T_H_ 1 + +#define CRYPTOKI_VERSION_MAJOR 3 +#define CRYPTOKI_VERSION_MINOR 1 +#define CRYPTOKI_VERSION_AMENDMENT 0 + +#define CK_TRUE 1 +#define CK_FALSE 0 + +#ifndef CK_DISABLE_TRUE_FALSE +#ifndef FALSE +#define FALSE CK_FALSE +#endif +#ifndef TRUE +#define TRUE CK_TRUE +#endif +#endif + +/* an unsigned 8-bit value */ +typedef unsigned char CK_BYTE; + +/* an unsigned 8-bit character */ +typedef CK_BYTE CK_CHAR; + +/* an 8-bit UTF-8 character */ +typedef CK_BYTE CK_UTF8CHAR; + +/* a BYTE-sized Boolean flag */ +typedef CK_BYTE CK_BBOOL; + +/* an unsigned value, at least 32 bits long */ +typedef unsigned long int CK_ULONG; + +/* a signed value, the same size as a CK_ULONG */ +typedef long int CK_LONG; + +/* at least 32 bits; each bit is a Boolean flag */ +typedef CK_ULONG CK_FLAGS; + + +/* some special values for certain CK_ULONG variables */ +#define CK_UNAVAILABLE_INFORMATION (~0UL) +#define CK_EFFECTIVELY_INFINITE 0UL + + +typedef CK_BYTE CK_PTR CK_BYTE_PTR; +typedef CK_CHAR CK_PTR CK_CHAR_PTR; +typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR; +typedef CK_ULONG CK_PTR CK_ULONG_PTR; +typedef void CK_PTR CK_VOID_PTR; + +/* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */ +typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR; + + +/* The following value is always invalid if used as a session + * handle or object handle + */ +#define CK_INVALID_HANDLE 0UL + + +typedef struct CK_VERSION { + CK_BYTE major; /* integer portion of version number */ + CK_BYTE minor; /* 1/100ths portion of version number */ +} CK_VERSION; + +typedef CK_VERSION CK_PTR CK_VERSION_PTR; + + +typedef struct CK_INFO { + CK_VERSION cryptokiVersion; /* Cryptoki interface ver */ + CK_UTF8CHAR manufacturerID[32]; /* blank padded */ + CK_FLAGS flags; /* must be zero */ + CK_UTF8CHAR libraryDescription[32]; /* blank padded */ + CK_VERSION libraryVersion; /* version of library */ +} CK_INFO; + +typedef CK_INFO CK_PTR CK_INFO_PTR; + + +/* CK_NOTIFICATION enumerates the types of notifications that + * Cryptoki provides to an application + */ +typedef CK_ULONG CK_NOTIFICATION; +#define CKN_SURRENDER 0UL +#define CKN_OTP_CHANGED 1UL + +typedef CK_ULONG CK_SLOT_ID; + +typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR; + + +/* CK_SLOT_INFO provides information about a slot */ +typedef struct CK_SLOT_INFO { + CK_UTF8CHAR slotDescription[64]; /* blank padded */ + CK_UTF8CHAR manufacturerID[32]; /* blank padded */ + CK_FLAGS flags; + + CK_VERSION hardwareVersion; /* version of hardware */ + CK_VERSION firmwareVersion; /* version of firmware */ +} CK_SLOT_INFO; + +/* flags: bit flags that provide capabilities of the slot + * Bit Flag Mask Meaning + */ +#define CKF_TOKEN_PRESENT 0x00000001UL /* a token is there */ +#define CKF_REMOVABLE_DEVICE 0x00000002UL /* removable devices*/ +#define CKF_HW_SLOT 0x00000004UL /* hardware slot */ + +typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR; + + +/* CK_TOKEN_INFO provides information about a token */ +typedef struct CK_TOKEN_INFO { + CK_UTF8CHAR label[32]; /* blank padded */ + CK_UTF8CHAR manufacturerID[32]; /* blank padded */ + CK_UTF8CHAR model[16]; /* blank padded */ + CK_CHAR serialNumber[16]; /* blank padded */ + CK_FLAGS flags; /* see below */ + + CK_ULONG ulMaxSessionCount; /* max open sessions */ + CK_ULONG ulSessionCount; /* sess. now open */ + CK_ULONG ulMaxRwSessionCount; /* max R/W sessions */ + CK_ULONG ulRwSessionCount; /* R/W sess. now open */ + CK_ULONG ulMaxPinLen; /* in bytes */ + CK_ULONG ulMinPinLen; /* in bytes */ + CK_ULONG ulTotalPublicMemory; /* in bytes */ + CK_ULONG ulFreePublicMemory; /* in bytes */ + CK_ULONG ulTotalPrivateMemory; /* in bytes */ + CK_ULONG ulFreePrivateMemory; /* in bytes */ + CK_VERSION hardwareVersion; /* version of hardware */ + CK_VERSION firmwareVersion; /* version of firmware */ + CK_CHAR utcTime[16]; /* time */ +} CK_TOKEN_INFO; + +/* The flags parameter is defined as follows: + * Bit Flag Mask Meaning + */ +#define CKF_RNG 0x00000001UL /* has random # generator */ +#define CKF_WRITE_PROTECTED 0x00000002UL /* token is write-protected */ +#define CKF_LOGIN_REQUIRED 0x00000004UL /* user must login */ +#define CKF_USER_PIN_INITIALIZED 0x00000008UL /* normal user's PIN is set */ + +/* CKF_RESTORE_KEY_NOT_NEEDED. If it is set, + * that means that *every* time the state of cryptographic + * operations of a session is successfully saved, all keys + * needed to continue those operations are stored in the state + */ +#define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020UL + +/* CKF_CLOCK_ON_TOKEN. If it is set, that means + * that the token has some sort of clock. The time on that + * clock is returned in the token info structure + */ +#define CKF_CLOCK_ON_TOKEN 0x00000040UL + +/* CKF_PROTECTED_AUTHENTICATION_PATH. If it is + * set, that means that there is some way for the user to login + * without sending a PIN through the Cryptoki library itself + */ +#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100UL + +/* CKF_DUAL_CRYPTO_OPERATIONS. If it is true, + * that means that a single session with the token can perform + * dual simultaneous cryptographic operations (digest and + * encrypt; decrypt and digest; sign and encrypt; and decrypt + * and sign) + */ +#define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200UL + +/* CKF_TOKEN_INITIALIZED. If it is true, the + * token has been initialized using C_InitializeToken or an + * equivalent mechanism outside the scope of PKCS #11. + * Calling C_InitializeToken when this flag is set will cause + * the token to be reinitialized. + */ +#define CKF_TOKEN_INITIALIZED 0x00000400UL + +/* CKF_SECONDARY_AUTHENTICATION. If it is + * true, the token supports secondary authentication for + * private key objects. + */ +#define CKF_SECONDARY_AUTHENTICATION 0x00000800UL + +/* CKF_USER_PIN_COUNT_LOW. If it is true, an + * incorrect user login PIN has been entered at least once + * since the last successful authentication. + */ +#define CKF_USER_PIN_COUNT_LOW 0x00010000UL + +/* CKF_USER_PIN_FINAL_TRY. If it is true, + * supplying an incorrect user PIN will it to become locked. + */ +#define CKF_USER_PIN_FINAL_TRY 0x00020000UL + +/* CKF_USER_PIN_LOCKED. If it is true, the + * user PIN has been locked. User login to the token is not + * possible. + */ +#define CKF_USER_PIN_LOCKED 0x00040000UL + +/* CKF_USER_PIN_TO_BE_CHANGED. If it is true, + * the user PIN value is the default value set by token + * initialization or manufacturing, or the PIN has been + * expired by the card. + */ +#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000UL + +/* CKF_SO_PIN_COUNT_LOW. If it is true, an + * incorrect SO login PIN has been entered at least once since + * the last successful authentication. + */ +#define CKF_SO_PIN_COUNT_LOW 0x00100000UL + +/* CKF_SO_PIN_FINAL_TRY. If it is true, + * supplying an incorrect SO PIN will it to become locked. + */ +#define CKF_SO_PIN_FINAL_TRY 0x00200000UL + +/* CKF_SO_PIN_LOCKED. If it is true, the SO + * PIN has been locked. SO login to the token is not possible. + */ +#define CKF_SO_PIN_LOCKED 0x00400000UL + +/* CKF_SO_PIN_TO_BE_CHANGED. If it is true, + * the SO PIN value is the default value set by token + * initialization or manufacturing, or the PIN has been + * expired by the card. + */ +#define CKF_SO_PIN_TO_BE_CHANGED 0x00800000UL + +#define CKF_ERROR_STATE 0x01000000UL + +typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR; + + +/* CK_SESSION_HANDLE is a Cryptoki-assigned value that + * identifies a session + */ +typedef CK_ULONG CK_SESSION_HANDLE; + +typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR; + + +/* CK_USER_TYPE enumerates the types of Cryptoki users */ +typedef CK_ULONG CK_USER_TYPE; +/* Security Officer */ +#define CKU_SO 0UL +/* Normal user */ +#define CKU_USER 1UL +/* Context specific */ +#define CKU_CONTEXT_SPECIFIC 2UL + +/* CK_STATE enumerates the session states */ +typedef CK_ULONG CK_STATE; +#define CKS_RO_PUBLIC_SESSION 0UL +#define CKS_RO_USER_FUNCTIONS 1UL +#define CKS_RW_PUBLIC_SESSION 2UL +#define CKS_RW_USER_FUNCTIONS 3UL +#define CKS_RW_SO_FUNCTIONS 4UL + +/* CK_SESSION_INFO provides information about a session */ +typedef struct CK_SESSION_INFO { + CK_SLOT_ID slotID; + CK_STATE state; + CK_FLAGS flags; /* see below */ + CK_ULONG ulDeviceError; /* device-dependent error code */ +} CK_SESSION_INFO; + +/* The flags are defined in the following table: + * Bit Flag Mask Meaning + */ +#define CKF_RW_SESSION 0x00000002UL /* session is r/w */ +#define CKF_SERIAL_SESSION 0x00000004UL /* no parallel */ + +typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR; + + +/* CK_OBJECT_HANDLE is a token-specific identifier for an + * object + */ +typedef CK_ULONG CK_OBJECT_HANDLE; + +typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR; + + +/* CK_OBJECT_CLASS is a value that identifies the classes (or + * types) of objects that Cryptoki recognizes. It is defined + * as follows: + */ +typedef CK_ULONG CK_OBJECT_CLASS; + +/* The following classes of objects are defined: */ +#define CKO_DATA 0x00000000UL +#define CKO_CERTIFICATE 0x00000001UL +#define CKO_PUBLIC_KEY 0x00000002UL +#define CKO_PRIVATE_KEY 0x00000003UL +#define CKO_SECRET_KEY 0x00000004UL +#define CKO_HW_FEATURE 0x00000005UL +#define CKO_DOMAIN_PARAMETERS 0x00000006UL +#define CKO_MECHANISM 0x00000007UL +#define CKO_OTP_KEY 0x00000008UL +#define CKO_PROFILE 0x00000009UL + +#define CKO_VENDOR_DEFINED 0x80000000UL + +typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR; + +/* Profile ID's */ +#define CKP_INVALID_ID 0x00000000UL +#define CKP_BASELINE_PROVIDER 0x00000001UL +#define CKP_EXTENDED_PROVIDER 0x00000002UL +#define CKP_AUTHENTICATION_TOKEN 0x00000003UL +#define CKP_PUBLIC_CERTIFICATES_TOKEN 0x00000004UL +#define CKP_COMPLETE_PROVIDER 0x00000005UL +#define CKP_HKDF_TLS_TOKEN 0x00000006UL +#define CKP_VENDOR_DEFINED 0x80000000UL + + +/* CK_HW_FEATURE_TYPE is a value that identifies the hardware feature type + * of an object with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. + */ +typedef CK_ULONG CK_HW_FEATURE_TYPE; + +/* The following hardware feature types are defined */ +#define CKH_MONOTONIC_COUNTER 0x00000001UL +#define CKH_CLOCK 0x00000002UL +#define CKH_USER_INTERFACE 0x00000003UL +#define CKH_VENDOR_DEFINED 0x80000000UL + +/* CK_KEY_TYPE is a value that identifies a key type */ +typedef CK_ULONG CK_KEY_TYPE; + +/* the following key types are defined: */ +#define CKK_RSA 0x00000000UL +#define CKK_DSA 0x00000001UL +#define CKK_DH 0x00000002UL +#define CKK_ECDSA 0x00000003UL /* Deprecated */ +#define CKK_EC 0x00000003UL +#define CKK_X9_42_DH 0x00000004UL +#define CKK_KEA 0x00000005UL +#define CKK_GENERIC_SECRET 0x00000010UL +#define CKK_RC2 0x00000011UL +#define CKK_RC4 0x00000012UL +#define CKK_DES 0x00000013UL +#define CKK_DES2 0x00000014UL +#define CKK_DES3 0x00000015UL +#define CKK_CAST 0x00000016UL +#define CKK_CAST3 0x00000017UL +#define CKK_CAST5 0x00000018UL /* Deprecated */ +#define CKK_CAST128 0x00000018UL +#define CKK_RC5 0x00000019UL +#define CKK_IDEA 0x0000001AUL +#define CKK_SKIPJACK 0x0000001BUL +#define CKK_BATON 0x0000001CUL +#define CKK_JUNIPER 0x0000001DUL +#define CKK_CDMF 0x0000001EUL +#define CKK_AES 0x0000001FUL +#define CKK_BLOWFISH 0x00000020UL +#define CKK_TWOFISH 0x00000021UL +#define CKK_SECURID 0x00000022UL +#define CKK_HOTP 0x00000023UL +#define CKK_ACTI 0x00000024UL +#define CKK_CAMELLIA 0x00000025UL +#define CKK_ARIA 0x00000026UL + +/* the following definitions were added in the 2.30 header file, + * but never defined in the spec. */ +#define CKK_MD5_HMAC 0x00000027UL +#define CKK_SHA_1_HMAC 0x00000028UL +#define CKK_RIPEMD128_HMAC 0x00000029UL +#define CKK_RIPEMD160_HMAC 0x0000002AUL +#define CKK_SHA256_HMAC 0x0000002BUL +#define CKK_SHA384_HMAC 0x0000002CUL +#define CKK_SHA512_HMAC 0x0000002DUL +#define CKK_SHA224_HMAC 0x0000002EUL + +#define CKK_SEED 0x0000002FUL +#define CKK_GOSTR3410 0x00000030UL +#define CKK_GOSTR3411 0x00000031UL +#define CKK_GOST28147 0x00000032UL +#define CKK_CHACHA20 0x00000033UL +#define CKK_POLY1305 0x00000034UL +#define CKK_AES_XTS 0x00000035UL +#define CKK_SHA3_224_HMAC 0x00000036UL +#define CKK_SHA3_256_HMAC 0x00000037UL +#define CKK_SHA3_384_HMAC 0x00000038UL +#define CKK_SHA3_512_HMAC 0x00000039UL +#define CKK_BLAKE2B_160_HMAC 0x0000003aUL +#define CKK_BLAKE2B_256_HMAC 0x0000003bUL +#define CKK_BLAKE2B_384_HMAC 0x0000003cUL +#define CKK_BLAKE2B_512_HMAC 0x0000003dUL +#define CKK_SALSA20 0x0000003eUL +#define CKK_X2RATCHET 0x0000003fUL +#define CKK_EC_EDWARDS 0x00000040UL +#define CKK_EC_MONTGOMERY 0x00000041UL +#define CKK_HKDF 0x00000042UL + +#define CKK_SHA512_224_HMAC 0x00000043UL +#define CKK_SHA512_256_HMAC 0x00000044UL +#define CKK_SHA512_T_HMAC 0x00000045UL +#define CKK_HSS 0x00000046UL + +#define CKK_VENDOR_DEFINED 0x80000000UL + + +/* CK_CERTIFICATE_TYPE is a value that identifies a certificate + * type + */ +typedef CK_ULONG CK_CERTIFICATE_TYPE; + +#define CK_CERTIFICATE_CATEGORY_UNSPECIFIED 0UL +#define CK_CERTIFICATE_CATEGORY_TOKEN_USER 1UL +#define CK_CERTIFICATE_CATEGORY_AUTHORITY 2UL +#define CK_CERTIFICATE_CATEGORY_OTHER_ENTITY 3UL + +#define CK_SECURITY_DOMAIN_UNSPECIFIED 0UL +#define CK_SECURITY_DOMAIN_MANUFACTURER 1UL +#define CK_SECURITY_DOMAIN_OPERATOR 2UL +#define CK_SECURITY_DOMAIN_THIRD_PARTY 3UL + + +/* The following certificate types are defined: */ +#define CKC_X_509 0x00000000UL +#define CKC_X_509_ATTR_CERT 0x00000001UL +#define CKC_WTLS 0x00000002UL +#define CKC_VENDOR_DEFINED 0x80000000UL + + +/* CK_ATTRIBUTE_TYPE is a value that identifies an attribute + * type + */ +typedef CK_ULONG CK_ATTRIBUTE_TYPE; + +/* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which + * consists of an array of values. + */ +#define CKF_ARRAY_ATTRIBUTE 0x40000000UL + +/* The following OTP-related defines relate to the CKA_OTP_FORMAT attribute */ +#define CK_OTP_FORMAT_DECIMAL 0UL +#define CK_OTP_FORMAT_HEXADECIMAL 1UL +#define CK_OTP_FORMAT_ALPHANUMERIC 2UL +#define CK_OTP_FORMAT_BINARY 3UL + +/* The following OTP-related defines relate to the CKA_OTP_..._REQUIREMENT + * attributes + */ +#define CK_OTP_PARAM_IGNORED 0UL +#define CK_OTP_PARAM_OPTIONAL 1UL +#define CK_OTP_PARAM_MANDATORY 2UL + +/* The following attribute types are defined: */ +#define CKA_CLASS 0x00000000UL +#define CKA_TOKEN 0x00000001UL +#define CKA_PRIVATE 0x00000002UL +#define CKA_LABEL 0x00000003UL +#define CKA_UNIQUE_ID 0x00000004UL +#define CKA_APPLICATION 0x00000010UL +#define CKA_VALUE 0x00000011UL +#define CKA_OBJECT_ID 0x00000012UL +#define CKA_CERTIFICATE_TYPE 0x00000080UL +#define CKA_ISSUER 0x00000081UL +#define CKA_SERIAL_NUMBER 0x00000082UL +#define CKA_AC_ISSUER 0x00000083UL +#define CKA_OWNER 0x00000084UL +#define CKA_ATTR_TYPES 0x00000085UL +#define CKA_TRUSTED 0x00000086UL +#define CKA_CERTIFICATE_CATEGORY 0x00000087UL +#define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088UL +#define CKA_URL 0x00000089UL +#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008aUL +#define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008bUL +#define CKA_NAME_HASH_ALGORITHM 0x0000008cUL +#define CKA_CHECK_VALUE 0x00000090UL + +#define CKA_KEY_TYPE 0x00000100UL +#define CKA_SUBJECT 0x00000101UL +#define CKA_ID 0x00000102UL +#define CKA_SENSITIVE 0x00000103UL +#define CKA_ENCRYPT 0x00000104UL +#define CKA_DECRYPT 0x00000105UL +#define CKA_WRAP 0x00000106UL +#define CKA_UNWRAP 0x00000107UL +#define CKA_SIGN 0x00000108UL +#define CKA_SIGN_RECOVER 0x00000109UL +#define CKA_VERIFY 0x0000010aUL +#define CKA_VERIFY_RECOVER 0x0000010bUL +#define CKA_DERIVE 0x0000010cUL +#define CKA_START_DATE 0x00000110UL +#define CKA_END_DATE 0x00000111UL +#define CKA_MODULUS 0x00000120UL +#define CKA_MODULUS_BITS 0x00000121UL +#define CKA_PUBLIC_EXPONENT 0x00000122UL +#define CKA_PRIVATE_EXPONENT 0x00000123UL +#define CKA_PRIME_1 0x00000124UL +#define CKA_PRIME_2 0x00000125UL +#define CKA_EXPONENT_1 0x00000126UL +#define CKA_EXPONENT_2 0x00000127UL +#define CKA_COEFFICIENT 0x00000128UL +#define CKA_PUBLIC_KEY_INFO 0x00000129UL +#define CKA_PRIME 0x00000130UL +#define CKA_SUBPRIME 0x00000131UL +#define CKA_BASE 0x00000132UL + +#define CKA_PRIME_BITS 0x00000133UL +#define CKA_SUBPRIME_BITS 0x00000134UL +#define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS + +#define CKA_VALUE_BITS 0x00000160UL +#define CKA_VALUE_LEN 0x00000161UL +#define CKA_EXTRACTABLE 0x00000162UL +#define CKA_LOCAL 0x00000163UL +#define CKA_NEVER_EXTRACTABLE 0x00000164UL +#define CKA_ALWAYS_SENSITIVE 0x00000165UL +#define CKA_KEY_GEN_MECHANISM 0x00000166UL + +#define CKA_MODIFIABLE 0x00000170UL +#define CKA_COPYABLE 0x00000171UL + +#define CKA_DESTROYABLE 0x00000172UL + +#define CKA_ECDSA_PARAMS 0x00000180UL /* Deprecated */ +#define CKA_EC_PARAMS 0x00000180UL + +#define CKA_EC_POINT 0x00000181UL + +#define CKA_SECONDARY_AUTH 0x00000200UL /* Deprecated */ +#define CKA_AUTH_PIN_FLAGS 0x00000201UL /* Deprecated */ + +#define CKA_ALWAYS_AUTHENTICATE 0x00000202UL + +#define CKA_WRAP_WITH_TRUSTED 0x00000210UL +#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211UL) +#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212UL) +#define CKA_DERIVE_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000213UL) + +#define CKA_OTP_FORMAT 0x00000220UL +#define CKA_OTP_LENGTH 0x00000221UL +#define CKA_OTP_TIME_INTERVAL 0x00000222UL +#define CKA_OTP_USER_FRIENDLY_MODE 0x00000223UL +#define CKA_OTP_CHALLENGE_REQUIREMENT 0x00000224UL +#define CKA_OTP_TIME_REQUIREMENT 0x00000225UL +#define CKA_OTP_COUNTER_REQUIREMENT 0x00000226UL +#define CKA_OTP_PIN_REQUIREMENT 0x00000227UL +#define CKA_OTP_COUNTER 0x0000022eUL +#define CKA_OTP_TIME 0x0000022fUL +#define CKA_OTP_USER_IDENTIFIER 0x0000022aUL +#define CKA_OTP_SERVICE_IDENTIFIER 0x0000022bUL +#define CKA_OTP_SERVICE_LOGO 0x0000022cUL +#define CKA_OTP_SERVICE_LOGO_TYPE 0x0000022dUL + +#define CKA_GOSTR3410_PARAMS 0x00000250UL +#define CKA_GOSTR3411_PARAMS 0x00000251UL +#define CKA_GOST28147_PARAMS 0x00000252UL + +#define CKA_HW_FEATURE_TYPE 0x00000300UL +#define CKA_RESET_ON_INIT 0x00000301UL +#define CKA_HAS_RESET 0x00000302UL + +#define CKA_PIXEL_X 0x00000400UL +#define CKA_PIXEL_Y 0x00000401UL +#define CKA_RESOLUTION 0x00000402UL +#define CKA_CHAR_ROWS 0x00000403UL +#define CKA_CHAR_COLUMNS 0x00000404UL +#define CKA_COLOR 0x00000405UL +#define CKA_BITS_PER_PIXEL 0x00000406UL +#define CKA_CHAR_SETS 0x00000480UL +#define CKA_ENCODING_METHODS 0x00000481UL +#define CKA_MIME_TYPES 0x00000482UL +#define CKA_MECHANISM_TYPE 0x00000500UL +#define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501UL +#define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502UL +#define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503UL +#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600UL) +#define CKA_PROFILE_ID 0x00000601UL + +#define CKA_X2RATCHET_BAG 0x00000602UL +#define CKA_X2RATCHET_BAGSIZE 0x00000603UL +#define CKA_X2RATCHET_BOBS1STMSG 0x00000604UL +#define CKA_X2RATCHET_CKR 0x00000605UL +#define CKA_X2RATCHET_CKS 0x00000606UL +#define CKA_X2RATCHET_DHP 0x00000607UL +#define CKA_X2RATCHET_DHR 0x00000608UL +#define CKA_X2RATCHET_DHS 0x00000609UL +#define CKA_X2RATCHET_HKR 0x0000060aUL +#define CKA_X2RATCHET_HKS 0x0000060bUL +#define CKA_X2RATCHET_ISALICE 0x0000060cUL +#define CKA_X2RATCHET_NHKR 0x0000060dUL +#define CKA_X2RATCHET_NHKS 0x0000060eUL +#define CKA_X2RATCHET_NR 0x0000060fUL +#define CKA_X2RATCHET_NS 0x00000610UL +#define CKA_X2RATCHET_PNS 0x00000611UL +#define CKA_X2RATCHET_RK 0x00000612UL +/* HSS */ +#define CKA_HSS_LEVELS 0x00000617UL +#define CKA_HSS_LMS_TYPE 0x00000618UL +#define CKA_HSS_LMOTS_TYPE 0x00000619UL +#define CKA_HSS_LMS_TYPES 0x0000061aUL +#define CKA_HSS_LMOTS_TYPES 0x0000061bUL +#define CKA_HSS_KEYS_REMAINING 0x0000061cUL + +#define CKA_VENDOR_DEFINED 0x80000000UL + +/* CK_ATTRIBUTE is a structure that includes the type, length + * and value of an attribute + */ +typedef struct CK_ATTRIBUTE { + CK_ATTRIBUTE_TYPE type; + CK_VOID_PTR pValue; + CK_ULONG ulValueLen; /* in bytes */ +} CK_ATTRIBUTE; + +typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR; + +/* CK_DATE is a structure that defines a date */ +typedef struct CK_DATE{ + CK_CHAR year[4]; /* the year ("1900" - "9999") */ + CK_CHAR month[2]; /* the month ("01" - "12") */ + CK_CHAR day[2]; /* the day ("01" - "31") */ +} CK_DATE; + + +/* CK_MECHANISM_TYPE is a value that identifies a mechanism + * type + */ +typedef CK_ULONG CK_MECHANISM_TYPE; + +/* the following mechanism types are defined: */ +#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000UL +#define CKM_RSA_PKCS 0x00000001UL +#define CKM_RSA_9796 0x00000002UL +#define CKM_RSA_X_509 0x00000003UL + +#define CKM_MD2_RSA_PKCS 0x00000004UL +#define CKM_MD5_RSA_PKCS 0x00000005UL +#define CKM_SHA1_RSA_PKCS 0x00000006UL + +#define CKM_RIPEMD128_RSA_PKCS 0x00000007UL +#define CKM_RIPEMD160_RSA_PKCS 0x00000008UL +#define CKM_RSA_PKCS_OAEP 0x00000009UL + +#define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000aUL +#define CKM_RSA_X9_31 0x0000000bUL +#define CKM_SHA1_RSA_X9_31 0x0000000cUL +#define CKM_RSA_PKCS_PSS 0x0000000dUL +#define CKM_SHA1_RSA_PKCS_PSS 0x0000000eUL + +#define CKM_DSA_KEY_PAIR_GEN 0x00000010UL +#define CKM_DSA 0x00000011UL +#define CKM_DSA_SHA1 0x00000012UL +#define CKM_DSA_SHA224 0x00000013UL +#define CKM_DSA_SHA256 0x00000014UL +#define CKM_DSA_SHA384 0x00000015UL +#define CKM_DSA_SHA512 0x00000016UL +#define CKM_DSA_SHA3_224 0x00000018UL +#define CKM_DSA_SHA3_256 0x00000019UL +#define CKM_DSA_SHA3_384 0x0000001aUL +#define CKM_DSA_SHA3_512 0x0000001bUL + +#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020UL +#define CKM_DH_PKCS_DERIVE 0x00000021UL + +#define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030UL +#define CKM_X9_42_DH_DERIVE 0x00000031UL +#define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032UL +#define CKM_X9_42_MQV_DERIVE 0x00000033UL + +#define CKM_SHA256_RSA_PKCS 0x00000040UL +#define CKM_SHA384_RSA_PKCS 0x00000041UL +#define CKM_SHA512_RSA_PKCS 0x00000042UL +#define CKM_SHA256_RSA_PKCS_PSS 0x00000043UL +#define CKM_SHA384_RSA_PKCS_PSS 0x00000044UL +#define CKM_SHA512_RSA_PKCS_PSS 0x00000045UL + +#define CKM_SHA224_RSA_PKCS 0x00000046UL +#define CKM_SHA224_RSA_PKCS_PSS 0x00000047UL + +#define CKM_SHA512_224 0x00000048UL +#define CKM_SHA512_224_HMAC 0x00000049UL +#define CKM_SHA512_224_HMAC_GENERAL 0x0000004aUL +#define CKM_SHA512_224_KEY_DERIVATION 0x0000004bUL +#define CKM_SHA512_256 0x0000004cUL +#define CKM_SHA512_256_HMAC 0x0000004dUL +#define CKM_SHA512_256_HMAC_GENERAL 0x0000004eUL +#define CKM_SHA512_256_KEY_DERIVATION 0x0000004fUL + +#define CKM_SHA512_T 0x00000050UL +#define CKM_SHA512_T_HMAC 0x00000051UL +#define CKM_SHA512_T_HMAC_GENERAL 0x00000052UL +#define CKM_SHA512_T_KEY_DERIVATION 0x00000053UL + +#define CKM_SHA3_256_RSA_PKCS 0x00000060UL +#define CKM_SHA3_384_RSA_PKCS 0x00000061UL +#define CKM_SHA3_512_RSA_PKCS 0x00000062UL +#define CKM_SHA3_256_RSA_PKCS_PSS 0x00000063UL +#define CKM_SHA3_384_RSA_PKCS_PSS 0x00000064UL +#define CKM_SHA3_512_RSA_PKCS_PSS 0x00000065UL +#define CKM_SHA3_224_RSA_PKCS 0x00000066UL +#define CKM_SHA3_224_RSA_PKCS_PSS 0x00000067UL + +#define CKM_RC2_KEY_GEN 0x00000100UL +#define CKM_RC2_ECB 0x00000101UL +#define CKM_RC2_CBC 0x00000102UL +#define CKM_RC2_MAC 0x00000103UL + +#define CKM_RC2_MAC_GENERAL 0x00000104UL +#define CKM_RC2_CBC_PAD 0x00000105UL + +#define CKM_RC4_KEY_GEN 0x00000110UL +#define CKM_RC4 0x00000111UL +#define CKM_DES_KEY_GEN 0x00000120UL +#define CKM_DES_ECB 0x00000121UL +#define CKM_DES_CBC 0x00000122UL +#define CKM_DES_MAC 0x00000123UL + +#define CKM_DES_MAC_GENERAL 0x00000124UL +#define CKM_DES_CBC_PAD 0x00000125UL + +#define CKM_DES2_KEY_GEN 0x00000130UL +#define CKM_DES3_KEY_GEN 0x00000131UL +#define CKM_DES3_ECB 0x00000132UL +#define CKM_DES3_CBC 0x00000133UL +#define CKM_DES3_MAC 0x00000134UL + +#define CKM_DES3_MAC_GENERAL 0x00000135UL +#define CKM_DES3_CBC_PAD 0x00000136UL +#define CKM_DES3_CMAC_GENERAL 0x00000137UL +#define CKM_DES3_CMAC 0x00000138UL +#define CKM_CDMF_KEY_GEN 0x00000140UL +#define CKM_CDMF_ECB 0x00000141UL +#define CKM_CDMF_CBC 0x00000142UL +#define CKM_CDMF_MAC 0x00000143UL +#define CKM_CDMF_MAC_GENERAL 0x00000144UL +#define CKM_CDMF_CBC_PAD 0x00000145UL + +#define CKM_DES_OFB64 0x00000150UL +#define CKM_DES_OFB8 0x00000151UL +#define CKM_DES_CFB64 0x00000152UL +#define CKM_DES_CFB8 0x00000153UL + +#define CKM_MD2 0x00000200UL + +#define CKM_MD2_HMAC 0x00000201UL +#define CKM_MD2_HMAC_GENERAL 0x00000202UL + +#define CKM_MD5 0x00000210UL + +#define CKM_MD5_HMAC 0x00000211UL +#define CKM_MD5_HMAC_GENERAL 0x00000212UL + +#define CKM_SHA_1 0x00000220UL + +#define CKM_SHA_1_HMAC 0x00000221UL +#define CKM_SHA_1_HMAC_GENERAL 0x00000222UL + +#define CKM_RIPEMD128 0x00000230UL +#define CKM_RIPEMD128_HMAC 0x00000231UL +#define CKM_RIPEMD128_HMAC_GENERAL 0x00000232UL +#define CKM_RIPEMD160 0x00000240UL +#define CKM_RIPEMD160_HMAC 0x00000241UL +#define CKM_RIPEMD160_HMAC_GENERAL 0x00000242UL + +#define CKM_SHA256 0x00000250UL +#define CKM_SHA256_HMAC 0x00000251UL +#define CKM_SHA256_HMAC_GENERAL 0x00000252UL +#define CKM_SHA224 0x00000255UL +#define CKM_SHA224_HMAC 0x00000256UL +#define CKM_SHA224_HMAC_GENERAL 0x00000257UL +#define CKM_SHA384 0x00000260UL +#define CKM_SHA384_HMAC 0x00000261UL +#define CKM_SHA384_HMAC_GENERAL 0x00000262UL +#define CKM_SHA512 0x00000270UL +#define CKM_SHA512_HMAC 0x00000271UL +#define CKM_SHA512_HMAC_GENERAL 0x00000272UL +#define CKM_SECURID_KEY_GEN 0x00000280UL +#define CKM_SECURID 0x00000282UL +#define CKM_HOTP_KEY_GEN 0x00000290UL +#define CKM_HOTP 0x00000291UL +#define CKM_ACTI 0x000002a0UL +#define CKM_ACTI_KEY_GEN 0x000002a1UL + +#define CKM_SHA3_256 0x000002b0UL +#define CKM_SHA3_256_HMAC 0x000002b1UL +#define CKM_SHA3_256_HMAC_GENERAL 0x000002b2UL +#define CKM_SHA3_256_KEY_GEN 0x000002b3UL +#define CKM_SHA3_224 0x000002b5UL +#define CKM_SHA3_224_HMAC 0x000002b6UL +#define CKM_SHA3_224_HMAC_GENERAL 0x000002b7UL +#define CKM_SHA3_224_KEY_GEN 0x000002b8UL +#define CKM_SHA3_384 0x000002c0UL +#define CKM_SHA3_384_HMAC 0x000002c1UL +#define CKM_SHA3_384_HMAC_GENERAL 0x000002c2UL +#define CKM_SHA3_384_KEY_GEN 0x000002c3UL +#define CKM_SHA3_512 0x000002d0UL +#define CKM_SHA3_512_HMAC 0x000002d1UL +#define CKM_SHA3_512_HMAC_GENERAL 0x000002d2UL +#define CKM_SHA3_512_KEY_GEN 0x000002d3UL + + +#define CKM_CAST_KEY_GEN 0x00000300UL +#define CKM_CAST_ECB 0x00000301UL +#define CKM_CAST_CBC 0x00000302UL +#define CKM_CAST_MAC 0x00000303UL +#define CKM_CAST_MAC_GENERAL 0x00000304UL +#define CKM_CAST_CBC_PAD 0x00000305UL +#define CKM_CAST3_KEY_GEN 0x00000310UL +#define CKM_CAST3_ECB 0x00000311UL +#define CKM_CAST3_CBC 0x00000312UL +#define CKM_CAST3_MAC 0x00000313UL +#define CKM_CAST3_MAC_GENERAL 0x00000314UL +#define CKM_CAST3_CBC_PAD 0x00000315UL +/* Note that CAST128 and CAST5 are the same algorithm */ +#define CKM_CAST5_KEY_GEN 0x00000320UL +#define CKM_CAST128_KEY_GEN 0x00000320UL +#define CKM_CAST5_ECB 0x00000321UL +#define CKM_CAST128_ECB 0x00000321UL +#define CKM_CAST5_CBC 0x00000322UL /* Deprecated */ +#define CKM_CAST128_CBC 0x00000322UL +#define CKM_CAST5_MAC 0x00000323UL /* Deprecated */ +#define CKM_CAST128_MAC 0x00000323UL +#define CKM_CAST5_MAC_GENERAL 0x00000324UL /* Deprecated */ +#define CKM_CAST128_MAC_GENERAL 0x00000324UL +#define CKM_CAST5_CBC_PAD 0x00000325UL /* Deprecated */ +#define CKM_CAST128_CBC_PAD 0x00000325UL +#define CKM_RC5_KEY_GEN 0x00000330UL +#define CKM_RC5_ECB 0x00000331UL +#define CKM_RC5_CBC 0x00000332UL +#define CKM_RC5_MAC 0x00000333UL +#define CKM_RC5_MAC_GENERAL 0x00000334UL +#define CKM_RC5_CBC_PAD 0x00000335UL +#define CKM_IDEA_KEY_GEN 0x00000340UL +#define CKM_IDEA_ECB 0x00000341UL +#define CKM_IDEA_CBC 0x00000342UL +#define CKM_IDEA_MAC 0x00000343UL +#define CKM_IDEA_MAC_GENERAL 0x00000344UL +#define CKM_IDEA_CBC_PAD 0x00000345UL +#define CKM_GENERIC_SECRET_KEY_GEN 0x00000350UL +#define CKM_CONCATENATE_BASE_AND_KEY 0x00000360UL +#define CKM_CONCATENATE_BASE_AND_DATA 0x00000362UL +#define CKM_CONCATENATE_DATA_AND_BASE 0x00000363UL +#define CKM_XOR_BASE_AND_DATA 0x00000364UL +#define CKM_EXTRACT_KEY_FROM_KEY 0x00000365UL +#define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370UL +#define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371UL +#define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372UL + +#define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373UL +#define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374UL +#define CKM_TLS_MASTER_KEY_DERIVE 0x00000375UL +#define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376UL +#define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377UL + +#define CKM_TLS_PRF 0x00000378UL + +#define CKM_SSL3_MD5_MAC 0x00000380UL +#define CKM_SSL3_SHA1_MAC 0x00000381UL +#define CKM_MD5_KEY_DERIVATION 0x00000390UL +#define CKM_MD2_KEY_DERIVATION 0x00000391UL +#define CKM_SHA1_KEY_DERIVATION 0x00000392UL + +#define CKM_SHA256_KEY_DERIVATION 0x00000393UL +#define CKM_SHA384_KEY_DERIVATION 0x00000394UL +#define CKM_SHA512_KEY_DERIVATION 0x00000395UL +#define CKM_SHA224_KEY_DERIVATION 0x00000396UL +#define CKM_SHA3_256_KEY_DERIVATION 0x00000397UL +#define CKM_SHA3_224_KEY_DERIVATION 0x00000398UL +#define CKM_SHA3_384_KEY_DERIVATION 0x00000399UL +#define CKM_SHA3_512_KEY_DERIVATION 0x0000039aUL +#define CKM_SHAKE_128_KEY_DERIVATION 0x0000039bUL +#define CKM_SHAKE_256_KEY_DERIVATION 0x0000039cUL +#define CKM_SHA3_256_KEY_DERIVE CKM_SHA3_256_KEY_DERIVATION +#define CKM_SHA3_224_KEY_DERIVE CKM_SHA3_224_KEY_DERIVATION +#define CKM_SHA3_384_KEY_DERIVE CKM_SHA3_384_KEY_DERIVATION +#define CKM_SHA3_512_KEY_DERIVE CKM_SHA3_512_KEY_DERIVATION +#define CKM_SHAKE_128_KEY_DERIVE CKM_SHAKE_128_KEY_DERIVATION +#define CKM_SHAKE_256_KEY_DERIVE CKM_SHAKE_256_KEY_DERIVATION + +#define CKM_PBE_MD2_DES_CBC 0x000003a0UL +#define CKM_PBE_MD5_DES_CBC 0x000003a1UL +#define CKM_PBE_MD5_CAST_CBC 0x000003a2UL +#define CKM_PBE_MD5_CAST3_CBC 0x000003a3UL +#define CKM_PBE_MD5_CAST5_CBC 0x000003a4UL /* Deprecated */ +#define CKM_PBE_MD5_CAST128_CBC 0x000003a4UL +#define CKM_PBE_SHA1_CAST5_CBC 0x000003a5UL /* Deprecated */ +#define CKM_PBE_SHA1_CAST128_CBC 0x000003a5UL +#define CKM_PBE_SHA1_RC4_128 0x000003a6UL +#define CKM_PBE_SHA1_RC4_40 0x000003a7UL +#define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003a8UL +#define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003a9UL +#define CKM_PBE_SHA1_RC2_128_CBC 0x000003aaUL +#define CKM_PBE_SHA1_RC2_40_CBC 0x000003abUL + +#define CKM_PKCS5_PBKD2 0x000003b0UL + +#define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003c0UL + +#define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003d0UL +#define CKM_WTLS_MASTER_KEY_DERIVE 0x000003d1UL +#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003d2UL +#define CKM_WTLS_PRF 0x000003d3UL +#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003d4UL +#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003d5UL + +#define CKM_TLS10_MAC_SERVER 0x000003d6UL +#define CKM_TLS10_MAC_CLIENT 0x000003d7UL +#define CKM_TLS12_MAC 0x000003d8UL +#define CKM_TLS12_KDF 0x000003d9UL +#define CKM_TLS12_MASTER_KEY_DERIVE 0x000003e0UL +#define CKM_TLS12_KEY_AND_MAC_DERIVE 0x000003e1UL +#define CKM_TLS12_MASTER_KEY_DERIVE_DH 0x000003e2UL +#define CKM_TLS12_KEY_SAFE_DERIVE 0x000003e3UL +#define CKM_TLS_MAC 0x000003e4UL +#define CKM_TLS_KDF 0x000003e5UL + +#define CKM_KEY_WRAP_LYNKS 0x00000400UL +#define CKM_KEY_WRAP_SET_OAEP 0x00000401UL + +#define CKM_CMS_SIG 0x00000500UL +#define CKM_KIP_DERIVE 0x00000510UL +#define CKM_KIP_WRAP 0x00000511UL +#define CKM_KIP_MAC 0x00000512UL + +#define CKM_CAMELLIA_KEY_GEN 0x00000550UL +#define CKM_CAMELLIA_ECB 0x00000551UL +#define CKM_CAMELLIA_CBC 0x00000552UL +#define CKM_CAMELLIA_MAC 0x00000553UL +#define CKM_CAMELLIA_MAC_GENERAL 0x00000554UL +#define CKM_CAMELLIA_CBC_PAD 0x00000555UL +#define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556UL +#define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557UL +#define CKM_CAMELLIA_CTR 0x00000558UL + +#define CKM_ARIA_KEY_GEN 0x00000560UL +#define CKM_ARIA_ECB 0x00000561UL +#define CKM_ARIA_CBC 0x00000562UL +#define CKM_ARIA_MAC 0x00000563UL +#define CKM_ARIA_MAC_GENERAL 0x00000564UL +#define CKM_ARIA_CBC_PAD 0x00000565UL +#define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566UL +#define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567UL + +#define CKM_SEED_KEY_GEN 0x00000650UL +#define CKM_SEED_ECB 0x00000651UL +#define CKM_SEED_CBC 0x00000652UL +#define CKM_SEED_MAC 0x00000653UL +#define CKM_SEED_MAC_GENERAL 0x00000654UL +#define CKM_SEED_CBC_PAD 0x00000655UL +#define CKM_SEED_ECB_ENCRYPT_DATA 0x00000656UL +#define CKM_SEED_CBC_ENCRYPT_DATA 0x00000657UL + +#define CKM_SKIPJACK_KEY_GEN 0x00001000UL +#define CKM_SKIPJACK_ECB64 0x00001001UL +#define CKM_SKIPJACK_CBC64 0x00001002UL +#define CKM_SKIPJACK_OFB64 0x00001003UL +#define CKM_SKIPJACK_CFB64 0x00001004UL +#define CKM_SKIPJACK_CFB32 0x00001005UL +#define CKM_SKIPJACK_CFB16 0x00001006UL +#define CKM_SKIPJACK_CFB8 0x00001007UL +#define CKM_SKIPJACK_WRAP 0x00001008UL +#define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009UL +#define CKM_SKIPJACK_RELAYX 0x0000100aUL +#define CKM_KEA_KEY_PAIR_GEN 0x00001010UL +#define CKM_KEA_KEY_DERIVE 0x00001011UL +#define CKM_KEA_DERIVE 0x00001012UL +#define CKM_FORTEZZA_TIMESTAMP 0x00001020UL +#define CKM_BATON_KEY_GEN 0x00001030UL +#define CKM_BATON_ECB128 0x00001031UL +#define CKM_BATON_ECB96 0x00001032UL +#define CKM_BATON_CBC128 0x00001033UL +#define CKM_BATON_COUNTER 0x00001034UL +#define CKM_BATON_SHUFFLE 0x00001035UL +#define CKM_BATON_WRAP 0x00001036UL + +#define CKM_ECDSA_KEY_PAIR_GEN 0x00001040UL /* Deprecated */ +#define CKM_EC_KEY_PAIR_GEN 0x00001040UL + +#define CKM_ECDSA 0x00001041UL +#define CKM_ECDSA_SHA1 0x00001042UL +#define CKM_ECDSA_SHA224 0x00001043UL +#define CKM_ECDSA_SHA256 0x00001044UL +#define CKM_ECDSA_SHA384 0x00001045UL +#define CKM_ECDSA_SHA512 0x00001046UL +#define CKM_EC_KEY_PAIR_GEN_W_EXTRA_BITS 0x0000140bUL + +#define CKM_ECDH1_DERIVE 0x00001050UL +#define CKM_ECDH1_COFACTOR_DERIVE 0x00001051UL +#define CKM_ECMQV_DERIVE 0x00001052UL + +#define CKM_ECDH_AES_KEY_WRAP 0x00001053UL +#define CKM_RSA_AES_KEY_WRAP 0x00001054UL + +#define CKM_JUNIPER_KEY_GEN 0x00001060UL +#define CKM_JUNIPER_ECB128 0x00001061UL +#define CKM_JUNIPER_CBC128 0x00001062UL +#define CKM_JUNIPER_COUNTER 0x00001063UL +#define CKM_JUNIPER_SHUFFLE 0x00001064UL +#define CKM_JUNIPER_WRAP 0x00001065UL +#define CKM_FASTHASH 0x00001070UL + +#define CKM_AES_XTS 0x00001071UL +#define CKM_AES_XTS_KEY_GEN 0x00001072UL +#define CKM_AES_KEY_GEN 0x00001080UL +#define CKM_AES_ECB 0x00001081UL +#define CKM_AES_CBC 0x00001082UL +#define CKM_AES_MAC 0x00001083UL +#define CKM_AES_MAC_GENERAL 0x00001084UL +#define CKM_AES_CBC_PAD 0x00001085UL +#define CKM_AES_CTR 0x00001086UL +#define CKM_AES_GCM 0x00001087UL +#define CKM_AES_CCM 0x00001088UL +#define CKM_AES_CTS 0x00001089UL +#define CKM_AES_CMAC 0x0000108aUL +#define CKM_AES_CMAC_GENERAL 0x0000108bUL + +#define CKM_AES_XCBC_MAC 0x0000108cUL +#define CKM_AES_XCBC_MAC_96 0x0000108dUL +#define CKM_AES_GMAC 0x0000108eUL + +#define CKM_BLOWFISH_KEY_GEN 0x00001090UL +#define CKM_BLOWFISH_CBC 0x00001091UL +#define CKM_TWOFISH_KEY_GEN 0x00001092UL +#define CKM_TWOFISH_CBC 0x00001093UL +#define CKM_BLOWFISH_CBC_PAD 0x00001094UL +#define CKM_TWOFISH_CBC_PAD 0x00001095UL + +#define CKM_DES_ECB_ENCRYPT_DATA 0x00001100UL +#define CKM_DES_CBC_ENCRYPT_DATA 0x00001101UL +#define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102UL +#define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103UL +#define CKM_AES_ECB_ENCRYPT_DATA 0x00001104UL +#define CKM_AES_CBC_ENCRYPT_DATA 0x00001105UL + +#define CKM_GOSTR3410_KEY_PAIR_GEN 0x00001200UL +#define CKM_GOSTR3410 0x00001201UL +#define CKM_GOSTR3410_WITH_GOSTR3411 0x00001202UL +#define CKM_GOSTR3410_KEY_WRAP 0x00001203UL +#define CKM_GOSTR3410_DERIVE 0x00001204UL +#define CKM_GOSTR3411 0x00001210UL +#define CKM_GOSTR3411_HMAC 0x00001211UL +#define CKM_GOST28147_KEY_GEN 0x00001220UL +#define CKM_GOST28147_ECB 0x00001221UL +#define CKM_GOST28147 0x00001222UL +#define CKM_GOST28147_MAC 0x00001223UL +#define CKM_GOST28147_KEY_WRAP 0x00001224UL +#define CKM_CHACHA20_KEY_GEN 0x00001225UL +#define CKM_CHACHA20 0x00001226UL +#define CKM_POLY1305_KEY_GEN 0x00001227UL +#define CKM_POLY1305 0x00001228UL +#define CKM_DSA_PARAMETER_GEN 0x00002000UL +#define CKM_DH_PKCS_PARAMETER_GEN 0x00002001UL +#define CKM_X9_42_DH_PARAMETER_GEN 0x00002002UL +#define CKM_DSA_PROBABILISTIC_PARAMETER_GEN 0x00002003UL +#define CKM_DSA_PROBABLISTIC_PARAMETER_GEN CKM_DSA_PROBABILISTIC_PARAMETER_GEN +#define CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN 0x00002004UL +#define CKM_DSA_FIPS_G_GEN 0x00002005UL + +#define CKM_AES_OFB 0x00002104UL +#define CKM_AES_CFB64 0x00002105UL +#define CKM_AES_CFB8 0x00002106UL +#define CKM_AES_CFB128 0x00002107UL + +#define CKM_AES_CFB1 0x00002108UL +#define CKM_AES_KEY_WRAP 0x00002109UL /* WAS: 0x00001090 */ +#define CKM_AES_KEY_WRAP_PAD 0x0000210AUL /* WAS: 0x00001091 */ +#define CKM_AES_KEY_WRAP_KWP 0x0000210BUL +#define CKM_AES_KEY_WRAP_PKCS7 0x0000210CUL + +#define CKM_RSA_PKCS_TPM_1_1 0x00004001UL +#define CKM_RSA_PKCS_OAEP_TPM_1_1 0x00004002UL + +#define CKM_SHA_1_KEY_GEN 0x00004003UL +#define CKM_SHA224_KEY_GEN 0x00004004UL +#define CKM_SHA256_KEY_GEN 0x00004005UL +#define CKM_SHA384_KEY_GEN 0x00004006UL +#define CKM_SHA512_KEY_GEN 0x00004007UL +#define CKM_SHA512_224_KEY_GEN 0x00004008UL +#define CKM_SHA512_256_KEY_GEN 0x00004009UL +#define CKM_SHA512_T_KEY_GEN 0x0000400aUL +#define CKM_NULL 0x0000400bUL +#define CKM_BLAKE2B_160 0x0000400cUL +#define CKM_BLAKE2B_160_HMAC 0x0000400dUL +#define CKM_BLAKE2B_160_HMAC_GENERAL 0x0000400eUL +#define CKM_BLAKE2B_160_KEY_DERIVE 0x0000400fUL +#define CKM_BLAKE2B_160_KEY_GEN 0x00004010UL +#define CKM_BLAKE2B_256 0x00004011UL +#define CKM_BLAKE2B_256_HMAC 0x00004012UL +#define CKM_BLAKE2B_256_HMAC_GENERAL 0x00004013UL +#define CKM_BLAKE2B_256_KEY_DERIVE 0x00004014UL +#define CKM_BLAKE2B_256_KEY_GEN 0x00004015UL +#define CKM_BLAKE2B_384 0x00004016UL +#define CKM_BLAKE2B_384_HMAC 0x00004017UL +#define CKM_BLAKE2B_384_HMAC_GENERAL 0x00004018UL +#define CKM_BLAKE2B_384_KEY_DERIVE 0x00004019UL +#define CKM_BLAKE2B_384_KEY_GEN 0x0000401aUL +#define CKM_BLAKE2B_512 0x0000401bUL +#define CKM_BLAKE2B_512_HMAC 0x0000401cUL +#define CKM_BLAKE2B_512_HMAC_GENERAL 0x0000401dUL +#define CKM_BLAKE2B_512_KEY_DERIVE 0x0000401eUL +#define CKM_BLAKE2B_512_KEY_GEN 0x0000401fUL +#define CKM_SALSA20 0x00004020UL +#define CKM_CHACHA20_POLY1305 0x00004021UL +#define CKM_SALSA20_POLY1305 0x00004022UL +#define CKM_X3DH_INITIALIZE 0x00004023UL +#define CKM_X3DH_RESPOND 0x00004024UL +#define CKM_X2RATCHET_INITIALIZE 0x00004025UL +#define CKM_X2RATCHET_RESPOND 0x00004026UL +#define CKM_X2RATCHET_ENCRYPT 0x00004027UL +#define CKM_X2RATCHET_DECRYPT 0x00004028UL +#define CKM_XEDDSA 0x00004029UL +#define CKM_HKDF_DERIVE 0x0000402aUL +#define CKM_HKDF_DATA 0x0000402bUL +#define CKM_HKDF_KEY_GEN 0x0000402cUL +#define CKM_SALSA20_KEY_GEN 0x0000402dUL + +#define CKM_ECDSA_SHA3_224 0x00001047UL +#define CKM_ECDSA_SHA3_256 0x00001048UL +#define CKM_ECDSA_SHA3_384 0x00001049UL +#define CKM_ECDSA_SHA3_512 0x0000104aUL +#define CKM_EC_EDWARDS_KEY_PAIR_GEN 0x00001055UL +#define CKM_EC_MONTGOMERY_KEY_PAIR_GEN 0x00001056UL +#define CKM_EDDSA 0x00001057UL +#define CKM_SP800_108_COUNTER_KDF 0x000003acUL +#define CKM_SP800_108_FEEDBACK_KDF 0x000003adUL +#define CKM_SP800_108_DOUBLE_PIPELINE_KDF 0x000003aeUL + +#define CKM_IKE2_PRF_PLUS_DERIVE 0x0000402eUL +#define CKM_IKE_PRF_DERIVE 0x0000402fUL +#define CKM_IKE1_PRF_DERIVE 0x00004030UL +#define CKM_IKE1_EXTENDED_DERIVE 0x00004031UL +#define CKM_HSS_KEY_PAIR_GEN 0x00004032UL +#define CKM_HSS 0x00004033UL + + +#define CKM_VENDOR_DEFINED 0x80000000UL + +typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR; + + +/* CK_MECHANISM is a structure that specifies a particular + * mechanism + */ +typedef struct CK_MECHANISM { + CK_MECHANISM_TYPE mechanism; + CK_VOID_PTR pParameter; + CK_ULONG ulParameterLen; /* in bytes */ +} CK_MECHANISM; + +typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR; + + +/* CK_MECHANISM_INFO provides information about a particular + * mechanism + */ +typedef struct CK_MECHANISM_INFO { + CK_ULONG ulMinKeySize; + CK_ULONG ulMaxKeySize; + CK_FLAGS flags; +} CK_MECHANISM_INFO; + +/* The flags are defined as follows: + * Bit Flag Mask Meaning */ +#define CKF_HW 0x00000001UL /* performed by HW */ + +/* Specify whether or not a mechanism can be used for a particular task */ +#define CKF_MESSAGE_ENCRYPT 0x00000002UL +#define CKF_MESSAGE_DECRYPT 0x00000004UL +#define CKF_MESSAGE_SIGN 0x00000008UL +#define CKF_MESSAGE_VERIFY 0x00000010UL +#define CKF_MULTI_MESSAGE 0x00000020UL +#define CKF_MULTI_MESSGE CKF_MULTI_MESSAGE +#define CKF_FIND_OBJECTS 0x00000040UL + +#define CKF_ENCRYPT 0x00000100UL +#define CKF_DECRYPT 0x00000200UL +#define CKF_DIGEST 0x00000400UL +#define CKF_SIGN 0x00000800UL +#define CKF_SIGN_RECOVER 0x00001000UL +#define CKF_VERIFY 0x00002000UL +#define CKF_VERIFY_RECOVER 0x00004000UL +#define CKF_GENERATE 0x00008000UL +#define CKF_GENERATE_KEY_PAIR 0x00010000UL +#define CKF_WRAP 0x00020000UL +#define CKF_UNWRAP 0x00040000UL +#define CKF_DERIVE 0x00080000UL + +/* Describe a token's EC capabilities not available in mechanism + * information. + */ +#define CKF_EC_F_P 0x00100000UL +#define CKF_EC_F_2M 0x00200000UL +#define CKF_EC_ECPARAMETERS 0x00400000UL +#define CKF_EC_OID 0x00800000UL +#define CKF_EC_NAMEDCURVE CKF_EC_OID /* deprecated since PKCS#11 3.00 */ +#define CKF_EC_UNCOMPRESS 0x01000000UL +#define CKF_EC_COMPRESS 0x02000000UL +#define CKF_EC_CURVENAME 0x04000000UL + +#define CKF_EXTENSION 0x80000000UL + +typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR; + +/* CK_RV is a value that identifies the return value of a + * Cryptoki function + */ +typedef CK_ULONG CK_RV; + +#define CKR_OK 0x00000000UL +#define CKR_CANCEL 0x00000001UL +#define CKR_HOST_MEMORY 0x00000002UL +#define CKR_SLOT_ID_INVALID 0x00000003UL + +#define CKR_GENERAL_ERROR 0x00000005UL +#define CKR_FUNCTION_FAILED 0x00000006UL + +#define CKR_ARGUMENTS_BAD 0x00000007UL +#define CKR_NO_EVENT 0x00000008UL +#define CKR_NEED_TO_CREATE_THREADS 0x00000009UL +#define CKR_CANT_LOCK 0x0000000AUL + +#define CKR_ATTRIBUTE_READ_ONLY 0x00000010UL +#define CKR_ATTRIBUTE_SENSITIVE 0x00000011UL +#define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012UL +#define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013UL + +#define CKR_ACTION_PROHIBITED 0x0000001BUL + +#define CKR_DATA_INVALID 0x00000020UL +#define CKR_DATA_LEN_RANGE 0x00000021UL +#define CKR_DEVICE_ERROR 0x00000030UL +#define CKR_DEVICE_MEMORY 0x00000031UL +#define CKR_DEVICE_REMOVED 0x00000032UL +#define CKR_ENCRYPTED_DATA_INVALID 0x00000040UL +#define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041UL +#define CKR_AEAD_DECRYPT_FAILED 0x00000042UL +#define CKR_FUNCTION_CANCELED 0x00000050UL +#define CKR_FUNCTION_NOT_PARALLEL 0x00000051UL + +#define CKR_FUNCTION_NOT_SUPPORTED 0x00000054UL + +#define CKR_KEY_HANDLE_INVALID 0x00000060UL + +#define CKR_KEY_SIZE_RANGE 0x00000062UL +#define CKR_KEY_TYPE_INCONSISTENT 0x00000063UL + +#define CKR_KEY_NOT_NEEDED 0x00000064UL +#define CKR_KEY_CHANGED 0x00000065UL +#define CKR_KEY_NEEDED 0x00000066UL +#define CKR_KEY_INDIGESTIBLE 0x00000067UL +#define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068UL +#define CKR_KEY_NOT_WRAPPABLE 0x00000069UL +#define CKR_KEY_UNEXTRACTABLE 0x0000006AUL + +#define CKR_MECHANISM_INVALID 0x00000070UL +#define CKR_MECHANISM_PARAM_INVALID 0x00000071UL + +#define CKR_OBJECT_HANDLE_INVALID 0x00000082UL +#define CKR_OPERATION_ACTIVE 0x00000090UL +#define CKR_OPERATION_NOT_INITIALIZED 0x00000091UL +#define CKR_PIN_INCORRECT 0x000000A0UL +#define CKR_PIN_INVALID 0x000000A1UL +#define CKR_PIN_LEN_RANGE 0x000000A2UL + +#define CKR_PIN_EXPIRED 0x000000A3UL +#define CKR_PIN_LOCKED 0x000000A4UL + +#define CKR_SESSION_CLOSED 0x000000B0UL +#define CKR_SESSION_COUNT 0x000000B1UL +#define CKR_SESSION_HANDLE_INVALID 0x000000B3UL +#define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4UL +#define CKR_SESSION_READ_ONLY 0x000000B5UL +#define CKR_SESSION_EXISTS 0x000000B6UL + +#define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7UL +#define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8UL + +#define CKR_SIGNATURE_INVALID 0x000000C0UL +#define CKR_SIGNATURE_LEN_RANGE 0x000000C1UL +#define CKR_TEMPLATE_INCOMPLETE 0x000000D0UL +#define CKR_TEMPLATE_INCONSISTENT 0x000000D1UL +#define CKR_TOKEN_NOT_PRESENT 0x000000E0UL +#define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1UL +#define CKR_TOKEN_WRITE_PROTECTED 0x000000E2UL +#define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0UL +#define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1UL +#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2UL +#define CKR_USER_ALREADY_LOGGED_IN 0x00000100UL +#define CKR_USER_NOT_LOGGED_IN 0x00000101UL +#define CKR_USER_PIN_NOT_INITIALIZED 0x00000102UL +#define CKR_USER_TYPE_INVALID 0x00000103UL + +#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104UL +#define CKR_USER_TOO_MANY_TYPES 0x00000105UL + +#define CKR_WRAPPED_KEY_INVALID 0x00000110UL +#define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112UL +#define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113UL +#define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114UL +#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115UL +#define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120UL + +#define CKR_RANDOM_NO_RNG 0x00000121UL + +#define CKR_DOMAIN_PARAMS_INVALID 0x00000130UL + +#define CKR_CURVE_NOT_SUPPORTED 0x00000140UL + +#define CKR_BUFFER_TOO_SMALL 0x00000150UL +#define CKR_SAVED_STATE_INVALID 0x00000160UL +#define CKR_INFORMATION_SENSITIVE 0x00000170UL +#define CKR_STATE_UNSAVEABLE 0x00000180UL + +#define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190UL +#define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191UL +#define CKR_MUTEX_BAD 0x000001A0UL +#define CKR_MUTEX_NOT_LOCKED 0x000001A1UL + +#define CKR_NEW_PIN_MODE 0x000001B0UL +#define CKR_NEXT_OTP 0x000001B1UL + +#define CKR_EXCEEDED_MAX_ITERATIONS 0x000001B5UL +#define CKR_FIPS_SELF_TEST_FAILED 0x000001B6UL +#define CKR_LIBRARY_LOAD_FAILED 0x000001B7UL +#define CKR_PIN_TOO_WEAK 0x000001B8UL +#define CKR_PUBLIC_KEY_INVALID 0x000001B9UL + +#define CKR_FUNCTION_REJECTED 0x00000200UL +#define CKR_TOKEN_RESOURCE_EXCEEDED 0x00000201UL +#define CKR_OPERATION_CANCEL_FAILED 0x00000202UL +#define CKR_KEY_EXHAUSTED 0x00000203UL + +#define CKR_VENDOR_DEFINED 0x80000000UL + + +/* CK_NOTIFY is an application callback that processes events */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_NOTIFICATION event, + CK_VOID_PTR pApplication /* passed to C_OpenSession */ +); + + +/* CK_FUNCTION_LIST is a structure holding a Cryptoki spec + * version and pointers of appropriate types to all the + * Cryptoki functions + */ +typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST; +typedef struct CK_FUNCTION_LIST_3_0 CK_FUNCTION_LIST_3_0; + +typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR; +typedef CK_FUNCTION_LIST_3_0 CK_PTR CK_FUNCTION_LIST_3_0_PTR; + +typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR; +typedef CK_FUNCTION_LIST_3_0_PTR CK_PTR CK_FUNCTION_LIST_3_0_PTR_PTR; + +typedef struct CK_INTERFACE { + CK_CHAR *pInterfaceName; + CK_VOID_PTR pFunctionList; + CK_FLAGS flags; +} CK_INTERFACE; + +typedef CK_INTERFACE CK_PTR CK_INTERFACE_PTR; +typedef CK_INTERFACE_PTR CK_PTR CK_INTERFACE_PTR_PTR; + +#define CKF_END_OF_MESSAGE 0x00000001UL + + +/* CK_CREATEMUTEX is an application callback for creating a + * mutex object + */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)( + CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */ +); + + +/* CK_DESTROYMUTEX is an application callback for destroying a + * mutex object + */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)( + CK_VOID_PTR pMutex /* pointer to mutex */ +); + + +/* CK_LOCKMUTEX is an application callback for locking a mutex */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)( + CK_VOID_PTR pMutex /* pointer to mutex */ +); + + +/* CK_UNLOCKMUTEX is an application callback for unlocking a + * mutex + */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)( + CK_VOID_PTR pMutex /* pointer to mutex */ +); + +/* Get functionlist flags */ +#define CKF_INTERFACE_FORK_SAFE 0x00000001UL + +/* CK_C_INITIALIZE_ARGS provides the optional arguments to + * C_Initialize + */ +typedef struct CK_C_INITIALIZE_ARGS { + CK_CREATEMUTEX CreateMutex; + CK_DESTROYMUTEX DestroyMutex; + CK_LOCKMUTEX LockMutex; + CK_UNLOCKMUTEX UnlockMutex; + CK_FLAGS flags; + CK_VOID_PTR pReserved; +} CK_C_INITIALIZE_ARGS; + +/* flags: bit flags that provide capabilities of the slot + * Bit Flag Mask Meaning + */ +#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001UL +#define CKF_OS_LOCKING_OK 0x00000002UL + +typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR; + + + +/* additional flags for parameters to functions */ + +/* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */ +#define CKF_DONT_BLOCK 1 + +/* CK_RSA_PKCS_MGF_TYPE is used to indicate the Message + * Generation Function (MGF) applied to a message block when + * formatting a message block for the PKCS #1 OAEP encryption + * scheme. + */ +typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE; + +typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR; + +/* The following MGFs are defined */ +#define CKG_MGF1_SHA1 0x00000001UL +#define CKG_MGF1_SHA256 0x00000002UL +#define CKG_MGF1_SHA384 0x00000003UL +#define CKG_MGF1_SHA512 0x00000004UL +#define CKG_MGF1_SHA224 0x00000005UL +#define CKG_MGF1_SHA3_224 0x00000006UL +#define CKG_MGF1_SHA3_256 0x00000007UL +#define CKG_MGF1_SHA3_384 0x00000008UL +#define CKG_MGF1_SHA3_512 0x00000009UL + + +/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source + * of the encoding parameter when formatting a message block + * for the PKCS #1 OAEP encryption scheme. + */ +typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE; + +typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR; + +/* The following encoding parameter sources are defined */ +#define CKZ_DATA_SPECIFIED 0x00000001UL + +/* CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the + * CKM_RSA_PKCS_OAEP mechanism. + */ +typedef struct CK_RSA_PKCS_OAEP_PARAMS { + CK_MECHANISM_TYPE hashAlg; + CK_RSA_PKCS_MGF_TYPE mgf; + CK_RSA_PKCS_OAEP_SOURCE_TYPE source; + CK_VOID_PTR pSourceData; + CK_ULONG ulSourceDataLen; +} CK_RSA_PKCS_OAEP_PARAMS; + +typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR; + +/* CK_RSA_PKCS_PSS_PARAMS provides the parameters to the + * CKM_RSA_PKCS_PSS mechanism(s). + */ +typedef struct CK_RSA_PKCS_PSS_PARAMS { + CK_MECHANISM_TYPE hashAlg; + CK_RSA_PKCS_MGF_TYPE mgf; + CK_ULONG sLen; +} CK_RSA_PKCS_PSS_PARAMS; + +typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR; + +typedef CK_ULONG CK_EC_KDF_TYPE; +typedef CK_EC_KDF_TYPE CK_PTR CK_EC_KDF_TYPE_PTR; + +/* The following EC Key Derivation Functions are defined */ +#define CKD_NULL 0x00000001UL +#define CKD_SHA1_KDF 0x00000002UL + +/* The following X9.42 DH key derivation functions are defined */ +#define CKD_SHA1_KDF_ASN1 0x00000003UL +#define CKD_SHA1_KDF_CONCATENATE 0x00000004UL +#define CKD_SHA224_KDF 0x00000005UL +#define CKD_SHA256_KDF 0x00000006UL +#define CKD_SHA384_KDF 0x00000007UL +#define CKD_SHA512_KDF 0x00000008UL +#define CKD_CPDIVERSIFY_KDF 0x00000009UL +#define CKD_SHA3_224_KDF 0x0000000AUL +#define CKD_SHA3_256_KDF 0x0000000BUL +#define CKD_SHA3_384_KDF 0x0000000CUL +#define CKD_SHA3_512_KDF 0x0000000DUL +#define CKD_SHA1_KDF_SP800 0x0000000EUL +#define CKD_SHA224_KDF_SP800 0x0000000FUL +#define CKD_SHA256_KDF_SP800 0x00000010UL +#define CKD_SHA384_KDF_SP800 0x00000011UL +#define CKD_SHA512_KDF_SP800 0x00000012UL +#define CKD_SHA3_224_KDF_SP800 0x00000013UL +#define CKD_SHA3_256_KDF_SP800 0x00000014UL +#define CKD_SHA3_384_KDF_SP800 0x00000015UL +#define CKD_SHA3_512_KDF_SP800 0x00000016UL +#define CKD_BLAKE2B_160_KDF 0x00000017UL +#define CKD_BLAKE2B_256_KDF 0x00000018UL +#define CKD_BLAKE2B_384_KDF 0x00000019UL +#define CKD_BLAKE2B_512_KDF 0x0000001aUL + +/* CK_ECDH1_DERIVE_PARAMS provides the parameters to the + * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms, + * where each party contributes one key pair. + */ +typedef struct CK_ECDH1_DERIVE_PARAMS { + CK_EC_KDF_TYPE kdf; + CK_ULONG ulSharedDataLen; + CK_BYTE_PTR pSharedData; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; +} CK_ECDH1_DERIVE_PARAMS; + +typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR; + +/* + * CK_ECDH2_DERIVE_PARAMS provides the parameters to the + * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. + */ +typedef struct CK_ECDH2_DERIVE_PARAMS { + CK_EC_KDF_TYPE kdf; + CK_ULONG ulSharedDataLen; + CK_BYTE_PTR pSharedData; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPrivateDataLen; + CK_OBJECT_HANDLE hPrivateData; + CK_ULONG ulPublicDataLen2; + CK_BYTE_PTR pPublicData2; +} CK_ECDH2_DERIVE_PARAMS; + +typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR; + +typedef struct CK_ECMQV_DERIVE_PARAMS { + CK_EC_KDF_TYPE kdf; + CK_ULONG ulSharedDataLen; + CK_BYTE_PTR pSharedData; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPrivateDataLen; + CK_OBJECT_HANDLE hPrivateData; + CK_ULONG ulPublicDataLen2; + CK_BYTE_PTR pPublicData2; + CK_OBJECT_HANDLE publicKey; +} CK_ECMQV_DERIVE_PARAMS; + +typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR; + +/* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the + * CKM_X9_42_DH_PARAMETER_GEN mechanisms + */ +typedef CK_ULONG CK_X9_42_DH_KDF_TYPE; +typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR; + +/* CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the + * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party + * contributes one key pair + */ +typedef struct CK_X9_42_DH1_DERIVE_PARAMS { + CK_X9_42_DH_KDF_TYPE kdf; + CK_ULONG ulOtherInfoLen; + CK_BYTE_PTR pOtherInfo; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; +} CK_X9_42_DH1_DERIVE_PARAMS; + +typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR; + +/* CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the + * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation + * mechanisms, where each party contributes two key pairs + */ +typedef struct CK_X9_42_DH2_DERIVE_PARAMS { + CK_X9_42_DH_KDF_TYPE kdf; + CK_ULONG ulOtherInfoLen; + CK_BYTE_PTR pOtherInfo; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPrivateDataLen; + CK_OBJECT_HANDLE hPrivateData; + CK_ULONG ulPublicDataLen2; + CK_BYTE_PTR pPublicData2; +} CK_X9_42_DH2_DERIVE_PARAMS; + +typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR; + +typedef struct CK_X9_42_MQV_DERIVE_PARAMS { + CK_X9_42_DH_KDF_TYPE kdf; + CK_ULONG ulOtherInfoLen; + CK_BYTE_PTR pOtherInfo; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPrivateDataLen; + CK_OBJECT_HANDLE hPrivateData; + CK_ULONG ulPublicDataLen2; + CK_BYTE_PTR pPublicData2; + CK_OBJECT_HANDLE publicKey; +} CK_X9_42_MQV_DERIVE_PARAMS; + +typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR; + +/* CK_KEA_DERIVE_PARAMS provides the parameters to the + * CKM_KEA_DERIVE mechanism + */ +typedef struct CK_KEA_DERIVE_PARAMS { + CK_BBOOL isSender; + CK_ULONG ulRandomLen; + CK_BYTE_PTR pRandomA; + CK_BYTE_PTR pRandomB; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; +} CK_KEA_DERIVE_PARAMS; + +typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR; + + +/* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and + * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just + * holds the effective keysize + */ +typedef CK_ULONG CK_RC2_PARAMS; + +typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR; + + +/* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC + * mechanism + */ +typedef struct CK_RC2_CBC_PARAMS { + CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ + CK_BYTE iv[8]; /* IV for CBC mode */ +} CK_RC2_CBC_PARAMS; + +typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR; + + +/* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the + * CKM_RC2_MAC_GENERAL mechanism + */ +typedef struct CK_RC2_MAC_GENERAL_PARAMS { + CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ + CK_ULONG ulMacLength; /* Length of MAC in bytes */ +} CK_RC2_MAC_GENERAL_PARAMS; + +typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \ + CK_RC2_MAC_GENERAL_PARAMS_PTR; + + +/* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and + * CKM_RC5_MAC mechanisms + */ +typedef struct CK_RC5_PARAMS { + CK_ULONG ulWordsize; /* wordsize in bits */ + CK_ULONG ulRounds; /* number of rounds */ +} CK_RC5_PARAMS; + +typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR; + + +/* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC + * mechanism + */ +typedef struct CK_RC5_CBC_PARAMS { + CK_ULONG ulWordsize; /* wordsize in bits */ + CK_ULONG ulRounds; /* number of rounds */ + CK_BYTE_PTR pIv; /* pointer to IV */ + CK_ULONG ulIvLen; /* length of IV in bytes */ +} CK_RC5_CBC_PARAMS; + +typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR; + + +/* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the + * CKM_RC5_MAC_GENERAL mechanism + */ +typedef struct CK_RC5_MAC_GENERAL_PARAMS { + CK_ULONG ulWordsize; /* wordsize in bits */ + CK_ULONG ulRounds; /* number of rounds */ + CK_ULONG ulMacLength; /* Length of MAC in bytes */ +} CK_RC5_MAC_GENERAL_PARAMS; + +typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \ + CK_RC5_MAC_GENERAL_PARAMS_PTR; + +/* CK_MAC_GENERAL_PARAMS provides the parameters to most block + * ciphers' MAC_GENERAL mechanisms. Its value is the length of + * the MAC + */ +typedef CK_ULONG CK_MAC_GENERAL_PARAMS; + +typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR; + +typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[8]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_DES_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR; + +typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_AES_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR; + +/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the + * CKM_SKIPJACK_PRIVATE_WRAP mechanism + */ +typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS { + CK_ULONG ulPasswordLen; + CK_BYTE_PTR pPassword; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPAndGLen; + CK_ULONG ulQLen; + CK_ULONG ulRandomLen; + CK_BYTE_PTR pRandomA; + CK_BYTE_PTR pPrimeP; + CK_BYTE_PTR pBaseG; + CK_BYTE_PTR pSubprimeQ; +} CK_SKIPJACK_PRIVATE_WRAP_PARAMS; + +typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \ + CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR; + + +/* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the + * CKM_SKIPJACK_RELAYX mechanism + */ +typedef struct CK_SKIPJACK_RELAYX_PARAMS { + CK_ULONG ulOldWrappedXLen; + CK_BYTE_PTR pOldWrappedX; + CK_ULONG ulOldPasswordLen; + CK_BYTE_PTR pOldPassword; + CK_ULONG ulOldPublicDataLen; + CK_BYTE_PTR pOldPublicData; + CK_ULONG ulOldRandomLen; + CK_BYTE_PTR pOldRandomA; + CK_ULONG ulNewPasswordLen; + CK_BYTE_PTR pNewPassword; + CK_ULONG ulNewPublicDataLen; + CK_BYTE_PTR pNewPublicData; + CK_ULONG ulNewRandomLen; + CK_BYTE_PTR pNewRandomA; +} CK_SKIPJACK_RELAYX_PARAMS; + +typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \ + CK_SKIPJACK_RELAYX_PARAMS_PTR; + + +typedef struct CK_PBE_PARAMS { + CK_BYTE_PTR pInitVector; + CK_UTF8CHAR_PTR pPassword; + CK_ULONG ulPasswordLen; + CK_BYTE_PTR pSalt; + CK_ULONG ulSaltLen; + CK_ULONG ulIteration; +} CK_PBE_PARAMS; + +typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR; + + +/* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the + * CKM_KEY_WRAP_SET_OAEP mechanism + */ +typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS { + CK_BYTE bBC; /* block contents byte */ + CK_BYTE_PTR pX; /* extra data */ + CK_ULONG ulXLen; /* length of extra data in bytes */ +} CK_KEY_WRAP_SET_OAEP_PARAMS; + +typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR CK_KEY_WRAP_SET_OAEP_PARAMS_PTR; + +typedef struct CK_SSL3_RANDOM_DATA { + CK_BYTE_PTR pClientRandom; + CK_ULONG ulClientRandomLen; + CK_BYTE_PTR pServerRandom; + CK_ULONG ulServerRandomLen; +} CK_SSL3_RANDOM_DATA; + + +typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS { + CK_SSL3_RANDOM_DATA RandomInfo; + CK_VERSION_PTR pVersion; +} CK_SSL3_MASTER_KEY_DERIVE_PARAMS; + +typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \ + CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR; + +typedef struct CK_SSL3_KEY_MAT_OUT { + CK_OBJECT_HANDLE hClientMacSecret; + CK_OBJECT_HANDLE hServerMacSecret; + CK_OBJECT_HANDLE hClientKey; + CK_OBJECT_HANDLE hServerKey; + CK_BYTE_PTR pIVClient; + CK_BYTE_PTR pIVServer; +} CK_SSL3_KEY_MAT_OUT; + +typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR; + + +typedef struct CK_SSL3_KEY_MAT_PARAMS { + CK_ULONG ulMacSizeInBits; + CK_ULONG ulKeySizeInBits; + CK_ULONG ulIVSizeInBits; + CK_BBOOL bIsExport; + CK_SSL3_RANDOM_DATA RandomInfo; + CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial; +} CK_SSL3_KEY_MAT_PARAMS; + +typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR; + +typedef struct CK_TLS_PRF_PARAMS { + CK_BYTE_PTR pSeed; + CK_ULONG ulSeedLen; + CK_BYTE_PTR pLabel; + CK_ULONG ulLabelLen; + CK_BYTE_PTR pOutput; + CK_ULONG_PTR pulOutputLen; +} CK_TLS_PRF_PARAMS; + +typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR; + +typedef struct CK_WTLS_RANDOM_DATA { + CK_BYTE_PTR pClientRandom; + CK_ULONG ulClientRandomLen; + CK_BYTE_PTR pServerRandom; + CK_ULONG ulServerRandomLen; +} CK_WTLS_RANDOM_DATA; + +typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR; + +typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS { + CK_MECHANISM_TYPE DigestMechanism; + CK_WTLS_RANDOM_DATA RandomInfo; + CK_BYTE_PTR pVersion; +} CK_WTLS_MASTER_KEY_DERIVE_PARAMS; + +typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \ + CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR; + +typedef struct CK_WTLS_PRF_PARAMS { + CK_MECHANISM_TYPE DigestMechanism; + CK_BYTE_PTR pSeed; + CK_ULONG ulSeedLen; + CK_BYTE_PTR pLabel; + CK_ULONG ulLabelLen; + CK_BYTE_PTR pOutput; + CK_ULONG_PTR pulOutputLen; +} CK_WTLS_PRF_PARAMS; + +typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR; + +typedef struct CK_WTLS_KEY_MAT_OUT { + CK_OBJECT_HANDLE hMacSecret; + CK_OBJECT_HANDLE hKey; + CK_BYTE_PTR pIV; +} CK_WTLS_KEY_MAT_OUT; + +typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR; + +typedef struct CK_WTLS_KEY_MAT_PARAMS { + CK_MECHANISM_TYPE DigestMechanism; + CK_ULONG ulMacSizeInBits; + CK_ULONG ulKeySizeInBits; + CK_ULONG ulIVSizeInBits; + CK_ULONG ulSequenceNumber; + CK_BBOOL bIsExport; + CK_WTLS_RANDOM_DATA RandomInfo; + CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial; +} CK_WTLS_KEY_MAT_PARAMS; + +typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR; + +typedef struct CK_CMS_SIG_PARAMS { + CK_OBJECT_HANDLE certificateHandle; + CK_MECHANISM_PTR pSigningMechanism; + CK_MECHANISM_PTR pDigestMechanism; + CK_UTF8CHAR_PTR pContentType; + CK_BYTE_PTR pRequestedAttributes; + CK_ULONG ulRequestedAttributesLen; + CK_BYTE_PTR pRequiredAttributes; + CK_ULONG ulRequiredAttributesLen; +} CK_CMS_SIG_PARAMS; + +typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR; + +typedef struct CK_KEY_DERIVATION_STRING_DATA { + CK_BYTE_PTR pData; + CK_ULONG ulLen; +} CK_KEY_DERIVATION_STRING_DATA; + +typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \ + CK_KEY_DERIVATION_STRING_DATA_PTR; + + +/* The CK_EXTRACT_PARAMS is used for the + * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit + * of the base key should be used as the first bit of the + * derived key + */ +typedef CK_ULONG CK_EXTRACT_PARAMS; + +typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR; + +/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to + * indicate the Pseudo-Random Function (PRF) used to generate + * key bits using PKCS #5 PBKDF2. + */ +typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; + +typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR \ + CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR; + +#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001UL +#define CKP_PKCS5_PBKD2_HMAC_GOSTR3411 0x00000002UL +#define CKP_PKCS5_PBKD2_HMAC_SHA224 0x00000003UL +#define CKP_PKCS5_PBKD2_HMAC_SHA256 0x00000004UL +#define CKP_PKCS5_PBKD2_HMAC_SHA384 0x00000005UL +#define CKP_PKCS5_PBKD2_HMAC_SHA512 0x00000006UL +#define CKP_PKCS5_PBKD2_HMAC_SHA512_224 0x00000007UL +#define CKP_PKCS5_PBKD2_HMAC_SHA512_256 0x00000008UL + +/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the + * source of the salt value when deriving a key using PKCS #5 + * PBKDF2. + */ +typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; + +typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR \ + CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR; + +/* The following salt value sources are defined in PKCS #5 v2.0. */ +#define CKZ_SALT_SPECIFIED 0x00000001UL + +/* CK_PKCS5_PBKD2_PARAMS is a structure that provides the + * parameters to the CKM_PKCS5_PBKD2 mechanism. + */ +typedef struct CK_PKCS5_PBKD2_PARAMS { + CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource; + CK_VOID_PTR pSaltSourceData; + CK_ULONG ulSaltSourceDataLen; + CK_ULONG iterations; + CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf; + CK_VOID_PTR pPrfData; + CK_ULONG ulPrfDataLen; + CK_UTF8CHAR_PTR pPassword; + CK_ULONG_PTR ulPasswordLen; +} CK_PKCS5_PBKD2_PARAMS; + +typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR; + +/* CK_PKCS5_PBKD2_PARAMS2 is a corrected version of the CK_PKCS5_PBKD2_PARAMS + * structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism + * noting that the ulPasswordLen field is a CK_ULONG and not a CK_ULONG_PTR. + */ +typedef struct CK_PKCS5_PBKD2_PARAMS2 { + CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource; + CK_VOID_PTR pSaltSourceData; + CK_ULONG ulSaltSourceDataLen; + CK_ULONG iterations; + CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf; + CK_VOID_PTR pPrfData; + CK_ULONG ulPrfDataLen; + CK_UTF8CHAR_PTR pPassword; + CK_ULONG ulPasswordLen; +} CK_PKCS5_PBKD2_PARAMS2; + +typedef CK_PKCS5_PBKD2_PARAMS2 CK_PTR CK_PKCS5_PBKD2_PARAMS2_PTR; + +typedef CK_ULONG CK_OTP_PARAM_TYPE; +typedef CK_OTP_PARAM_TYPE CK_PARAM_TYPE; /* backward compatibility */ + +typedef struct CK_OTP_PARAM { + CK_OTP_PARAM_TYPE type; + CK_VOID_PTR pValue; + CK_ULONG ulValueLen; +} CK_OTP_PARAM; + +typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR; + +typedef struct CK_OTP_PARAMS { + CK_OTP_PARAM_PTR pParams; + CK_ULONG ulCount; +} CK_OTP_PARAMS; + +typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR; + +typedef struct CK_OTP_SIGNATURE_INFO { + CK_OTP_PARAM_PTR pParams; + CK_ULONG ulCount; +} CK_OTP_SIGNATURE_INFO; + +typedef CK_OTP_SIGNATURE_INFO CK_PTR CK_OTP_SIGNATURE_INFO_PTR; + +#define CK_OTP_VALUE 0UL +#define CK_OTP_PIN 1UL +#define CK_OTP_CHALLENGE 2UL +#define CK_OTP_TIME 3UL +#define CK_OTP_COUNTER 4UL +#define CK_OTP_FLAGS 5UL +#define CK_OTP_OUTPUT_LENGTH 6UL +#define CK_OTP_OUTPUT_FORMAT 7UL + +#define CKF_NEXT_OTP 0x00000001UL +#define CKF_EXCLUDE_TIME 0x00000002UL +#define CKF_EXCLUDE_COUNTER 0x00000004UL +#define CKF_EXCLUDE_CHALLENGE 0x00000008UL +#define CKF_EXCLUDE_PIN 0x00000010UL +#define CKF_USER_FRIENDLY_OTP 0x00000020UL + +typedef struct CK_KIP_PARAMS { + CK_MECHANISM_PTR pMechanism; + CK_OBJECT_HANDLE hKey; + CK_BYTE_PTR pSeed; + CK_ULONG ulSeedLen; +} CK_KIP_PARAMS; + +typedef CK_KIP_PARAMS CK_PTR CK_KIP_PARAMS_PTR; + +typedef struct CK_AES_CTR_PARAMS { + CK_ULONG ulCounterBits; + CK_BYTE cb[16]; +} CK_AES_CTR_PARAMS; + +typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR; + +typedef struct CK_GCM_PARAMS { + CK_BYTE_PTR pIv; + CK_ULONG ulIvLen; + CK_ULONG ulIvBits; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulTagBits; +} CK_GCM_PARAMS; + +typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR; + +typedef CK_ULONG CK_GENERATOR_FUNCTION; +#define CKG_NO_GENERATE 0x00000000UL +#define CKG_GENERATE 0x00000001UL +#define CKG_GENERATE_COUNTER 0x00000002UL +#define CKG_GENERATE_RANDOM 0x00000003UL +#define CKG_GENERATE_COUNTER_XOR 0x00000004UL + +typedef struct CK_GCM_MESSAGE_PARAMS { + CK_BYTE_PTR pIv; + CK_ULONG ulIvLen; + CK_ULONG ulIvFixedBits; + CK_GENERATOR_FUNCTION ivGenerator; + CK_BYTE_PTR pTag; + CK_ULONG ulTagBits; +} CK_GCM_MESSAGE_PARAMS; + +typedef CK_GCM_MESSAGE_PARAMS CK_PTR CK_GCM_MESSAGE_PARAMS_PTR; + +typedef struct CK_CCM_PARAMS { + CK_ULONG ulDataLen; + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceLen; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulMACLen; +} CK_CCM_PARAMS; + +typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR; + +typedef struct CK_CCM_MESSAGE_PARAMS { + CK_ULONG ulDataLen; /*plaintext or ciphertext*/ + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceLen; + CK_ULONG ulNonceFixedBits; + CK_GENERATOR_FUNCTION nonceGenerator; + CK_BYTE_PTR pMAC; + CK_ULONG ulMACLen; +} CK_CCM_MESSAGE_PARAMS; + +typedef CK_CCM_MESSAGE_PARAMS CK_PTR CK_CCM_MESSAGE_PARAMS_PTR; + +/* Deprecated. Use CK_GCM_PARAMS */ +typedef struct CK_AES_GCM_PARAMS { + CK_BYTE_PTR pIv; + CK_ULONG ulIvLen; + CK_ULONG ulIvBits; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulTagBits; +} CK_AES_GCM_PARAMS; + +typedef CK_AES_GCM_PARAMS CK_PTR CK_AES_GCM_PARAMS_PTR; + +/* Deprecated. Use CK_CCM_PARAMS */ +typedef struct CK_AES_CCM_PARAMS { + CK_ULONG ulDataLen; + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceLen; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; + CK_ULONG ulMACLen; +} CK_AES_CCM_PARAMS; + +typedef CK_AES_CCM_PARAMS CK_PTR CK_AES_CCM_PARAMS_PTR; + +typedef struct CK_CAMELLIA_CTR_PARAMS { + CK_ULONG ulCounterBits; + CK_BYTE cb[16]; +} CK_CAMELLIA_CTR_PARAMS; + +typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR; + +typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \ + CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR; + +typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_ARIA_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \ + CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR; + +typedef struct CK_DSA_PARAMETER_GEN_PARAM { + CK_MECHANISM_TYPE hash; + CK_BYTE_PTR pSeed; + CK_ULONG ulSeedLen; + CK_ULONG ulIndex; +} CK_DSA_PARAMETER_GEN_PARAM; + +typedef CK_DSA_PARAMETER_GEN_PARAM CK_PTR CK_DSA_PARAMETER_GEN_PARAM_PTR; + +typedef struct CK_ECDH_AES_KEY_WRAP_PARAMS { + CK_ULONG ulAESKeyBits; + CK_EC_KDF_TYPE kdf; + CK_ULONG ulSharedDataLen; + CK_BYTE_PTR pSharedData; +} CK_ECDH_AES_KEY_WRAP_PARAMS; + +typedef CK_ECDH_AES_KEY_WRAP_PARAMS CK_PTR CK_ECDH_AES_KEY_WRAP_PARAMS_PTR; + +typedef CK_ULONG CK_JAVA_MIDP_SECURITY_DOMAIN; + +typedef CK_ULONG CK_CERTIFICATE_CATEGORY; + +typedef struct CK_RSA_AES_KEY_WRAP_PARAMS { + CK_ULONG ulAESKeyBits; + CK_RSA_PKCS_OAEP_PARAMS_PTR pOAEPParams; +} CK_RSA_AES_KEY_WRAP_PARAMS; + +typedef CK_RSA_AES_KEY_WRAP_PARAMS CK_PTR CK_RSA_AES_KEY_WRAP_PARAMS_PTR; + +typedef struct CK_TLS12_MASTER_KEY_DERIVE_PARAMS { + CK_SSL3_RANDOM_DATA RandomInfo; + CK_VERSION_PTR pVersion; + CK_MECHANISM_TYPE prfHashMechanism; +} CK_TLS12_MASTER_KEY_DERIVE_PARAMS; + +typedef CK_TLS12_MASTER_KEY_DERIVE_PARAMS CK_PTR \ + CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR; + +typedef struct CK_TLS12_KEY_MAT_PARAMS { + CK_ULONG ulMacSizeInBits; + CK_ULONG ulKeySizeInBits; + CK_ULONG ulIVSizeInBits; + CK_BBOOL bIsExport; + CK_SSL3_RANDOM_DATA RandomInfo; + CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial; + CK_MECHANISM_TYPE prfHashMechanism; +} CK_TLS12_KEY_MAT_PARAMS; + +typedef CK_TLS12_KEY_MAT_PARAMS CK_PTR CK_TLS12_KEY_MAT_PARAMS_PTR; + +typedef struct CK_TLS_KDF_PARAMS { + CK_MECHANISM_TYPE prfMechanism; + CK_BYTE_PTR pLabel; + CK_ULONG ulLabelLength; + CK_SSL3_RANDOM_DATA RandomInfo; + CK_BYTE_PTR pContextData; + CK_ULONG ulContextDataLength; +} CK_TLS_KDF_PARAMS; + +typedef CK_TLS_KDF_PARAMS CK_PTR CK_TLS_KDF_PARAMS_PTR; + +typedef struct CK_TLS_MAC_PARAMS { + CK_MECHANISM_TYPE prfHashMechanism; + CK_ULONG ulMacLength; + CK_ULONG ulServerOrClient; +} CK_TLS_MAC_PARAMS; + +typedef CK_TLS_MAC_PARAMS CK_PTR CK_TLS_MAC_PARAMS_PTR; + +typedef struct CK_GOSTR3410_DERIVE_PARAMS { + CK_EC_KDF_TYPE kdf; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pUKM; + CK_ULONG ulUKMLen; +} CK_GOSTR3410_DERIVE_PARAMS; + +typedef CK_GOSTR3410_DERIVE_PARAMS CK_PTR CK_GOSTR3410_DERIVE_PARAMS_PTR; + +typedef struct CK_GOSTR3410_KEY_WRAP_PARAMS { + CK_BYTE_PTR pWrapOID; + CK_ULONG ulWrapOIDLen; + CK_BYTE_PTR pUKM; + CK_ULONG ulUKMLen; + CK_OBJECT_HANDLE hKey; +} CK_GOSTR3410_KEY_WRAP_PARAMS; + +typedef CK_GOSTR3410_KEY_WRAP_PARAMS CK_PTR CK_GOSTR3410_KEY_WRAP_PARAMS_PTR; + +typedef struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS { + CK_BYTE iv[16]; + CK_BYTE_PTR pData; + CK_ULONG length; +} CK_SEED_CBC_ENCRYPT_DATA_PARAMS; + +typedef CK_SEED_CBC_ENCRYPT_DATA_PARAMS CK_PTR \ + CK_SEED_CBC_ENCRYPT_DATA_PARAMS_PTR; + +/* + * New PKCS 11 v3.0 data structures. + */ + +typedef CK_ULONG CK_PROFILE_ID; +typedef CK_PROFILE_ID CK_PTR CK_PROFILE_ID_PTR; + +/* Typedefs for Flexible KDF */ +typedef CK_ULONG CK_PRF_DATA_TYPE; +typedef CK_MECHANISM_TYPE CK_SP800_108_PRF_TYPE; +#define CK_SP800_108_ITERATION_VARIABLE 0x00000001UL +#define CK_SP800_108_OPTIONAL_COUNTER 0x00000002UL +#define CK_SP800_108_DKM_LENGTH 0x00000003UL +#define CK_SP800_108_BYTE_ARRAY 0x00000004UL +#define CK_SP800_108_COUNTER CK_SP800_108_OPTIONAL_COUNTER + +typedef struct CK_PRF_DATA_PARAM +{ + CK_PRF_DATA_TYPE type; + CK_VOID_PTR pValue; + CK_ULONG ulValueLen; +} CK_PRF_DATA_PARAM; + +typedef CK_PRF_DATA_PARAM CK_PTR CK_PRF_DATA_PARAM_PTR; + + +typedef struct CK_SP800_108_COUNTER_FORMAT +{ + CK_BBOOL bLittleEndian; + CK_ULONG ulWidthInBits; +} CK_SP800_108_COUNTER_FORMAT; + +typedef CK_SP800_108_COUNTER_FORMAT CK_PTR CK_SP800_108_COUNTER_FORMAT_PTR; + +typedef CK_ULONG CK_SP800_108_DKM_LENGTH_METHOD; +#define CK_SP800_108_DKM_LENGTH_SUM_OF_KEYS 0x00000001UL +#define CK_SP800_108_DKM_LENGTH_SUM_OF_SEGMENTS 0x00000002UL + +typedef struct CK_SP800_108_DKM_LENGTH_FORMAT +{ + CK_SP800_108_DKM_LENGTH_METHOD dkmLengthMethod; + CK_BBOOL bLittleEndian; + CK_ULONG ulWidthInBits; +} CK_SP800_108_DKM_LENGTH_FORMAT; + +typedef CK_SP800_108_DKM_LENGTH_FORMAT \ + CK_PTR CK_SP800_108_DKM_LENGTH_FORMAT_PTR; + +typedef struct CK_DERIVED_KEY +{ + CK_ATTRIBUTE_PTR pTemplate; + CK_ULONG ulAttributeCount; + CK_OBJECT_HANDLE_PTR phKey; +} CK_DERIVED_KEY; + +typedef CK_DERIVED_KEY CK_PTR CK_DERIVED_KEY_PTR; + +typedef struct CK_SP800_108_KDF_PARAMS +{ + CK_SP800_108_PRF_TYPE prfType; + CK_ULONG ulNumberOfDataParams; + CK_PRF_DATA_PARAM_PTR pDataParams; + CK_ULONG ulAdditionalDerivedKeys; + CK_DERIVED_KEY_PTR pAdditionalDerivedKeys; +} CK_SP800_108_KDF_PARAMS; + +typedef CK_SP800_108_KDF_PARAMS CK_PTR CK_SP800_108_KDF_PARAMS_PTR; + +typedef struct CK_SP800_108_FEEDBACK_KDF_PARAMS +{ + CK_SP800_108_PRF_TYPE prfType; + CK_ULONG ulNumberOfDataParams; + CK_PRF_DATA_PARAM_PTR pDataParams; + CK_ULONG ulIVLen; + CK_BYTE_PTR pIV; + CK_ULONG ulAdditionalDerivedKeys; + CK_DERIVED_KEY_PTR pAdditionalDerivedKeys; +} CK_SP800_108_FEEDBACK_KDF_PARAMS; + +typedef CK_SP800_108_FEEDBACK_KDF_PARAMS \ + CK_PTR CK_SP800_108_FEEDBACK_KDF_PARAMS_PTR; + +/* EDDSA */ +typedef struct CK_EDDSA_PARAMS { + CK_BBOOL phFlag; + CK_ULONG ulContextDataLen; + CK_BYTE_PTR pContextData; +} CK_EDDSA_PARAMS; + +typedef CK_EDDSA_PARAMS CK_PTR CK_EDDSA_PARAMS_PTR; + +/* Extended ChaCha20/Salsa20 support*/ +typedef struct CK_CHACHA20_PARAMS { + CK_BYTE_PTR pBlockCounter; + CK_ULONG blockCounterBits; + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceBits; +} CK_CHACHA20_PARAMS; + +typedef CK_CHACHA20_PARAMS CK_PTR CK_CHACHA20_PARAMS_PTR; + +typedef struct CK_SALSA20_PARAMS { + CK_BYTE_PTR pBlockCounter; + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceBits; +} CK_SALSA20_PARAMS; +typedef CK_SALSA20_PARAMS CK_PTR CK_SALSA20_PARAMS_PTR; + +typedef struct CK_SALSA20_CHACHA20_POLY1305_PARAMS { + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceLen; + CK_BYTE_PTR pAAD; + CK_ULONG ulAADLen; +} CK_SALSA20_CHACHA20_POLY1305_PARAMS; + +typedef CK_SALSA20_CHACHA20_POLY1305_PARAMS \ + CK_PTR CK_SALSA20_CHACHA20_POLY1305_PARAMS_PTR; + +typedef struct CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS { + CK_BYTE_PTR pNonce; + CK_ULONG ulNonceLen; + CK_BYTE_PTR pTag; +} CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS; + +typedef CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS \ + CK_PTR CK_SALSA20_CHACHA20_POLY1305_MSG_PARAMS_PTR; + +typedef CK_ULONG CK_X3DH_KDF_TYPE; +typedef CK_X3DH_KDF_TYPE CK_PTR CK_X3DH_KDF_TYPE_PTR; + +/* X3dh, ratchet */ +typedef struct CK_X3DH_INITIATE_PARAMS { + CK_X3DH_KDF_TYPE kdf; + CK_OBJECT_HANDLE pPeer_identity; + CK_OBJECT_HANDLE pPeer_prekey; + CK_BYTE_PTR pPrekey_signature; + CK_BYTE_PTR pOnetime_key; + CK_OBJECT_HANDLE pOwn_identity; + CK_OBJECT_HANDLE pOwn_ephemeral; +} CK_X3DH_INITIATE_PARAMS; + +typedef struct CK_X3DH_RESPOND_PARAMS { + CK_X3DH_KDF_TYPE kdf; + CK_BYTE_PTR pIdentity_id; + CK_BYTE_PTR pPrekey_id; + CK_BYTE_PTR pOnetime_id; + CK_OBJECT_HANDLE pInitiator_identity; + CK_BYTE_PTR pInitiator_ephemeral; +} CK_X3DH_RESPOND_PARAMS; + +typedef CK_ULONG CK_X2RATCHET_KDF_TYPE; +typedef CK_X2RATCHET_KDF_TYPE CK_PTR CK_X2RATCHET_KDF_TYPE_PTR; + +typedef struct CK_X2RATCHET_INITIALIZE_PARAMS { + CK_BYTE_PTR sk; + CK_OBJECT_HANDLE peer_public_prekey; + CK_OBJECT_HANDLE peer_public_identity; + CK_OBJECT_HANDLE own_public_identity; + CK_BBOOL bEncryptedHeader; + CK_ULONG eCurve; + CK_MECHANISM_TYPE aeadMechanism; + CK_X2RATCHET_KDF_TYPE kdfMechanism; +} CK_X2RATCHET_INITIALIZE_PARAMS; + +typedef CK_X2RATCHET_INITIALIZE_PARAMS \ + CK_PTR CK_X2RATCHET_INITIALIZE_PARAMS_PTR; + +typedef struct CK_X2RATCHET_RESPOND_PARAMS { + CK_BYTE_PTR sk; + CK_OBJECT_HANDLE own_prekey; + CK_OBJECT_HANDLE initiator_identity; + CK_OBJECT_HANDLE own_public_identity; + CK_BBOOL bEncryptedHeader; + CK_ULONG eCurve; + CK_MECHANISM_TYPE aeadMechanism; + CK_X2RATCHET_KDF_TYPE kdfMechanism; +} CK_X2RATCHET_RESPOND_PARAMS; +typedef CK_X2RATCHET_RESPOND_PARAMS \ + CK_PTR CK_X2RATCHET_RESPOND_PARAMS_PTR; + +typedef CK_ULONG CK_XEDDSA_HASH_TYPE; +typedef CK_XEDDSA_HASH_TYPE CK_PTR CK_XEDDSA_HASH_TYPE_PTR; + +/* XEDDSA */ +typedef struct CK_XEDDSA_PARAMS { + CK_XEDDSA_HASH_TYPE hash; +} CK_XEDDSA_PARAMS; +typedef CK_XEDDSA_PARAMS CK_PTR CK_XEDDSA_PARAMS_PTR; + +/* HKDF params */ +typedef struct CK_HKDF_PARAMS { + CK_BBOOL bExtract; + CK_BBOOL bExpand; + CK_MECHANISM_TYPE prfHashMechanism; + CK_ULONG ulSaltType; + CK_BYTE_PTR pSalt; + CK_ULONG ulSaltLen; + CK_OBJECT_HANDLE hSaltKey; + CK_BYTE_PTR pInfo; + CK_ULONG ulInfoLen; +} CK_HKDF_PARAMS; +typedef CK_HKDF_PARAMS CK_PTR CK_HKDF_PARAMS_PTR; + +#define CKF_HKDF_SALT_NULL 0x00000001UL +#define CKF_HKDF_SALT_DATA 0x00000002UL +#define CKF_HKDF_SALT_KEY 0x00000004UL + +/* HSS */ +typedef CK_ULONG CK_HSS_LEVELS; +typedef CK_ULONG CK_LMS_TYPE; +typedef CK_ULONG CK_LMOTS_TYPE; + +typedef struct specifiedParams { + CK_HSS_LEVELS levels; + CK_LMS_TYPE lm_type[8]; + CK_LMOTS_TYPE lm_ots_type[8]; +} specifiedParams; + +/* IKE Params */ +typedef struct CK_IKE2_PRF_PLUS_DERIVE_PARAMS { + CK_MECHANISM_TYPE prfMechanism; + CK_BBOOL bHasSeedKey; + CK_OBJECT_HANDLE hSeedKey; + CK_BYTE_PTR pSeedData; + CK_ULONG ulSeedDataLen; +} CK_IKE2_PRF_PLUS_DERIVE_PARAMS; +typedef CK_IKE2_PRF_PLUS_DERIVE_PARAMS CK_PTR CK_IKE2_PRF_PLUS_DERIVE_PARAMS_PTR; + +typedef struct CK_IKE_PRF_DERIVE_PARAMS { + CK_MECHANISM_TYPE prfMechanism; + CK_BBOOL bDataAsKey; + CK_BBOOL bRekey; + CK_BYTE_PTR pNi; + CK_ULONG ulNiLen; + CK_BYTE_PTR pNr; + CK_ULONG ulNrLen; + CK_OBJECT_HANDLE hNewKey; +} CK_IKE_PRF_DERIVE_PARAMS; +typedef CK_IKE_PRF_DERIVE_PARAMS CK_PTR CK_IKE_PRF_DERIVE_PARAMS_PTR; + +typedef struct CK_IKE1_PRF_DERIVE_PARAMS { + CK_MECHANISM_TYPE prfMechanism; + CK_BBOOL bHasPrevKey; + CK_OBJECT_HANDLE hKeygxy; + CK_OBJECT_HANDLE hPrevKey; + CK_BYTE_PTR pCKYi; + CK_ULONG ulCKYiLen; + CK_BYTE_PTR pCKYr; + CK_ULONG ulCKYrLen; + CK_BYTE keyNumber; +} CK_IKE1_PRF_DERIVE_PARAMS; +typedef CK_IKE1_PRF_DERIVE_PARAMS CK_PTR CK_IKE1_PRF_DERIVE_PARAMS_PTR; + +typedef struct CK_IKE1_EXTENDED_DERIVE_PARAMS { + CK_MECHANISM_TYPE prfMechanism; + CK_BBOOL bHasKeygxy; + CK_OBJECT_HANDLE hKeygxy; + CK_BYTE_PTR pExtraData; + CK_ULONG ulExtraDataLen; +} CK_IKE1_EXTENDED_DERIVE_PARAMS; +typedef CK_IKE1_EXTENDED_DERIVE_PARAMS CK_PTR CK_IKE1_EXTENDED_DERIVE_PARAMS_PTR; + +#endif /* _PKCS11T_H_ */ +