diff --git a/.env b/.env
new file mode 100644
index 0000000..f085653
--- /dev/null
+++ b/.env
@@ -0,0 +1,2 @@
+DIST=debian
+FLAVOR=sid
\ No newline at end of file
diff --git a/.github/build-pkg-git.sh b/.github/build-pkg-git.sh
new file mode 100755
index 0000000..ff8b0ab
--- /dev/null
+++ b/.github/build-pkg-git.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+#set parameters needed for gbp import
+git config --global user.email "calderon.thomas@gmail"
+git config --global user.name "Thomas Calderon"
+
+echo Generating package for $BRANCH_NAME, will output in $DEB_OUTPUT_CONTAINER
+
+COMMIT_SHORT=1.0.x-$(git rev-parse --short HEAD)
+git archive --format=tar.gz --prefix=caml-crush-$COMMIT_SHORT/ HEAD > ../caml-crush-$COMMIT_SHORT.tar.gz
+
+#Track needed branches
+git checkout --track origin/upstream
+git checkout --track origin/debian
+
+gbp import-orig --debian-branch=debian -u $COMMIT_SHORT ../caml-crush-$COMMIT_SHORT.tar.gz
+
+COMMIT_TS=$(git show -s --pretty=format:%ct HEAD)
+COMMIT_DATE=$(date --date="@${COMMIT_TS}" +%Y%m%d%H%M)
+GBP_SINCE_PARAM="--auto"
+export DEBEMAIL="calderon.thomas@gmail.com"
+export DEBFULLNAME="Thomas Calderon"
+gbp dch $GBP_SINCE_PARAM --snapshot --snapshot-number="${COMMIT_DATE}" --no-multimaint --ignore-branch
+
+gbp buildpackage -uc -us --git-no-sign-tags --git-debian-branch=debian --git-ignore-new
+
+#copy all artefacts in output directory
+mv ../caml-crush* $DEB_OUTPUT_CONTAINER/
\ No newline at end of file
diff --git a/.github/build-pkg.sh b/.github/build-pkg.sh
new file mode 100755
index 0000000..5f8c8b0
--- /dev/null
+++ b/.github/build-pkg.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+OUTPUT=/tmp/output
+
+git checkout debian
+gbp buildpackage -uc -us -S --git-no-sign-tags --git-debian-branch=debian --git-ignore-new --git-export-dir=$OUTPUT
+
+# Build AMD64 package
+#docker run --rm -it -e DEB_BUILD_OPTIONS='parallel=1' -v ${OUTPUT}:/tmp/output  caml-crush-pkgsid gbp buildpackage -uc -us --git-no-sign-tags --git-debian-branch=debian --git-ignore-new --git-export-dir=/tmp/output
\ No newline at end of file
diff --git a/.github/workflows/debian-packaging.yml b/.github/workflows/debian-packaging.yml
new file mode 100644
index 0000000..19a21a2
--- /dev/null
+++ b/.github/workflows/debian-packaging.yml
@@ -0,0 +1,85 @@
+name: Debian
+on: push
+env:
+  CHANGELOG_AUTHOR_NAME: "Thomas Calderon"
+  CHANGELOG_AUTHOR_EMAIL: "calderon.thomas@gmail.com"
+  DEB_OUTPUT: "/tmp/cc-output"
+  DEB_OUTPUT_CONTAINER: "/tmp/output"
+
+jobs:
+  build-debian-package:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+       include:
+         - dist: "debian"
+           flavor: "sid"
+        #  - dist: "debian"
+        #    flavor: "testing"
+        #  - dist: "debian"
+        #    flavor: "bullseye"
+        #  - dist: "debian"
+        #    flavor: "buster"
+        # #  Ubuntu Focal does not have coccinelle package, skip for now
+        # #  - dist: "ubuntu"
+        # #    flavor: "focal"
+        #  - dist: "ubuntu"
+        #    flavor: "bionic"
+        #  - dist: "ubuntu"
+        #    flavor: "xenial"
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+    - name: Get branch name (merge)
+      if: github.event_name != 'pull_request'
+      shell: bash
+      run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
+
+    - name: Get branch name (pull request)
+      if: github.event_name == 'pull_request'
+      shell: bash
+      run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
+    - name: Show branch detail
+      shell: bash
+      run: echo "echo ${BRANCH_NAME}"
+    - name: build docker container to build
+      env:
+          DIST: ${{ matrix.dist }}
+          FLAVOR: ${{ matrix.flavor }}
+      run: |
+        curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+        sudo add-apt-repository \
+          "deb https://download.docker.com/linux/ubuntu \
+          $(lsb_release -cs) \
+          stable"
+        sudo apt-get update
+        sudo apt-get install -y --no-install-recommends docker-ce
+        docker build -t caml-crush-pkg-${FLAVOR} \
+          --build-arg flavor=${DIST} \
+          --build-arg flavor=${FLAVOR} \
+           -f Dockerfile.debian-pkg .
+    # - name: Setup tmate session
+    #   uses: mxschmitt/action-tmate@v3
+    - name: build package in container
+      env:
+          DIST: ${{ matrix.dist }}
+          FLAVOR: ${{ matrix.flavor }}
+          BRANCH_NAME: ${{ env.BRANCH_NAME }}
+          DEB_OUTPUT: ${{ env.DEB_OUTPUT }}
+          DEB_OUTPUT_CONTAINER: ${{ env.DEB_OUTPUT_CONTAINER }}
+      run: |
+        mkdir -p ${DEB_OUTPUT}
+        docker run --rm \
+          -e BRANCH_NAME=${BRANCH_NAME} \
+          -e DEB_OUTPUT_CONTAINER=${DEB_OUTPUT_CONTAINER} \
+          -v ${DEB_OUTPUT}:${DEB_OUTPUT_CONTAINER} \
+          caml-crush-pkg-${FLAVOR} \
+          bash -x .github/build-pkg-git.sh
+    - name: Upload artifacts
+      uses: actions/upload-artifact@v2
+      with:
+        name: deb
+        path: ${{env.DEB_OUTPUT}}/
+        if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` 
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..1fb49c9
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,45 @@
+name: CI
+on: push
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+       include:
+         - dist: "debian"
+           flavor: "sid"
+         - dist: "debian"
+           flavor: "testing"
+         - dist: "debian"
+           flavor: "bullseye"
+         - dist: "debian"
+           flavor: "buster"
+        #  Ubuntu Focal does not have coccinelle package, skip for now
+        #  - dist: "ubuntu"
+        #    flavor: "focal"
+         - dist: "ubuntu"
+           flavor: "bionic"
+         - dist: "ubuntu"
+           flavor: "xenial"
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v2
+    - name: docker-build
+      env:
+          DIST: ${{ matrix.dist }}
+          FLAVOR: ${{ matrix.flavor }}
+      run: |
+        apt-get update && apt-get install -y --no-install-recommends docker docker-compose
+        docker-compose build
+        docker-compose -f docker-compose-unix.yml build
+    - name: run integration tests
+      env:
+          DIST: ${{ matrix.dist }}
+          FLAVOR: ${{ matrix.flavor }}
+      run: |
+        # important to use -p so that different compose-project name are used to avoid collision between CI-runs
+        docker-compose -p cc-test-${FLAVOR} up --force-recreate --exit-code-from client client
+        docker-compose -p cc-test-${FLAVOR} up --force-recreate --exit-code-from client-tls client-tls
+        docker-compose -p cc-test-${FLAVOR} -f docker-compose-unix.yml up --exit-code-from client-unix client-unix
+        docker-compose -p cc-test-${FLAVOR} -f docker-compose-unix.yml up --exit-code-from client-unix-tls client-unix-tls
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..8e51671
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,30 @@
+language: c
+
+compiler: gcc
+services: docker
+
+dist: bionic
+
+jobs:
+    include:
+      - stage: Debian builds
+        name: Stretch
+        script: docker build -t caml-crush-stretch --build-arg flavor=stretch -f Dockerfile.debian .
+      -  
+        name: Jessie
+        script: docker build -t caml-crush-jessie --build-arg flavor=jessie -f Dockerfile.debian .
+      -  
+        name: Buster
+        script: docker build -t caml-crush-buster --build-arg flavor=buster -f Dockerfile.debian .
+      -  
+        name: Sid
+        script: docker build -t caml-crush-sid --build-arg flavor=sid -f Dockerfile.debian .
+      - stage: Ubuntu builds
+        name: Trusty
+        script: docker build -t caml-crush-trusty -f Dockerfile.ubuntu-trusty .
+      -  
+        name: Xenial
+        script: docker build -t caml-crush-xenial --build-arg dist=ubuntu --build-arg flavor=xenial -f Dockerfile.debian .
+      -  
+        name: Bionic
+        script: docker build -t caml-crush-bionic --build-arg dist=ubuntu --build-arg flavor=bionic -f Dockerfile.debian .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3195fe1..2b2e949 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,32 @@
 
 ## [Unreleased][unreleased]
 
+## [1.0.12] - 2021-11-25
+* Build fixes
+## [1.0.11] - 2021-11-19
+* TIRPC support
+* Ocaml > 4.10 support
+* Better integration tests
+## [1.0.10] - 2020-09-22
+* Sequential compilation
+* GCC-10 fixes
+* Travis-CI fixes
+
+## [1.0.9] - 2020-05-22
+* Fix compilation for recent coccinelle versions
+* MinGW fixes
+* Travis-CI is now used
+* Docker can be used to compile recent/older targets
+
+## [1.0.8] - 2016-07-05
+* OpenSSL 1.1.0 support (#23)
+* Fix some Win32 compilation issues
+* Improved support for TLS mutual auth when using Ocamlnet 4.x
+
+## [1.0.7] - 2015-11-23
+* Merge support for OCamlnet 4.x (#13)
+* Fix uninstall target (#18), credits to louis@louisroche.net
+
 ## [1.0.6] - 2015-05-28
 * Switch to MIT license for the project.
 
@@ -51,8 +77,14 @@
 * correct conflicting attribute patch regarding.
 * GnuTLS ressource deallocation issue.
 
-[unreleased]: https://github.com/ANSSI-FR/caml-crush/compare/v1.0.6...HEAD
-[1.0.6]: https://github.com/ANSSI-FR/caml-crush/compare/v1.0.5...v1.0.6
-[1.0.5]: https://github.com/ANSSI-FR/caml-crush/compare/v1.0.4...v1.0.5
-[1.0.4]: https://github.com/ANSSI-FR/caml-crush/compare/v1.0.3...v1.0.4
-[1.0.3]: https://github.com/ANSSI-FR/caml-crush/compare/v1.0.2...v1.0.3
+[unreleased]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.12...HEAD
+[1.0.12]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.11...v1.0.12
+[1.0.11]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.10...v1.0.11
+[1.0.10]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.9...v1.0.10
+[1.0.9]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.8...v1.0.9
+[1.0.8]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.7...v1.0.8
+[1.0.7]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.6...v1.0.7
+[1.0.6]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.5...v1.0.6
+[1.0.5]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.4...v1.0.5
+[1.0.4]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.3...v1.0.4
+[1.0.3]: https://github.com/caml-pkcs11/caml-crush/compare/v1.0.2...v1.0.3
diff --git a/Dockerfile.debian b/Dockerfile.debian
new file mode 100644
index 0000000..8901d7e
--- /dev/null
+++ b/Dockerfile.debian
@@ -0,0 +1,24 @@
+# Override with --build-arg dist=ubuntu --build-arg flavor=bionic
+ARG dist=debian
+ARG flavor=sid
+
+FROM ${dist}:${flavor} as builder
+
+
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends autoconf make gcc \
+                     automake autotools-dev \
+                     ocaml-nox camlidl coccinelle \
+                     libocamlnet-ocaml-dev libocamlnet-ocaml-bin \
+                     libocamlnet-ssl-ocaml libocamlnet-ssl-ocaml-dev \
+                     libssl-dev gnutls-dev \
+                     libconfig-file-ocaml-dev camlp4
+
+FROM builder
+COPY . /build
+
+WORKDIR /build
+
+RUN ./autogen.sh
+RUN ./configure --with-idlgen --with-rpcgen --with-libnames=foo --with-ssl --with-ssl-clientfiles='env'
+RUN make
\ No newline at end of file
diff --git a/Dockerfile.debian-pkg b/Dockerfile.debian-pkg
new file mode 100644
index 0000000..1d136aa
--- /dev/null
+++ b/Dockerfile.debian-pkg
@@ -0,0 +1,28 @@
+# Override with --build-arg dist=ubuntu --build-arg flavor=bionic
+ARG dist=debian
+ARG flavor=sid
+
+FROM ${dist}:${flavor} as builder
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update
+RUN apt-get -y upgrade
+RUN apt-get install -y --no-install-recommends autoconf make gcc \
+                     automake autotools-dev \
+                     ocaml-nox camlidl coccinelle \
+                     libocamlnet-ocaml-dev libocamlnet-ocaml-bin \
+                     libocamlnet-ssl-ocaml libocamlnet-ssl-ocaml-dev \
+                     libssl-dev gnutls-dev \
+                     libconfig-file-ocaml-dev camlp4 \
+                     git-buildpackage debhelper \
+                     dh-exec dh-autoreconf build-essential
+
+RUN apt-get install -y --no-install-recommends ca-certificates fakeroot debhelper
+
+FROM builder
+
+WORKDIR /build/git
+COPY . .
+
+RUN mkdir /tmp/output
diff --git a/Dockerfile.ubuntu-trusty b/Dockerfile.ubuntu-trusty
new file mode 100644
index 0000000..1b3368d
--- /dev/null
+++ b/Dockerfile.ubuntu-trusty
@@ -0,0 +1,33 @@
+FROM ubuntu:trusty as builder
+
+
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends autoconf make gcc \
+                     automake autotools-dev \
+                     ocaml-nox camlidl coccinelle libocamlnet-ocaml-dev \
+                     libocamlnet-ssl-ocaml libocamlnet-ssl-ocaml-dev \
+                     libocamlnet-ocaml-bin libconfig-file-ocaml-dev camlp4 \
+                     libssl-dev libgnutls-dev ca-certificates pkg-config \
+                     ocaml-findlib wget
+
+FROM builder
+COPY . /build
+
+WORKDIR /build
+
+# install findlib
+RUN wget http://download.camlcity.org/download/findlib-1.5.6.tar.gz -O /tmp/findlib-1.5.6.tar.gz
+RUN cd /tmp && tar xzf findlib-1.5.6.tar.gz && cd findlib-1.5.6 && \
+        ./configure -config /etc/ocamlfind.conf -bindir /usr/bin/ \
+             -sitelib /usr/lib/ocaml -with-toolbox && \
+        make all && make opt && sudo make install
+
+# install ocaml-ssl
+RUN wget https://github.com/savonet/ocaml-ssl/releases/download/0.5.5/ocaml-ssl-0.5.5.tar.gz -O /tmp/ocaml-ssl-0.5.5.tar.gz
+RUN cd /tmp && tar xzf /tmp/ocaml-ssl-0.5.5.tar.gz && cd ocaml-ssl-0.5.5 && ./configure && make && sudo make install
+
+RUN cd /build
+
+RUN ./autogen.sh
+RUN ./configure --with-idlgen --with-rpcgen --with-libnames=foo
+RUN make
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index 0a11cf6..f9f62d8 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,8 +1,8 @@
 The MIT License (MIT)
 
-Copyright ANSSI (2013-2015)
-Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-               Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+Copyright ANSSI (2013-2016)
+Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+               Thomas CALDERON [calderon.thomas@gmail.com]
                Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/Makefile.Unix.in b/Makefile.Unix.in
index e3a6eaf..cc9d9a4 100644
--- a/Makefile.Unix.in
+++ b/Makefile.Unix.in
@@ -6,6 +6,7 @@ filter_dir = src/filter
 tests_dir = src/tests
 
 .PHONY: all bindings rpc server client filter install uninstall tests
+.NOTPARALLEL: all bindings rpc server client filter install uninstall tests
 
 all:	@with_bindings@ @with_rpc@ @with_filter@ @with_server@ @with_client@
 
diff --git a/Makefile.Win32.in b/Makefile.Win32.in
index 5d4ec93..3d77716 100644
--- a/Makefile.Win32.in
+++ b/Makefile.Win32.in
@@ -6,6 +6,7 @@ filter_dir = src/filter
 tests_dir = src/tests
 
 .PHONY: all bindings rpc server client filter install uninstall tests
+.NOTPARALLEL: all bindings rpc server client filter install uninstall tests
 
 #all:	bindings rpc @with_filter@ server client
 all:	bindings client
diff --git a/README.md b/README.md
index 4a8a31d..6968901 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
 # Caml Crush: an OCaml PKCS#11 filtering proxy
+[![Build Status](https://travis-ci.com/caml-pkcs11/caml-crush.svg?branch=master)](https://travis-ci.com/caml-pkcs11/caml-crush)
 
 This software is a computer program whose purpose is to implement
 a PKCS#11 proxy as well as a PKCS#11 filter with security features
@@ -50,8 +51,8 @@ Here is a big picture of how the PKCS#11 proxy works:
 
 ## Authors
 
-  * Ryad Benadjila (<mailto:ryad.benadjila@ssi.gouv.fr>)
-  * Thomas Calderon (<mailto:thomas.calderon@ssi.gouv.fr>)
+  * Ryad Benadjila (<mailto:ryadbenadjila@gmail.com>)
+  * Thomas Calderon (<mailto:calderon.thomas@gmail.com>)
   * Marion Daubignard (<mailto:marion.daubignard@ssi.gouv.fr>)
 
 ## Quickstart
@@ -72,9 +73,10 @@ Here is a big picture of how the PKCS#11 proxy works:
     
     sudo make install
 
+
 ### Configure the middleware to use
 
-Edit **/usr/local/etc/pkcs11proxy/filter.conf**, uncomment the **modules** parameter to
+Edit **/usr/local/etc/pkcs11proxyd/filter.conf**, uncomment the **modules** parameter to
 have it point to the PKCS#11 middleware you want to use.
 
 Example using the OpenSC middleware:
diff --git a/autoclean.sh b/autoclean.sh
index 7b3c263..a41bf4c 100755
--- a/autoclean.sh
+++ b/autoclean.sh
@@ -19,7 +19,7 @@ clean_dirs=($main_dir $bindings_dir $rpc_dir $server_dir $client_dir $filter_dir
 echo "Cleaning the project ..."
 make clean &> /dev/null
 echo "Cleaning AUTOCONF files ..."
-rm -rf autom4te.cache config.log config.status configure summary
+rm -rf aclocal.m4 autom4te.cache config.log config.status configure summary
 echo "Cleaning Makefiles ..."
 for (( i = 0 ; i < ${#clean_dirs[*]} ; i++ ))
 do
diff --git a/autogen.sh b/autogen.sh
index 3923cd0..6ba77fd 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 echo "[Generating configure file ...]"
+aclocal
 if [ "${OS}" = "Windows_NT" ]
 then
   echo "  |-> Using Cygwin environment"
diff --git a/configure-win32.ac b/configure-win32.ac
index 00d8474..ef5dcf6 100644
--- a/configure-win32.ac
+++ b/configure-win32.ac
@@ -1,6 +1,6 @@
 define([PACKAGE_VERSION_MAJOR], [1])
 define([PACKAGE_VERSION_MINOR], [0])
-define([PACKAGE_VERSION_FIX], [4])
+define([PACKAGE_VERSION_FIX], [12])
 
 AC_INIT(cam-crush, [PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX])
 AC_CONFIG_SRCDIR([src/client-lib/modwrap.c])
diff --git a/configure.ac b/configure.ac
index df4a949..594b1bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,12 @@
 define([PACKAGE_VERSION_MAJOR], [1])
 define([PACKAGE_VERSION_MINOR], [0])
-define([PACKAGE_VERSION_FIX], [5])
+define([PACKAGE_VERSION_FIX], [12])
 
 AC_INIT(cam-crush, [PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX])
+
+#Include autoconf macros (ocaml and version comparisons)
+m4_include([m4/ax_compare_version.m4])
+
 AC_CONFIG_SRCDIR([src/client-lib/modwrap.c])
 
 bindings_dir="src/bindings-pkcs11"
@@ -18,6 +22,7 @@ ocaml_tests_dir="src/tests/ocaml"
 c_tests_dir="src/tests/c-based"
 scripts_dir="scripts"
 
+
 AC_CONFIG_FILES([$bindings_dir/Makefile $bindings_dir/Makefile.standalone $rpc_dir/Makefile $server_dir/Makefile $client_dir/Makefile $filter_filter_dir/Makefile $filter_backend_dir/Makefile $filter_frontend_dir/Makefile $filter_dir/Makefile $tests_dir/Makefile $ocaml_tests_dir/Makefile $c_tests_dir/Makefile $scripts_dir/pkcs11proxyd])
 
 AC_ARG_WITH(caml-crush, [  --without-caml-crush    compile only pkcs11 bindings, (this is NOT the default)], [], with_caml_crush=yes)
@@ -45,10 +50,10 @@ full_libdir="$full_libdir/caml-crush"
 libdir=$full_libdir
 
 # Summary helpers
-AC_DEFUN(WRITE_TO_FILE,[
+AC_DEFUN([WRITE_TO_FILE],[
 printf "%-40s:   %s\n" $2 $3 >> $1
 ])
-AC_DEFUN(SHOW_SUMMARY,[
+AC_DEFUN([SHOW_SUMMARY],[
 cat $1 && rm -f $1
 ])
 
@@ -68,27 +73,26 @@ echo "###########################################" >> ./summary
 # CHECK Make
 
 case $host_type in
+   *-gnu*)
+	make_exe=make
+	;;
    *freebsd*)
-	AC_CHECK_PROG(MAKEPROG,gmake,gmake,no)
-	if test "$MAKEPROG" == "no"
-	then
-	  AC_MSG_ERROR(Cannot find GNU gmake.)
-	fi
-	AC_SUBST(MAKEPROG,$MAKEPROG)
+	make_exe=gmake
 	;;
    *)
-	AC_CHECK_PROG(MAKEPROG,make,make,no)
-	if test "$MAKEPROG" == "no"
-	then
-	  AC_MSG_ERROR(Cannot find GNU make.)
-	fi
-	AC_SUBST(MAKEPROG,$MAKEPROG)
+	make_exe=make
 	;;
 esac
+AC_CHECK_PROG(MAKEPROG,$make_exe,$make_exe,no)
+if test "$MAKEPROG" == "no"
+then
+  AC_MSG_ERROR(Cannot find GNU make as $make_exe.)
+fi
+AC_SUBST(MAKEPROG,$MAKEPROG)
 
 ##########
 # CHECK OCaml an needed binaries
-AC_DEFUN(AC_PROG_OCAML,
+AC_DEFUN([AC_PROG_OCAML],
 [dnl
 # checking for ocamlc
 AC_CHECK_PROG(OCAMLC,ocamlc,yes,no)
@@ -152,7 +156,7 @@ AC_SUBST(OCAMLMKLIB)
 ])
 # CHECK for ocamlp4 needed for 
 # some conditional compilation
-AC_DEFUN(AC_PROG_CAMLP4,
+AC_DEFUN([AC_PROG_CAMLP4],
 [dnl
 AC_REQUIRE([AC_PROG_OCAML])
 # checking for camlp4
@@ -170,14 +174,14 @@ AC_SUBST(CAMLP4O)
 ])
 # CHECK for OCaml findlib needed 
 # for dependency solving
-AC_DEFUN(AC_PROG_FINDLIB,
+AC_DEFUN([AC_PROG_FINDLIB],
 [dnl
 # checking for ocamlfind
    AC_CHECK_PROG(OCAMLFIND,ocamlfind,ocamlfind,
    AC_MSG_ERROR(ocamlfind not found))
    AC_SUBST(OCAMLFIND)
 ])
-AC_DEFUN(AC_CHECK_OCAML_PKG,
+AC_DEFUN([AC_CHECK_OCAML_PKG],
 [dnl
 AC_REQUIRE([AC_PROG_FINDLIB])
     AC_MSG_CHECKING(OCaml package $1)
@@ -189,11 +193,23 @@ AC_REQUIRE([AC_PROG_FINDLIB])
       unset pkg_$2
     fi
 ])
+AC_DEFUN([AC_CHECK_OCAML_PKG_VERS],
+[dnl
+AC_REQUIRE([AC_PROG_FINDLIB])
+    AC_MSG_CHECKING(OCaml package $1)
+    if $OCAMLFIND query $1 >/dev/null 2>/dev/null; then
+      AC_MSG_RESULT(found)
+      pkg_vers_$2=$($OCAMLFIND query -format "%v" $1)
+    else
+      AC_MSG_ERROR(not found)
+      unset pkg_vers_$2
+    fi
+])
 dnl
 dnl
 dnl
 dnl AC_ARG_OCAML_INSTALLDIR adds a --with-installdir option
-AC_DEFUN(AC_ARG_OCAML_INSTALLDIR,
+AC_DEFUN([AC_ARG_OCAML_INSTALLDIR],
 [dnl
 AC_ARG_WITH(installdir,[  --with-installdir=DIR	  specify installation directory],INSTALLDIR="$withval")
 if ! test "$INSTALLDIR" -o "$use_findlib" ; then
@@ -209,7 +225,7 @@ dnl 1 -> name (for printing)
 dnl 2 -> env var name
 dnl 3 -> module to check
 dnl 4 -> default dirs
-AC_DEFUN(AC_CHECK_OCAML_MODULE,
+AC_DEFUN([AC_CHECK_OCAML_MODULE],
 [dnl
 AC_MSG_CHECKING($1 directory)
 cat > conftest.ml <<EOF
@@ -276,6 +292,19 @@ esac
 AC_CHECK_LIB(pthread, pthread_mutex_init, THREAD_LIB="-lpthread",
                AC_MSG_ERROR(Cannot find pthread library.))
 
+# Handle the Byte package that is not present for OCaml < 4.02.0
+AX_COMPARE_VERSION([$OCAMLVERSION], [lt], [4.02.0], [bytes_module_present=no], [bytes_module_present=yes])
+if test "$bytes_module_present" == "no"
+then
+	AC_SUBST(ocaml_bytes_module_define, "-DOCAML_NO_BYTES_MODULE")
+	AC_SUBST(idl_ocaml_bytes_module_define, "-D OCAML_NO_BYTES_MODULE")
+	AC_SUBST(ocaml_options, "")
+else
+	AC_SUBST(ocaml_bytes_module_define, "")
+	AC_SUBST(idl_ocaml_bytes_module_define, "")
+	AC_SUBST(ocaml_options, "")
+fi
+
 # IDL generation handling
 ####
 # CHECK for the camlidl program, 
@@ -292,6 +321,16 @@ then
         then
           AC_MSG_ERROR(Cannot find spatch binary: needed for PKCS11 bindings generation - install coccinelle.)
         fi
+	# Adapt the compilation depending in the coccinelle version
+	COCCIVERSION=$(spatch --version | grep -Po "(\d+\.)+\d+" | head -1)
+	echo "Detected coccinelle version $COCCIVERSION"
+	AX_COMPARE_VERSION([$COCCIVERSION], [lt], [1.0.7], [use_new_cocci=no], [use_new_cocci=yes])
+	if test "$use_new_cocci" == "yes"
+	then
+		AC_SUBST(pkcs11_cocci_patch, "pkcs11.cocci.new")
+	else
+		AC_SUBST(pkcs11_cocci_patch, "pkcs11.cocci.old")
+	fi
         AC_SUBST(idl_gen, "idl")
   	WRITE_TO_FILE(summary, "IDL gen", "YES")
 else
@@ -362,12 +401,28 @@ then
 else
 	WRITE_TO_FILE(summary, "client type", "Native C client (RPC generated with native rpcgen)")
 	AC_MSG_NOTICE([Using default C based client and RPC])
+	AC_CHECK_LIB(tirpc, getnetname, RPC_LIB=tirpc, RPC_LIB=c)
+
+	if test "$RPC_LIB" == "tirpc"
+	then
+		AC_MSG_NOTICE([Using the tirpc library])
+		CPPFLAGS="$CPPFLAGS -DWITH_TIRPC -I/usr/include/tirpc"
+		RPC_CPPFLAGS="-DWITH_TIRPC -I/usr/include/tirpc"
+		RPC_LDFLAGS="-ltirpc"
+	else
+		AC_MSG_NOTICE([Using the glibc RPC implementation])
+		RPC_CPPFLAGS=""
+		RPC_LDFLAGS=""
+	fi
 
 	AC_CHECK_HEADERS([rpc/rpc.h],,AC_MSG_ERROR(Could not find C RPC headers.))
 	AC_CHECK_HEADERS([rpc/clnt.h],,AC_MSG_ERROR(Could not find C RPC client headers.))
 
 	AC_SUBST(client_to_compile, "crpc")
 	AC_SUBST(client_to_compile_debug, "crpc_debug")
+
+	AC_SUBST(RPC_CPPFLAGS)
+	AC_SUBST(RPC_LDFLAGS)
 fi
 
 
@@ -446,12 +501,12 @@ then
         case $socket_type in
                 UNIX_SOCKET)
 			# Check the library against RPC unix client creation
-			AC_CHECK_LIB(c, clntunix_create, ,
+			AC_CHECK_LIB("$RPC_LIB", clntunix_create, ,
 			AC_MSG_ERROR(Cannot find RPC clntunix_create symbol in C library.))
 			;;
                 TCP_SOCKET)
 			# Check the library against RPC tcp client creation
-			AC_CHECK_LIB(c, clnttcp_create, ,
+			AC_CHECK_LIB("$RPC_LIB", clnttcp_create, ,
 			AC_MSG_ERROR(Cannot find RPC clnttcp_create symbol in C library.))
 			;;
                 *)
@@ -519,12 +574,40 @@ then
         	AC_MSG_ERROR([--with-ssl needs --with-ssl-clientfiles!])
 	fi
         AC_MSG_NOTICE([Using OCaml RPC over ssl for server side ...])
+
+	#Compare version of OCamlnet for TLS support
+	#get the version in pkg_vers_rpc var
+	AC_CHECK_OCAML_PKG_VERS([rpc], rpc)
+	AX_COMPARE_VERSION([$pkg_vers_rpc], [lt], [4.0.0], [use_ocamlnet_tls=no], [use_ocamlnet_tls=yes])
+	if test "$use_ocamlnet_tls" == "yes"
+	then
+		AC_MSG_NOTICE([Using newer Ocamlnet TLS])
+		# Since Ocamlnet TLS is based on gnutls, check
+		# that the library dev package is installed
+		AC_CHECK_LIB(gnutls, gnutls_record_recv, GNUTLS_LIB="-lgnutls",
+		AC_MSG_ERROR(Cannot find symbol in gnutls library.))
+		# Check that the Ocaml nettls-gnutls is installed
+		AC_CHECK_OCAML_PKG([nettls-gnutls], nettlsgnutls)
+		# Position the ssl define and linking for the server
+        	AC_SUBST(caml_server_ssl_define, "-DWITH_SSL")
+	        AC_SUBST(caml_server_ssl_package, "-package \"nettls-gnutls\"")
+	else
+		AC_MSG_NOTICE([Using standard OCaml-SSL TLS])
+		AC_CHECK_OCAML_PKG([ssl], ssl)
+                # Check for the ocaml-ssl version: we only support
+                # version >= 0.4.7
+		AC_CHECK_OCAML_PKG_VERS([ssl], ssl)
+                AX_COMPARE_VERSION([$pkg_vers_ssl], [lt], [0.4.7], [ocaml_ssl_bad_version=yes], [ocaml_ssl_bad_version=no])
+                if test "$ocaml_ssl_bad_version" == "yes"
+                then
+                        AC_MSG_ERROR(Version of ocaml-ssl must be >= 0.4.7.)
+                fi
+		AC_CHECK_OCAML_PKG([rpc-ssl], rpcssl)
+		# Position the ssl define and linking for the server
+		AC_SUBST(caml_server_ssl_define, "-DWITH_SSL -DWITH_SSL_LEGACY")
+	        AC_SUBST(caml_server_ssl_package, "-package \"ssl\" -package \"rpc-ssl\"")
+	fi
 	# We need the ssl and rpc-ssl package for RPC over ssl support
-	AC_CHECK_OCAML_PKG([ssl], ssl)
-	AC_CHECK_OCAML_PKG([rpc-ssl], rpcssl)
-	# Position the ssl define and linking for the server
-        AC_SUBST(caml_server_ssl_define, "-DWITH_SSL")
-        AC_SUBST(caml_server_ssl_package, "-package \"ssl\" -package \"rpc-ssl\"")
         if test "$with_ocamlclient" == ""
 	then
 		if test "$with_gnutls" != ""
@@ -586,12 +669,24 @@ then
 			# Check the library
 			AC_CHECK_LIB(ssl, SSL_read, OPENSSL_LIB="-lssl",
                			AC_MSG_ERROR(Cannot find symbol in openssl library.))
+			# Check if we are in presence of openssl >= 1.1.0 or not
+			AC_CHECK_LIB(ssl, OPENSSL_init_ssl, OPENSSL_LIB="-lssl", new_openssl=no)
+			# Check for used symbols
 			AC_CHECK_LIB(ssl, SSL_write, OPENSSL_LIB="-lssl",
                			AC_MSG_ERROR(Cannot find symbol in openssl library.))
-			AC_CHECK_LIB(ssl, SSL_load_error_strings, OPENSSL_LIB="-lssl",
-               			AC_MSG_ERROR(Cannot find symbol in openssl library.))
-			AC_CHECK_LIB(ssl, SSL_library_init, OPENSSL_LIB="-lssl",
-               			AC_MSG_ERROR(Cannot find symbol in openssl library.))
+			if test "$new_openssl" == "no"; then
+				AC_MSG_NOTICE([Openssl < 1.1.0 detected])
+				# SSL_load_error_strings is deprecated in openssl >= 1.1.0
+				AC_CHECK_LIB(ssl, SSL_load_error_strings, OPENSSL_LIB="-lssl",
+					AC_MSG_ERROR(Cannot find symbol in openssl library.))
+				# SSL_library_init is deprecated in openssl >= 1.1.0
+				AC_CHECK_LIB(ssl, SSL_library_init, OPENSSL_LIB="-lssl",
+					AC_MSG_ERROR(Cannot find symbol in openssl library.))
+			else
+				AC_MSG_NOTICE([Openssl >= 1.1.0 detected])
+				AC_CHECK_LIB(ssl, OPENSSL_init_ssl, OPENSSL_LIB="-lssl",
+					AC_MSG_ERROR(Cannot find symbol in openssl library.))
+			fi
 			AC_CHECK_LIB(ssl, SSL_CTX_new, OPENSSL_LIB="-lssl",
                			AC_MSG_ERROR(Cannot find symbol in openssl library.))
 			#AC_CHECK_LIB(ssl, SSL_CTX_set_options, OPENSSL_LIB="-lssl",
@@ -679,7 +774,7 @@ fi
 # Macro to create the ssl headers, for C and ML clients, from the 
 # given files $1 is the file path, $2 is the file type ("ca", "cert",
 # "priv" for private key, "server" for the allowed servers certificates)
-AC_DEFUN(CREATE_SSL_HEADERS,[
+AC_DEFUN([CREATE_SSL_HEADERS],[
 C_FILE="./create_ssl_files.c"
 FILE="./create_ssl_files"
 rm -f $C_FILE $FILE
diff --git a/doc/INDEX.md b/doc/INDEX.md
index 1430f19..7857d3d 100644
--- a/doc/INDEX.md
+++ b/doc/INDEX.md
@@ -62,8 +62,8 @@ Here is a big picture of how the PKCS#11 proxy works:
 
 ## Authors <a name="Authors"></a>
 
-  * Ryad Benadjila (<mailto:ryad.benadjila@ssi.gouv.fr>)
-  * Thomas Calderon (<mailto:thomas.calderon@ssi.gouv.fr>)
+  * Ryad Benadjila (<mailto:ryadbenadjila@gmail.com>)
+  * Thomas Calderon (<mailto:calderon.thomas@gmail.com>)
   * Marion Daubignard (<mailto:marion.daubignard@ssi.gouv.fr>)
 
 ## OS Support <a name="OSSupport"></a>
diff --git a/doc/PRE-BUILD.md b/doc/PRE-BUILD.md
index 833227a..07580c7 100644
--- a/doc/PRE-BUILD.md
+++ b/doc/PRE-BUILD.md
@@ -52,11 +52,11 @@ This behavior is controlled using the `PKCS11PROXY_LIBNAME` variable.
 
 ### Client socket configuration
 The client library socket is defined at compile time.
-Use --with-socket to configure the client socket.
+Use --with-client-socket to configure the client socket.
 
-  * --with-socket=unix,/run/pkcs11-socket
+  * --with-client-socket=unix,/run/pkcs11-socket
     * (client will connect to UNIX domain socket located at /run/pkcs11-socket)
-  * --with-socket=tcp,127.0.0.1:4444
+  * --with-client-socket=tcp,127.0.0.1:4444
     * (client will establish a TCP socket with remote peer 127.0.0.1 and port 4444)
 
 However, an environment variable can be used to change the socket parameters.
diff --git a/doc/SERVER-CONF.md b/doc/SERVER-CONF.md
index a70802c..9a959f1 100644
--- a/doc/SERVER-CONF.md
+++ b/doc/SERVER-CONF.md
@@ -38,7 +38,49 @@ protocol{
 ...
 ```
 
-### Server SSL/TLS configuration
+### Server SSL/TLS configuration for versions > 1.0.6
+The SSL/TLS support can be turned on with the following configuration directives:
+
+```ocaml
+...
+processor {
+  ...
+      tls {
+        (* Ciphersuites, GnuTLS syntax *)
+        (* TLS 1.2, PFS-only suites, no DSS, no CAMELLIA *)
+        algorithms = "SECURE256:+SECURE128:-VERS-TLS-ALL:+VERS-TLS1.2:-RSA:-DHE-DSS:-CAMELLIA-128-CBC:-CAMELLIA-256-CBC";
+
+        (* Uncomment to enable DHE parameters, used for PFS *)
+        (*
+        dh_params {
+          (* Pre-computed DH parameters *)
+          pkcs3_file = "/etc/pkcs11proxyd/dhparams.pem";
+          (* Run-time DH parameters, warning: this takes a long time *)
+          (*bits = 2048;*)
+        };
+        *)
+        x509 {
+         key {
+           crt_file = "server.pem";
+           key_file = "server.key";
+         };
+         trust {
+           crt_file = "cacert.pem";
+         };
+        }
+      };
+  ...
+};
+...
+```
+
+Please note that the current implementation expects PEM files and that
+the private key has to be un-encrypted.
+
+The algorithm parameter accepts GnuTLS cipher list, the default only allows TLS 1.2 and modern PFS-enabled suites.
+The dh\_params can be configured to enable DHE suites. Also, parameters can be generated at startup but note that it will slow down startup.
+
+### Server SSL/TLS configuration for older releases
 The SSL/TLS support can be turned on with the following configuration directives:
 
 ```ocaml
diff --git a/docker-compose-unix.yml b/docker-compose-unix.yml
new file mode 100644
index 0000000..7844dc1
--- /dev/null
+++ b/docker-compose-unix.yml
@@ -0,0 +1,58 @@
+version: '3.6'
+services:
+  pkcs11proxyd-unix:
+    image: "pkcs11proxyd-unix:${FLAVOR}"
+    build:
+      context: .
+      dockerfile: src/tests/integration/Dockerfile.debian-integration-unix
+      args:
+        dist: "${DIST}"
+        flavor: "${FLAVOR}"
+    volumes:
+      - ./src/tests/integration/filter.conf:/build/src/tests/integration/filter.conf:ro
+      - ./src/tests/integration/pkcs11proxyd-unix.conf:/build/src/tests/integration/pkcs11proxyd.conf:ro
+      - vol-pkcs11proxyd-unix:/var/run/
+    entrypoint: '/usr/local/bin/pkcs11proxyd -fg -conf /build/src/tests/integration/pkcs11proxyd.conf'
+  pkcs11proxydtls-unix:
+    image: "pkcs11proxydtls-unix:${FLAVOR}"
+    build:
+      context: .
+      dockerfile: src/tests/integration/Dockerfile.debian-integration-unix-tls
+      args:
+        dist: "${DIST}"
+        flavor: "${FLAVOR}"
+    volumes:
+      - ./src/tests/integration/filter.conf:/build/src/tests/integration/filter.conf:ro
+      - ./src/tests/integration/pkcs11proxyd-unix-tls.conf:/build/src/tests/integration/pkcs11proxyd.conf:ro
+      - ./src/tests/integration/certs/ca.pem:/build/src/tests/integration/ca.pem:ro
+      - ./src/tests/integration/certs/server.pem:/build/src/tests/integration/server.pem:ro
+      - ./src/tests/integration/certs/server-key.pem:/build/src/tests/integration/server-key.pem:ro
+      - vol-pkcs11proxydtls-unix:/var/run/
+    entrypoint: '/usr/local/bin/pkcs11proxyd -fg -conf /build/src/tests/integration/pkcs11proxyd.conf'
+  client-unix:
+    image: "pkcs11proxyd-unix:${FLAVOR}"
+    depends_on:
+      - "pkcs11proxyd-unix"
+    volumes:
+      - vol-pkcs11proxyd-unix:/var/run/
+    environment: 
+      - PKCS11PROXY_LIBNAME=softhsm
+    entrypoint: /build/src/tests/integration/run-tests.sh
+  client-unix-tls:
+    image: "pkcs11proxydtls-unix:${FLAVOR}"
+    depends_on:
+      - "pkcs11proxydtls-unix"
+    environment: 
+      - PKCS11PROXY_LIBNAME=softhsm
+      - PKCS11PROXY_CA_FILE=/tmp/ca.pem
+      - PKCS11PROXY_CERT_FILE=/tmp/client.pem
+      - PKCS11PROXY_PRIVKEY_FILE=/tmp/client-key.pem
+    volumes:
+      - vol-pkcs11proxydtls-unix:/var/run/
+      - ./src/tests/integration/certs/ca.pem:/tmp/ca.pem:ro
+      - ./src/tests/integration/certs/client.pem:/tmp/client.pem:ro
+      - ./src/tests/integration/certs/client-key.pem:/tmp/client-key.pem:ro
+    entrypoint: /build/src/tests/integration/run-tests.sh
+volumes:
+  vol-pkcs11proxyd-unix:
+  vol-pkcs11proxydtls-unix:
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..f763375
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,54 @@
+version: '3.6'
+services:
+  pkcs11proxyd:
+    image: "pkcs11proxyd:${FLAVOR}"
+    build:
+      context: .
+      dockerfile: src/tests/integration/Dockerfile.debian-integration
+      args:
+        dist: "${DIST}"
+        flavor: "${FLAVOR}"
+    # ports:
+    #   - '4444:4444'
+    volumes:
+      - ./src/tests/integration/filter.conf:/build/src/tests/integration/filter.conf:ro
+      - ./src/tests/integration/pkcs11proxyd-tcp.conf:/build/src/tests/integration/pkcs11proxyd.conf:ro
+    entrypoint: '/usr/local/bin/pkcs11proxyd -fg -conf /build/src/tests/integration/pkcs11proxyd.conf'
+  pkcs11proxydtls:
+    image: "pkcs11proxydtls:${FLAVOR}"
+    build:
+      context: .
+      dockerfile: src/tests/integration/Dockerfile.debian-integration-tls
+      args:
+        dist: "${DIST}"
+        flavor: "${FLAVOR}"
+    volumes:
+      - ./src/tests/integration/filter.conf:/build/src/tests/integration/filter.conf:ro
+      - ./src/tests/integration/pkcs11proxyd-tcp-tls.conf:/build/src/tests/integration/pkcs11proxyd.conf:ro
+      - ./src/tests/integration/certs/ca.pem:/build/src/tests/integration/ca.pem:ro
+      - ./src/tests/integration/certs/server.pem:/build/src/tests/integration/server.pem:ro
+      - ./src/tests/integration/certs/server-key.pem:/build/src/tests/integration/server-key.pem:ro
+    entrypoint: '/usr/local/bin/pkcs11proxyd -fg -conf /build/src/tests/integration/pkcs11proxyd.conf'
+  client:
+    image: "pkcs11proxyd:${FLAVOR}"
+    depends_on:
+      - "pkcs11proxyd"
+    environment: 
+      - PKCS11PROXY_LIBNAME=softhsm
+      - PKCS11PROXY_SOCKET_PATH=pkcs11proxyd:4444
+    entrypoint: "/build/src/tests/integration/wait-for-it.sh pkcs11proxyd:4444 -- /build/src/tests/integration/run-tests.sh"
+  client-tls:
+    image: "pkcs11proxydtls:${FLAVOR}"
+    depends_on:
+      - "pkcs11proxydtls"
+    environment: 
+      - PKCS11PROXY_LIBNAME=softhsm
+      - PKCS11PROXY_SOCKET_PATH=pkcs11proxydtls:4444
+      - PKCS11PROXY_CA_FILE=/tmp/ca.pem
+      - PKCS11PROXY_CERT_FILE=/tmp/client.pem
+      - PKCS11PROXY_PRIVKEY_FILE=/tmp/client-key.pem
+    volumes:
+      - ./src/tests/integration/certs/ca.pem:/tmp/ca.pem:ro
+      - ./src/tests/integration/certs/client.pem:/tmp/client.pem:ro
+      - ./src/tests/integration/certs/client-key.pem:/tmp/client-key.pem:ro
+    entrypoint: "/build/src/tests/integration/wait-for-it.sh pkcs11proxydtls:4444 -- /build/src/tests/integration/run-tests.sh"
diff --git a/m4/ax_compare_version.m4 b/m4/ax_compare_version.m4
new file mode 100644
index 0000000..74dc0fd
--- /dev/null
+++ b/m4/ax_compare_version.m4
@@ -0,0 +1,177 @@
+# ===========================================================================
+#    http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+#   This macro compares two version strings. Due to the various number of
+#   minor-version numbers that can exist, and the fact that string
+#   comparisons are not compatible with numeric comparisons, this is not
+#   necessarily trivial to do in a autoconf script. This macro makes doing
+#   these comparisons easy.
+#
+#   The six basic comparisons are available, as well as checking equality
+#   limited to a certain number of minor-version levels.
+#
+#   The operator OP determines what type of comparison to do, and can be one
+#   of:
+#
+#    eq  - equal (test A == B)
+#    ne  - not equal (test A != B)
+#    le  - less than or equal (test A <= B)
+#    ge  - greater than or equal (test A >= B)
+#    lt  - less than (test A < B)
+#    gt  - greater than (test A > B)
+#
+#   Additionally, the eq and ne operator can have a number after it to limit
+#   the test to that number of minor versions.
+#
+#    eq0 - equal up to the length of the shorter version
+#    ne0 - not equal up to the length of the shorter version
+#    eqN - equal up to N sub-version levels
+#    neN - not equal up to N sub-version levels
+#
+#   When the condition is true, shell commands ACTION-IF-TRUE are run,
+#   otherwise shell commands ACTION-IF-FALSE are run. The environment
+#   variable 'ax_compare_version' is always set to either 'true' or 'false'
+#   as well.
+#
+#   Examples:
+#
+#     AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+#   would both be true.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+#   would both be false.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+#   would be true because it is only comparing two minor versions.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+#   would be true because it is only comparing the lesser number of minor
+#   versions of the two values.
+#
+#   Note: The characters that separate the version numbers do not matter. An
+#   empty string is the same as version 0. OP is evaluated by autoconf, not
+#   configure, so must be a string, not a variable.
+#
+#   The author would like to acknowledge Guido Draheim whose advice about
+#   the m4_case and m4_ifvaln functions make this macro only include the
+#   portions necessary to perform the specific comparison specified by the
+#   OP argument in the final configure script.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 11
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+  AC_REQUIRE([AC_PROG_AWK])
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+  AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+  A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+  B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+  dnl # then the first line is used to determine if the condition is true.
+  dnl # The sed right after the echo is to remove any indented white space.
+  m4_case(m4_tolower($2),
+  [lt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [gt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [le],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],
+  [ge],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],[
+    dnl Split the operator from the subversion count if present.
+    m4_bmatch(m4_substr($2,2),
+    [0],[
+      # A count of zero means use the length of the shorter version.
+      # Determine the number of characters in A and B.
+      ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+      ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+      # Set A to no more than B's length and B to no more than A's length.
+      A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+    ],
+    [[0-9]+],[
+      # A count greater than zero means use only that many subversions
+      A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+    ],
+    [.+],[
+      AC_WARNING(
+        [illegal OP numeric parameter: $2])
+    ],[])
+
+    # Pad zeros at end of numbers to make same length.
+    ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+    B="$B`echo $A | sed 's/./0/g'`"
+    A="$ax_compare_version_tmp_A"
+
+    # Check for equality or inequality as necessary.
+    m4_case(m4_tolower(m4_substr($2,0,2)),
+    [eq],[
+      test "x$A" = "x$B" && ax_compare_version=true
+    ],
+    [ne],[
+      test "x$A" != "x$B" && ax_compare_version=true
+    ],[
+      AC_WARNING([illegal OP parameter: $2])
+    ])
+  ])
+
+  AS_VAR_POPDEF([A])dnl
+  AS_VAR_POPDEF([B])dnl
+
+  dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+  if test "$ax_compare_version" = "true" ; then
+    m4_ifvaln([$4],[$4],[:])dnl
+    m4_ifvaln([$5],[else $5])dnl
+  fi
+]) dnl AX_COMPARE_VERSION
diff --git a/src/bindings-pkcs11/Makefile.in b/src/bindings-pkcs11/Makefile.in
index fe77e2e..a51db3c 100644
--- a/src/bindings-pkcs11/Makefile.in
+++ b/src/bindings-pkcs11/Makefile.in
@@ -1,5 +1,5 @@
 CC=@CC@
-CFLAGS_OPT = -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wuninitialized
+CFLAGS_OPT = -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wuninitialized -fcommon
 CFLAGS_OPT += ${CPPFLAGS}
 CFLAGS = -O2 -fPIC $(CFLAGS_OPT) -I@OCAMLLIB@
 CFLAGS_DBG = -g -fPIC -I@OCAMLLIB@ $(CFLAGS_OPT)
@@ -9,29 +9,37 @@ LDFLAGS = -cclib -L$(caml_link_dirs) -cclib -lcamlidl
 all:	@idl_gen@
 	$(CC) @srcdir@/pkcs11_stubs.c -DSERVER_ROLE -c $(CFLAGS)
 	$(CC) @srcdir@/pkcs11_functions.c @aliasing_def@ -DSERVER_ROLE -c $(CFLAGS)
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.mli
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.ml
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -o pkcs11 -c @srcdir@/pkcs11.mli
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -o pkcs11 -c @srcdir@/pkcs11.ml
 	ocamlmklib -o pkcs11 pkcs11.cmx pkcs11_functions.o pkcs11_stubs.o $(LDFLAGS)
 
 debug:	@idl_gen@
-	$(CC) @srcdir@/pkcs11_stubs.c -DSERVER_ROLE -DDEBUG -c $(CFLAGS_DBG)
-	$(CC) @srcdir@/pkcs11_functions.c @aliasing_def@ -DSERVER_ROLE -DDEBUG -c $(CFLAGS_DBG)
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.mli
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.ml
+	$(CC) @srcdir@/pkcs11_stubs.c -DSERVER_ROLE -DDEBUG -g -c $(CFLAGS_DBG)
+	$(CC) @srcdir@/pkcs11_functions.c @aliasing_def@ -DSERVER_ROLE -g -DDEBUG -c $(CFLAGS_DBG)
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -g -o pkcs11 -c @srcdir@/pkcs11.mli
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -g -o pkcs11 -c @srcdir@/pkcs11.ml
 	ocamlmklib -o pkcs11 pkcs11.cmx pkcs11_functions.o pkcs11_stubs.o $(LDFLAGS)
 
-idl:	
+idl:
 	@rm -f @idl_clean@
-	camlidl -header @srcdir@/pkcs11.idl
+	camlidl @idl_ocaml_bytes_module_define@ -header @srcdir@/pkcs11.idl
 	cat @srcdir@/pkcs11_stubs.c | sed -e 's/Begin_roots_block(\(.*\)).*/Begin_roots_block(\1);/g' | sed -e 's/Begin_root(\(.*\)).*/Begin_root(\1);/g' | sed -e 's/End_roots(\(.*\)).*/End_roots(\1);/g' > ./tmp
 	mv ./tmp @srcdir@/pkcs11_stubs.c
 	#Sed to patch (GetSlotList/GetMechList/FindObjects/GetObjectSize)
 	sed -i "s/* int/\* nativeint/g" @srcdir@/pkcs11.mli
 	sed -i "s/* int/\* nativeint/g" @srcdir@/pkcs11.ml
+	#Handle recent IDL (as they rename some functions and cocci patches will not be applied otherwise)
+	sed -i "s/caml_modify/modify/g" @srcdir@/pkcs11_stubs.c
+	sed -i "s/caml_copy_nativeint/custom_copy_int/g" @srcdir@/pkcs11_stubs.c
+	sed -i "s/caml_invalid_argument/invalid_argument/g" @srcdir@/pkcs11_stubs.c
+	# Patch the stubs with cocci
 	spatch --no-show-diff --in-place --sp-file @srcdir@/pkcs11_stubs.cocci @srcdir@/pkcs11_stubs.c
 	#Sed because spatch is not able to preprocess
 	sed -i 's/^_CAMLIDL_EXTERN_C/extern/g' @srcdir@/pkcs11.h
-	spatch --no-show-diff --in-place --sp-file @srcdir@/pkcs11.cocci @srcdir@/pkcs11.h
+	#Sed to change the structure packing pragma in WIN32 mode: CamlIDL fixes it to 8 while
+	#PKCS11 header fixes it to 1 => this can create binary interoperability issues
+	sed -i 's/push,8/push,1\/* Replaced for PKCS11 compatibiliy *\//g' @srcdir@/pkcs11.h
+	spatch --no-show-diff --in-place --sp-file @srcdir@/@pkcs11_cocci_patch@ @srcdir@/pkcs11.h
 	#Sed to force the produced idl variable context and some values to be tagged 'unused'
 	sed -i 's/\(.*\), camlidl_ctx _ctx)$$/#ifdef __GNUC__\n\1, __attribute__((unused)) camlidl_ctx _ctx)\n#else\n\1, camlidl_ctx _ctx)\n#endif/g' @srcdir@/pkcs11_stubs.c
 	sed -i 's/\(.*\)value _unit)$$/#ifdef __GNUC__\n\1__attribute__((unused))value _unit)\n#else\n\1value _unit)\n#endif/g' @srcdir@/pkcs11_stubs.c
diff --git a/src/bindings-pkcs11/Makefile.standalone.in b/src/bindings-pkcs11/Makefile.standalone.in
index e222f9f..5e1c78f 100644
--- a/src/bindings-pkcs11/Makefile.standalone.in
+++ b/src/bindings-pkcs11/Makefile.standalone.in
@@ -9,29 +9,37 @@ LDFLAGS = -cclib -L$(caml_link_dirs) -cclib -lcamlidl
 all:	@idl_gen@
 	$(CC) @srcdir@/pkcs11_stubs.c -c $(CFLAGS)
 	$(CC) @srcdir@/pkcs11_functions.c @aliasing_def@ -c $(CFLAGS)
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.mli
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.ml
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -o pkcs11 -c @srcdir@/pkcs11.mli
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -o pkcs11 -c @srcdir@/pkcs11.ml
 	ocamlmklib -o pkcs11_standalone pkcs11.cmx pkcs11_functions.o pkcs11_stubs.o $(LDFLAGS)
 
 debug:	@idl_gen@
-	$(CC) @srcdir@/pkcs11_stubs.c -DDEBUG -c $(CFLAGS_DBG)
-	$(CC) @srcdir@/pkcs11_functions.c @aliasing_def@ -DDEBUG -c $(CFLAGS_DBG)
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.mli
-	ocamlopt -o pkcs11 -c @srcdir@/pkcs11.ml
+	$(CC) @srcdir@/pkcs11_stubs.c -DSERVER_ROLE -DDEBUG -g -c $(CFLAGS_DBG)
+	$(CC) @srcdir@/pkcs11_functions.c @aliasing_def@ -DSERVER_ROLE -g -DDEBUG -c $(CFLAGS_DBG)
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -g -o pkcs11 -c @srcdir@/pkcs11.mli
+	ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@" -g -o pkcs11 -c @srcdir@/pkcs11.ml
 	ocamlmklib -o pkcs11_standalone pkcs11.cmx pkcs11_functions.o pkcs11_stubs.o $(LDFLAGS)
 
-idl:	
+idl:
 	@rm -f @idl_clean@
-	camlidl -header @srcdir@/pkcs11.idl
+	camlidl @idl_ocaml_bytes_module_define@ -header @srcdir@/pkcs11.idl
 	cat @srcdir@/pkcs11_stubs.c | sed -e 's/Begin_roots_block(\(.*\)).*/Begin_roots_block(\1);/g' | sed -e 's/Begin_root(\(.*\)).*/Begin_root(\1);/g' | sed -e 's/End_roots(\(.*\)).*/End_roots(\1);/g' > ./tmp
 	mv ./tmp @srcdir@/pkcs11_stubs.c
 	#Sed to patch (GetSlotList/GetMechList/FindObjects/GetObjectSize)
 	sed -i "s/* int/\* nativeint/g" @srcdir@/pkcs11.mli
 	sed -i "s/* int/\* nativeint/g" @srcdir@/pkcs11.ml
+	#Handle recent IDL (as they rename some functions and cocci patches will not be applied otherwise)
+	sed -i "s/caml_modify/modify/g" @srcdir@/pkcs11_stubs.c
+	sed -i "s/caml_copy_nativeint/custom_copy_int/g" @srcdir@/pkcs11_stubs.c
+	sed -i "s/caml_invalid_argument/invalid_argument/g" @srcdir@/pkcs11_stubs.c
+	# Patch the stubs with cocci
 	spatch --no-show-diff --in-place --sp-file @srcdir@/pkcs11_stubs.cocci @srcdir@/pkcs11_stubs.c
 	#Sed because spatch is not able to preprocess
 	sed -i 's/^_CAMLIDL_EXTERN_C/extern/g' @srcdir@/pkcs11.h
-	spatch --no-show-diff --in-place --sp-file @srcdir@/pkcs11.cocci @srcdir@/pkcs11.h
+	#Sed to change the structure packing pragma in WIN32 mode: CamlIDL fixes it to 8 while
+	#PKCS11 header fixes it to 1 => this can create binary interoperability issues
+	sed -i 's/push,8/push,1\/* Replaced for PKCS11 compatibiliy *\//g' @srcdir@/pkcs11.h
+	spatch --no-show-diff --in-place --sp-file @srcdir@/@pkcs11_cocci_patch@ @srcdir@/pkcs11.h
 	#Sed to force the produced idl variable context and some values to be tagged 'unused'
 	sed -i 's/\(.*\), camlidl_ctx _ctx)$$/#ifdef __GNUC__\n\1, __attribute__((unused)) camlidl_ctx _ctx)\n#else\n\1, camlidl_ctx _ctx)\n#endif/g' @srcdir@/pkcs11_stubs.c
 	sed -i 's/\(.*\)value _unit)$$/#ifdef __GNUC__\n\1__attribute__((unused))value _unit)\n#else\n\1value _unit)\n#endif/g' @srcdir@/pkcs11_stubs.c
diff --git a/src/bindings-pkcs11/PRESENT_tables.h b/src/bindings-pkcs11/PRESENT_tables.h
index 56b453b..cfb7a20 100644
--- a/src/bindings-pkcs11/PRESENT_tables.h
+++ b/src/bindings-pkcs11/PRESENT_tables.h
@@ -1,43 +1,37 @@
 /*------------------------ MIT License HEADER ------------------------------------
-    Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
-    Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
+    Copyright ANSSI and NTU (2015)
+    Contributors:
+    Ryad BENADJILA [ryadbenadjila@gmail.com] and
+    Jian GUO [ntu.guo@gmail.com] and
+    Victor LOMNE [victor.lomne@ssi.gouv.fr] and
+    Thomas PEYRIN [thomas.peyrin@gmail.com]
 
     This software is a computer program whose purpose is to implement
-    a PKCS#11 proxy as well as a PKCS#11 filter with security features
-    in mind. The project source tree is subdivided in six parts.
-    There are five main parts:
-      1] OCaml/C PKCS#11 bindings (using OCaml IDL).
-      2] XDR RPC generators (to be used with ocamlrpcgen and/or rpcgen).
-      3] A PKCS#11 RPC server (daemon) in OCaml using a Netplex RPC basis.
-      4] A PKCS#11 filtering module used as a backend to the RPC server.
-      5] A PKCS#11 client module that comes as a dynamic library offering
-         the PKCS#11 API to the software.
-    There is one "optional" part:
-      6] Tests in C and OCaml to be used with client module 5] or with the
-         bindings 1]
-
-    Here is a big picture of how the PKCS#11 proxy works:
-
- ----------------------   --------  socket (TCP or Unix)  --------------------
-| 3] PKCS#11 RPC server|-|2] RPC  |<+++++++++++++++++++> | 5] Client library  |
- ----------------------  |  Layer | [SSL/TLS optional]   |  --------          |
-           |              --------                       | |2] RPC  | PKCS#11 |
- ----------------------                                  | |  Layer |functions|
-| 4] PKCS#11 filter    |                                 |  --------          |
- ----------------------                                   --------------------
-           |                                                        |
- ----------------------                                             |
-| 1] PKCS#11 OCaml     |                                  { PKCS#11 INTERFACE }
-|       bindings       |                                            |
- ----------------------                                       APPLICATION
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
- REAL PKCS#11 MIDDLEWARE
-    (shared library)
+    lightweight block ciphers with different optimizations for the x86
+    platform. Three algorithms have been implemented: PRESENT, LED and 
+    Piccolo. Three techniques have been explored: table based 
+    implementations, vperm (for vector permutation) and bitslice 
+    implementations. For more details, please refer to the SAC 2013
+    paper:
+    http://eprint.iacr.org/2013/445
+    as well as the documentation of the project.
+    Here is a big picture of how the code is divided:
+      - src/common contains common headers, structures and functions.
+      - src/table contains table based implementations, with the code 
+        that generates the tables in src/table/gen_tables. The code here 
+        is written in pure C so it should compile on any platform (x86  
+        and other architectures), as well as any OS flavour (*nix, 
+        Windows ...).
+      - src/vperm contains vperm based implementations. They are written 
+        in inline assembly for x86_64 and will only compile and work on 
+        this platform. The code only compiles with gcc, but porting it to
+        other assembly flavours should not be too complicated.
+      - src/bitslice contains bitslice based implementations. They are 
+        written in asm intrinsics. It should compile and run on i386 as 
+        well as x86_64 platforms, and it should be portable to other OS 
+        flavours since intrinsics are standard among many compilers.
+    Note: vperm and bitslice implementations require a x86 CPU with at least 
+    SSSE3 extensions.
 
     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
@@ -61,20 +55,6 @@
     shall not be used in advertising or otherwise to promote the sale, use or other
     dealings in this Software without prior written authorization.
 
-    The current source code is part of the bindings 1] source tree:
- ----------------------
-| 1] PKCS#11 OCaml     |
-|       bindings       |
- ----------------------
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
-  REAL PKCS#11 MIDDLEWARE
-     (shared library)
-
-    Project: PKCS#11 Filtering Proxy
-    File:    src/bindings-pkcs11/PRESENT_tables.h
 
 -------------------------- MIT License HEADER ----------------------------------*/
 unsigned long long T0_PRESENT[256] = {0x0003000300000000, 0x0002000300000001, 0x0002000300010000, 0x0003000200010001, 0x0003000200000001, 0x0002000200000000, 0x0003000200010000, 0x0003000300000001, 0x0002000200010001, 0x0003000300010000, 0x0003000300010001, 0x0003000200000000, 0x0002000300000000, 0x0002000300010001, 0x0002000200000001, 0x0002000200010000, 0x0001000300000002, 0x0000000300000003, 0x0000000300010002, 0x0001000200010003, 0x0001000200000003, 0x0000000200000002, 0x0001000200010002, 0x0001000300000003, 0x0000000200010003, 0x0001000300010002, 0x0001000300010003, 0x0001000200000002, 0x0000000300000002, 0x0000000300010003, 0x0000000200000003, 0x0000000200010002, 0x0001000300020000, 0x0000000300020001, 0x0000000300030000, 0x0001000200030001, 0x0001000200020001, 0x0000000200020000, 0x0001000200030000, 0x0001000300020001, 0x0000000200030001, 0x0001000300030000, 0x0001000300030001, 0x0001000200020000, 0x0000000300020000, 0x0000000300030001, 0x0000000200020001, 0x0000000200030000, 0x0003000100020002, 0x0002000100020003, 0x0002000100030002, 0x0003000000030003, 0x0003000000020003, 0x0002000000020002, 0x0003000000030002, 0x0003000100020003, 0x0002000000030003, 0x0003000100030002, 0x0003000100030003, 0x0003000000020002, 0x0002000100020002, 0x0002000100030003, 0x0002000000020003, 0x0002000000030002, 0x0003000100000002, 0x0002000100000003, 0x0002000100010002, 0x0003000000010003, 0x0003000000000003, 0x0002000000000002, 0x0003000000010002, 0x0003000100000003, 0x0002000000010003, 0x0003000100010002, 0x0003000100010003, 0x0003000000000002, 0x0002000100000002, 0x0002000100010003, 0x0002000000000003, 0x0002000000010002, 0x0001000100000000, 0x0000000100000001, 0x0000000100010000, 0x0001000000010001, 0x0001000000000001, 0x0000000000000000, 0x0001000000010000, 0x0001000100000001, 0x0000000000010001, 0x0001000100010000, 0x0001000100010001, 0x0001000000000000, 0x0000000100000000, 0x0000000100010001, 0x0000000000000001, 0x0000000000010000, 0x0003000100020000, 0x0002000100020001, 0x0002000100030000, 0x0003000000030001, 0x0003000000020001, 0x0002000000020000, 0x0003000000030000, 0x0003000100020001, 0x0002000000030001, 0x0003000100030000, 0x0003000100030001, 0x0003000000020000, 0x0002000100020000, 0x0002000100030001, 0x0002000000020001, 0x0002000000030000, 0x0003000300000002, 0x0002000300000003, 0x0002000300010002, 0x0003000200010003, 0x0003000200000003, 0x0002000200000002, 0x0003000200010002, 0x0003000300000003, 0x0002000200010003, 0x0003000300010002, 0x0003000300010003, 0x0003000200000002, 0x0002000300000002, 0x0002000300010003, 0x0002000200000003, 0x0002000200010002, 0x0001000100020002, 0x0000000100020003, 0x0000000100030002, 0x0001000000030003, 0x0001000000020003, 0x0000000000020002, 0x0001000000030002, 0x0001000100020003, 0x0000000000030003, 0x0001000100030002, 0x0001000100030003, 0x0001000000020002, 0x0000000100020002, 0x0000000100030003, 0x0000000000020003, 0x0000000000030002, 0x0003000300020000, 0x0002000300020001, 0x0002000300030000, 0x0003000200030001, 0x0003000200020001, 0x0002000200020000, 0x0003000200030000, 0x0003000300020001, 0x0002000200030001, 0x0003000300030000, 0x0003000300030001, 0x0003000200020000, 0x0002000300020000, 0x0002000300030001, 0x0002000200020001, 0x0002000200030000, 0x0003000300020002, 0x0002000300020003, 0x0002000300030002, 0x0003000200030003, 0x0003000200020003, 0x0002000200020002, 0x0003000200030002, 0x0003000300020003, 0x0002000200030003, 0x0003000300030002, 0x0003000300030003, 0x0003000200020002, 0x0002000300020002, 0x0002000300030003, 0x0002000200020003, 0x0002000200030002, 0x0003000100000000, 0x0002000100000001, 0x0002000100010000, 0x0003000000010001, 0x0003000000000001, 0x0002000000000000, 0x0003000000010000, 0x0003000100000001, 0x0002000000010001, 0x0003000100010000, 0x0003000100010001, 0x0003000000000000, 0x0002000100000000, 0x0002000100010001, 0x0002000000000001, 0x0002000000010000, 0x0001000300000000, 0x0000000300000001, 0x0000000300010000, 0x0001000200010001, 0x0001000200000001, 0x0000000200000000, 0x0001000200010000, 0x0001000300000001, 0x0000000200010001, 0x0001000300010000, 0x0001000300010001, 0x0001000200000000, 0x0000000300000000, 0x0000000300010001, 0x0000000200000001, 0x0000000200010000, 0x0001000300020002, 0x0000000300020003, 0x0000000300030002, 0x0001000200030003, 0x0001000200020003, 0x0000000200020002, 0x0001000200030002, 0x0001000300020003, 0x0000000200030003, 0x0001000300030002, 0x0001000300030003, 0x0001000200020002, 0x0000000300020002, 0x0000000300030003, 0x0000000200020003, 0x0000000200030002, 0x0001000100000002, 0x0000000100000003, 0x0000000100010002, 0x0001000000010003, 0x0001000000000003, 0x0000000000000002, 0x0001000000010002, 0x0001000100000003, 0x0000000000010003, 0x0001000100010002, 0x0001000100010003, 0x0001000000000002, 0x0000000100000002, 0x0000000100010003, 0x0000000000000003, 0x0000000000010002, 0x0001000100020000, 0x0000000100020001, 0x0000000100030000, 0x0001000000030001, 0x0001000000020001, 0x0000000000020000, 0x0001000000030000, 0x0001000100020001, 0x0000000000030001, 0x0001000100030000, 0x0001000100030001, 0x0001000000020000, 0x0000000100020000, 0x0000000100030001, 0x0000000000020001, 0x0000000000030000};
diff --git a/src/bindings-pkcs11/helpers_pkcs11.h b/src/bindings-pkcs11/helpers_pkcs11.h
index 0765c83..fa31571 100644
--- a/src/bindings-pkcs11/helpers_pkcs11.h
+++ b/src/bindings-pkcs11/helpers_pkcs11.h
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/bindings-pkcs11/pkcs11.cocci.new b/src/bindings-pkcs11/pkcs11.cocci.new
new file mode 100644
index 0000000..3656804
--- /dev/null
+++ b/src/bindings-pkcs11/pkcs11.cocci.new
@@ -0,0 +1,101 @@
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_Encrypt(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len, /*out*/ unsigned char *encrypted, /*in*/ unsigned long *encrypted_len);
++ ck_rv_t ML_CK_C_Encrypt(ck_session_handle_t session, unsigned char *data, unsigned long data_len, unsigned char **encrypted, unsigned long *encrypted_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_EncryptUpdate(ck_session_handle_t session, unsigned char *data, unsigned long data_len, unsigned char *encrypted, unsigned long *encrypted_len);
++ ck_rv_t ML_CK_C_EncryptUpdate(ck_session_handle_t session, unsigned char *data, unsigned long data_len, unsigned char **encrypted, unsigned long *encrypted_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_DigestEncryptUpdate(ck_session_handle_t session, unsigned char *data, unsigned long data_len, unsigned char *encrypted, unsigned long *encrypted_len);
++ ck_rv_t ML_CK_C_DigestEncryptUpdate(ck_session_handle_t session, unsigned char *data, unsigned long data_len, unsigned char **encrypted, unsigned long *encrypted_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_SignEncryptUpdate(ck_session_handle_t session, unsigned char *data, unsigned long data_len, unsigned char *encrypted, unsigned long *encrypted_len);
++ ck_rv_t ML_CK_C_SignEncryptUpdate(ck_session_handle_t session, unsigned char *data, unsigned long data_len, unsigned char **encrypted, unsigned long *encrypted_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_EncryptFinal(ck_session_handle_t session, unsigned char *encrypted, unsigned long *encrypted_len);
++ ck_rv_t ML_CK_C_EncryptFinal(ck_session_handle_t session, unsigned char **encrypted, unsigned long *encrypted_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_Decrypt(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char *decrypted, unsigned long *decrypted_len);
++ ck_rv_t ML_CK_C_Decrypt(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char **decrypted, unsigned long *decrypted_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_VerifyRecover(ck_session_handle_t session, unsigned char *signature, unsigned long signature_len, unsigned char *data, unsigned long *data_len);
++ ck_rv_t ML_CK_C_VerifyRecover(ck_session_handle_t session, unsigned char *signature, unsigned long signature_len, unsigned char **data, unsigned long *data_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_DecryptUpdate(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char *data, unsigned long *data_len);
++ ck_rv_t ML_CK_C_DecryptUpdate(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char **data, unsigned long *data_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_DecryptDigestUpdate(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char *data, unsigned long *data_len);
++ ck_rv_t ML_CK_C_DecryptDigestUpdate(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char **data, unsigned long *data_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_DecryptVerifyUpdate(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char *data, unsigned long *data_len);
++ ck_rv_t ML_CK_C_DecryptVerifyUpdate(ck_session_handle_t session, unsigned char *encrypted, unsigned long encrypted_len, unsigned char **data, unsigned long *data_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_DecryptFinal(ck_session_handle_t session, unsigned char *decrypted, unsigned long *decrypted_len);
++ ck_rv_t ML_CK_C_DecryptFinal(ck_session_handle_t session, unsigned char **decrypted, unsigned long *decrypted_len);
+
+@@
+typedef ck_rv_t;
+typedef ck_session_handle_t;
+@@
+- ck_rv_t ML_CK_C_GetOperationState(ck_session_handle_t session, unsigned char *data, unsigned long *data_len);
++ ck_rv_t ML_CK_C_GetOperationState(ck_session_handle_t session, unsigned char **data, unsigned long *data_len);
+
+@@
+@@
+- void char_array_to_ulong(/*in*/ unsigned char *data, /*out*/ unsigned long output);
++ void char_array_to_ulong(/*in*/ unsigned char *data, /*in*/ size_t data_size, /*out*/ unsigned long *output);
+
+@@
+symbol in, out, out_len;
+@@
+- void hton_char_array(/*in*/ unsigned char *in, /*out*/ unsigned char *out, /*in*/ unsigned long *out_len);
++ void hton_char_array(/*in*/ unsigned char *in, unsigned long in_len, /*out*/ unsigned char *out, /*in*/ unsigned long *out_len); 
+
+@@
+symbol in, out, out_len;
+@@
+- void ntoh_char_array(/*in*/ unsigned char *in, /*out*/ unsigned char *out, /*in*/ unsigned long *out_len);
++ void ntoh_char_array(/*in*/ unsigned char *in, unsigned long in_len, /*out*/ unsigned char *out, /*in*/ unsigned long *out_len); 
+
diff --git a/src/bindings-pkcs11/pkcs11.cocci b/src/bindings-pkcs11/pkcs11.cocci.old
similarity index 100%
rename from src/bindings-pkcs11/pkcs11.cocci
rename to src/bindings-pkcs11/pkcs11.cocci.old
diff --git a/src/bindings-pkcs11/pkcs11.h b/src/bindings-pkcs11/pkcs11.h
index e92156f..be306b9 100644
--- a/src/bindings-pkcs11/pkcs11.h
+++ b/src/bindings-pkcs11/pkcs11.h
@@ -1,82 +1,3 @@
-/*------------------------ MIT License HEADER ------------------------------------
-    Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
-    Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
-
-    This software is a computer program whose purpose is to implement
-    a PKCS#11 proxy as well as a PKCS#11 filter with security features
-    in mind. The project source tree is subdivided in six parts.
-    There are five main parts:
-      1] OCaml/C PKCS#11 bindings (using OCaml IDL).
-      2] XDR RPC generators (to be used with ocamlrpcgen and/or rpcgen).
-      3] A PKCS#11 RPC server (daemon) in OCaml using a Netplex RPC basis.
-      4] A PKCS#11 filtering module used as a backend to the RPC server.
-      5] A PKCS#11 client module that comes as a dynamic library offering
-         the PKCS#11 API to the software.
-    There is one "optional" part:
-      6] Tests in C and OCaml to be used with client module 5] or with the
-         bindings 1]
-
-    Here is a big picture of how the PKCS#11 proxy works:
-
- ----------------------   --------  socket (TCP or Unix)  --------------------
-| 3] PKCS#11 RPC server|-|2] RPC  |<+++++++++++++++++++> | 5] Client library  |
- ----------------------  |  Layer | [SSL/TLS optional]   |  --------          |
-           |              --------                       | |2] RPC  | PKCS#11 |
- ----------------------                                  | |  Layer |functions|
-| 4] PKCS#11 filter    |                                 |  --------          |
- ----------------------                                   --------------------
-           |                                                        |
- ----------------------                                             |
-| 1] PKCS#11 OCaml     |                                  { PKCS#11 INTERFACE }
-|       bindings       |                                            |
- ----------------------                                       APPLICATION
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
- REAL PKCS#11 MIDDLEWARE
-    (shared library)
-
-    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:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    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.
-
-    Except as contained in this notice, the name(s) of the above copyright holders
-    shall not be used in advertising or otherwise to promote the sale, use or other
-    dealings in this Software without prior written authorization.
-
-    The current source code is part of the bindings 1] source tree:
- ----------------------
-| 1] PKCS#11 OCaml     |
-|       bindings       |
- ----------------------
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
-  REAL PKCS#11 MIDDLEWARE
-     (shared library)
-
-    Project: PKCS#11 Filtering Proxy
-    File:    src/bindings-pkcs11/pkcs11.h
-
--------------------------- MIT License HEADER ----------------------------------*/
 /* File generated from pkcs11.idl */
 
 #ifndef _CAMLIDL_PKCS11_H
@@ -89,7 +10,7 @@
 #endif
 
 #ifdef _WIN32
-#pragma pack(push,1)		/* necessary for COM interfaces */
+#pragma pack(push,1/* Replaced for PKCS11 compatibiliy */) /* necessary for COM interfaces */
 #endif
 
 #include <stdint.h>
@@ -105,6 +26,7 @@ struct ck_version {
 
 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
 
+
 #ifdef __FreeBSD__
 /* Needed on FreeBSD for endianess conversion functions */
 #include <sys/endian.h>
@@ -131,28 +53,25 @@ struct ck_version {
 #endif
 
 #ifdef CUSTOM_ALLOC
-void *custom_malloc(size_t size);
-void custom_free(void **to_free);
+void* custom_malloc(size_t size);
+void custom_free(void** to_free);
 
 /* Custom malloc to fail on malloc error */
-void *custom_malloc(size_t size)
-{
-  void *returned_pointer = (void *)malloc(size);
-  if (returned_pointer == NULL) {
+void* custom_malloc(size_t size){
+  void* returned_pointer = (void*)malloc(size);
+  if(returned_pointer == NULL){
 #ifdef DEBUG
-    printf("malloc error: NULL pointer returned! We exit\n");
+    printf ("malloc error: NULL pointer returned! We exit\n");
 #endif
     exit(-1);
   }
   return returned_pointer;
 }
-
 /* Custom free to force NULL on variables */
-void custom_free(void **to_free)
-{
-  if (*to_free == NULL) {
+void custom_free(void** to_free){
+  if(*to_free == NULL){
 #ifdef DEBUG
-    printf("warning: trying to free a NULL pointer! Ignoring ...\n");
+    printf ("warning: trying to free a NULL pointer! Ignoring ...\n");
 #endif
     return;
   }
@@ -161,8 +80,8 @@ void custom_free(void **to_free)
   return;
 }
 #else
-extern void *custom_malloc(size_t size);
-extern void custom_free(void **to_free);
+extern void* custom_malloc(size_t size);
+extern void custom_free(void** to_free);
 #endif
 /* To handle nativeint versus int64 for native bindings versus RPC ocaml client */
 #ifdef CAMLRPC
@@ -371,226 +290,107 @@ struct ck_c_initialize_args {
   void *reserved;
 };
 
-extern ck_rv_t ML_CK_C_Daemonize( /*in */ unsigned char *param,	/*in */
-				 unsigned long param_len);
+extern ck_rv_t ML_CK_C_Daemonize(/*in*/ unsigned char *param, /*in*/ unsigned long param_len);
 
-extern ck_rv_t ML_CK_C_SetupArch( /*in */ unsigned int arch);
+extern ck_rv_t ML_CK_C_SetupArch(/*in*/ unsigned int arch);
 
-extern ck_rv_t ML_CK_C_LoadModule( /*in */ unsigned char *libname);
+extern ck_rv_t ML_CK_C_LoadModule(/*in*/ unsigned char *libname);
 
 extern ck_rv_t ML_CK_C_Initialize(void);
 
 extern ck_rv_t ML_CK_C_Finalize(void);
 
-extern ck_rv_t ML_CK_C_GetSlotList( /*in */ unsigned int token_present,	/*out */
-				   ck_slot_id_t * slot_list,	/*in */
-				   unsigned long count,	/*out */
-				   unsigned long *real_count);
-
-extern ck_rv_t ML_CK_C_GetInfo( /*out */ struct ck_info *info);
-
-extern ck_rv_t ML_CK_C_WaitForSlotEvent( /*in */ ck_flags_t flags,	/*out */
-					ck_slot_id_t * slot_id);
+extern ck_rv_t ML_CK_C_GetSlotList(/*in*/ unsigned int token_present, /*out*/ ck_slot_id_t *slot_list, /*in*/ unsigned long count, /*out*/ unsigned long *real_count);
+
+extern ck_rv_t ML_CK_C_GetInfo(/*out*/ struct ck_info *info);
+
+extern ck_rv_t ML_CK_C_WaitForSlotEvent(/*in*/ ck_flags_t flags, /*out*/ ck_slot_id_t *slot_id);
+
+extern ck_rv_t ML_CK_C_GetSlotInfo(/*in*/ ck_slot_id_t slot_id, /*out*/ struct ck_slot_info *info);
+
+extern ck_rv_t ML_CK_C_GetTokenInfo(/*in*/ ck_slot_id_t slot_id, /*out*/ struct ck_token_info *info);
+
+extern ck_rv_t ML_CK_C_InitToken(/*in*/ ck_slot_id_t slot_id, /*in*/ unsigned char *pin, /*in*/ unsigned long pin_len, /*in*/ unsigned char *label);
+
+extern ck_rv_t ML_CK_C_OpenSession(/*in*/ ck_slot_id_t slot_id, /*in*/ ck_flags_t flags, /*out*/ ck_session_handle_t *session);
+
+extern ck_rv_t ML_CK_C_CloseSession(/*in*/ ck_session_handle_t session);
+
+extern ck_rv_t ML_CK_C_CloseAllSessions(/*in*/ ck_slot_id_t slot_id);
+
+extern ck_rv_t ML_CK_C_GetSessionInfo(/*in*/ ck_session_handle_t session, /*out*/ struct ck_session_info *info);
+
+extern ck_rv_t ML_CK_C_Login(/*in*/ ck_session_handle_t session, /*in*/ ck_user_type_t user_type, /*in*/ unsigned char *pin, /*in*/ unsigned long pin_len);
+
+extern ck_rv_t ML_CK_C_Logout(/*in*/ ck_session_handle_t session);
+
+extern ck_rv_t ML_CK_C_GetMechanismList(/*in*/ ck_slot_id_t slot_id, /*out*/ ck_mechanism_type_t *mechanism_list, /*in*/ unsigned long count, /*out*/ unsigned long *real_count);
+
+extern ck_rv_t ML_CK_C_GetMechanismInfo(/*in*/ ck_slot_id_t slot_id, /*in*/ ck_mechanism_type_t mechanism, /*out*/ struct ck_mechanism_info *info);
+
+extern ck_rv_t ML_CK_C_InitPIN(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *pin, /*in*/ unsigned long pin_len);
+
+extern ck_rv_t ML_CK_C_SetPIN(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *old_pin, /*in*/ unsigned long old_pin_len, /*in*/ unsigned char *new_pin, /*in*/ unsigned long new_pin_len);
+
+extern ck_rv_t ML_CK_C_SeedRandom(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *seed, /*in*/ unsigned long seed_len);
+
+extern ck_rv_t ML_CK_C_GenerateRandom(/*in*/ ck_session_handle_t session, /*out*/ unsigned char *rand_value, /*in*/ unsigned long rand_len);
+
+extern ck_rv_t ML_CK_C_FindObjectsInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_attribute *templ, /*in*/ unsigned long count);
+
+extern ck_rv_t ML_CK_C_FindObjects(/*in*/ ck_session_handle_t session, /*out*/ ck_object_handle_t *object, /*in*/ unsigned long max_object_count, /*out*/ unsigned long *object_count);
+
+extern ck_rv_t ML_CK_C_FindObjectsFinal(/*in*/ ck_session_handle_t session);
+
+extern ck_rv_t ML_CK_C_GenerateKey(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ struct ck_attribute *templ, /*in*/ unsigned long count, /*out*/ ck_object_handle_t *phkey);
+
+extern ck_rv_t ML_CK_C_GenerateKeyPair(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ struct ck_attribute *pub_templ, /*in*/ unsigned long pub_count, /*in*/ struct ck_attribute *priv_templ, /*in*/ unsigned long priv_count, /*out*/ ck_object_handle_t *phpubkey, /*out*/ ck_object_handle_t *phprivkey);
 
-extern ck_rv_t ML_CK_C_GetSlotInfo( /*in */ ck_slot_id_t slot_id,	/*out */
-				   struct ck_slot_info *info);
-
-extern ck_rv_t ML_CK_C_GetTokenInfo( /*in */ ck_slot_id_t slot_id,	/*out */
-				    struct ck_token_info *info);
-
-extern ck_rv_t ML_CK_C_InitToken( /*in */ ck_slot_id_t slot_id,	/*in */
-				 unsigned char *pin,	/*in */
-				 unsigned long pin_len,	/*in */
-				 unsigned char *label);
-
-extern ck_rv_t ML_CK_C_OpenSession( /*in */ ck_slot_id_t slot_id,	/*in */
-				   ck_flags_t flags,	/*out */
-				   ck_session_handle_t * session);
-
-extern ck_rv_t ML_CK_C_CloseSession( /*in */ ck_session_handle_t session);
-
-extern ck_rv_t ML_CK_C_CloseAllSessions( /*in */ ck_slot_id_t slot_id);
-
-extern ck_rv_t ML_CK_C_GetSessionInfo( /*in */ ck_session_handle_t session,
-				      /*out */ struct ck_session_info *info);
-
-extern ck_rv_t ML_CK_C_Login( /*in */ ck_session_handle_t session,	/*in */
-			     ck_user_type_t user_type,	/*in */
-			     unsigned char *pin, /*in */ unsigned long pin_len);
-
-extern ck_rv_t ML_CK_C_Logout( /*in */ ck_session_handle_t session);
-
-extern ck_rv_t ML_CK_C_GetMechanismList( /*in */ ck_slot_id_t slot_id,	/*out */
-					ck_mechanism_type_t * mechanism_list,
-					/*in */ unsigned long count,
-					/*out */
-					unsigned long *real_count);
-
-extern ck_rv_t ML_CK_C_GetMechanismInfo( /*in */ ck_slot_id_t slot_id,	/*in */
-					ck_mechanism_type_t mechanism,	/*out */
-					struct ck_mechanism_info *info);
-
-extern ck_rv_t ML_CK_C_InitPIN( /*in */ ck_session_handle_t session,	/*in */
-			       unsigned char *pin,	/*in */
-			       unsigned long pin_len);
-
-extern ck_rv_t ML_CK_C_SetPIN( /*in */ ck_session_handle_t session,	/*in */
-			      unsigned char *old_pin,	/*in */
-			      unsigned long old_pin_len,	/*in */
-			      unsigned char *new_pin,	/*in */
-			      unsigned long new_pin_len);
-
-extern ck_rv_t ML_CK_C_SeedRandom( /*in */ ck_session_handle_t session,	/*in */
-				  unsigned char *seed,	/*in */
-				  unsigned long seed_len);
-
-extern ck_rv_t ML_CK_C_GenerateRandom( /*in */ ck_session_handle_t session,
-				      /*out */ unsigned char *rand_value,
-				      /*in */ unsigned long rand_len);
-
-extern ck_rv_t ML_CK_C_FindObjectsInit( /*in */ ck_session_handle_t session,
-				       /*in */ struct ck_attribute *templ,
-				       /*in */ unsigned long count);
-
-extern ck_rv_t ML_CK_C_FindObjects( /*in */ ck_session_handle_t session,
-				   /*out */ ck_object_handle_t * object,
-				   /*in */
-				   unsigned long max_object_count,	/*out */
-				   unsigned long *object_count);
-
-extern ck_rv_t ML_CK_C_FindObjectsFinal( /*in */ ck_session_handle_t session);
-
-extern ck_rv_t ML_CK_C_GenerateKey( /*in */ ck_session_handle_t session,	/*in */
-				   struct ck_mechanism mechanism,	/*in */
-				   struct ck_attribute *templ,	/*in */
-				   unsigned long count,	/*out */
-				   ck_object_handle_t * phkey);
-
-extern ck_rv_t ML_CK_C_GenerateKeyPair( /*in */ ck_session_handle_t session,
-				       /*in */ struct ck_mechanism mechanism,
-				       /*in */ struct ck_attribute *pub_templ,
-				       /*in */ unsigned long pub_count,
-				       /*in */
-				       struct ck_attribute *priv_templ,	/*in */
-				       unsigned long priv_count,	/*out */
-				       ck_object_handle_t * phpubkey,	/*out */
-				       ck_object_handle_t * phprivkey);
-
-extern ck_rv_t ML_CK_C_CreateObject( /*in */ ck_session_handle_t session,
-				    /*in */ struct ck_attribute *templ,
-				    /*in */
-				    unsigned long count,	/*out */
-				    ck_object_handle_t * phobject);
-
-extern ck_rv_t ML_CK_C_CopyObject( /*in */ ck_session_handle_t session,	/*in */
-				  ck_object_handle_t hobject,	/*in */
-				  struct ck_attribute *templ,	/*in */
-				  unsigned long count,	/*out */
-				  ck_object_handle_t * phnewobject);
-
-extern ck_rv_t ML_CK_C_DestroyObject( /*in */ ck_session_handle_t session,
-				     /*in */ ck_object_handle_t hobject);
-
-extern ck_rv_t ML_CK_C_GetAttributeValue( /*in */ ck_session_handle_t session,
-					 /*in */ ck_object_handle_t hobject,
-					 /*in,out */ struct ck_attribute *templ,
-					 /*in */ unsigned long count);
-
-extern ck_rv_t ML_CK_C_SetAttributeValue( /*in */ ck_session_handle_t session,
-					 /*in */ ck_object_handle_t hobject,
-					 /*in */ struct ck_attribute *templ,
-					 /*in */ unsigned long count);
-
-extern ck_rv_t ML_CK_C_GetObjectSize( /*in */ ck_session_handle_t session,
-				     /*in */ ck_object_handle_t hobject,
-				     /*out */ unsigned long *object_size);
-
-extern ck_rv_t ML_CK_C_WrapKey( /*in */ ck_session_handle_t session,	/*in */
-			       struct ck_mechanism mechanism,	/*in */
-			       ck_object_handle_t hwrappingkey,	/*in */
-			       ck_object_handle_t hkey,	/*out */
-			       unsigned char *wrapped_key,	/*in */
-			       unsigned long *wrapped_key_len);
-
-extern ck_rv_t ML_CK_C_UnwrapKey( /*in */ ck_session_handle_t session,	/*in */
-				 struct ck_mechanism mechanism,	/*in */
-				 ck_object_handle_t hunwrappingkey,	/*in */
-				 unsigned char *wrapped_key,	/*in */
-				 unsigned long wrapped_key_len,	/*in */
-				 struct ck_attribute *templ,	/*in */
-				 unsigned long count,	/*out */
-				 ck_object_handle_t * phobject);
-
-extern ck_rv_t ML_CK_C_DeriveKey( /*in */ ck_session_handle_t session,	/*in */
-				 struct ck_mechanism mechanism,	/*in */
-				 ck_object_handle_t hbasekey,	/*in */
-				 struct ck_attribute *templ,	/*in */
-				 unsigned long count,	/*out */
-				 ck_object_handle_t * phkey);
-
-extern ck_rv_t ML_CK_C_DigestInit( /*in */ ck_session_handle_t session,	/*in */
-				  struct ck_mechanism mechanism);
-
-extern ck_rv_t ML_CK_C_Digest( /*in */ ck_session_handle_t session,	/*in */
-			      unsigned char *data,	/*in */
-			      unsigned long data_len,	/*out */
-			      unsigned char *digest,	/*in */
-			      unsigned long *digest_len);
-
-extern ck_rv_t ML_CK_C_DigestUpdate( /*in */ ck_session_handle_t session,
-				    /*in */ unsigned char *data,
-				    /*in */
-				    unsigned long data_len);
-
-extern ck_rv_t ML_CK_C_DigestKey( /*in */ ck_session_handle_t session,	/*in */
-				 ck_object_handle_t hkey);
-
-extern ck_rv_t ML_CK_C_DigestFinal( /*in */ ck_session_handle_t session,
-				   /*out */ unsigned char *digest,
-				   /*in */
-				   unsigned long *digest_len);
-
-extern ck_rv_t ML_CK_C_SignInit( /*in */ ck_session_handle_t session,	/*in */
-				struct ck_mechanism mechanism,	/*in */
-				ck_object_handle_t hkey);
-
-extern ck_rv_t ML_CK_C_SignRecoverInit( /*in */ ck_session_handle_t session,
-				       /*in */ struct ck_mechanism mechanism,
-				       /*in */ ck_object_handle_t hkey);
-
-extern ck_rv_t ML_CK_C_Sign( /*in */ ck_session_handle_t session,	/*in */
-			    unsigned char *data, /*in */ unsigned long data_len,
-			    /*out */ unsigned char *signature,
-			    /*in */
-			    unsigned long *signed_len);
-
-extern ck_rv_t ML_CK_C_SignRecover( /*in */ ck_session_handle_t session,	/*in */
-				   unsigned char *data,	/*in */
-				   unsigned long data_len,	/*out */
-				   unsigned char *signature,	/*in */
-				   unsigned long *signed_len);
-
-extern ck_rv_t ML_CK_C_SignUpdate( /*in */ ck_session_handle_t session,	/*in */
-				  unsigned char *data,	/*in */
-				  unsigned long data_len);
-
-extern ck_rv_t ML_CK_C_SignFinal( /*in */ ck_session_handle_t session,	/*out */
-				 unsigned char *signature,	/*in */
-				 unsigned long *signed_len);
-
-extern ck_rv_t ML_CK_C_VerifyInit( /*in */ ck_session_handle_t session,	/*in */
-				  struct ck_mechanism mechanism,	/*in */
-				  ck_object_handle_t hkey);
-
-extern ck_rv_t ML_CK_C_VerifyRecoverInit( /*in */ ck_session_handle_t session,
-					 /*in */ struct ck_mechanism mechanism,
-					 /*in */ ck_object_handle_t hkey);
-
-extern ck_rv_t ML_CK_C_Verify( /*in */ ck_session_handle_t session,	/*in */
-			      unsigned char *data,	/*in */
-			      unsigned long data_len,	/*in */
-			      unsigned char *signature,	/*in */
-			      unsigned long signed_len);
+extern ck_rv_t ML_CK_C_CreateObject(/*in*/ ck_session_handle_t session, /*in*/ struct ck_attribute *templ, /*in*/ unsigned long count, /*out*/ ck_object_handle_t *phobject);
+
+extern ck_rv_t ML_CK_C_CopyObject(/*in*/ ck_session_handle_t session, /*in*/ ck_object_handle_t hobject, /*in*/ struct ck_attribute *templ, /*in*/ unsigned long count, /*out*/ ck_object_handle_t *phnewobject);
+
+extern ck_rv_t ML_CK_C_DestroyObject(/*in*/ ck_session_handle_t session, /*in*/ ck_object_handle_t hobject);
+
+extern ck_rv_t ML_CK_C_GetAttributeValue(/*in*/ ck_session_handle_t session, /*in*/ ck_object_handle_t hobject, /*in,out*/ struct ck_attribute *templ, /*in*/ unsigned long count);
+
+extern ck_rv_t ML_CK_C_SetAttributeValue(/*in*/ ck_session_handle_t session, /*in*/ ck_object_handle_t hobject, /*in*/ struct ck_attribute *templ, /*in*/ unsigned long count);
+
+extern ck_rv_t ML_CK_C_GetObjectSize(/*in*/ ck_session_handle_t session, /*in*/ ck_object_handle_t hobject, /*out*/ unsigned long *object_size);
+
+extern ck_rv_t ML_CK_C_WrapKey(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hwrappingkey, /*in*/ ck_object_handle_t hkey, /*out*/ unsigned char *wrapped_key, /*in*/ unsigned long *wrapped_key_len);
+
+extern ck_rv_t ML_CK_C_UnwrapKey(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hunwrappingkey, /*in*/ unsigned char *wrapped_key, /*in*/ unsigned long wrapped_key_len, /*in*/ struct ck_attribute *templ, /*in*/ unsigned long count, /*out*/ ck_object_handle_t *phobject);
+
+extern ck_rv_t ML_CK_C_DeriveKey(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hbasekey, /*in*/ struct ck_attribute *templ, /*in*/ unsigned long count, /*out*/ ck_object_handle_t *phkey);
+
+extern ck_rv_t ML_CK_C_DigestInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism);
+
+extern ck_rv_t ML_CK_C_Digest(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len, /*out*/ unsigned char *digest, /*in*/ unsigned long *digest_len);
+
+extern ck_rv_t ML_CK_C_DigestUpdate(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len);
+
+extern ck_rv_t ML_CK_C_DigestKey(/*in*/ ck_session_handle_t session, /*in*/ ck_object_handle_t hkey);
+
+extern ck_rv_t ML_CK_C_DigestFinal(/*in*/ ck_session_handle_t session, /*out*/ unsigned char *digest, /*in*/ unsigned long *digest_len);
+
+extern ck_rv_t ML_CK_C_SignInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hkey);
+
+extern ck_rv_t ML_CK_C_SignRecoverInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hkey);
+
+extern ck_rv_t ML_CK_C_Sign(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len, /*out*/ unsigned char *signature, /*in*/ unsigned long *signed_len);
+
+extern ck_rv_t ML_CK_C_SignRecover(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len, /*out*/ unsigned char *signature, /*in*/ unsigned long *signed_len);
+
+extern ck_rv_t ML_CK_C_SignUpdate(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len);
+
+extern ck_rv_t ML_CK_C_SignFinal(/*in*/ ck_session_handle_t session, /*out*/ unsigned char *signature, /*in*/ unsigned long *signed_len);
+
+extern ck_rv_t ML_CK_C_VerifyInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hkey);
+
+extern ck_rv_t ML_CK_C_VerifyRecoverInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hkey);
+
+extern ck_rv_t ML_CK_C_Verify(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len, /*in*/ unsigned char *signature, /*in*/ unsigned long signed_len);
 
 extern ck_rv_t ML_CK_C_VerifyRecover(ck_session_handle_t session,
 				     unsigned char *signature,
@@ -598,21 +398,14 @@ extern ck_rv_t ML_CK_C_VerifyRecover(ck_session_handle_t session,
 				     unsigned char **data,
 				     unsigned long *data_len);
 
-extern ck_rv_t ML_CK_C_VerifyUpdate( /*in */ ck_session_handle_t session,
-				    /*in */ unsigned char *data,
-				    /*in */
-				    unsigned long data_len);
+extern ck_rv_t ML_CK_C_VerifyUpdate(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len);
 
-extern ck_rv_t ML_CK_C_VerifyFinal( /*in */ ck_session_handle_t session,	/*in */
-				   unsigned char *signature,	/*in */
-				   unsigned long signed_len);
+extern ck_rv_t ML_CK_C_VerifyFinal(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *signature, /*in*/ unsigned long signed_len);
 
-extern ck_rv_t ML_CK_C_EncryptInit( /*in */ ck_session_handle_t session,	/*in */
-				   struct ck_mechanism mechanism,	/*in */
-				   ck_object_handle_t hkey);
+extern ck_rv_t ML_CK_C_EncryptInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hkey);
 
-extern ck_rv_t ML_CK_C_Encrypt(ck_session_handle_t session, unsigned char *data,
-			       unsigned long data_len,
+extern ck_rv_t ML_CK_C_Encrypt(ck_session_handle_t session,
+			       unsigned char *data, unsigned long data_len,
 			       unsigned char **encrypted,
 			       unsigned long *encrypted_len);
 
@@ -638,9 +431,7 @@ extern ck_rv_t ML_CK_C_SignEncryptUpdate(ck_session_handle_t session,
 					 unsigned char **encrypted,
 					 unsigned long *encrypted_len);
 
-extern ck_rv_t ML_CK_C_DecryptInit( /*in */ ck_session_handle_t session,	/*in */
-				   struct ck_mechanism mechanism,	/*in */
-				   ck_object_handle_t hkey);
+extern ck_rv_t ML_CK_C_DecryptInit(/*in*/ ck_session_handle_t session, /*in*/ struct ck_mechanism mechanism, /*in*/ ck_object_handle_t hkey);
 
 extern ck_rv_t ML_CK_C_Decrypt(ck_session_handle_t session,
 			       unsigned char *encrypted,
@@ -674,374 +465,220 @@ extern ck_rv_t ML_CK_C_GetOperationState(ck_session_handle_t session,
 					 unsigned char **data,
 					 unsigned long *data_len);
 
-extern ck_rv_t ML_CK_C_SetOperationState( /*in */ ck_session_handle_t session,
-					 /*in */ unsigned char *data,
-					 /*in */
-					 unsigned long data_len,	/*in */
-					 ck_object_handle_t hencryptionkey,
-					 /*in */
-					 ck_object_handle_t hauthenticationkey);
+extern ck_rv_t ML_CK_C_SetOperationState(/*in*/ ck_session_handle_t session, /*in*/ unsigned char *data, /*in*/ unsigned long data_len, /*in*/ ck_object_handle_t hencryptionkey, /*in*/ ck_object_handle_t hauthenticationkey);
 
-extern ck_rv_t ML_CK_C_GetFunctionStatus( /*in */ ck_session_handle_t session);
+extern ck_rv_t ML_CK_C_GetFunctionStatus(/*in*/ ck_session_handle_t session);
 
-extern ck_rv_t ML_CK_C_CancelFunction( /*in */ ck_session_handle_t session);
+extern ck_rv_t ML_CK_C_CancelFunction(/*in*/ ck_session_handle_t session);
 
-extern void int_to_ulong_char_array( /*in */ unsigned long input,	/*out */
-				    unsigned char *data);
+extern void int_to_ulong_char_array(/*in*/ unsigned long input, /*out*/ unsigned char *data);
 
-extern void char_array_to_ulong( /*in */ unsigned char *data,	/*in */
-				size_t data_size,	/*out */
-				unsigned long *output);
+extern void char_array_to_ulong(/*in*/unsigned char *data,
+				/*in*/size_t data_size,
+				/*out*/unsigned long *output);
 
-extern void hton_char_array( /*in */ unsigned char *in, unsigned long in_len,
-								/*out */ unsigned char *out,
-								/*in */
-			    unsigned long *out_len);
+extern void hton_char_array(/*in*/unsigned char *in, unsigned long in_len,
+			    /*out*/unsigned char *out,
+			    /*in*/unsigned long *out_len);
 
-extern void ntoh_char_array( /*in */ unsigned char *in, unsigned long in_len,
-								/*out */ unsigned char *out,
-								/*in */
-			    unsigned long *out_len);
+extern void ntoh_char_array(/*in*/unsigned char *in, unsigned long in_len,
+			    /*out*/unsigned char *out,
+			    /*in*/unsigned long *out_len);
 
 /* Avoid declaring caml stuff when sharing this header with C rpc client code */
 #if !defined(CRPC)
-void camlidl_ml2c_pkcs11_ck_flags_t(value _v1, ck_flags_t * _c2,
-				    camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_flags_t(ck_flags_t * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_version(value _v1, struct ck_version *_c2,
-					   camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_struct_ck_version(struct ck_version *_c1,
-					    camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info *_c2,
-					camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_flags_t(value _v1, ck_flags_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_flags_t(ck_flags_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_version(value _v1, struct ck_version *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_struct_ck_version(struct ck_version *_c1, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info *_c2, camlidl_ctx _ctx);
 value camlidl_c2ml_pkcs11_struct_ck_info(struct ck_info *_c1, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_notification_t(value _v1, ck_notification_t * _c2,
-					   camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_notification_t(ck_notification_t * _c2,
-					    camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_slot_id_t(value _v1, ck_slot_id_t * _c2,
-				      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_slot_id_t(ck_slot_id_t * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1,
-					     struct ck_slot_info *_c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_struct_ck_slot_info(struct ck_slot_info *_c1,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1,
-					      struct ck_token_info *_c2,
-					      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_struct_ck_token_info(struct ck_token_info *_c1,
-					       camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_session_handle_t(value _v1,
-					     ck_session_handle_t * _c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_session_handle_t(ck_session_handle_t * _c2,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_user_type_t(value _v1, ck_user_type_t * _c2,
-					camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_user_type_t(ck_user_type_t * _c2,
-					 camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_state_t(value _v1, ck_state_t * _c2,
-				    camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_state_t(ck_state_t * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_session_info(value _v1,
-						struct ck_session_info *_c2,
-						camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_struct_ck_session_info(struct ck_session_info *_c1,
-						 camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_object_handle_t(value _v1, ck_object_handle_t * _c2,
-					    camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_object_handle_t(ck_object_handle_t * _c2,
-					     camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_object_class_t(value _v1, ck_object_class_t * _c2,
-					   camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_object_class_t(ck_object_class_t * _c2,
-					    camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_hw_feature_type_t(value _v1,
-					      ck_hw_feature_type_t * _c2,
-					      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_hw_feature_type_t(ck_hw_feature_type_t * _c2,
-					       camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_key_type_t(value _v1, ck_key_type_t * _c2,
-				       camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_key_type_t(ck_key_type_t * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_certificate_type_t(value _v1,
-					       ck_certificate_type_t * _c2,
-					       camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_certificate_type_t(ck_certificate_type_t * _c2,
-						camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_attribute_type_t(value _v1,
-					     ck_attribute_type_t * _c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_attribute_type_t(ck_attribute_type_t * _c2,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1,
-					     struct ck_attribute *_c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_struct_ck_attribute(struct ck_attribute *_c1,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date *_c2,
-					camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_notification_t(value _v1, ck_notification_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_notification_t(ck_notification_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_slot_id_t(value _v1, ck_slot_id_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_slot_id_t(ck_slot_id_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1, struct ck_slot_info *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_struct_ck_slot_info(struct ck_slot_info *_c1, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1, struct ck_token_info *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_struct_ck_token_info(struct ck_token_info *_c1, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_session_handle_t(value _v1, ck_session_handle_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_session_handle_t(ck_session_handle_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_user_type_t(value _v1, ck_user_type_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_user_type_t(ck_user_type_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_state_t(value _v1, ck_state_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_state_t(ck_state_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_session_info(value _v1, struct ck_session_info *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_struct_ck_session_info(struct ck_session_info *_c1, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_object_handle_t(value _v1, ck_object_handle_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_object_handle_t(ck_object_handle_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_object_class_t(value _v1, ck_object_class_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_object_class_t(ck_object_class_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_hw_feature_type_t(value _v1, ck_hw_feature_type_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_hw_feature_type_t(ck_hw_feature_type_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_key_type_t(value _v1, ck_key_type_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_key_type_t(ck_key_type_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_certificate_type_t(value _v1, ck_certificate_type_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_certificate_type_t(ck_certificate_type_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_attribute_type_t(value _v1, ck_attribute_type_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_attribute_type_t(ck_attribute_type_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1, struct ck_attribute *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_struct_ck_attribute(struct ck_attribute *_c1, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date *_c2, camlidl_ctx _ctx);
 value camlidl_c2ml_pkcs11_struct_ck_date(struct ck_date *_c1, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_mechanism_type_t(value _v1,
-					     ck_mechanism_type_t * _c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_mechanism_type_t(ck_mechanism_type_t * _c2,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1,
-					     struct ck_mechanism *_c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_struct_ck_mechanism(struct ck_mechanism *_c1,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_struct_ck_mechanism_info(value _v1,
-						  struct ck_mechanism_info *_c2,
-						  camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_struct_ck_mechanism_info(struct ck_mechanism_info
-						   *_c1, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_BYTE(value _v1, CK_BYTE * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_BYTE(CK_BYTE * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_CHAR(value _v1, CK_CHAR * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_CHAR(CK_CHAR * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_UTF8CHAR(value _v1, CK_UTF8CHAR * _c2,
-				     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_UTF8CHAR(CK_UTF8CHAR * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_BBOOL(value _v1, CK_BBOOL * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_BBOOL(CK_BBOOL * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_ULONG(value _v1, CK_ULONG * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_ULONG(CK_ULONG * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_LONG(value _v1, CK_LONG * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_LONG(CK_LONG * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_BYTE_PTR(value _v1, CK_BYTE_PTR * _c2,
-				     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_BYTE_PTR(CK_BYTE_PTR * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_CHAR_PTR(value _v1, CK_CHAR_PTR * _c2,
-				     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_CHAR_PTR(CK_CHAR_PTR * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_UTF8CHAR_PTR(value _v1, CK_UTF8CHAR_PTR * _c2,
-					 camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_UTF8CHAR_PTR(CK_UTF8CHAR_PTR * _c2,
-					  camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_ULONG_PTR(value _v1, CK_ULONG_PTR * _c2,
-				      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_ULONG_PTR(CK_ULONG_PTR * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_VERSION(value _v1, CK_VERSION * _c2,
-				    camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_VERSION(CK_VERSION * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_VERSION_PTR(value _v1, CK_VERSION_PTR * _c2,
-					camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_VERSION_PTR(CK_VERSION_PTR * _c2,
-					 camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_INFO(value _v1, CK_INFO * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_INFO(CK_INFO * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_INFO_PTR(value _v1, CK_INFO_PTR * _c2,
-				     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_INFO_PTR(CK_INFO_PTR * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_SLOT_ID_PTR(value _v1, CK_SLOT_ID_PTR * _c2,
-					camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_SLOT_ID_PTR(CK_SLOT_ID_PTR * _c2,
-					 camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_SLOT_INFO(value _v1, CK_SLOT_INFO * _c2,
-				      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_SLOT_INFO(CK_SLOT_INFO * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_SLOT_INFO_PTR(value _v1, CK_SLOT_INFO_PTR * _c2,
-					  camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_SLOT_INFO_PTR(CK_SLOT_INFO_PTR * _c2,
-					   camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_TOKEN_INFO(value _v1, CK_TOKEN_INFO * _c2,
-				       camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_TOKEN_INFO(CK_TOKEN_INFO * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_TOKEN_INFO_PTR(value _v1, CK_TOKEN_INFO_PTR * _c2,
-					   camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_TOKEN_INFO_PTR(CK_TOKEN_INFO_PTR * _c2,
-					    camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_SESSION_HANDLE_PTR(value _v1,
-					       CK_SESSION_HANDLE_PTR * _c2,
-					       camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_SESSION_HANDLE_PTR(CK_SESSION_HANDLE_PTR * _c2,
-						camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_SESSION_INFO(value _v1, CK_SESSION_INFO * _c2,
-					 camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_SESSION_INFO(CK_SESSION_INFO * _c2,
-					  camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_SESSION_INFO_PTR(value _v1,
-					     CK_SESSION_INFO_PTR * _c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_SESSION_INFO_PTR(CK_SESSION_INFO_PTR * _c2,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_OBJECT_HANDLE_PTR(value _v1,
-					      CK_OBJECT_HANDLE_PTR * _c2,
-					      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_OBJECT_HANDLE_PTR(CK_OBJECT_HANDLE_PTR * _c2,
-					       camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_OBJECT_CLASS_PTR(value _v1,
-					     CK_OBJECT_CLASS_PTR * _c2,
-					     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_OBJECT_CLASS_PTR(CK_OBJECT_CLASS_PTR * _c2,
-					      camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_ATTRIBUTE(value _v1, CK_ATTRIBUTE * _c2,
-				      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_ATTRIBUTE(CK_ATTRIBUTE * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_ATTRIBUTE_PTR(value _v1, CK_ATTRIBUTE_PTR * _c2,
-					  camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_ATTRIBUTE_PTR(CK_ATTRIBUTE_PTR * _c2,
-					   camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_DATE(value _v1, CK_DATE * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_DATE(CK_DATE * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_DATE_PTR(value _v1, CK_DATE_PTR * _c2,
-				     camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_DATE_PTR(CK_DATE_PTR * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_MECHANISM_TYPE_PTR(value _v1,
-					       CK_MECHANISM_TYPE_PTR * _c2,
-					       camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_MECHANISM_TYPE_PTR(CK_MECHANISM_TYPE_PTR * _c2,
-						camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_MECHANISM(value _v1, CK_MECHANISM * _c2,
-				      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_MECHANISM(CK_MECHANISM * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_MECHANISM_PTR(value _v1, CK_MECHANISM_PTR * _c2,
-					  camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_MECHANISM_PTR(CK_MECHANISM_PTR * _c2,
-					   camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO(value _v1, CK_MECHANISM_INFO * _c2,
-					   camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO(CK_MECHANISM_INFO * _c2,
-					    camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO_PTR(value _v1,
-					       CK_MECHANISM_INFO_PTR * _c2,
-					       camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO_PTR(CK_MECHANISM_INFO_PTR * _c2,
-						camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS(value _v1,
-					      CK_C_INITIALIZE_ARGS * _c2,
-					      camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS(CK_C_INITIALIZE_ARGS * _c2,
-					       camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS_PTR(value _v1,
-						  CK_C_INITIALIZE_ARGS_PTR *
-						  _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS_PTR(CK_C_INITIALIZE_ARGS_PTR *
-						   _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_rv_t(value _v1, ck_rv_t * _c2, camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_rv_t(ck_rv_t * _c2, camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_createmutex_t(value _v1, ck_createmutex_t * _c2,
-					  camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_createmutex_t(ck_createmutex_t * _c2,
-					   camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_destroymutex_t(value _v1, ck_destroymutex_t * _c2,
-					   camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_destroymutex_t(ck_destroymutex_t * _c2,
-					    camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_lockmutex_t(value _v1, ck_lockmutex_t * _c2,
-					camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_lockmutex_t(ck_lockmutex_t * _c2,
-					 camlidl_ctx _ctx);
-void camlidl_ml2c_pkcs11_ck_unlockmutex_t(value _v1, ck_unlockmutex_t * _c2,
-					  camlidl_ctx _ctx);
-value camlidl_c2ml_pkcs11_ck_unlockmutex_t(ck_unlockmutex_t * _c2,
-					   camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_mechanism_type_t(value _v1, ck_mechanism_type_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_mechanism_type_t(ck_mechanism_type_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1, struct ck_mechanism *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_struct_ck_mechanism(struct ck_mechanism *_c1, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_struct_ck_mechanism_info(value _v1, struct ck_mechanism_info *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_struct_ck_mechanism_info(struct ck_mechanism_info *_c1, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_BYTE(value _v1, CK_BYTE *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_BYTE(CK_BYTE *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_CHAR(value _v1, CK_CHAR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_CHAR(CK_CHAR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_UTF8CHAR(value _v1, CK_UTF8CHAR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_UTF8CHAR(CK_UTF8CHAR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_BBOOL(value _v1, CK_BBOOL *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_BBOOL(CK_BBOOL *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_ULONG(value _v1, CK_ULONG *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_ULONG(CK_ULONG *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_LONG(value _v1, CK_LONG *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_LONG(CK_LONG *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_BYTE_PTR(value _v1, CK_BYTE_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_BYTE_PTR(CK_BYTE_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_CHAR_PTR(value _v1, CK_CHAR_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_CHAR_PTR(CK_CHAR_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_UTF8CHAR_PTR(value _v1, CK_UTF8CHAR_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_UTF8CHAR_PTR(CK_UTF8CHAR_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_ULONG_PTR(value _v1, CK_ULONG_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_ULONG_PTR(CK_ULONG_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_VERSION(value _v1, CK_VERSION *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_VERSION(CK_VERSION *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_VERSION_PTR(value _v1, CK_VERSION_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_VERSION_PTR(CK_VERSION_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_INFO(value _v1, CK_INFO *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_INFO(CK_INFO *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_INFO_PTR(value _v1, CK_INFO_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_INFO_PTR(CK_INFO_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_SLOT_ID_PTR(value _v1, CK_SLOT_ID_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_SLOT_ID_PTR(CK_SLOT_ID_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_SLOT_INFO(value _v1, CK_SLOT_INFO *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_SLOT_INFO(CK_SLOT_INFO *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_SLOT_INFO_PTR(value _v1, CK_SLOT_INFO_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_SLOT_INFO_PTR(CK_SLOT_INFO_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_TOKEN_INFO(value _v1, CK_TOKEN_INFO *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_TOKEN_INFO(CK_TOKEN_INFO *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_TOKEN_INFO_PTR(value _v1, CK_TOKEN_INFO_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_TOKEN_INFO_PTR(CK_TOKEN_INFO_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_SESSION_HANDLE_PTR(value _v1, CK_SESSION_HANDLE_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_SESSION_HANDLE_PTR(CK_SESSION_HANDLE_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_SESSION_INFO(value _v1, CK_SESSION_INFO *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_SESSION_INFO(CK_SESSION_INFO *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_SESSION_INFO_PTR(value _v1, CK_SESSION_INFO_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_SESSION_INFO_PTR(CK_SESSION_INFO_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_OBJECT_HANDLE_PTR(value _v1, CK_OBJECT_HANDLE_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_OBJECT_HANDLE_PTR(CK_OBJECT_HANDLE_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_OBJECT_CLASS_PTR(value _v1, CK_OBJECT_CLASS_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_OBJECT_CLASS_PTR(CK_OBJECT_CLASS_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_ATTRIBUTE(value _v1, CK_ATTRIBUTE *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_ATTRIBUTE(CK_ATTRIBUTE *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_ATTRIBUTE_PTR(value _v1, CK_ATTRIBUTE_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_ATTRIBUTE_PTR(CK_ATTRIBUTE_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_DATE(value _v1, CK_DATE *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_DATE(CK_DATE *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_DATE_PTR(value _v1, CK_DATE_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_DATE_PTR(CK_DATE_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_MECHANISM_TYPE_PTR(value _v1, CK_MECHANISM_TYPE_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_MECHANISM_TYPE_PTR(CK_MECHANISM_TYPE_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_MECHANISM(value _v1, CK_MECHANISM *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_MECHANISM(CK_MECHANISM *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_MECHANISM_PTR(value _v1, CK_MECHANISM_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_MECHANISM_PTR(CK_MECHANISM_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO(value _v1, CK_MECHANISM_INFO *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO(CK_MECHANISM_INFO *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO_PTR(value _v1, CK_MECHANISM_INFO_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO_PTR(CK_MECHANISM_INFO_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS(value _v1, CK_C_INITIALIZE_ARGS *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS(CK_C_INITIALIZE_ARGS *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS_PTR(value _v1, CK_C_INITIALIZE_ARGS_PTR *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS_PTR(CK_C_INITIALIZE_ARGS_PTR *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_rv_t(value _v1, ck_rv_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_rv_t(ck_rv_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_createmutex_t(value _v1, ck_createmutex_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_createmutex_t(ck_createmutex_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_destroymutex_t(value _v1, ck_destroymutex_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_destroymutex_t(ck_destroymutex_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_lockmutex_t(value _v1, ck_lockmutex_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_lockmutex_t(ck_lockmutex_t *_c2, camlidl_ctx _ctx);
+void camlidl_ml2c_pkcs11_ck_unlockmutex_t(value _v1, ck_unlockmutex_t *_c2, camlidl_ctx _ctx);
+value camlidl_c2ml_pkcs11_ck_unlockmutex_t(ck_unlockmutex_t *_c2, camlidl_ctx _ctx);
 value camlidl_pkcs11_ML_CK_C_Daemonize(value _v_param);
 value camlidl_pkcs11_ML_CK_C_SetupArch(value _v_client_arch);
 value camlidl_pkcs11_ML_CK_C_LoadModule(value _v_libname);
 value camlidl_pkcs11_ML_CK_C_Initialize(value _unit);
 value camlidl_pkcs11_ML_CK_C_Finalize(value _unit);
-value camlidl_pkcs11_ML_CK_C_GetSlotList(value _v_token_present,
-					 value _v_count);
+value camlidl_pkcs11_ML_CK_C_GetSlotList(value _v_token_present, value _v_count);
 value camlidl_pkcs11_ML_CK_C_GetInfo(value _unit);
 value camlidl_pkcs11_ML_CK_C_WaitForSlotEvent(value _v_flags);
 value camlidl_pkcs11_ML_CK_C_GetSlotInfo(value _v_slot_id);
 value camlidl_pkcs11_ML_CK_C_GetTokenInfo(value _v_slot_id);
-value camlidl_pkcs11_ML_CK_C_InitToken(value _v_slot_id, value _v_pin,
-				       value _v_label);
+value camlidl_pkcs11_ML_CK_C_InitToken(value _v_slot_id, value _v_pin, value _v_label);
 value camlidl_pkcs11_ML_CK_C_OpenSession(value _v_slot_id, value _v_flags);
 value camlidl_pkcs11_ML_CK_C_CloseSession(value _v_session);
 value camlidl_pkcs11_ML_CK_C_CloseAllSessions(value _v_slot_id);
 value camlidl_pkcs11_ML_CK_C_GetSessionInfo(value _v_session);
-value camlidl_pkcs11_ML_CK_C_Login(value _v_session, value _v_user_type,
-				   value _v_pin);
+value camlidl_pkcs11_ML_CK_C_Login(value _v_session, value _v_user_type, value _v_pin);
 value camlidl_pkcs11_ML_CK_C_Logout(value _v_session);
 value camlidl_pkcs11_ML_CK_C_GetMechanismList(value _v_slot_id, value _v_count);
-value camlidl_pkcs11_ML_CK_C_GetMechanismInfo(value _v_slot_id,
-					      value _v_mechanism);
+value camlidl_pkcs11_ML_CK_C_GetMechanismInfo(value _v_slot_id, value _v_mechanism);
 value camlidl_pkcs11_ML_CK_C_InitPIN(value _v_session, value _v_pin);
-value camlidl_pkcs11_ML_CK_C_SetPIN(value _v_session, value _v_old_pin,
-				    value _v_new_pin);
+value camlidl_pkcs11_ML_CK_C_SetPIN(value _v_session, value _v_old_pin, value _v_new_pin);
 value camlidl_pkcs11_ML_CK_C_SeedRandom(value _v_session, value _v_seed);
-value camlidl_pkcs11_ML_CK_C_GenerateRandom(value _v_session,
-					    value _v_rand_len);
+value camlidl_pkcs11_ML_CK_C_GenerateRandom(value _v_session, value _v_rand_len);
 value camlidl_pkcs11_ML_CK_C_FindObjectsInit(value _v_session, value _v_templ);
-value camlidl_pkcs11_ML_CK_C_FindObjects(value _v_session,
-					 value _v_max_object_count);
+value camlidl_pkcs11_ML_CK_C_FindObjects(value _v_session, value _v_max_object_count);
 value camlidl_pkcs11_ML_CK_C_FindObjectsFinal(value _v_session);
-value camlidl_pkcs11_ML_CK_C_GenerateKey(value _v_session, value _v_mechanism,
-					 value _v_templ);
-value camlidl_pkcs11_ML_CK_C_GenerateKeyPair(value _v_session,
-					     value _v_mechanism,
-					     value _v_pub_templ,
-					     value _v_priv_templ);
+value camlidl_pkcs11_ML_CK_C_GenerateKey(value _v_session, value _v_mechanism, value _v_templ);
+value camlidl_pkcs11_ML_CK_C_GenerateKeyPair(value _v_session, value _v_mechanism, value _v_pub_templ, value _v_priv_templ);
 value camlidl_pkcs11_ML_CK_C_CreateObject(value _v_session, value _v_templ);
-value camlidl_pkcs11_ML_CK_C_CopyObject(value _v_session, value _v_hobject,
-					value _v_templ);
+value camlidl_pkcs11_ML_CK_C_CopyObject(value _v_session, value _v_hobject, value _v_templ);
 value camlidl_pkcs11_ML_CK_C_DestroyObject(value _v_session, value _v_hobject);
-value camlidl_pkcs11_ML_CK_C_GetAttributeValue(value _v_session,
-					       value _v_hobject,
-					       value _v_templ);
-value camlidl_pkcs11_ML_CK_C_SetAttributeValue(value _v_session,
-					       value _v_hobject,
-					       value _v_templ);
+value camlidl_pkcs11_ML_CK_C_GetAttributeValue(value _v_session, value _v_hobject, value _v_templ);
+value camlidl_pkcs11_ML_CK_C_SetAttributeValue(value _v_session, value _v_hobject, value _v_templ);
 value camlidl_pkcs11_ML_CK_C_GetObjectSize(value _v_session, value _v_hobject);
-value camlidl_pkcs11_ML_CK_C_WrapKey(value _v_session, value _v_mechanism,
-				     value _v_hwrappingkey, value _v_hkey);
-value camlidl_pkcs11_ML_CK_C_UnwrapKey(value _v_session, value _v_mechanism,
-				       value _v_hunwrappingkey,
-				       value _v_wrapped_key, value _v_templ);
-value camlidl_pkcs11_ML_CK_C_DeriveKey(value _v_session, value _v_mechanism,
-				       value _v_hbasekey, value _v_templ);
+value camlidl_pkcs11_ML_CK_C_WrapKey(value _v_session, value _v_mechanism, value _v_hwrappingkey, value _v_hkey);
+value camlidl_pkcs11_ML_CK_C_UnwrapKey(value _v_session, value _v_mechanism, value _v_hunwrappingkey, value _v_wrapped_key, value _v_templ);
+value camlidl_pkcs11_ML_CK_C_DeriveKey(value _v_session, value _v_mechanism, value _v_hbasekey, value _v_templ);
 value camlidl_pkcs11_ML_CK_C_DigestInit(value _v_session, value _v_mechanism);
 value camlidl_pkcs11_ML_CK_C_Digest(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_DigestUpdate(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_DigestKey(value _v_session, value _v_hkey);
 value camlidl_pkcs11_ML_CK_C_DigestFinal(value _v_session);
-value camlidl_pkcs11_ML_CK_C_SignInit(value _v_session, value _v_mechanism,
-				      value _v_hkey);
-value camlidl_pkcs11_ML_CK_C_SignRecoverInit(value _v_session,
-					     value _v_mechanism, value _v_hkey);
+value camlidl_pkcs11_ML_CK_C_SignInit(value _v_session, value _v_mechanism, value _v_hkey);
+value camlidl_pkcs11_ML_CK_C_SignRecoverInit(value _v_session, value _v_mechanism, value _v_hkey);
 value camlidl_pkcs11_ML_CK_C_Sign(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_SignRecover(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_SignUpdate(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_SignFinal(value _v_session);
-value camlidl_pkcs11_ML_CK_C_VerifyInit(value _v_session, value _v_mechanism,
-					value _v_hkey);
-value camlidl_pkcs11_ML_CK_C_VerifyRecoverInit(value _v_session,
-					       value _v_mechanism,
-					       value _v_hkey);
-value camlidl_pkcs11_ML_CK_C_Verify(value _v_session, value _v_data,
-				    value _v_signature);
-value camlidl_pkcs11_ML_CK_C_VerifyRecover(value _v_session,
-					   value _v_signature);
+value camlidl_pkcs11_ML_CK_C_VerifyInit(value _v_session, value _v_mechanism, value _v_hkey);
+value camlidl_pkcs11_ML_CK_C_VerifyRecoverInit(value _v_session, value _v_mechanism, value _v_hkey);
+value camlidl_pkcs11_ML_CK_C_Verify(value _v_session, value _v_data, value _v_signature);
+value camlidl_pkcs11_ML_CK_C_VerifyRecover(value _v_session, value _v_signature);
 value camlidl_pkcs11_ML_CK_C_VerifyUpdate(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_VerifyFinal(value _v_session, value _v_signature);
-value camlidl_pkcs11_ML_CK_C_EncryptInit(value _v_session, value _v_mechanism,
-					 value _v_hkey);
+value camlidl_pkcs11_ML_CK_C_EncryptInit(value _v_session, value _v_mechanism, value _v_hkey);
 value camlidl_pkcs11_ML_CK_C_Encrypt(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_EncryptUpdate(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_EncryptFinal(value _v_session);
-value camlidl_pkcs11_ML_CK_C_DigestEncryptUpdate(value _v_session,
-						 value _v_data);
+value camlidl_pkcs11_ML_CK_C_DigestEncryptUpdate(value _v_session, value _v_data);
 value camlidl_pkcs11_ML_CK_C_SignEncryptUpdate(value _v_session, value _v_data);
-value camlidl_pkcs11_ML_CK_C_DecryptInit(value _v_session, value _v_mechanism,
-					 value _v_hkey);
+value camlidl_pkcs11_ML_CK_C_DecryptInit(value _v_session, value _v_mechanism, value _v_hkey);
 value camlidl_pkcs11_ML_CK_C_Decrypt(value _v_session, value _v_encrypted);
-value camlidl_pkcs11_ML_CK_C_DecryptUpdate(value _v_session,
-					   value _v_encrypted);
+value camlidl_pkcs11_ML_CK_C_DecryptUpdate(value _v_session, value _v_encrypted);
 value camlidl_pkcs11_ML_CK_C_DecryptFinal(value _v_session);
-value camlidl_pkcs11_ML_CK_C_DecryptDigestUpdate(value _v_session,
-						 value _v_encrypted);
-value camlidl_pkcs11_ML_CK_C_DecryptVerifyUpdate(value _v_session,
-						 value _v_encrypted);
+value camlidl_pkcs11_ML_CK_C_DecryptDigestUpdate(value _v_session, value _v_encrypted);
+value camlidl_pkcs11_ML_CK_C_DecryptVerifyUpdate(value _v_session, value _v_encrypted);
 value camlidl_pkcs11_ML_CK_C_GetOperationState(value _v_session);
-value camlidl_pkcs11_ML_CK_C_SetOperationState(value _v_session, value _v_data,
-					       value _v_hencryptionkey,
-					       value _v_hauthenticationkey);
+value camlidl_pkcs11_ML_CK_C_SetOperationState(value _v_session, value _v_data, value _v_hencryptionkey, value _v_hauthenticationkey);
 value camlidl_pkcs11_ML_CK_C_GetFunctionStatus(value _v_session);
 value camlidl_pkcs11_ML_CK_C_CancelFunction(value _v_session);
 value camlidl_pkcs11_int_to_ulong_char_array(value _v_input);
@@ -1049,12 +686,13 @@ value camlidl_pkcs11_char_array_to_ulong(value _v_data);
 value camlidl_pkcs11_hton_char_array(value _v_data);
 value camlidl_pkcs11_ntoh_char_array(value _v_data);
 #ifdef SERVER_ROLE
-int decode_ck_attribute_arch(value, struct ck_attribute *, camlidl_ctx);
+int decode_ck_attribute_arch(value , struct ck_attribute *, camlidl_ctx);
 int encode_ck_attribute_arch(struct ck_attribute *, struct ck_attribute *);
 #endif
-#endif				/* !CRPC */
+#endif /* !CRPC */
 #ifdef _WIN32
 #pragma pack(pop)
 #endif
 
-#endif				/* !_CAMLIDL_PKCS11_H */
+
+#endif /* !_CAMLIDL_PKCS11_H */
diff --git a/src/bindings-pkcs11/pkcs11.idl b/src/bindings-pkcs11/pkcs11.idl
index 2f0c267..08576dd 100644
--- a/src/bindings-pkcs11/pkcs11.idl
+++ b/src/bindings-pkcs11/pkcs11.idl
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -3175,9 +3175,18 @@ quote(mli, "val char_array_to_bool : char array -> nativeint\n");
 quote(mli, "val sprint_bool_attribute_value : nativeint -> string\n");
 quote(mli, "val sprint_template_array : ck_attribute array -> string\n");
 
+/* Use aliases if this is an old version (< 4.02) of OCaml without a Bytes module */
+#ifdef OCAML_NO_BYTES_MODULE
+quote(ml, "module Bytes = String");
+
+quote(ml,
+      "let char_array_to_string = fun a -> let s = Bytes.create (Array.length a) in\n");
+quote(ml, "  Array.iteri (fun i x -> Bytes.set s i x) a; s;;\n");
+#else
 quote(ml,
-      "let char_array_to_string = fun a -> let s = String.create (Array.length a) in\n");
-quote(ml, "  Array.iteri (fun i x -> String.set s i x) a; s;;\n");
+      "let char_array_to_string = fun a -> let s = Bytes.create (Array.length a) in\n");
+quote(ml, "  Array.iteri (fun i x -> Bytes.set s i x) a; Bytes.to_string s;;\n");
+#endif
 
 quote(ml,
       "let string_to_char_array = fun s -> Array.init (String.length s) (fun i -> s.[i]);;\n");
@@ -3248,17 +3257,21 @@ quote(ml, "    (res);;");
 quote(ml, "let pack hexstr =");
 quote(ml, "     let len = String.length hexstr in");
 quote(ml, "     let half_len = len / 2 in");
-quote(ml, "     let res = String.create half_len in");
+quote(ml, "     let res = Bytes.create half_len in");
 quote(ml, "     let j = ref 0 in");
 quote(ml, "     for i = 0 to len - 2 do");
 quote(ml, "        if (i mod 2 == 0) then");
 quote(ml, "          (");
 quote(ml, "          let tmp = merge_nibbles hexstr.[i] hexstr.[i+1] in");
-quote(ml, "          res.[!j] <- tmp;");
+quote(ml, "          Bytes.set res !j tmp;");
 quote(ml, "          j := !j +1;");
 quote(ml, "          )");
 quote(ml, "     done;");
+#ifdef OCAML_NO_BYTES_MODULE
 quote(ml, "     (res);;");
+#else
+quote(ml, "     (Bytes.to_string res);;");
+#endif
 
 quote(ml, "let sprint_hex_array myarray =");
 quote(ml, "  let s = Array.fold_left (");
diff --git a/src/bindings-pkcs11/pkcs11.ml b/src/bindings-pkcs11/pkcs11.ml
index ad68446..8354cc3 100644
--- a/src/bindings-pkcs11/pkcs11.ml
+++ b/src/bindings-pkcs11/pkcs11.ml
@@ -1,82 +1,3 @@
-(************************* MIT License HEADER ************************************
-    Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
-    Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
-
-    This software is a computer program whose purpose is to implement
-    a PKCS#11 proxy as well as a PKCS#11 filter with security features
-    in mind. The project source tree is subdivided in six parts.
-    There are five main parts:
-      1] OCaml/C PKCS#11 bindings (using OCaml IDL).
-      2] XDR RPC generators (to be used with ocamlrpcgen and/or rpcgen).
-      3] A PKCS#11 RPC server (daemon) in OCaml using a Netplex RPC basis.
-      4] A PKCS#11 filtering module used as a backend to the RPC server.
-      5] A PKCS#11 client module that comes as a dynamic library offering
-         the PKCS#11 API to the software.
-    There is one "optional" part:
-      6] Tests in C and OCaml to be used with client module 5] or with the
-         bindings 1]
-
-    Here is a big picture of how the PKCS#11 proxy works:
-
- ----------------------   --------  socket (TCP or Unix)  --------------------
-| 3] PKCS#11 RPC server|-|2] RPC  |<+++++++++++++++++++> | 5] Client library  |
- ----------------------  |  Layer | [SSL/TLS optional]   |  --------          |
-           |              --------                       | |2] RPC  | PKCS#11 |
- ----------------------                                  | |  Layer |functions|
-| 4] PKCS#11 filter    |                                 |  --------          |
- ----------------------                                   --------------------
-           |                                                        |
- ----------------------                                             |
-| 1] PKCS#11 OCaml     |                                  { PKCS#11 INTERFACE }
-|       bindings       |                                            |
- ----------------------                                       APPLICATION
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
- REAL PKCS#11 MIDDLEWARE
-    (shared library)
-
-    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:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    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.
-
-    Except as contained in this notice, the name(s) of the above copyright holders
-    shall not be used in advertising or otherwise to promote the sale, use or other
-    dealings in this Software without prior written authorization.
-
-    The current source code is part of the bindings 1] source tree:
- ----------------------
-| 1] PKCS#11 OCaml     |
-|       bindings       |
- ----------------------
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
-  REAL PKCS#11 MIDDLEWARE
-     (shared library)
-
-    Project: PKCS#11 Filtering Proxy
-    File:    src/bindings-pkcs11/pkcs11.ml
-
-************************** MIT License HEADER ***********************************)
 (* File generated from pkcs11.idl *)
 
 type ck_flags_t = nativeint
@@ -1777,9 +1698,9 @@ let match_cKC_value a = match a with
 | 2n -> "cKC_WTLS"
 | 2147483648n -> "cKC_VENDOR_DEFINED"
 | _ -> "cKC_UNKNOWN!"
-let char_array_to_string = fun a -> let s = String.create (Array.length a) in
+let char_array_to_string = fun a -> let s = Bytes.create (Array.length a) in
 
-  Array.iteri (fun i x -> String.set s i x) a; s;;
+  Array.iteri (fun i x -> Bytes.set s i x) a; Bytes.to_string s;;
 
 let string_to_char_array = fun s -> Array.init (String.length s) (fun i -> s.[i]);;
 
@@ -1844,17 +1765,17 @@ let merge_nibbles niba nibb =
 let pack hexstr =
      let len = String.length hexstr in
      let half_len = len / 2 in
-     let res = String.create half_len in
+     let res = Bytes.create half_len in
      let j = ref 0 in
      for i = 0 to len - 2 do
         if (i mod 2 == 0) then
           (
           let tmp = merge_nibbles hexstr.[i] hexstr.[i+1] in
-          res.[!j] <- tmp;
+          Bytes.set res !j tmp;
           j := !j +1;
           )
      done;
-     (res);;
+     (Bytes.to_string res);;
 let sprint_hex_array myarray =
   let s = Array.fold_left (
     fun a elem -> Printf.sprintf "%s%02x" a (int_of_char elem);
diff --git a/src/bindings-pkcs11/pkcs11_aliasing.h b/src/bindings-pkcs11/pkcs11_aliasing.h
index 7db49a1..d18df3e 100644
--- a/src/bindings-pkcs11/pkcs11_aliasing.h
+++ b/src/bindings-pkcs11/pkcs11_aliasing.h
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/bindings-pkcs11/pkcs11_functions.c b/src/bindings-pkcs11/pkcs11_functions.c
index c2f03b8..322156e 100644
--- a/src/bindings-pkcs11/pkcs11_functions.c
+++ b/src/bindings-pkcs11/pkcs11_functions.c
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/bindings-pkcs11/pkcs11_functions.h b/src/bindings-pkcs11/pkcs11_functions.h
index b2f59d8..a927d3a 100644
--- a/src/bindings-pkcs11/pkcs11_functions.h
+++ b/src/bindings-pkcs11/pkcs11_functions.h
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/bindings-pkcs11/pkcs11_stubs.c b/src/bindings-pkcs11/pkcs11_stubs.c
index 86ea9a6..cb97274 100644
--- a/src/bindings-pkcs11/pkcs11_stubs.c
+++ b/src/bindings-pkcs11/pkcs11_stubs.c
@@ -1,82 +1,3 @@
-/*------------------------ MIT License HEADER ------------------------------------
-    Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
-    Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
-
-    This software is a computer program whose purpose is to implement
-    a PKCS#11 proxy as well as a PKCS#11 filter with security features
-    in mind. The project source tree is subdivided in six parts.
-    There are five main parts:
-      1] OCaml/C PKCS#11 bindings (using OCaml IDL).
-      2] XDR RPC generators (to be used with ocamlrpcgen and/or rpcgen).
-      3] A PKCS#11 RPC server (daemon) in OCaml using a Netplex RPC basis.
-      4] A PKCS#11 filtering module used as a backend to the RPC server.
-      5] A PKCS#11 client module that comes as a dynamic library offering
-         the PKCS#11 API to the software.
-    There is one "optional" part:
-      6] Tests in C and OCaml to be used with client module 5] or with the
-         bindings 1]
-
-    Here is a big picture of how the PKCS#11 proxy works:
-
- ----------------------   --------  socket (TCP or Unix)  --------------------
-| 3] PKCS#11 RPC server|-|2] RPC  |<+++++++++++++++++++> | 5] Client library  |
- ----------------------  |  Layer | [SSL/TLS optional]   |  --------          |
-           |              --------                       | |2] RPC  | PKCS#11 |
- ----------------------                                  | |  Layer |functions|
-| 4] PKCS#11 filter    |                                 |  --------          |
- ----------------------                                   --------------------
-           |                                                        |
- ----------------------                                             |
-| 1] PKCS#11 OCaml     |                                  { PKCS#11 INTERFACE }
-|       bindings       |                                            |
- ----------------------                                       APPLICATION
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
- REAL PKCS#11 MIDDLEWARE
-    (shared library)
-
-    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:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    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.
-
-    Except as contained in this notice, the name(s) of the above copyright holders
-    shall not be used in advertising or otherwise to promote the sale, use or other
-    dealings in this Software without prior written authorization.
-
-    The current source code is part of the bindings 1] source tree:
- ----------------------
-| 1] PKCS#11 OCaml     |
-|       bindings       |
- ----------------------
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
-  REAL PKCS#11 MIDDLEWARE
-     (shared library)
-
-    Project: PKCS#11 Filtering Proxy
-    File:    src/bindings-pkcs11/pkcs11_stubs.c
-
--------------------------- MIT License HEADER ----------------------------------*/
 /* File generated from pkcs11.idl */
 
 #include <stddef.h>
@@ -92,39 +13,35 @@
 #endif
 #include <caml/camlidlruntime.h>
 
+
 #define CUSTOM_ALLOC
 #include "pkcs11.h"
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_flags_t(value _v1, ck_flags_t * _c2,
-				    __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_flags_t(value _v1, ck_flags_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_flags_t(value _v1, ck_flags_t * _c2,
-				    camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_flags_t(value _v1, ck_flags_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_flags_t(ck_flags_t * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_flags_t(ck_flags_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_ck_flags_t(ck_flags_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_version(value _v1, struct ck_version *_c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_version(value _v1, struct ck_version * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_version(value _v1, struct ck_version *_c2,
-					   camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_version(value _v1, struct ck_version * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -136,12 +53,9 @@ void camlidl_ml2c_pkcs11_struct_ck_version(value _v1, struct ck_version *_c2,
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_version(struct ck_version *_c1,
-					    __attribute__ ((unused)) camlidl_ctx
-					    _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_version(struct ck_version * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_version(struct ck_version *_c1,
-					    camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_version(struct ck_version * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -157,22 +71,19 @@ value camlidl_c2ml_pkcs11_struct_ck_version(struct ck_version *_c1,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = Val_int((*_c1).major);
-  _v3[1] = Val_int((*_c1).minor);
-  _v2 = camlidl_alloc_small(2, 0);
-  Field(_v2, 0) = _v3[0];
-  Field(_v2, 1) = _v3[1];
+    _v3[0] = Val_int((*_c1).major);
+    _v3[1] = Val_int((*_c1).minor);
+    _v2 = camlidl_alloc_small(2, 0);
+    Field(_v2, 0) = _v3[0];
+    Field(_v2, 1) = _v3[1];
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info *_c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info *_c2,
-					camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -190,8 +101,7 @@ void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info *_c2,
   camlidl_ml2c_pkcs11_struct_ck_version(_v3, &(*_c2).cryptoki_version, _ctx);
   _v4 = Field(_v1, 1);
   _c5 = Wosize_val(_v4);
-  if (_c5 != 32)
-    invalid_argument("struct ck_info");
+  if (_c5 != 32) invalid_argument("struct ck_info");
   for (_c6 = 0; _c6 < 32; _c6++) {
     _v7 = Field(_v4, _c6);
     (*_c2).manufacturer_id[_c6] = Int_val(_v7);
@@ -200,8 +110,7 @@ void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info *_c2,
   camlidl_ml2c_pkcs11_ck_flags_t(_v8, &(*_c2).flags, _ctx);
   _v9 = Field(_v1, 3);
   _c10 = Wosize_val(_v9);
-  if (_c10 != 32)
-    invalid_argument("struct ck_info");
+  if (_c10 != 32) invalid_argument("struct ck_info");
   for (_c11 = 0; _c11 < 32; _c11++) {
     _v12 = Field(_v9, _c11);
     (*_c2).library_description[_c11] = Int_val(_v12);
@@ -211,11 +120,9 @@ void camlidl_ml2c_pkcs11_struct_ck_info(value _v1, struct ck_info *_c2,
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_info(struct ck_info *_c1,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_info(struct ck_info * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_info(struct ck_info *_c1, camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_info(struct ck_info * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -233,87 +140,71 @@ value camlidl_c2ml_pkcs11_struct_ck_info(struct ck_info *_c1, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] =
-      camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).cryptoki_version, _ctx);
-  _v3[1] = camlidl_alloc_small(32, 0);
-  for (_c4 = 0; _c4 < 32; _c4++) {
-    Field(_v3[1], _c4) = Val_int((*_c1).manufacturer_id[_c4]);
-  }
-  _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
-  _v3[3] = camlidl_alloc_small(32, 0);
-  for (_c5 = 0; _c5 < 32; _c5++) {
-    Field(_v3[3], _c5) = Val_int((*_c1).library_description[_c5]);
-  }
-  _v3[4] = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).library_version, _ctx);
-  _v2 = camlidl_alloc_small(5, 0);
-  {
-    mlsize_t _c6;
-    for (_c6 = 0; _c6 < 5; _c6++)
-      Field(_v2, _c6) = _v3[_c6];
-  }
+    _v3[0] = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).cryptoki_version, _ctx);
+    _v3[1] = camlidl_alloc_small(32, 0);
+    for (_c4 = 0; _c4 < 32; _c4++) {
+      Field(_v3[1], _c4) = Val_int((*_c1).manufacturer_id[_c4]);
+    }
+    _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
+    _v3[3] = camlidl_alloc_small(32, 0);
+    for (_c5 = 0; _c5 < 32; _c5++) {
+      Field(_v3[3], _c5) = Val_int((*_c1).library_description[_c5]);
+    }
+    _v3[4] = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).library_version, _ctx);
+    _v2 = camlidl_alloc_small(5, 0);
+    { mlsize_t _c6;
+      for (_c6 = 0; _c6 < 5; _c6++) Field(_v2, _c6) = _v3[_c6];
+    }
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_notification_t(value _v1, ck_notification_t * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+void camlidl_ml2c_pkcs11_ck_notification_t(value _v1, ck_notification_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_notification_t(value _v1, ck_notification_t * _c2,
-					   camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_notification_t(value _v1, ck_notification_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_notification_t(ck_notification_t * _c2,
-					    __attribute__ ((unused)) camlidl_ctx
-					    _ctx)
+value camlidl_c2ml_pkcs11_ck_notification_t(ck_notification_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_notification_t(ck_notification_t * _c2,
-					    camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_notification_t(ck_notification_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_slot_id_t(value _v1, ck_slot_id_t * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_slot_id_t(value _v1, ck_slot_id_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_slot_id_t(value _v1, ck_slot_id_t * _c2,
-				      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_slot_id_t(value _v1, ck_slot_id_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_slot_id_t(ck_slot_id_t * _c2,
-				       __attribute__ ((unused)) camlidl_ctx
-				       _ctx)
+value camlidl_c2ml_pkcs11_ck_slot_id_t(ck_slot_id_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_ck_slot_id_t(ck_slot_id_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1,
-					     struct ck_slot_info *_c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1, struct ck_slot_info * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1,
-					     struct ck_slot_info *_c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1, struct ck_slot_info * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -329,16 +220,14 @@ void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1,
   value _v13;
   _v3 = Field(_v1, 0);
   _c4 = Wosize_val(_v3);
-  if (_c4 != 64)
-    invalid_argument("struct ck_slot_info");
+  if (_c4 != 64) invalid_argument("struct ck_slot_info");
   for (_c5 = 0; _c5 < 64; _c5++) {
     _v6 = Field(_v3, _c5);
     (*_c2).slot_description[_c5] = Int_val(_v6);
   }
   _v7 = Field(_v1, 1);
   _c8 = Wosize_val(_v7);
-  if (_c8 != 32)
-    invalid_argument("struct ck_slot_info");
+  if (_c8 != 32) invalid_argument("struct ck_slot_info");
   for (_c9 = 0; _c9 < 32; _c9++) {
     _v10 = Field(_v7, _c9);
     (*_c2).manufacturer_id[_c9] = Int_val(_v10);
@@ -352,12 +241,9 @@ void camlidl_ml2c_pkcs11_struct_ck_slot_info(value _v1,
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_slot_info(struct ck_slot_info *_c1,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_slot_info(struct ck_slot_info * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_slot_info(struct ck_slot_info *_c1,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_slot_info(struct ck_slot_info * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -376,39 +262,30 @@ value camlidl_c2ml_pkcs11_struct_ck_slot_info(struct ck_slot_info *_c1,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = camlidl_alloc(64, 0);
-  for (_c4 = 0; _c4 < 64; _c4++) {
-    _v5 = Val_int((*_c1).slot_description[_c4]);
-    modify(&Field(_v3[0], _c4), _v5);
-  }
-  _v3[1] = camlidl_alloc_small(32, 0);
-  for (_c6 = 0; _c6 < 32; _c6++) {
-    Field(_v3[1], _c6) = Val_int((*_c1).manufacturer_id[_c6]);
-  }
-  _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
-  _v3[3] =
-      camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).hardware_version, _ctx);
-  _v3[4] =
-      camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).firmware_version, _ctx);
-  _v2 = camlidl_alloc_small(5, 0);
-  {
-    mlsize_t _c7;
-    for (_c7 = 0; _c7 < 5; _c7++)
-      Field(_v2, _c7) = _v3[_c7];
-  }
+    _v3[0] = camlidl_alloc(64, 0);
+    for (_c4 = 0; _c4 < 64; _c4++) {
+      _v5 = Val_int((*_c1).slot_description[_c4]);
+      modify(&Field(_v3[0], _c4), _v5);
+    }
+    _v3[1] = camlidl_alloc_small(32, 0);
+    for (_c6 = 0; _c6 < 32; _c6++) {
+      Field(_v3[1], _c6) = Val_int((*_c1).manufacturer_id[_c6]);
+    }
+    _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
+    _v3[3] = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).hardware_version, _ctx);
+    _v3[4] = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).firmware_version, _ctx);
+    _v2 = camlidl_alloc_small(5, 0);
+    { mlsize_t _c7;
+      for (_c7 = 0; _c7 < 5; _c7++) Field(_v2, _c7) = _v3[_c7];
+    }
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1,
-					      struct ck_token_info *_c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1, struct ck_token_info * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1,
-					      struct ck_token_info *_c2,
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1, struct ck_token_info * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -446,32 +323,28 @@ void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1,
   value _v35;
   _v3 = Field(_v1, 0);
   _c4 = Wosize_val(_v3);
-  if (_c4 != 32)
-    invalid_argument("struct ck_token_info");
+  if (_c4 != 32) invalid_argument("struct ck_token_info");
   for (_c5 = 0; _c5 < 32; _c5++) {
     _v6 = Field(_v3, _c5);
     (*_c2).label[_c5] = Int_val(_v6);
   }
   _v7 = Field(_v1, 1);
   _c8 = Wosize_val(_v7);
-  if (_c8 != 32)
-    invalid_argument("struct ck_token_info");
+  if (_c8 != 32) invalid_argument("struct ck_token_info");
   for (_c9 = 0; _c9 < 32; _c9++) {
     _v10 = Field(_v7, _c9);
     (*_c2).manufacturer_id[_c9] = Int_val(_v10);
   }
   _v11 = Field(_v1, 2);
   _c12 = Wosize_val(_v11);
-  if (_c12 != 16)
-    invalid_argument("struct ck_token_info");
+  if (_c12 != 16) invalid_argument("struct ck_token_info");
   for (_c13 = 0; _c13 < 16; _c13++) {
     _v14 = Field(_v11, _c13);
     (*_c2).model[_c13] = Int_val(_v14);
   }
   _v15 = Field(_v1, 3);
   _c16 = Wosize_val(_v15);
-  if (_c16 != 16)
-    invalid_argument("struct ck_token_info");
+  if (_c16 != 16) invalid_argument("struct ck_token_info");
   for (_c17 = 0; _c17 < 16; _c17++) {
     _v18 = Field(_v15, _c17);
     (*_c2).serial_number[_c17] = Int_val(_v18);
@@ -479,24 +352,34 @@ void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1,
   _v19 = Field(_v1, 4);
   camlidl_ml2c_pkcs11_ck_flags_t(_v19, &(*_c2).flags, _ctx);
   _v20 = Field(_v1, 5);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).max_session_count = custom_int_val(_v20);
   _v21 = Field(_v1, 6);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).session_count = custom_int_val(_v21);
   _v22 = Field(_v1, 7);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).max_rw_session_count = custom_int_val(_v22);
   _v23 = Field(_v1, 8);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).rw_session_count = custom_int_val(_v23);
   _v24 = Field(_v1, 9);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).max_pin_len = custom_int_val(_v24);
   _v25 = Field(_v1, 10);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).min_pin_len = custom_int_val(_v25);
   _v26 = Field(_v1, 11);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).total_public_memory = custom_int_val(_v26);
   _v27 = Field(_v1, 12);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).free_public_memory = custom_int_val(_v27);
   _v28 = Field(_v1, 13);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).total_private_memory = custom_int_val(_v28);
   _v29 = Field(_v1, 14);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).free_private_memory = custom_int_val(_v29);
   _v30 = Field(_v1, 15);
   camlidl_ml2c_pkcs11_struct_ck_version(_v30, &(*_c2).hardware_version, _ctx);
@@ -504,8 +387,7 @@ void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1,
   camlidl_ml2c_pkcs11_struct_ck_version(_v31, &(*_c2).firmware_version, _ctx);
   _v32 = Field(_v1, 17);
   _c33 = Wosize_val(_v32);
-  if (_c33 != 16)
-    invalid_argument("struct ck_token_info");
+  if (_c33 != 16) invalid_argument("struct ck_token_info");
   for (_c34 = 0; _c34 < 16; _c34++) {
     _v35 = Field(_v32, _c34);
     (*_c2).utc_time[_c34] = Int_val(_v35);
@@ -513,12 +395,9 @@ void camlidl_ml2c_pkcs11_struct_ck_token_info(value _v1,
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_token_info(struct ck_token_info *_c1,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_token_info(struct ck_token_info * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_token_info(struct ck_token_info *_c1,
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_token_info(struct ck_token_info * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -539,136 +418,114 @@ value camlidl_c2ml_pkcs11_struct_ck_token_info(struct ck_token_info *_c1,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = camlidl_alloc_small(32, 0);
-  for (_c4 = 0; _c4 < 32; _c4++) {
-    Field(_v3[0], _c4) = Val_int((*_c1).label[_c4]);
-  }
-  _v3[1] = camlidl_alloc_small(32, 0);
-  for (_c5 = 0; _c5 < 32; _c5++) {
-    Field(_v3[1], _c5) = Val_int((*_c1).manufacturer_id[_c5]);
-  }
-  _v3[2] = camlidl_alloc_small(16, 0);
-  for (_c6 = 0; _c6 < 16; _c6++) {
-    Field(_v3[2], _c6) = Val_int((*_c1).model[_c6]);
-  }
-  _v3[3] = camlidl_alloc_small(16, 0);
-  for (_c7 = 0; _c7 < 16; _c7++) {
-    Field(_v3[3], _c7) = Val_int((*_c1).serial_number[_c7]);
-  }
-  _v3[4] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
-  _v3[5] = custom_copy_int((*_c1).max_session_count);
-  _v3[6] = custom_copy_int((*_c1).session_count);
-  _v3[7] = custom_copy_int((*_c1).max_rw_session_count);
-  _v3[8] = custom_copy_int((*_c1).rw_session_count);
-  _v3[9] = custom_copy_int((*_c1).max_pin_len);
-  _v3[10] = custom_copy_int((*_c1).min_pin_len);
-  _v3[11] = custom_copy_int((*_c1).total_public_memory);
-  _v3[12] = custom_copy_int((*_c1).free_public_memory);
-  _v3[13] = custom_copy_int((*_c1).total_private_memory);
-  _v3[14] = custom_copy_int((*_c1).free_private_memory);
-  _v3[15] =
-      camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).hardware_version, _ctx);
-  _v3[16] =
-      camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).firmware_version, _ctx);
-  _v3[17] = camlidl_alloc_small(16, 0);
-  for (_c8 = 0; _c8 < 16; _c8++) {
-    Field(_v3[17], _c8) = Val_int((*_c1).utc_time[_c8]);
-  }
-  _v2 = camlidl_alloc_small(18, 0);
-  {
-    mlsize_t _c9;
-    for (_c9 = 0; _c9 < 18; _c9++)
-      Field(_v2, _c9) = _v3[_c9];
-  }
+    _v3[0] = camlidl_alloc_small(32, 0);
+    for (_c4 = 0; _c4 < 32; _c4++) {
+      Field(_v3[0], _c4) = Val_int((*_c1).label[_c4]);
+    }
+    _v3[1] = camlidl_alloc_small(32, 0);
+    for (_c5 = 0; _c5 < 32; _c5++) {
+      Field(_v3[1], _c5) = Val_int((*_c1).manufacturer_id[_c5]);
+    }
+    _v3[2] = camlidl_alloc_small(16, 0);
+    for (_c6 = 0; _c6 < 16; _c6++) {
+      Field(_v3[2], _c6) = Val_int((*_c1).model[_c6]);
+    }
+    _v3[3] = camlidl_alloc_small(16, 0);
+    for (_c7 = 0; _c7 < 16; _c7++) {
+      Field(_v3[3], _c7) = Val_int((*_c1).serial_number[_c7]);
+    }
+    _v3[4] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
+    _v3[5] = custom_copy_int((*_c1).max_session_count);
+    _v3[6] = custom_copy_int((*_c1).session_count);
+    _v3[7] = custom_copy_int((*_c1).max_rw_session_count);
+    _v3[8] = custom_copy_int((*_c1).rw_session_count);
+    _v3[9] = custom_copy_int((*_c1).max_pin_len);
+    _v3[10] = custom_copy_int((*_c1).min_pin_len);
+    _v3[11] = custom_copy_int((*_c1).total_public_memory);
+    _v3[12] = custom_copy_int((*_c1).free_public_memory);
+    _v3[13] = custom_copy_int((*_c1).total_private_memory);
+    _v3[14] = custom_copy_int((*_c1).free_private_memory);
+    _v3[15] = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).hardware_version, _ctx);
+    _v3[16] = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c1).firmware_version, _ctx);
+    _v3[17] = camlidl_alloc_small(16, 0);
+    for (_c8 = 0; _c8 < 16; _c8++) {
+      Field(_v3[17], _c8) = Val_int((*_c1).utc_time[_c8]);
+    }
+    _v2 = camlidl_alloc_small(18, 0);
+    { mlsize_t _c9;
+      for (_c9 = 0; _c9 < 18; _c9++) Field(_v2, _c9) = _v3[_c9];
+    }
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_session_handle_t(value _v1,
-					     ck_session_handle_t * _c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_session_handle_t(value _v1, ck_session_handle_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_session_handle_t(value _v1,
-					     ck_session_handle_t * _c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_session_handle_t(value _v1, ck_session_handle_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_session_handle_t(ck_session_handle_t * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_session_handle_t(ck_session_handle_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_session_handle_t(ck_session_handle_t * _c2,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_session_handle_t(ck_session_handle_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_user_type_t(value _v1, ck_user_type_t * _c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+void camlidl_ml2c_pkcs11_ck_user_type_t(value _v1, ck_user_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_user_type_t(value _v1, ck_user_type_t * _c2,
-					camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_user_type_t(value _v1, ck_user_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_user_type_t(ck_user_type_t * _c2,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+value camlidl_c2ml_pkcs11_ck_user_type_t(ck_user_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_ck_user_type_t(ck_user_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_state_t(value _v1, ck_state_t * _c2,
-				    __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_state_t(value _v1, ck_state_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_state_t(value _v1, ck_state_t * _c2,
-				    camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_state_t(value _v1, ck_state_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_state_t(ck_state_t * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_state_t(ck_state_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_ck_state_t(ck_state_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_session_info(value _v1,
-						struct ck_session_info *_c2,
-						__attribute__ ((unused))
-						camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_session_info(value _v1, struct ck_session_info * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_session_info(value _v1,
-						struct ck_session_info *_c2,
-						camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_session_info(value _v1, struct ck_session_info * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -682,16 +539,14 @@ void camlidl_ml2c_pkcs11_struct_ck_session_info(value _v1,
   _v5 = Field(_v1, 2);
   camlidl_ml2c_pkcs11_ck_flags_t(_v5, &(*_c2).flags, _ctx);
   _v6 = Field(_v1, 3);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).device_error = custom_int_val(_v6);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_session_info(struct ck_session_info *_c1,
-						 __attribute__ ((unused))
-						 camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_session_info(struct ck_session_info * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_session_info(struct ck_session_info *_c1,
-						 camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_session_info(struct ck_session_info * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -707,189 +562,149 @@ value camlidl_c2ml_pkcs11_struct_ck_session_info(struct ck_session_info *_c1,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = camlidl_c2ml_pkcs11_ck_slot_id_t(&(*_c1).slot_id, _ctx);
-  _v3[1] = camlidl_c2ml_pkcs11_ck_state_t(&(*_c1).state, _ctx);
-  _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
-  _v3[3] = custom_copy_int((*_c1).device_error);
-  _v2 = camlidl_alloc_small(4, 0);
-  Field(_v2, 0) = _v3[0];
-  Field(_v2, 1) = _v3[1];
-  Field(_v2, 2) = _v3[2];
-  Field(_v2, 3) = _v3[3];
+    _v3[0] = camlidl_c2ml_pkcs11_ck_slot_id_t(&(*_c1).slot_id, _ctx);
+    _v3[1] = camlidl_c2ml_pkcs11_ck_state_t(&(*_c1).state, _ctx);
+    _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
+    _v3[3] = custom_copy_int((*_c1).device_error);
+    _v2 = camlidl_alloc_small(4, 0);
+    Field(_v2, 0) = _v3[0];
+    Field(_v2, 1) = _v3[1];
+    Field(_v2, 2) = _v3[2];
+    Field(_v2, 3) = _v3[3];
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_object_handle_t(value _v1, ck_object_handle_t * _c2,
-					    __attribute__ ((unused)) camlidl_ctx
-					    _ctx)
+void camlidl_ml2c_pkcs11_ck_object_handle_t(value _v1, ck_object_handle_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_object_handle_t(value _v1, ck_object_handle_t * _c2,
-					    camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_object_handle_t(value _v1, ck_object_handle_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_object_handle_t(ck_object_handle_t * _c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_object_handle_t(ck_object_handle_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_object_handle_t(ck_object_handle_t * _c2,
-					     camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_object_handle_t(ck_object_handle_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_object_class_t(value _v1, ck_object_class_t * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+void camlidl_ml2c_pkcs11_ck_object_class_t(value _v1, ck_object_class_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_object_class_t(value _v1, ck_object_class_t * _c2,
-					   camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_object_class_t(value _v1, ck_object_class_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_object_class_t(ck_object_class_t * _c2,
-					    __attribute__ ((unused)) camlidl_ctx
-					    _ctx)
+value camlidl_c2ml_pkcs11_ck_object_class_t(ck_object_class_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_object_class_t(ck_object_class_t * _c2,
-					    camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_object_class_t(ck_object_class_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_hw_feature_type_t(value _v1,
-					      ck_hw_feature_type_t * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_hw_feature_type_t(value _v1, ck_hw_feature_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_hw_feature_type_t(value _v1,
-					      ck_hw_feature_type_t * _c2,
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_hw_feature_type_t(value _v1, ck_hw_feature_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_hw_feature_type_t(ck_hw_feature_type_t * _c2,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_hw_feature_type_t(ck_hw_feature_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_hw_feature_type_t(ck_hw_feature_type_t * _c2,
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_hw_feature_type_t(ck_hw_feature_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_key_type_t(value _v1, ck_key_type_t * _c2,
-				       __attribute__ ((unused)) camlidl_ctx
-				       _ctx)
+void camlidl_ml2c_pkcs11_ck_key_type_t(value _v1, ck_key_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_key_type_t(value _v1, ck_key_type_t * _c2,
-				       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_key_type_t(value _v1, ck_key_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_key_type_t(ck_key_type_t * _c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+value camlidl_c2ml_pkcs11_ck_key_type_t(ck_key_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_ck_key_type_t(ck_key_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_certificate_type_t(value _v1,
-					       ck_certificate_type_t * _c2,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_certificate_type_t(value _v1, ck_certificate_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_certificate_type_t(value _v1,
-					       ck_certificate_type_t * _c2,
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_certificate_type_t(value _v1, ck_certificate_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_certificate_type_t(ck_certificate_type_t * _c2,
-						__attribute__ ((unused))
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_certificate_type_t(ck_certificate_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_certificate_type_t(ck_certificate_type_t * _c2,
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_certificate_type_t(ck_certificate_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_attribute_type_t(value _v1,
-					     ck_attribute_type_t * _c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_attribute_type_t(value _v1, ck_attribute_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_attribute_type_t(value _v1,
-					     ck_attribute_type_t * _c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_attribute_type_t(value _v1, ck_attribute_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_attribute_type_t(ck_attribute_type_t * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_attribute_type_t(ck_attribute_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_attribute_type_t(ck_attribute_type_t * _c2,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_attribute_type_t(ck_attribute_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1,
-					     struct ck_attribute *_c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1, struct ck_attribute * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1,
-					     struct ck_attribute *_c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1, struct ck_attribute * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -902,50 +717,51 @@ void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1,
   _v4 = Field(_v1, 1);
   _c5 = Wosize_val(_v4);
   /* Endianness transformations for 
-     CKA_CLASS, CKA_CERTIFICATE_TYPE, CKA_KEY_TYPE, 
-     CKA_KEY_GEN_MECHANISM, CKA_AUTH_PIN_FLAGS, CKA_VALUE_LEN,
-     CKA_MECHANISM_TYPE */
+    CKA_CLASS, CKA_CERTIFICATE_TYPE, CKA_KEY_TYPE, 
+    CKA_KEY_GEN_MECHANISM, CKA_AUTH_PIN_FLAGS, CKA_VALUE_LEN,
+    CKA_MECHANISM_TYPE */
   switch ((*_c2).type_) {
-  case 0x0:
-  case 0x80:
-  case 0x88:
-  case 0x100:
-  case 0x121:
-  case 0x161:
-  case 0x166:
-  case 0x201:
-  case 0x400:
-  case 0x401:
-  case 0x402:
-  case 0x403:
-  case 0x404:
-  case 0x405:
-  case 0x406:
-  case 0x500:{
+  case 0x0: 
+  case 0x80: 
+  case 0x88: 
+  case 0x100: 
+  case 0x121: 
+  case 0x161: 
+  case 0x166: 
+  case 0x201: 
+  case 0x400: 
+  case 0x401: 
+  case 0x402: 
+  case 0x403: 
+  case 0x404: 
+  case 0x405: 
+  case 0x406: 
+  case 0x500:  {
 #ifdef SERVER_ROLE
       int decode_ret = 1;
       if ((long)_c5 > 0) {
-	decode_ret = decode_ck_attribute_arch(_v4, _c2, _ctx);
+        decode_ret = decode_ck_attribute_arch(_v4, _c2, _ctx);
       }
       /* We come from OCaml cannot be negative, allocate a zero pointer */
       else {
-	(*_c2).value = camlidl_malloc(_c5 * sizeof(char), _ctx);
-	(*_c2).value_len = _c5;
+        (*_c2).value = camlidl_malloc(_c5 * sizeof(char), _ctx);
+        (*_c2).value_len = _c5;
       }
       /* Break ONLY if decode_ck_attribute_arch succeeded
        * otherwise, we want to go to the default case */
       if (decode_ret != -1) {
-	break;
+        break;
       }
 #endif
     }
-  default:{
+    /* Fallthrough */
+default:  {
       if ((long)_c5 >= 0) {
-	(*_c2).value = camlidl_malloc(_c5 * sizeof(char), _ctx);
-	for (_c6 = 0; _c6 < _c5; _c6++) {
-	  _v7 = Field(_v4, _c6);
-	  (*_c2).value[_c6] = Int_val(_v7);
-	}
+        (*_c2).value = camlidl_malloc(_c5 * sizeof(char), _ctx);
+        for(_c6 = 0;_c6 < _c5;_c6++) {
+          _v7 = Field(_v4, _c6);
+          (*_c2).value[_c6] = Int_val(_v7);
+        }
       }
       (*_c2).value_len = _c5;
       break;
@@ -955,12 +771,9 @@ void camlidl_ml2c_pkcs11_struct_ck_attribute(value _v1,
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_attribute(struct ck_attribute *_c1,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_attribute(struct ck_attribute * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_attribute(struct ck_attribute *_c1,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_attribute(struct ck_attribute * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -981,96 +794,94 @@ value camlidl_c2ml_pkcs11_struct_ck_attribute(struct ck_attribute *_c1,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = camlidl_c2ml_pkcs11_ck_attribute_type_t(&(*_c1).type_, _ctx);
-  memset(buff, 0, sizeof(uint64_t));
-  temp_.type_ = 0;
-  temp_.value = (void *)buff;
-  temp_.value_len = sizeof(uint64_t);
-  temp = &temp_;
+    _v3[0] = camlidl_c2ml_pkcs11_ck_attribute_type_t(&(*_c1).type_, _ctx);
+    memset(buff, 0, sizeof(uint64_t));
+    temp_.type_ = 0;
+    temp_.value = (void *)buff;
+    temp_.value_len = sizeof(uint64_t);
+    temp = &temp_;
 
-  *temp = *_c1;
+    *temp = *_c1;
 
-  if ((long)(*temp).value_len >= 0) {
-    /* Endianness transformations for 
-       CKA_CLASS, CKA_CERTIFICATE_TYPE, CKA_KEY_TYPE,
-       CKA_KEY_GEN_MECHANISM, CKA_AUTH_PIN_FLAGS, CKA_VALUE_LEN,
-       CKA_MECHANISM_TYPE */
+    if ((long)(*temp).value_len >= 0) {
+      /* Endianness transformations for 
+    CKA_CLASS, CKA_CERTIFICATE_TYPE, CKA_KEY_TYPE,
+    CKA_KEY_GEN_MECHANISM, CKA_AUTH_PIN_FLAGS, CKA_VALUE_LEN,
+    CKA_MECHANISM_TYPE */
 
 #ifdef SERVER_ROLE
-    switch ((*temp).type_) {
-    case 0x0:
-    case 0x80:
-    case 0x88:
-    case 0x100:
-    case 0x121:
-    case 0x161:
-    case 0x166:
-    case 0x201:
-    case 0x400:
-    case 0x401:
-    case 0x402:
-    case 0x403:
-    case 0x404:
-    case 0x405:
-    case 0x406:
-    case 0x500:{
-	int encode_ret = 1;
-	/* We override the pointer to temp->value */
-	temp->value = (void *)buff;
-	encode_ret = encode_ck_attribute_arch(_c1, temp);
-	if (encode_ret == -1) {
-	  /* FIXME: Something went wrong with encode_ck_attribute_arch
-	   * we exit (thus terminating the child process), is there a
-	   * better way to handle it.
-	   */
-	  exit(-1);
-	}
+      switch ((*temp).type_) {
+      case 0x0: 
+      case 0x80: 
+      case 0x88: 
+      case 0x100: 
+      case 0x121: 
+      case 0x161: 
+      case 0x166: 
+      case 0x201: 
+      case 0x400: 
+      case 0x401: 
+      case 0x402: 
+      case 0x403: 
+      case 0x404: 
+      case 0x405: 
+      case 0x406: 
+      case 0x500:  {
+          int encode_ret = 1;
+          /* We override the pointer to temp->value */
+          temp->value = (void *)buff;
+          encode_ret = encode_ck_attribute_arch(_c1, temp);
+          if (encode_ret == -1) {
+            /* FIXME: Something went wrong with encode_ck_attribute_arch
+                * we exit (thus terminating the child process), is there a
+                * better way to handle it.
+                */
+            exit(-1);
+          }
+        }
       }
-
-    }
 #endif
-    if ((*temp).value != NULL) {
+      if ((*temp).value != NULL) {
 
-      _v3[1] = camlidl_alloc((*temp).value_len, 0);
+        _v3[1] = camlidl_alloc((*temp).value_len, 0);
 
-      for (_c4 = 0; _c4 < (*temp).value_len; _c4++) {
-	_v5 = Val_int((unsigned char)((*temp).value[_c4]));
-	modify(&Field(_v3[1], _c4), _v5);
+        for(_c4 = 0;_c4 < (*temp).value_len;_c4++) {
+          _v5 = Val_int((unsigned char)((*temp).value[_c4]));
+          modify(&Field(_v3[1], _c4), _v5);
+        }
       }
-    } else {
-      _v3[1] = camlidl_alloc((*temp).value_len, 0);
-      for (_c4 = 0; _c4 < (*temp).value_len; _c4++) {
-	_v5 = Val_int(0);
-	modify(&Field(_v3[1], _c4), _v5);
+      else {
+        _v3[1] = camlidl_alloc((*temp).value_len, 0);
+        for(_c4 = 0;_c4 < (*temp).value_len;_c4++) {
+          _v5 = Val_int(0);
+          modify(&Field(_v3[1], _c4), _v5);
+        }
+        /*
+        int i = 0;
+        char output_size[sizeof(unsigned long)];
+        *((unsigned long*)output_size) = (*temp).value_len;
+        _v3[1] = camlidl_alloc(sizeof(unsigned long), 0);
+        for (i = 0 ; i< sizeof(unsigned long); i++){
+            modify(&Field(_v3[1], i), output_size[i]);
+        }
+        */
       }
-      /*
-         int i = 0;
-         char output_size[sizeof(unsigned long)];
-         *((unsigned long*)output_size) = (*temp).value_len;
-         _v3[1] = camlidl_alloc(sizeof(unsigned long), 0);
-         for (i = 0 ; i< sizeof(unsigned long); i++){
-         modify(&Field(_v3[1], i), output_size[i]);
-         }
-       */
     }
-  } else {
-    (*temp).value_len = -1;
-    _v3[1] = camlidl_alloc(0, 0);
-  }
-  _v2 = camlidl_alloc_small(2, 0);
-  Field(_v2, 0) = _v3[0];
-  Field(_v2, 1) = _v3[1];
+    else {
+      (*temp).value_len = -1;
+      _v3[1] = camlidl_alloc(0, 0);
+    }
+    _v2 = camlidl_alloc_small(2, 0);
+    Field(_v2, 0) = _v3[0];
+    Field(_v2, 1) = _v3[1];
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date *_c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date *_c2,
-					camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -1087,24 +898,21 @@ void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date *_c2,
   value _v14;
   _v3 = Field(_v1, 0);
   _c4 = Wosize_val(_v3);
-  if (_c4 != 4)
-    invalid_argument("struct ck_date");
+  if (_c4 != 4) invalid_argument("struct ck_date");
   for (_c5 = 0; _c5 < 4; _c5++) {
     _v6 = Field(_v3, _c5);
     (*_c2).year[_c5] = Int_val(_v6);
   }
   _v7 = Field(_v1, 1);
   _c8 = Wosize_val(_v7);
-  if (_c8 != 2)
-    invalid_argument("struct ck_date");
+  if (_c8 != 2) invalid_argument("struct ck_date");
   for (_c9 = 0; _c9 < 2; _c9++) {
     _v10 = Field(_v7, _c9);
     (*_c2).month[_c9] = Int_val(_v10);
   }
   _v11 = Field(_v1, 2);
   _c12 = Wosize_val(_v11);
-  if (_c12 != 2)
-    invalid_argument("struct ck_date");
+  if (_c12 != 2) invalid_argument("struct ck_date");
   for (_c13 = 0; _c13 < 2; _c13++) {
     _v14 = Field(_v11, _c13);
     (*_c2).day[_c13] = Int_val(_v14);
@@ -1112,11 +920,9 @@ void camlidl_ml2c_pkcs11_struct_ck_date(value _v1, struct ck_date *_c2,
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_date(struct ck_date *_c1,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_date(struct ck_date * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_date(struct ck_date *_c1, camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_date(struct ck_date * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -1135,63 +941,51 @@ value camlidl_c2ml_pkcs11_struct_ck_date(struct ck_date *_c1, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = camlidl_alloc_small(4, 0);
-  for (_c4 = 0; _c4 < 4; _c4++) {
-    Field(_v3[0], _c4) = Val_int((*_c1).year[_c4]);
-  }
-  _v3[1] = camlidl_alloc_small(2, 0);
-  for (_c5 = 0; _c5 < 2; _c5++) {
-    Field(_v3[1], _c5) = Val_int((*_c1).month[_c5]);
-  }
-  _v3[2] = camlidl_alloc_small(2, 0);
-  for (_c6 = 0; _c6 < 2; _c6++) {
-    Field(_v3[2], _c6) = Val_int((*_c1).day[_c6]);
-  }
-  _v2 = camlidl_alloc_small(3, 0);
-  Field(_v2, 0) = _v3[0];
-  Field(_v2, 1) = _v3[1];
-  Field(_v2, 2) = _v3[2];
+    _v3[0] = camlidl_alloc_small(4, 0);
+    for (_c4 = 0; _c4 < 4; _c4++) {
+      Field(_v3[0], _c4) = Val_int((*_c1).year[_c4]);
+    }
+    _v3[1] = camlidl_alloc_small(2, 0);
+    for (_c5 = 0; _c5 < 2; _c5++) {
+      Field(_v3[1], _c5) = Val_int((*_c1).month[_c5]);
+    }
+    _v3[2] = camlidl_alloc_small(2, 0);
+    for (_c6 = 0; _c6 < 2; _c6++) {
+      Field(_v3[2], _c6) = Val_int((*_c1).day[_c6]);
+    }
+    _v2 = camlidl_alloc_small(3, 0);
+    Field(_v2, 0) = _v3[0];
+    Field(_v2, 1) = _v3[1];
+    Field(_v2, 2) = _v3[2];
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_mechanism_type_t(value _v1,
-					     ck_mechanism_type_t * _c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_mechanism_type_t(value _v1, ck_mechanism_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_mechanism_type_t(value _v1,
-					     ck_mechanism_type_t * _c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_mechanism_type_t(value _v1, ck_mechanism_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_mechanism_type_t(ck_mechanism_type_t * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_mechanism_type_t(ck_mechanism_type_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_mechanism_type_t(ck_mechanism_type_t * _c2,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_mechanism_type_t(ck_mechanism_type_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1,
-					     struct ck_mechanism *_c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1, struct ck_mechanism * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1,
-					     struct ck_mechanism *_c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1, struct ck_mechanism * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -1203,7 +997,7 @@ void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1,
   camlidl_ml2c_pkcs11_ck_mechanism_type_t(_v3, &(*_c2).mechanism, _ctx);
   _v4 = Field(_v1, 1);
   _c5 = Wosize_val(_v4);
-  (*_c2).parameter = camlidl_malloc(_c5 * sizeof(char), _ctx);
+  (*_c2).parameter = camlidl_malloc(_c5 * sizeof(char ), _ctx);
   for (_c6 = 0; _c6 < _c5; _c6++) {
     _v7 = Field(_v4, _c6);
     (*_c2).parameter[_c6] = Int_val(_v7);
@@ -1212,12 +1006,9 @@ void camlidl_ml2c_pkcs11_struct_ck_mechanism(value _v1,
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_mechanism(struct ck_mechanism *_c1,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_mechanism(struct ck_mechanism * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_mechanism(struct ck_mechanism *_c1,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_mechanism(struct ck_mechanism * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -1235,49 +1026,42 @@ value camlidl_c2ml_pkcs11_struct_ck_mechanism(struct ck_mechanism *_c1,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = camlidl_c2ml_pkcs11_ck_mechanism_type_t(&(*_c1).mechanism, _ctx);
-  _v3[1] = camlidl_alloc((*_c1).parameter_len, 0);
-  for (_c4 = 0; _c4 < (*_c1).parameter_len; _c4++) {
-    _v5 = Val_int((unsigned char)((*_c1).parameter[_c4]));
-    modify(&Field(_v3[1], _c4), _v5);
-  }
-  _v2 = camlidl_alloc_small(2, 0);
-  Field(_v2, 0) = _v3[0];
-  Field(_v2, 1) = _v3[1];
+    _v3[0] = camlidl_c2ml_pkcs11_ck_mechanism_type_t(&(*_c1).mechanism, _ctx);
+    _v3[1] = camlidl_alloc((*_c1).parameter_len, 0);
+    for (_c4 = 0; _c4 < (*_c1).parameter_len; _c4++) {
+      _v5 = Val_int((unsigned char)((*_c1).parameter[_c4]));
+      modify(&Field(_v3[1], _c4), _v5);
+    }
+    _v2 = camlidl_alloc_small(2, 0);
+    Field(_v2, 0) = _v3[0];
+    Field(_v2, 1) = _v3[1];
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_mechanism_info(value _v1,
-						  struct ck_mechanism_info *_c2,
-						  __attribute__ ((unused))
-						  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_mechanism_info(value _v1, struct ck_mechanism_info * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_mechanism_info(value _v1,
-						  struct ck_mechanism_info *_c2,
-						  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_mechanism_info(value _v1, struct ck_mechanism_info * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
   value _v4;
   value _v5;
   _v3 = Field(_v1, 0);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).min_key_size = custom_int_val(_v3);
   _v4 = Field(_v1, 1);
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2).max_key_size = custom_int_val(_v4);
   _v5 = Field(_v1, 2);
   camlidl_ml2c_pkcs11_ck_flags_t(_v5, &(*_c2).flags, _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_mechanism_info(struct ck_mechanism_info
-						   *_c1,
-						   __attribute__ ((unused))
-						   camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_mechanism_info(struct ck_mechanism_info * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_mechanism_info(struct ck_mechanism_info
-						   *_c1, camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_mechanism_info(struct ck_mechanism_info * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -1293,20 +1077,19 @@ value camlidl_c2ml_pkcs11_struct_ck_mechanism_info(struct ck_mechanism_info
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = custom_copy_int((*_c1).min_key_size);
-  _v3[1] = custom_copy_int((*_c1).max_key_size);
-  _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
-  _v2 = camlidl_alloc_small(3, 0);
-  Field(_v2, 0) = _v3[0];
-  Field(_v2, 1) = _v3[1];
-  Field(_v2, 2) = _v3[2];
+    _v3[0] = custom_copy_int((*_c1).min_key_size);
+    _v3[1] = custom_copy_int((*_c1).max_key_size);
+    _v3[2] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
+    _v2 = camlidl_alloc_small(3, 0);
+    Field(_v2, 0) = _v3[0];
+    Field(_v2, 1) = _v3[1];
+    Field(_v2, 2) = _v3[2];
   End_roots();
   return _v2;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_BYTE(value _v1, CK_BYTE * _c2,
-				 __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_BYTE(value _v1, CK_BYTE * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_CK_BYTE(value _v1, CK_BYTE * _c2, camlidl_ctx _ctx)
 #endif
@@ -1315,20 +1098,18 @@ void camlidl_ml2c_pkcs11_CK_BYTE(value _v1, CK_BYTE * _c2, camlidl_ctx _ctx)
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_BYTE(CK_BYTE * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_BYTE(CK_BYTE * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_BYTE(CK_BYTE * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = Val_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_CHAR(value _v1, CK_CHAR * _c2,
-				 __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_CHAR(value _v1, CK_CHAR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_CK_CHAR(value _v1, CK_CHAR * _c2, camlidl_ctx _ctx)
 #endif
@@ -1337,43 +1118,38 @@ void camlidl_ml2c_pkcs11_CK_CHAR(value _v1, CK_CHAR * _c2, camlidl_ctx _ctx)
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_CHAR(CK_CHAR * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_CHAR(CK_CHAR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_CHAR(CK_CHAR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = Val_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_UTF8CHAR(value _v1, CK_UTF8CHAR * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_UTF8CHAR(value _v1, CK_UTF8CHAR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_UTF8CHAR(value _v1, CK_UTF8CHAR * _c2,
-				     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_UTF8CHAR(value _v1, CK_UTF8CHAR * _c2, camlidl_ctx _ctx)
 #endif
 {
   (*_c2) = Int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_UTF8CHAR(CK_UTF8CHAR * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_UTF8CHAR(CK_UTF8CHAR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_UTF8CHAR(CK_UTF8CHAR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = Val_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_BBOOL(value _v1, CK_BBOOL * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_BBOOL(value _v1, CK_BBOOL * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_CK_BBOOL(value _v1, CK_BBOOL * _c2, camlidl_ctx _ctx)
 #endif
@@ -1382,88 +1158,82 @@ void camlidl_ml2c_pkcs11_CK_BBOOL(value _v1, CK_BBOOL * _c2, camlidl_ctx _ctx)
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_BBOOL(CK_BBOOL * _c2,
-				   __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_BBOOL(CK_BBOOL * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_BBOOL(CK_BBOOL * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = Val_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_ULONG(value _v1, CK_ULONG * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_ULONG(value _v1, CK_ULONG * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_CK_ULONG(value _v1, CK_ULONG * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_ULONG(CK_ULONG * _c2,
-				   __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_ULONG(CK_ULONG * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_ULONG(CK_ULONG * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_LONG(value _v1, CK_LONG * _c2,
-				 __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_LONG(value _v1, CK_LONG * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_CK_LONG(value _v1, CK_LONG * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_LONG(CK_LONG * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_LONG(CK_LONG * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_LONG(CK_LONG * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_BYTE_PTR(value _v1, CK_BYTE_PTR * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_BYTE_PTR(value _v1, CK_BYTE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_BYTE_PTR(value _v1, CK_BYTE_PTR * _c2,
-				     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_BYTE_PTR(value _v1, CK_BYTE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (CK_BYTE *) camlidl_malloc(sizeof(CK_BYTE), _ctx);
+    (*_c2) = (CK_BYTE  *) camlidl_malloc(sizeof(CK_BYTE ), _ctx);
     camlidl_ml2c_pkcs11_CK_BYTE(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_BYTE_PTR(CK_BYTE_PTR * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_BYTE_PTR(CK_BYTE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_BYTE_PTR(CK_BYTE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1478,40 +1248,37 @@ value camlidl_c2ml_pkcs11_CK_BYTE_PTR(CK_BYTE_PTR * _c2, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_CHAR_PTR(value _v1, CK_CHAR_PTR * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_CHAR_PTR(value _v1, CK_CHAR_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_CHAR_PTR(value _v1, CK_CHAR_PTR * _c2,
-				     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_CHAR_PTR(value _v1, CK_CHAR_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (CK_CHAR *) camlidl_malloc(sizeof(CK_CHAR), _ctx);
+    (*_c2) = (CK_CHAR  *) camlidl_malloc(sizeof(CK_CHAR ), _ctx);
     camlidl_ml2c_pkcs11_CK_CHAR(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_CHAR_PTR(CK_CHAR_PTR * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_CHAR_PTR(CK_CHAR_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_CHAR_PTR(CK_CHAR_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1526,43 +1293,37 @@ value camlidl_c2ml_pkcs11_CK_CHAR_PTR(CK_CHAR_PTR * _c2, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_UTF8CHAR_PTR(value _v1, CK_UTF8CHAR_PTR * _c2,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+void camlidl_ml2c_pkcs11_CK_UTF8CHAR_PTR(value _v1, CK_UTF8CHAR_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_UTF8CHAR_PTR(value _v1, CK_UTF8CHAR_PTR * _c2,
-					 camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_UTF8CHAR_PTR(value _v1, CK_UTF8CHAR_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (CK_UTF8CHAR *) camlidl_malloc(sizeof(CK_UTF8CHAR), _ctx);
+    (*_c2) = (CK_UTF8CHAR  *) camlidl_malloc(sizeof(CK_UTF8CHAR ), _ctx);
     camlidl_ml2c_pkcs11_CK_UTF8CHAR(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_UTF8CHAR_PTR(CK_UTF8CHAR_PTR * _c2,
-					  __attribute__ ((unused)) camlidl_ctx
-					  _ctx)
+value camlidl_c2ml_pkcs11_CK_UTF8CHAR_PTR(CK_UTF8CHAR_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_UTF8CHAR_PTR(CK_UTF8CHAR_PTR * _c2,
-					  camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_UTF8CHAR_PTR(CK_UTF8CHAR_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1577,41 +1338,37 @@ value camlidl_c2ml_pkcs11_CK_UTF8CHAR_PTR(CK_UTF8CHAR_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_ULONG_PTR(value _v1, CK_ULONG_PTR * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_ULONG_PTR(value _v1, CK_ULONG_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_ULONG_PTR(value _v1, CK_ULONG_PTR * _c2,
-				      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_ULONG_PTR(value _v1, CK_ULONG_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (CK_ULONG *) camlidl_malloc(sizeof(CK_ULONG), _ctx);
+    (*_c2) = (CK_ULONG  *) camlidl_malloc(sizeof(CK_ULONG ), _ctx);
     camlidl_ml2c_pkcs11_CK_ULONG(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_ULONG_PTR(CK_ULONG_PTR * _c2,
-				       __attribute__ ((unused)) camlidl_ctx
-				       _ctx)
+value camlidl_c2ml_pkcs11_CK_ULONG_PTR(CK_ULONG_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_ULONG_PTR(CK_ULONG_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1626,66 +1383,57 @@ value camlidl_c2ml_pkcs11_CK_ULONG_PTR(CK_ULONG_PTR * _c2, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_VERSION(value _v1, CK_VERSION * _c2,
-				    __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_VERSION(value _v1, CK_VERSION * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_VERSION(value _v1, CK_VERSION * _c2,
-				    camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_VERSION(value _v1, CK_VERSION * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_version(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_VERSION(CK_VERSION * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_VERSION(CK_VERSION * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_VERSION(CK_VERSION * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_version(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_VERSION_PTR(value _v1, CK_VERSION_PTR * _c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+void camlidl_ml2c_pkcs11_CK_VERSION_PTR(value _v1, CK_VERSION_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_VERSION_PTR(value _v1, CK_VERSION_PTR * _c2,
-					camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_VERSION_PTR(value _v1, CK_VERSION_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(struct ck_version *)camlidl_malloc(sizeof(struct ck_version), _ctx);
+    (*_c2) = (struct ck_version  *) camlidl_malloc(sizeof(struct ck_version ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_version(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_VERSION_PTR(CK_VERSION_PTR * _c2,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+value camlidl_c2ml_pkcs11_CK_VERSION_PTR(CK_VERSION_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_VERSION_PTR(CK_VERSION_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1700,16 +1448,15 @@ value camlidl_c2ml_pkcs11_CK_VERSION_PTR(CK_VERSION_PTR * _c2, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_INFO(value _v1, CK_INFO * _c2,
-				 __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_INFO(value _v1, CK_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_CK_INFO(value _v1, CK_INFO * _c2, camlidl_ctx _ctx)
 #endif
@@ -1718,44 +1465,40 @@ void camlidl_ml2c_pkcs11_CK_INFO(value _v1, CK_INFO * _c2, camlidl_ctx _ctx)
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_INFO(CK_INFO * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_INFO(CK_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_INFO(CK_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_info(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_INFO_PTR(value _v1, CK_INFO_PTR * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_INFO_PTR(value _v1, CK_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_INFO_PTR(value _v1, CK_INFO_PTR * _c2,
-				     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_INFO_PTR(value _v1, CK_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (struct ck_info *)camlidl_malloc(sizeof(struct ck_info), _ctx);
+    (*_c2) = (struct ck_info  *) camlidl_malloc(sizeof(struct ck_info ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_info(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_INFO_PTR(CK_INFO_PTR * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_INFO_PTR(CK_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_INFO_PTR(CK_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1770,42 +1513,37 @@ value camlidl_c2ml_pkcs11_CK_INFO_PTR(CK_INFO_PTR * _c2, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_SLOT_ID_PTR(value _v1, CK_SLOT_ID_PTR * _c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+void camlidl_ml2c_pkcs11_CK_SLOT_ID_PTR(value _v1, CK_SLOT_ID_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_SLOT_ID_PTR(value _v1, CK_SLOT_ID_PTR * _c2,
-					camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SLOT_ID_PTR(value _v1, CK_SLOT_ID_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (ck_slot_id_t *) camlidl_malloc(sizeof(ck_slot_id_t), _ctx);
+    (*_c2) = (ck_slot_id_t  *) camlidl_malloc(sizeof(ck_slot_id_t ), _ctx);
     camlidl_ml2c_pkcs11_ck_slot_id_t(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_SLOT_ID_PTR(CK_SLOT_ID_PTR * _c2,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+value camlidl_c2ml_pkcs11_CK_SLOT_ID_PTR(CK_SLOT_ID_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_SLOT_ID_PTR(CK_SLOT_ID_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1820,69 +1558,57 @@ value camlidl_c2ml_pkcs11_CK_SLOT_ID_PTR(CK_SLOT_ID_PTR * _c2, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_SLOT_INFO(value _v1, CK_SLOT_INFO * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SLOT_INFO(value _v1, CK_SLOT_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_SLOT_INFO(value _v1, CK_SLOT_INFO * _c2,
-				      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SLOT_INFO(value _v1, CK_SLOT_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_slot_info(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_SLOT_INFO(CK_SLOT_INFO * _c2,
-				       __attribute__ ((unused)) camlidl_ctx
-				       _ctx)
+value camlidl_c2ml_pkcs11_CK_SLOT_INFO(CK_SLOT_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_SLOT_INFO(CK_SLOT_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_slot_info(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_SLOT_INFO_PTR(value _v1, CK_SLOT_INFO_PTR * _c2,
-					  __attribute__ ((unused)) camlidl_ctx
-					  _ctx)
+void camlidl_ml2c_pkcs11_CK_SLOT_INFO_PTR(value _v1, CK_SLOT_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_SLOT_INFO_PTR(value _v1, CK_SLOT_INFO_PTR * _c2,
-					  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SLOT_INFO_PTR(value _v1, CK_SLOT_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(struct ck_slot_info *)camlidl_malloc(sizeof(struct ck_slot_info),
-					      _ctx);
+    (*_c2) = (struct ck_slot_info  *) camlidl_malloc(sizeof(struct ck_slot_info ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_slot_info(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_SLOT_INFO_PTR(CK_SLOT_INFO_PTR * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+value camlidl_c2ml_pkcs11_CK_SLOT_INFO_PTR(CK_SLOT_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_SLOT_INFO_PTR(CK_SLOT_INFO_PTR * _c2,
-					   camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_SLOT_INFO_PTR(CK_SLOT_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1897,70 +1623,57 @@ value camlidl_c2ml_pkcs11_CK_SLOT_INFO_PTR(CK_SLOT_INFO_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_TOKEN_INFO(value _v1, CK_TOKEN_INFO * _c2,
-				       __attribute__ ((unused)) camlidl_ctx
-				       _ctx)
+void camlidl_ml2c_pkcs11_CK_TOKEN_INFO(value _v1, CK_TOKEN_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_TOKEN_INFO(value _v1, CK_TOKEN_INFO * _c2,
-				       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_TOKEN_INFO(value _v1, CK_TOKEN_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_token_info(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_TOKEN_INFO(CK_TOKEN_INFO * _c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+value camlidl_c2ml_pkcs11_CK_TOKEN_INFO(CK_TOKEN_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_TOKEN_INFO(CK_TOKEN_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_token_info(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_TOKEN_INFO_PTR(value _v1, CK_TOKEN_INFO_PTR * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+void camlidl_ml2c_pkcs11_CK_TOKEN_INFO_PTR(value _v1, CK_TOKEN_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_TOKEN_INFO_PTR(value _v1, CK_TOKEN_INFO_PTR * _c2,
-					   camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_TOKEN_INFO_PTR(value _v1, CK_TOKEN_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(struct ck_token_info *)camlidl_malloc(sizeof(struct ck_token_info),
-					       _ctx);
+    (*_c2) = (struct ck_token_info  *) camlidl_malloc(sizeof(struct ck_token_info ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_token_info(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_TOKEN_INFO_PTR(CK_TOKEN_INFO_PTR * _c2,
-					    __attribute__ ((unused)) camlidl_ctx
-					    _ctx)
+value camlidl_c2ml_pkcs11_CK_TOKEN_INFO_PTR(CK_TOKEN_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_TOKEN_INFO_PTR(CK_TOKEN_INFO_PTR * _c2,
-					    camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_TOKEN_INFO_PTR(CK_TOKEN_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -1975,47 +1688,37 @@ value camlidl_c2ml_pkcs11_CK_TOKEN_INFO_PTR(CK_TOKEN_INFO_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_SESSION_HANDLE_PTR(value _v1,
-					       CK_SESSION_HANDLE_PTR * _c2,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SESSION_HANDLE_PTR(value _v1, CK_SESSION_HANDLE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_SESSION_HANDLE_PTR(value _v1,
-					       CK_SESSION_HANDLE_PTR * _c2,
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SESSION_HANDLE_PTR(value _v1, CK_SESSION_HANDLE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(ck_session_handle_t *) camlidl_malloc(sizeof(ck_session_handle_t),
-					       _ctx);
+    (*_c2) = (ck_session_handle_t  *) camlidl_malloc(sizeof(ck_session_handle_t ), _ctx);
     camlidl_ml2c_pkcs11_ck_session_handle_t(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_SESSION_HANDLE_PTR(CK_SESSION_HANDLE_PTR * _c2,
-						__attribute__ ((unused))
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_SESSION_HANDLE_PTR(CK_SESSION_HANDLE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_SESSION_HANDLE_PTR(CK_SESSION_HANDLE_PTR * _c2,
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_SESSION_HANDLE_PTR(CK_SESSION_HANDLE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2030,73 +1733,57 @@ value camlidl_c2ml_pkcs11_CK_SESSION_HANDLE_PTR(CK_SESSION_HANDLE_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_SESSION_INFO(value _v1, CK_SESSION_INFO * _c2,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+void camlidl_ml2c_pkcs11_CK_SESSION_INFO(value _v1, CK_SESSION_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_SESSION_INFO(value _v1, CK_SESSION_INFO * _c2,
-					 camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SESSION_INFO(value _v1, CK_SESSION_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_session_info(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_SESSION_INFO(CK_SESSION_INFO * _c2,
-					  __attribute__ ((unused)) camlidl_ctx
-					  _ctx)
+value camlidl_c2ml_pkcs11_CK_SESSION_INFO(CK_SESSION_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_SESSION_INFO(CK_SESSION_INFO * _c2,
-					  camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_SESSION_INFO(CK_SESSION_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_session_info(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_SESSION_INFO_PTR(value _v1,
-					     CK_SESSION_INFO_PTR * _c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SESSION_INFO_PTR(value _v1, CK_SESSION_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_SESSION_INFO_PTR(value _v1,
-					     CK_SESSION_INFO_PTR * _c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_SESSION_INFO_PTR(value _v1, CK_SESSION_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(struct ck_session_info *)camlidl_malloc(sizeof(struct ck_session_info),
-						 _ctx);
+    (*_c2) = (struct ck_session_info  *) camlidl_malloc(sizeof(struct ck_session_info ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_session_info(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_SESSION_INFO_PTR(CK_SESSION_INFO_PTR * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_SESSION_INFO_PTR(CK_SESSION_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_SESSION_INFO_PTR(CK_SESSION_INFO_PTR * _c2,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_SESSION_INFO_PTR(CK_SESSION_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2111,46 +1798,37 @@ value camlidl_c2ml_pkcs11_CK_SESSION_INFO_PTR(CK_SESSION_INFO_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_OBJECT_HANDLE_PTR(value _v1,
-					      CK_OBJECT_HANDLE_PTR * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_OBJECT_HANDLE_PTR(value _v1, CK_OBJECT_HANDLE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_OBJECT_HANDLE_PTR(value _v1,
-					      CK_OBJECT_HANDLE_PTR * _c2,
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_OBJECT_HANDLE_PTR(value _v1, CK_OBJECT_HANDLE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(ck_object_handle_t *) camlidl_malloc(sizeof(ck_object_handle_t), _ctx);
+    (*_c2) = (ck_object_handle_t  *) camlidl_malloc(sizeof(ck_object_handle_t ), _ctx);
     camlidl_ml2c_pkcs11_ck_object_handle_t(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_OBJECT_HANDLE_PTR(CK_OBJECT_HANDLE_PTR * _c2,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_OBJECT_HANDLE_PTR(CK_OBJECT_HANDLE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_OBJECT_HANDLE_PTR(CK_OBJECT_HANDLE_PTR * _c2,
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_OBJECT_HANDLE_PTR(CK_OBJECT_HANDLE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2165,46 +1843,37 @@ value camlidl_c2ml_pkcs11_CK_OBJECT_HANDLE_PTR(CK_OBJECT_HANDLE_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_OBJECT_CLASS_PTR(value _v1,
-					     CK_OBJECT_CLASS_PTR * _c2,
-					     __attribute__ ((unused))
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_OBJECT_CLASS_PTR(value _v1, CK_OBJECT_CLASS_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_OBJECT_CLASS_PTR(value _v1,
-					     CK_OBJECT_CLASS_PTR * _c2,
-					     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_OBJECT_CLASS_PTR(value _v1, CK_OBJECT_CLASS_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(ck_object_class_t *) camlidl_malloc(sizeof(ck_object_class_t), _ctx);
+    (*_c2) = (ck_object_class_t  *) camlidl_malloc(sizeof(ck_object_class_t ), _ctx);
     camlidl_ml2c_pkcs11_ck_object_class_t(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_OBJECT_CLASS_PTR(CK_OBJECT_CLASS_PTR * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_OBJECT_CLASS_PTR(CK_OBJECT_CLASS_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_OBJECT_CLASS_PTR(CK_OBJECT_CLASS_PTR * _c2,
-					      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_OBJECT_CLASS_PTR(CK_OBJECT_CLASS_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2219,69 +1888,57 @@ value camlidl_c2ml_pkcs11_CK_OBJECT_CLASS_PTR(CK_OBJECT_CLASS_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_ATTRIBUTE(value _v1, CK_ATTRIBUTE * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_ATTRIBUTE(value _v1, CK_ATTRIBUTE * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_ATTRIBUTE(value _v1, CK_ATTRIBUTE * _c2,
-				      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_ATTRIBUTE(value _v1, CK_ATTRIBUTE * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_attribute(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_ATTRIBUTE(CK_ATTRIBUTE * _c2,
-				       __attribute__ ((unused)) camlidl_ctx
-				       _ctx)
+value camlidl_c2ml_pkcs11_CK_ATTRIBUTE(CK_ATTRIBUTE * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_ATTRIBUTE(CK_ATTRIBUTE * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_attribute(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_ATTRIBUTE_PTR(value _v1, CK_ATTRIBUTE_PTR * _c2,
-					  __attribute__ ((unused)) camlidl_ctx
-					  _ctx)
+void camlidl_ml2c_pkcs11_CK_ATTRIBUTE_PTR(value _v1, CK_ATTRIBUTE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_ATTRIBUTE_PTR(value _v1, CK_ATTRIBUTE_PTR * _c2,
-					  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_ATTRIBUTE_PTR(value _v1, CK_ATTRIBUTE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(struct ck_attribute *)camlidl_malloc(sizeof(struct ck_attribute),
-					      _ctx);
+    (*_c2) = (struct ck_attribute  *) camlidl_malloc(sizeof(struct ck_attribute ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_ATTRIBUTE_PTR(CK_ATTRIBUTE_PTR * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+value camlidl_c2ml_pkcs11_CK_ATTRIBUTE_PTR(CK_ATTRIBUTE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_ATTRIBUTE_PTR(CK_ATTRIBUTE_PTR * _c2,
-					   camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_ATTRIBUTE_PTR(CK_ATTRIBUTE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2296,16 +1953,15 @@ value camlidl_c2ml_pkcs11_CK_ATTRIBUTE_PTR(CK_ATTRIBUTE_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_DATE(value _v1, CK_DATE * _c2,
-				 __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_DATE(value _v1, CK_DATE * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_CK_DATE(value _v1, CK_DATE * _c2, camlidl_ctx _ctx)
 #endif
@@ -2314,44 +1970,40 @@ void camlidl_ml2c_pkcs11_CK_DATE(value _v1, CK_DATE * _c2, camlidl_ctx _ctx)
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_DATE(CK_DATE * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_DATE(CK_DATE * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_DATE(CK_DATE * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_date(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_DATE_PTR(value _v1, CK_DATE_PTR * _c2,
-				     __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_DATE_PTR(value _v1, CK_DATE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_DATE_PTR(value _v1, CK_DATE_PTR * _c2,
-				     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_DATE_PTR(value _v1, CK_DATE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (struct ck_date *)camlidl_malloc(sizeof(struct ck_date), _ctx);
+    (*_c2) = (struct ck_date  *) camlidl_malloc(sizeof(struct ck_date ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_date(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_DATE_PTR(CK_DATE_PTR * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_DATE_PTR(CK_DATE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_DATE_PTR(CK_DATE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2366,47 +2018,37 @@ value camlidl_c2ml_pkcs11_CK_DATE_PTR(CK_DATE_PTR * _c2, camlidl_ctx _ctx)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_MECHANISM_TYPE_PTR(value _v1,
-					       CK_MECHANISM_TYPE_PTR * _c2,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_TYPE_PTR(value _v1, CK_MECHANISM_TYPE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_MECHANISM_TYPE_PTR(value _v1,
-					       CK_MECHANISM_TYPE_PTR * _c2,
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_TYPE_PTR(value _v1, CK_MECHANISM_TYPE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(ck_mechanism_type_t *) camlidl_malloc(sizeof(ck_mechanism_type_t),
-					       _ctx);
+    (*_c2) = (ck_mechanism_type_t  *) camlidl_malloc(sizeof(ck_mechanism_type_t ), _ctx);
     camlidl_ml2c_pkcs11_ck_mechanism_type_t(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_MECHANISM_TYPE_PTR(CK_MECHANISM_TYPE_PTR * _c2,
-						__attribute__ ((unused))
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_TYPE_PTR(CK_MECHANISM_TYPE_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_MECHANISM_TYPE_PTR(CK_MECHANISM_TYPE_PTR * _c2,
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_TYPE_PTR(CK_MECHANISM_TYPE_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2421,69 +2063,57 @@ value camlidl_c2ml_pkcs11_CK_MECHANISM_TYPE_PTR(CK_MECHANISM_TYPE_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_MECHANISM(value _v1, CK_MECHANISM * _c2,
-				      __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM(value _v1, CK_MECHANISM * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_MECHANISM(value _v1, CK_MECHANISM * _c2,
-				      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM(value _v1, CK_MECHANISM * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_mechanism(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_MECHANISM(CK_MECHANISM * _c2,
-				       __attribute__ ((unused)) camlidl_ctx
-				       _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM(CK_MECHANISM * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_CK_MECHANISM(CK_MECHANISM * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_mechanism(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_MECHANISM_PTR(value _v1, CK_MECHANISM_PTR * _c2,
-					  __attribute__ ((unused)) camlidl_ctx
-					  _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_PTR(value _v1, CK_MECHANISM_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_MECHANISM_PTR(value _v1, CK_MECHANISM_PTR * _c2,
-					  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_PTR(value _v1, CK_MECHANISM_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) =
-	(struct ck_mechanism *)camlidl_malloc(sizeof(struct ck_mechanism),
-					      _ctx);
+    (*_c2) = (struct ck_mechanism  *) camlidl_malloc(sizeof(struct ck_mechanism ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_mechanism(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_MECHANISM_PTR(CK_MECHANISM_PTR * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_PTR(CK_MECHANISM_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_MECHANISM_PTR(CK_MECHANISM_PTR * _c2,
-					   camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_PTR(CK_MECHANISM_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2498,72 +2128,57 @@ value camlidl_c2ml_pkcs11_CK_MECHANISM_PTR(CK_MECHANISM_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO(value _v1, CK_MECHANISM_INFO * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO(value _v1, CK_MECHANISM_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO(value _v1, CK_MECHANISM_INFO * _c2,
-					   camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO(value _v1, CK_MECHANISM_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_mechanism_info(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO(CK_MECHANISM_INFO * _c2,
-					    __attribute__ ((unused)) camlidl_ctx
-					    _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO(CK_MECHANISM_INFO * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO(CK_MECHANISM_INFO * _c2,
-					    camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO(CK_MECHANISM_INFO * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_mechanism_info(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO_PTR(value _v1,
-					       CK_MECHANISM_INFO_PTR * _c2,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO_PTR(value _v1, CK_MECHANISM_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO_PTR(value _v1,
-					       CK_MECHANISM_INFO_PTR * _c2,
-					       camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_MECHANISM_INFO_PTR(value _v1, CK_MECHANISM_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (struct ck_mechanism_info *)
-	camlidl_malloc(sizeof(struct ck_mechanism_info), _ctx);
+    (*_c2) = (struct ck_mechanism_info  *) camlidl_malloc(sizeof(struct ck_mechanism_info ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_mechanism_info(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO_PTR(CK_MECHANISM_INFO_PTR * _c2,
-						__attribute__ ((unused))
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO_PTR(CK_MECHANISM_INFO_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO_PTR(CK_MECHANISM_INFO_PTR * _c2,
-						camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO_PTR(CK_MECHANISM_INFO_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2578,83 +2193,60 @@ value camlidl_c2ml_pkcs11_CK_MECHANISM_INFO_PTR(CK_MECHANISM_INFO_PTR * _c2,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
-extern void camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(value, struct
-							    ck_c_initialize_args
-							    *,
-							    camlidl_ctx _ctx);
-extern value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct
-							     ck_c_initialize_args
-							     *,
-							     camlidl_ctx _ctx);
+extern void camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(value, struct ck_c_initialize_args *, camlidl_ctx _ctx);
+extern value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct ck_c_initialize_args *, camlidl_ctx _ctx);
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS(value _v1,
-					      CK_C_INITIALIZE_ARGS * _c2,
-					      __attribute__ ((unused))
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS(value _v1, CK_C_INITIALIZE_ARGS * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS(value _v1,
-					      CK_C_INITIALIZE_ARGS * _c2,
-					      camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS(value _v1, CK_C_INITIALIZE_ARGS * _c2, camlidl_ctx _ctx)
 #endif
 {
   camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(_v1, &(*_c2), _ctx);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS(CK_C_INITIALIZE_ARGS * _c2,
-					       __attribute__ ((unused))
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS(CK_C_INITIALIZE_ARGS * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS(CK_C_INITIALIZE_ARGS * _c2,
-					       camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS(CK_C_INITIALIZE_ARGS * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(&(*_c2), _ctx);
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS_PTR(value _v1,
-						  CK_C_INITIALIZE_ARGS_PTR *
-						  _c2, __attribute__ ((unused))
-						  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS_PTR(value _v1, CK_C_INITIALIZE_ARGS_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS_PTR(value _v1,
-						  CK_C_INITIALIZE_ARGS_PTR *
-						  _c2, camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_CK_C_INITIALIZE_ARGS_PTR(value _v1, CK_C_INITIALIZE_ARGS_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v3;
+value _v3;
   if (_v1 == Val_int(0)) {
     (*_c2) = NULL;
   } else {
     _v3 = Field(_v1, 0);
-    (*_c2) = (struct ck_c_initialize_args *)
-	camlidl_malloc(sizeof(struct ck_c_initialize_args), _ctx);
+    (*_c2) = (struct ck_c_initialize_args  *) camlidl_malloc(sizeof(struct ck_c_initialize_args ), _ctx);
     camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(_v3, &*(*_c2), _ctx);
   }
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS_PTR(CK_C_INITIALIZE_ARGS_PTR *
-						   _c2, __attribute__ ((unused))
-						   camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS_PTR(CK_C_INITIALIZE_ARGS_PTR * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS_PTR(CK_C_INITIALIZE_ARGS_PTR *
-						   _c2, camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS_PTR(CK_C_INITIALIZE_ARGS_PTR * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  value _v3;
+value _v1;
+value _v3;
   if ((*_c2) == NULL) {
     _v1 = Val_int(0);
   } else {
@@ -2669,158 +2261,122 @@ value camlidl_c2ml_pkcs11_CK_C_INITIALIZE_ARGS_PTR(CK_C_INITIALIZE_ARGS_PTR *
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    _v1 = camlidl_alloc_small(1, 0);
-    Field(_v1, 0) = _v3;
+      _v1 = camlidl_alloc_small(1, 0);
+      Field(_v1, 0) = _v3;
     End_roots();
   }
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_rv_t(value _v1, ck_rv_t * _c2,
-				 __attribute__ ((unused)) camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_rv_t(value _v1, ck_rv_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 void camlidl_ml2c_pkcs11_ck_rv_t(value _v1, ck_rv_t * _c2, camlidl_ctx _ctx)
 #endif
 {
+  /* To handle OCaml client RPC layer int64 format */
   (*_c2) = custom_int_val(_v1);
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_rv_t(ck_rv_t * _c2,
-				  __attribute__ ((unused)) camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_rv_t(ck_rv_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_ck_rv_t(ck_rv_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
+value _v1;
   _v1 = custom_copy_int((*_c2));
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_createmutex_t(value _v1, ck_createmutex_t * _c2,
-					  __attribute__ ((unused)) camlidl_ctx
-					  _ctx)
+void camlidl_ml2c_pkcs11_ck_createmutex_t(value _v1, ck_createmutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_createmutex_t(value _v1, ck_createmutex_t * _c2,
-					  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_createmutex_t(value _v1, ck_createmutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
   *_c2 = *((ck_createmutex_t *) Bp_val(_v1));
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_createmutex_t(ck_createmutex_t * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+value camlidl_c2ml_pkcs11_ck_createmutex_t(ck_createmutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_createmutex_t(ck_createmutex_t * _c2,
-					   camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_createmutex_t(ck_createmutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  _v1 =
-      camlidl_alloc((sizeof(ck_createmutex_t) + sizeof(value) -
-		     1) / sizeof(value), Abstract_tag);
+value _v1;
+  _v1 = camlidl_alloc((sizeof(ck_createmutex_t) + sizeof(value) - 1) / sizeof(value), Abstract_tag);
   *((ck_createmutex_t *) Bp_val(_v1)) = *_c2;
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_destroymutex_t(value _v1, ck_destroymutex_t * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+void camlidl_ml2c_pkcs11_ck_destroymutex_t(value _v1, ck_destroymutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_destroymutex_t(value _v1, ck_destroymutex_t * _c2,
-					   camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_destroymutex_t(value _v1, ck_destroymutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
   *_c2 = *((ck_destroymutex_t *) Bp_val(_v1));
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_destroymutex_t(ck_destroymutex_t * _c2,
-					    __attribute__ ((unused)) camlidl_ctx
-					    _ctx)
+value camlidl_c2ml_pkcs11_ck_destroymutex_t(ck_destroymutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_destroymutex_t(ck_destroymutex_t * _c2,
-					    camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_destroymutex_t(ck_destroymutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  _v1 =
-      camlidl_alloc((sizeof(ck_destroymutex_t) + sizeof(value) -
-		     1) / sizeof(value), Abstract_tag);
+value _v1;
+  _v1 = camlidl_alloc((sizeof(ck_destroymutex_t) + sizeof(value) - 1) / sizeof(value), Abstract_tag);
   *((ck_destroymutex_t *) Bp_val(_v1)) = *_c2;
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_lockmutex_t(value _v1, ck_lockmutex_t * _c2,
-					__attribute__ ((unused)) camlidl_ctx
-					_ctx)
+void camlidl_ml2c_pkcs11_ck_lockmutex_t(value _v1, ck_lockmutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_lockmutex_t(value _v1, ck_lockmutex_t * _c2,
-					camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_lockmutex_t(value _v1, ck_lockmutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
   *_c2 = *((ck_lockmutex_t *) Bp_val(_v1));
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_lockmutex_t(ck_lockmutex_t * _c2,
-					 __attribute__ ((unused)) camlidl_ctx
-					 _ctx)
+value camlidl_c2ml_pkcs11_ck_lockmutex_t(ck_lockmutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
 value camlidl_c2ml_pkcs11_ck_lockmutex_t(ck_lockmutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  _v1 =
-      camlidl_alloc((sizeof(ck_lockmutex_t) + sizeof(value) -
-		     1) / sizeof(value), Abstract_tag);
+value _v1;
+  _v1 = camlidl_alloc((sizeof(ck_lockmutex_t) + sizeof(value) - 1) / sizeof(value), Abstract_tag);
   *((ck_lockmutex_t *) Bp_val(_v1)) = *_c2;
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_ck_unlockmutex_t(value _v1, ck_unlockmutex_t * _c2,
-					  __attribute__ ((unused)) camlidl_ctx
-					  _ctx)
+void camlidl_ml2c_pkcs11_ck_unlockmutex_t(value _v1, ck_unlockmutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_ck_unlockmutex_t(value _v1, ck_unlockmutex_t * _c2,
-					  camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_ck_unlockmutex_t(value _v1, ck_unlockmutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
   *_c2 = *((ck_unlockmutex_t *) Bp_val(_v1));
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_ck_unlockmutex_t(ck_unlockmutex_t * _c2,
-					   __attribute__ ((unused)) camlidl_ctx
-					   _ctx)
+value camlidl_c2ml_pkcs11_ck_unlockmutex_t(ck_unlockmutex_t * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_ck_unlockmutex_t(ck_unlockmutex_t * _c2,
-					   camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_ck_unlockmutex_t(ck_unlockmutex_t * _c2, camlidl_ctx _ctx)
 #endif
 {
-  value _v1;
-  _v1 =
-      camlidl_alloc((sizeof(ck_unlockmutex_t) + sizeof(value) -
-		     1) / sizeof(value), Abstract_tag);
+value _v1;
+  _v1 = camlidl_alloc((sizeof(ck_unlockmutex_t) + sizeof(value) - 1) / sizeof(value), Abstract_tag);
   *((ck_unlockmutex_t *) Bp_val(_v1)) = *_c2;
   return _v1;
 }
 
 #ifdef __GNUC__
-void camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(value _v1, struct ck_c_initialize_args
-						     *_c2,
-						     __attribute__ ((unused))
-						     camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(value _v1, struct ck_c_initialize_args * _c2, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-void camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(value _v1, struct ck_c_initialize_args
-						     *_c2, camlidl_ctx _ctx)
+void camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(value _v1, struct ck_c_initialize_args * _c2, camlidl_ctx _ctx)
 #endif
 {
   value _v3;
@@ -2842,14 +2398,9 @@ void camlidl_ml2c_pkcs11_struct_ck_c_initialize_args(value _v1, struct ck_c_init
 }
 
 #ifdef __GNUC__
-value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct
-						      ck_c_initialize_args *_c1,
-						      __attribute__ ((unused))
-						      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct ck_c_initialize_args * _c1, __attribute__((unused)) camlidl_ctx _ctx)
 #else
-value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct
-						      ck_c_initialize_args *_c1,
-						      camlidl_ctx _ctx)
+value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct ck_c_initialize_args * _c1, camlidl_ctx _ctx)
 #endif
 {
   value _v2;
@@ -2865,17 +2416,15 @@ value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _v3[0] = camlidl_c2ml_pkcs11_ck_createmutex_t(&(*_c1).create_mutex, _ctx);
-  _v3[1] = camlidl_c2ml_pkcs11_ck_destroymutex_t(&(*_c1).destroy_mutex, _ctx);
-  _v3[2] = camlidl_c2ml_pkcs11_ck_lockmutex_t(&(*_c1).lock_mutex, _ctx);
-  _v3[3] = camlidl_c2ml_pkcs11_ck_unlockmutex_t(&(*_c1).unlock_mutex, _ctx);
-  _v3[4] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
-  _v2 = camlidl_alloc_small(5, 0);
-  {
-    mlsize_t _c4;
-    for (_c4 = 0; _c4 < 5; _c4++)
-      Field(_v2, _c4) = _v3[_c4];
-  }
+    _v3[0] = camlidl_c2ml_pkcs11_ck_createmutex_t(&(*_c1).create_mutex, _ctx);
+    _v3[1] = camlidl_c2ml_pkcs11_ck_destroymutex_t(&(*_c1).destroy_mutex, _ctx);
+    _v3[2] = camlidl_c2ml_pkcs11_ck_lockmutex_t(&(*_c1).lock_mutex, _ctx);
+    _v3[3] = camlidl_c2ml_pkcs11_ck_unlockmutex_t(&(*_c1).unlock_mutex, _ctx);
+    _v3[4] = camlidl_c2ml_pkcs11_ck_flags_t(&(*_c1).flags, _ctx);
+    _v2 = camlidl_alloc_small(5, 0);
+    { mlsize_t _c4;
+      for (_c4 = 0; _c4 < 5; _c4++) Field(_v2, _c4) = _v3[_c4];
+    }
   End_roots();
   return _v2;
 }
@@ -2884,10 +2433,11 @@ value camlidl_c2ml_pkcs11_struct_ck_c_initialize_args(struct
 
 #define CKR_OK					(0UL)
 
-value camlidl_pkcs11_ML_CK_C_Daemonize(value _v_param)
+value camlidl_pkcs11_ML_CK_C_Daemonize(
+	value _v_param)
 {
-  unsigned char *param;		/*in */
-  unsigned long param_len;	/*in */
+  unsigned char *param; /*in*/
+  unsigned long param_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -2897,7 +2447,7 @@ value camlidl_pkcs11_ML_CK_C_Daemonize(value _v_param)
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
   _c1 = Wosize_val(_v_param);
-  param = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  param = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_param, _c2);
     param[_c2] = Int_val(_v3);
@@ -2909,14 +2459,16 @@ value camlidl_pkcs11_ML_CK_C_Daemonize(value _v_param)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_SetupArch(value _v_arch)
+value camlidl_pkcs11_ML_CK_C_SetupArch(
+	value _v_arch)
 {
-  unsigned int arch;		/*in */
+  unsigned int arch; /*in*/
   ck_rv_t _res;
   value _vres;
 
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
+  /* To handle OCaml client RPC layer int64 format */
   arch = custom_int_val(_v_arch);
   /* Check if SetupArch was previously called, if so, return -1 */
   if (peer_arch != NOT_INITIALIZED) {
@@ -2928,8 +2480,7 @@ value camlidl_pkcs11_ML_CK_C_SetupArch(value _v_arch)
     camlidl_free(_ctx);
     return _vres;
   }
-  _res = ML_CK_C_SetupArch(arch);
-  /* Initialize local architecture */
+  _res = ML_CK_C_SetupArch(arch);/* Initialize local architecture */
   if (_res != UNSUPPORTED_ARCHITECTURE) {
     peer_arch = arch;
     my_arch = _res;
@@ -2939,9 +2490,10 @@ value camlidl_pkcs11_ML_CK_C_SetupArch(value _v_arch)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_LoadModule(value _v_libname)
+value camlidl_pkcs11_ML_CK_C_LoadModule(
+	value _v_libname)
 {
-  unsigned char *libname;	/*in */
+  unsigned char *libname; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -2951,7 +2503,7 @@ value camlidl_pkcs11_ML_CK_C_LoadModule(value _v_libname)
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
   _c1 = Wosize_val(_v_libname);
-  libname = camlidl_malloc((_c1 + 1) * sizeof(unsigned char), _ctx);
+  libname = camlidl_malloc((_c1 + 1) * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_libname, _c2);
     libname[_c2] = Int_val(_v3);
@@ -2981,7 +2533,7 @@ value camlidl_pkcs11_ML_CK_C_LoadModule(value _v_libname)
 }
 
 #ifdef __GNUC__
-value camlidl_pkcs11_ML_CK_C_Initialize( __attribute__ ((unused)) value _unit)
+value camlidl_pkcs11_ML_CK_C_Initialize(__attribute__((unused))value _unit)
 #else
 value camlidl_pkcs11_ML_CK_C_Initialize(value _unit)
 #endif
@@ -2998,7 +2550,7 @@ value camlidl_pkcs11_ML_CK_C_Initialize(value _unit)
 }
 
 #ifdef __GNUC__
-value camlidl_pkcs11_ML_CK_C_Finalize( __attribute__ ((unused)) value _unit)
+value camlidl_pkcs11_ML_CK_C_Finalize(__attribute__((unused))value _unit)
 #else
 value camlidl_pkcs11_ML_CK_C_Finalize(value _unit)
 #endif
@@ -3014,13 +2566,15 @@ value camlidl_pkcs11_ML_CK_C_Finalize(value _unit)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetSlotList(value _v_token_present, value _v_count)
+value camlidl_pkcs11_ML_CK_C_GetSlotList(
+	value _v_token_present,
+	value _v_count)
 {
   unsigned long slots_to_cpy = 0;
-  unsigned int token_present;	/*in */
-  ck_slot_id_t *slot_list;	/*out */
-  unsigned long count;		/*in */
-  unsigned long *real_count;	/*out */
+  unsigned int token_present; /*in*/
+  ck_slot_id_t *slot_list; /*out*/
+  unsigned long count; /*in*/
+  unsigned long *real_count; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3030,9 +2584,11 @@ value camlidl_pkcs11_ML_CK_C_GetSlotList(value _v_token_present, value _v_count)
   value _vresult;
   value _vres[3] = { 0, 0, 0, };
 
+  /* To handle OCaml client RPC layer int64 format */
   token_present = custom_int_val(_v_token_present);
+  /* To handle OCaml client RPC layer int64 format */
   count = custom_int_val(_v_count);
-  slot_list = camlidl_malloc(count * sizeof(ck_slot_id_t), _ctx);
+  slot_list = camlidl_malloc(count * sizeof(ck_slot_id_t ), _ctx);
   real_count = &_c1;
   _res = ML_CK_C_GetSlotList(token_present, slot_list, count, real_count);
 /* We add this because of possible shadow warning  */
@@ -3045,51 +2601,53 @@ value camlidl_pkcs11_ML_CK_C_GetSlotList(value _v_token_present, value _v_count)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  /* If we have got an error from PKCS#11 functions */
-  /* we return an empty array to the caml side      */
-  if (_res != CKR_OK) {
-    count = 0;
-  }
-  if (count > *real_count) {
-    _vres[1] = camlidl_alloc(*real_count, 0);
-    slots_to_cpy = *real_count;
-  } else {
-    _vres[1] = camlidl_alloc(count, 0);
-    slots_to_cpy = count;
-  }
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    /* If we have got an error from PKCS#11 functions */
+      /* we return an empty array to the caml side      */
+      if (_res != CKR_OK) {
+        count = 0;
+      }
+      if (count > *real_count) {
+        _vres[1] = camlidl_alloc(*real_count, 0);
+        slots_to_cpy = *real_count;
+      }
+      else {
+        _vres[1] = camlidl_alloc(count, 0);
+        slots_to_cpy = count;
+      }
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #endif
-  Begin_root(_vres[1]);
+      Begin_root(_vres[1]);
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  for (_c2 = 0; _c2 < slots_to_cpy; _c2++) {
-    _v3 = camlidl_c2ml_pkcs11_ck_slot_id_t(&slot_list[_c2], _ctx);
-    modify(&Field(_vres[1], _c2), _v3);
-  }
-  End_roots();
-  _vres[2] = custom_copy_int(*real_count);
-  _vresult = camlidl_alloc_small(3, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
-  Field(_vresult, 2) = _vres[2];
+      for(_c2 = 0;_c2 < slots_to_cpy;_c2++) {
+        _v3 = camlidl_c2ml_pkcs11_ck_slot_id_t(&slot_list[_c2], _ctx);
+        modify(&Field(_vres[1], _c2), _v3);
+    }
+    End_roots();
+    /* To handle OCaml client RPC layer int64 format */
+    _vres[2] = custom_copy_int(*real_count);
+    _vresult = camlidl_alloc_small(3, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
+    Field(_vresult, 2) = _vres[2];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
 #ifdef __GNUC__
-value camlidl_pkcs11_ML_CK_C_GetInfo( __attribute__ ((unused)) value _unit)
+value camlidl_pkcs11_ML_CK_C_GetInfo(__attribute__((unused))value _unit)
 #else
 value camlidl_pkcs11_ML_CK_C_GetInfo(value _unit)
 #endif
 {
-  struct ck_info *info;		/*out */
+  struct ck_info *info; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3109,20 +2667,21 @@ value camlidl_pkcs11_ML_CK_C_GetInfo(value _unit)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_struct_ck_info(&*info, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_struct_ck_info(&*info, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_WaitForSlotEvent(value _v_flags)
+value camlidl_pkcs11_ML_CK_C_WaitForSlotEvent(
+	value _v_flags)
 {
-  ck_flags_t flags;		/*in */
-  ck_slot_id_t *slot_id;	/*out */
+  ck_flags_t flags; /*in*/
+  ck_slot_id_t *slot_id; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3143,20 +2702,21 @@ value camlidl_pkcs11_ML_CK_C_WaitForSlotEvent(value _v_flags)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_slot_id_t(&*slot_id, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_slot_id_t(&*slot_id, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetSlotInfo(value _v_slot_id)
+value camlidl_pkcs11_ML_CK_C_GetSlotInfo(
+	value _v_slot_id)
 {
-  ck_slot_id_t slot_id;		/*in */
-  struct ck_slot_info *info;	/*out */
+  ck_slot_id_t slot_id; /*in*/
+  struct ck_slot_info *info; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3177,20 +2737,21 @@ value camlidl_pkcs11_ML_CK_C_GetSlotInfo(value _v_slot_id)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_struct_ck_slot_info(&*info, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_struct_ck_slot_info(&*info, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetTokenInfo(value _v_slot_id)
+value camlidl_pkcs11_ML_CK_C_GetTokenInfo(
+	value _v_slot_id)
 {
-  ck_slot_id_t slot_id;		/*in */
-  struct ck_token_info *info;	/*out */
+  ck_slot_id_t slot_id; /*in*/
+  struct ck_token_info *info; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3211,23 +2772,25 @@ value camlidl_pkcs11_ML_CK_C_GetTokenInfo(value _v_slot_id)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_struct_ck_token_info(&*info, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_struct_ck_token_info(&*info, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_InitToken(value _v_slot_id,
-				       value _v_pin, value _v_label)
+value camlidl_pkcs11_ML_CK_C_InitToken(
+	value _v_slot_id,
+	value _v_pin,
+	value _v_label)
 {
-  ck_slot_id_t slot_id;		/*in */
-  unsigned char *pin;		/*in */
-  unsigned long pin_len;	/*in */
-  unsigned char *label;		/*in */
+  ck_slot_id_t slot_id; /*in*/
+  unsigned char *pin; /*in*/
+  unsigned long pin_len; /*in*/
+  unsigned char *label; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -3241,14 +2804,14 @@ value camlidl_pkcs11_ML_CK_C_InitToken(value _v_slot_id,
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_slot_id_t(_v_slot_id, &slot_id, _ctx);
   _c1 = Wosize_val(_v_pin);
-  pin = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  pin = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_pin, _c2);
     pin[_c2] = Int_val(_v3);
   }
   pin_len = _c1;
   _c4 = Wosize_val(_v_label);
-  label = camlidl_malloc((_c4 + 1) * sizeof(unsigned char), _ctx);
+  label = camlidl_malloc((_c4 + 1) * sizeof(unsigned char ), _ctx);
   for (_c5 = 0; _c5 < _c4; _c5++) {
     _v6 = Field(_v_label, _c5);
     label[_c5] = Int_val(_v6);
@@ -3260,11 +2823,13 @@ value camlidl_pkcs11_ML_CK_C_InitToken(value _v_slot_id,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_OpenSession(value _v_slot_id, value _v_flags)
+value camlidl_pkcs11_ML_CK_C_OpenSession(
+	value _v_slot_id,
+	value _v_flags)
 {
-  ck_slot_id_t slot_id;		/*in */
-  ck_flags_t flags;		/*in */
-  ck_session_handle_t *session;	/*out */
+  ck_slot_id_t slot_id; /*in*/
+  ck_flags_t flags; /*in*/
+  ck_session_handle_t *session; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3286,19 +2851,20 @@ value camlidl_pkcs11_ML_CK_C_OpenSession(value _v_slot_id, value _v_flags)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_session_handle_t(&*session, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_session_handle_t(&*session, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_CloseSession(value _v_session)
+value camlidl_pkcs11_ML_CK_C_CloseSession(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
+  ck_session_handle_t session; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -3311,9 +2877,10 @@ value camlidl_pkcs11_ML_CK_C_CloseSession(value _v_session)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_CloseAllSessions(value _v_slot_id)
+value camlidl_pkcs11_ML_CK_C_CloseAllSessions(
+	value _v_slot_id)
 {
-  ck_slot_id_t slot_id;		/*in */
+  ck_slot_id_t slot_id; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -3326,10 +2893,11 @@ value camlidl_pkcs11_ML_CK_C_CloseAllSessions(value _v_slot_id)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetSessionInfo(value _v_session)
+value camlidl_pkcs11_ML_CK_C_GetSessionInfo(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_session_info *info;	/*out */
+  ck_session_handle_t session; /*in*/
+  struct ck_session_info *info; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3350,23 +2918,25 @@ value camlidl_pkcs11_ML_CK_C_GetSessionInfo(value _v_session)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_struct_ck_session_info(&*info, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_struct_ck_session_info(&*info, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_Login(value _v_session,
-				   value _v_user_type, value _v_pin)
+value camlidl_pkcs11_ML_CK_C_Login(
+	value _v_session,
+	value _v_user_type,
+	value _v_pin)
 {
-  ck_session_handle_t session;	/*in */
-  ck_user_type_t user_type;	/*in */
-  unsigned char *pin;		/*in */
-  unsigned long pin_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  ck_user_type_t user_type; /*in*/
+  unsigned char *pin; /*in*/
+  unsigned long pin_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -3378,7 +2948,7 @@ value camlidl_pkcs11_ML_CK_C_Login(value _v_session,
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   camlidl_ml2c_pkcs11_ck_user_type_t(_v_user_type, &user_type, _ctx);
   _c1 = Wosize_val(_v_pin);
-  pin = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  pin = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_pin, _c2);
     pin[_c2] = Int_val(_v3);
@@ -3390,9 +2960,10 @@ value camlidl_pkcs11_ML_CK_C_Login(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_Logout(value _v_session)
+value camlidl_pkcs11_ML_CK_C_Logout(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
+  ck_session_handle_t session; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -3405,13 +2976,15 @@ value camlidl_pkcs11_ML_CK_C_Logout(value _v_session)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetMechanismList(value _v_slot_id, value _v_count)
+value camlidl_pkcs11_ML_CK_C_GetMechanismList(
+	value _v_slot_id,
+	value _v_count)
 {
   unsigned long mech_to_cpy = 0;
-  ck_slot_id_t slot_id;		/*in */
-  ck_mechanism_type_t *mechanism_list;	/*out */
-  unsigned long count;		/*in */
-  unsigned long *real_count;	/*out */
+  ck_slot_id_t slot_id; /*in*/
+  ck_mechanism_type_t *mechanism_list; /*out*/
+  unsigned long count; /*in*/
+  unsigned long *real_count; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3422,8 +2995,9 @@ value camlidl_pkcs11_ML_CK_C_GetMechanismList(value _v_slot_id, value _v_count)
   value _vres[3] = { 0, 0, 0, };
 
   camlidl_ml2c_pkcs11_ck_slot_id_t(_v_slot_id, &slot_id, _ctx);
+  /* To handle OCaml client RPC layer int64 format */
   count = custom_int_val(_v_count);
-  mechanism_list = camlidl_malloc(count * sizeof(ck_mechanism_type_t), _ctx);
+  mechanism_list = camlidl_malloc(count * sizeof(ck_mechanism_type_t ), _ctx);
   real_count = &_c1;
   _res = ML_CK_C_GetMechanismList(slot_id, mechanism_list, count, real_count);
 /* We add this because of possible shadow warning  */
@@ -3436,50 +3010,54 @@ value camlidl_pkcs11_ML_CK_C_GetMechanismList(value _v_slot_id, value _v_count)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  /* If we have got an error from PKCS#11 functions */
-  /* we return an empty array to the caml side      */
-  if (_res != CKR_OK) {
-    count = 0;
-  }
-  if (count > *real_count) {
-    _vres[1] = camlidl_alloc(*real_count, 0);
-    mech_to_cpy = *real_count;
-  } else {
-    _vres[1] = camlidl_alloc(count, 0);
-    mech_to_cpy = count;
-  }
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    /* If we have got an error from PKCS#11 functions */
+      /* we return an empty array to the caml side      */
+      if (_res != CKR_OK) {
+        count = 0;
+      }
+      if (count > *real_count) {
+        _vres[1] = camlidl_alloc(*real_count, 0);
+        mech_to_cpy = *real_count;
+      }
+      else {
+        _vres[1] = camlidl_alloc(count, 0);
+        mech_to_cpy = count;
+      }
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #endif
-  Begin_root(_vres[1]);
+      Begin_root(_vres[1]);
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  for (_c2 = 0; _c2 < mech_to_cpy; _c2++) {
-    _v3 = camlidl_c2ml_pkcs11_ck_mechanism_type_t(&mechanism_list[_c2], _ctx);
-    modify(&Field(_vres[1], _c2), _v3);
-  }
-  End_roots();
-  _vres[2] = custom_copy_int(*real_count);
-  _vresult = camlidl_alloc_small(3, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
-  Field(_vresult, 2) = _vres[2];
+      for(_c2 = 0;_c2 < mech_to_cpy;_c2++) {
+        _v3 = camlidl_c2ml_pkcs11_ck_mechanism_type_t(&mechanism_list[_c2],
+                                                      _ctx);
+        modify(&Field(_vres[1], _c2), _v3);
+    }
+    End_roots();
+    /* To handle OCaml client RPC layer int64 format */
+    _vres[2] = custom_copy_int(*real_count);
+    _vresult = camlidl_alloc_small(3, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
+    Field(_vresult, 2) = _vres[2];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetMechanismInfo(value _v_slot_id,
-					      value _v_mechanism)
+value camlidl_pkcs11_ML_CK_C_GetMechanismInfo(
+	value _v_slot_id,
+	value _v_mechanism)
 {
-  ck_slot_id_t slot_id;		/*in */
-  ck_mechanism_type_t mechanism;	/*in */
-  struct ck_mechanism_info *info;	/*out */
+  ck_slot_id_t slot_id; /*in*/
+  ck_mechanism_type_t mechanism; /*in*/
+  struct ck_mechanism_info *info; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3501,21 +3079,23 @@ value camlidl_pkcs11_ML_CK_C_GetMechanismInfo(value _v_slot_id,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_struct_ck_mechanism_info(&*info, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_struct_ck_mechanism_info(&*info, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_InitPIN(value _v_session, value _v_pin)
+value camlidl_pkcs11_ML_CK_C_InitPIN(
+	value _v_session,
+	value _v_pin)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *pin;		/*in */
-  unsigned long pin_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *pin; /*in*/
+  unsigned long pin_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -3526,7 +3106,7 @@ value camlidl_pkcs11_ML_CK_C_InitPIN(value _v_session, value _v_pin)
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_pin);
-  pin = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  pin = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_pin, _c2);
     pin[_c2] = Int_val(_v3);
@@ -3538,14 +3118,16 @@ value camlidl_pkcs11_ML_CK_C_InitPIN(value _v_session, value _v_pin)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_SetPIN(value _v_session,
-				    value _v_old_pin, value _v_new_pin)
+value camlidl_pkcs11_ML_CK_C_SetPIN(
+	value _v_session,
+	value _v_old_pin,
+	value _v_new_pin)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *old_pin;	/*in */
-  unsigned long old_pin_len;	/*in */
-  unsigned char *new_pin;	/*in */
-  unsigned long new_pin_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *old_pin; /*in*/
+  unsigned long old_pin_len; /*in*/
+  unsigned char *new_pin; /*in*/
+  unsigned long new_pin_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -3559,14 +3141,14 @@ value camlidl_pkcs11_ML_CK_C_SetPIN(value _v_session,
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_old_pin);
-  old_pin = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  old_pin = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_old_pin, _c2);
     old_pin[_c2] = Int_val(_v3);
   }
   old_pin_len = _c1;
   _c4 = Wosize_val(_v_new_pin);
-  new_pin = camlidl_malloc(_c4 * sizeof(unsigned char), _ctx);
+  new_pin = camlidl_malloc(_c4 * sizeof(unsigned char ), _ctx);
   for (_c5 = 0; _c5 < _c4; _c5++) {
     _v6 = Field(_v_new_pin, _c5);
     new_pin[_c5] = Int_val(_v6);
@@ -3578,11 +3160,13 @@ value camlidl_pkcs11_ML_CK_C_SetPIN(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_SeedRandom(value _v_session, value _v_seed)
+value camlidl_pkcs11_ML_CK_C_SeedRandom(
+	value _v_session,
+	value _v_seed)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *seed;		/*in */
-  unsigned long seed_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *seed; /*in*/
+  unsigned long seed_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -3593,7 +3177,7 @@ value camlidl_pkcs11_ML_CK_C_SeedRandom(value _v_session, value _v_seed)
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_seed);
-  seed = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  seed = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_seed, _c2);
     seed[_c2] = Int_val(_v3);
@@ -3605,11 +3189,13 @@ value camlidl_pkcs11_ML_CK_C_SeedRandom(value _v_session, value _v_seed)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GenerateRandom(value _v_session, value _v_rand_len)
+value camlidl_pkcs11_ML_CK_C_GenerateRandom(
+	value _v_session,
+	value _v_rand_len)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *rand_value;	/*out */
-  unsigned long rand_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *rand_value; /*out*/
+  unsigned long rand_len; /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3619,12 +3205,12 @@ value camlidl_pkcs11_ML_CK_C_GenerateRandom(value _v_session, value _v_rand_len)
   value _vres[2] = { 0, 0, };
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
+  /* To handle OCaml client RPC layer int64 format */
   rand_len = custom_int_val(_v_rand_len);
-  rand_value = camlidl_malloc(rand_len * sizeof(unsigned char), _ctx);
-  _res = ML_CK_C_GenerateRandom(session, rand_value, rand_len);
-  /* If for some reason the function fails, return an empty array */
+  rand_value = camlidl_malloc(rand_len * sizeof(unsigned char ), _ctx);
+  _res = ML_CK_C_GenerateRandom(session, rand_value, rand_len);/* If for some reason the function fails, return an empty array */
   if (_res != CKR_OK) {
-    rand_len = 0;
+      rand_len = 0;
   }
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
@@ -3636,25 +3222,27 @@ value camlidl_pkcs11_ML_CK_C_GenerateRandom(value _v_session, value _v_rand_len)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(rand_len, 0);
-  for (_c1 = 0; _c1 < rand_len; _c1++) {
-    _v2 = Val_int(rand_value[_c1]);
-    modify(&Field(_vres[1], _c1), _v2);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(rand_len, 0);
+    for (_c1 = 0; _c1 < rand_len; _c1++) {
+      _v2 = Val_int(rand_value[_c1]);
+      modify(&Field(_vres[1], _c1), _v2);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_FindObjectsInit(value _v_session, value _v_templ)
+value camlidl_pkcs11_ML_CK_C_FindObjectsInit(
+	value _v_session,
+	value _v_templ)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_attribute *templ;	/*in */
-  unsigned long count;		/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_attribute *templ; /*in*/
+  unsigned long count; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -3665,7 +3253,7 @@ value camlidl_pkcs11_ML_CK_C_FindObjectsInit(value _v_session, value _v_templ)
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &templ[_c2], _ctx);
@@ -3677,13 +3265,14 @@ value camlidl_pkcs11_ML_CK_C_FindObjectsInit(value _v_session, value _v_templ)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_FindObjects(value _v_session,
-					 value _v_max_object_count)
+value camlidl_pkcs11_ML_CK_C_FindObjects(
+	value _v_session,
+	value _v_max_object_count)
 {
-  ck_session_handle_t session;	/*in */
-  ck_object_handle_t *object;	/*out */
-  unsigned long max_object_count;	/*in */
-  unsigned long *object_count;	/*out */
+  ck_session_handle_t session; /*in*/
+  ck_object_handle_t *object; /*out*/
+  unsigned long max_object_count; /*in*/
+  unsigned long *object_count; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3694,8 +3283,9 @@ value camlidl_pkcs11_ML_CK_C_FindObjects(value _v_session,
   value _vres[3] = { 0, 0, 0, };
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
+  /* To handle OCaml client RPC layer int64 format */
   max_object_count = custom_int_val(_v_max_object_count);
-  object = camlidl_malloc(max_object_count * sizeof(ck_object_handle_t), _ctx);
+  object = camlidl_malloc(max_object_count * sizeof(ck_object_handle_t ), _ctx);
   object_count = &_c1;
   _res = ML_CK_C_FindObjects(session, object, max_object_count, object_count);
 /* We add this because of possible shadow warning  */
@@ -3708,55 +3298,58 @@ value camlidl_pkcs11_ML_CK_C_FindObjects(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  if (max_object_count > *object_count) {
-    _vres[1] = camlidl_alloc(*object_count, 0);
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    if (max_object_count > *object_count) {
+        _vres[1] = camlidl_alloc(*object_count, 0);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #endif
-    Begin_root(_vres[1]);
+        Begin_root(_vres[1]);
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    for (_c2 = 0; _c2 < *object_count; _c2++) {
-      _v3 = camlidl_c2ml_pkcs11_ck_object_handle_t(&object[_c2], _ctx);
-      modify(&Field(_vres[1], _c2), _v3);
+        for(_c2 = 0;_c2 < *object_count;_c2++) {
+            _v3 = camlidl_c2ml_pkcs11_ck_object_handle_t(&object[_c2], _ctx);
+            modify(&Field(_vres[1], _c2), _v3);
+        }
+        End_roots();
     }
-    End_roots();
-  } else {
-    _vres[1] = camlidl_alloc(max_object_count, 0);
+    else {
+        _vres[1] = camlidl_alloc(max_object_count, 0);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #endif
-    Begin_root(_vres[1]);
+        Begin_root(_vres[1]);
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-    for (_c2 = 0; _c2 < max_object_count; _c2++) {
-      _v3 = camlidl_c2ml_pkcs11_ck_object_handle_t(&object[_c2], _ctx);
-      modify(&Field(_vres[1], _c2), _v3);
+        for(_c2 = 0;_c2 < max_object_count;_c2++) {
+            _v3 = camlidl_c2ml_pkcs11_ck_object_handle_t(&object[_c2], _ctx);
+            modify(&Field(_vres[1], _c2), _v3);
+        }
+        End_roots();
     }
-    End_roots();
-  }
-  _vres[2] = custom_copy_int(*object_count);
-  _vresult = camlidl_alloc_small(3, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
-  Field(_vresult, 2) = _vres[2];
+    /* To handle OCaml client RPC layer int64 format */
+    _vres[2] = custom_copy_int(*object_count);
+    _vresult = camlidl_alloc_small(3, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
+    Field(_vresult, 2) = _vres[2];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_FindObjectsFinal(value _v_session)
+value camlidl_pkcs11_ML_CK_C_FindObjectsFinal(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
+  ck_session_handle_t session; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -3769,14 +3362,16 @@ value camlidl_pkcs11_ML_CK_C_FindObjectsFinal(value _v_session)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GenerateKey(value _v_session,
-					 value _v_mechanism, value _v_templ)
+value camlidl_pkcs11_ML_CK_C_GenerateKey(
+	value _v_session,
+	value _v_mechanism,
+	value _v_templ)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  struct ck_attribute *templ;	/*in */
-  unsigned long count;		/*in */
-  ck_object_handle_t *phkey;	/*out */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  struct ck_attribute *templ; /*in*/
+  unsigned long count; /*in*/
+  ck_object_handle_t *phkey; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3790,7 +3385,7 @@ value camlidl_pkcs11_ML_CK_C_GenerateKey(value _v_session,
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   camlidl_ml2c_pkcs11_struct_ck_mechanism(_v_mechanism, &mechanism, _ctx);
   _c1 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &templ[_c2], _ctx);
@@ -3808,29 +3403,30 @@ value camlidl_pkcs11_ML_CK_C_GenerateKey(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phkey, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phkey, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_GenerateKeyPair(value _v_session,
-					     value _v_mechanism,
-					     value _v_pub_templ,
-					     value _v_priv_templ)
-{
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  struct ck_attribute *pub_templ;	/*in */
-  unsigned long pub_count;	/*in */
-  struct ck_attribute *priv_templ;	/*in */
-  unsigned long priv_count;	/*in */
-  ck_object_handle_t *phpubkey;	/*out */
-  ck_object_handle_t *phprivkey;	/*out */
+value camlidl_pkcs11_ML_CK_C_GenerateKeyPair(
+	value _v_session,
+	value _v_mechanism,
+	value _v_pub_templ,
+	value _v_priv_templ)
+{
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  struct ck_attribute *pub_templ; /*in*/
+  unsigned long pub_count; /*in*/
+  struct ck_attribute *priv_templ; /*in*/
+  unsigned long priv_count; /*in*/
+  ck_object_handle_t *phpubkey; /*out*/
+  ck_object_handle_t *phprivkey; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3848,14 +3444,14 @@ value camlidl_pkcs11_ML_CK_C_GenerateKeyPair(value _v_session,
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   camlidl_ml2c_pkcs11_struct_ck_mechanism(_v_mechanism, &mechanism, _ctx);
   _c1 = Wosize_val(_v_pub_templ);
-  pub_templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  pub_templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_pub_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &pub_templ[_c2], _ctx);
   }
   pub_count = _c1;
   _c4 = Wosize_val(_v_priv_templ);
-  priv_templ = camlidl_malloc(_c4 * sizeof(struct ck_attribute), _ctx);
+  priv_templ = camlidl_malloc(_c4 * sizeof(struct ck_attribute ), _ctx);
   for (_c5 = 0; _c5 < _c4; _c5++) {
     _v6 = Field(_v_priv_templ, _c5);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v6, &priv_templ[_c5], _ctx);
@@ -3863,9 +3459,7 @@ value camlidl_pkcs11_ML_CK_C_GenerateKeyPair(value _v_session,
   priv_count = _c4;
   phpubkey = &_c7;
   phprivkey = &_c8;
-  _res =
-      ML_CK_C_GenerateKeyPair(session, mechanism, pub_templ, pub_count,
-			      priv_templ, priv_count, phpubkey, phprivkey);
+  _res = ML_CK_C_GenerateKeyPair(session, mechanism, pub_templ, pub_count, priv_templ, priv_count, phpubkey, phprivkey);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -3876,24 +3470,26 @@ value camlidl_pkcs11_ML_CK_C_GenerateKeyPair(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phpubkey, _ctx);
-  _vres[2] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phprivkey, _ctx);
-  _vresult = camlidl_alloc_small(3, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
-  Field(_vresult, 2) = _vres[2];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phpubkey, _ctx);
+    _vres[2] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phprivkey, _ctx);
+    _vresult = camlidl_alloc_small(3, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
+    Field(_vresult, 2) = _vres[2];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_CreateObject(value _v_session, value _v_templ)
+value camlidl_pkcs11_ML_CK_C_CreateObject(
+	value _v_session,
+	value _v_templ)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_attribute *templ;	/*in */
-  unsigned long count;		/*in */
-  ck_object_handle_t *phobject;	/*out */
+  ck_session_handle_t session; /*in*/
+  struct ck_attribute *templ; /*in*/
+  unsigned long count; /*in*/
+  ck_object_handle_t *phobject; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3906,7 +3502,7 @@ value camlidl_pkcs11_ML_CK_C_CreateObject(value _v_session, value _v_templ)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &templ[_c2], _ctx);
@@ -3924,24 +3520,26 @@ value camlidl_pkcs11_ML_CK_C_CreateObject(value _v_session, value _v_templ)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phobject, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phobject, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_CopyObject(value _v_session,
-					value _v_hobject, value _v_templ)
+value camlidl_pkcs11_ML_CK_C_CopyObject(
+	value _v_session,
+	value _v_hobject,
+	value _v_templ)
 {
-  ck_session_handle_t session;	/*in */
-  ck_object_handle_t hobject;	/*in */
-  struct ck_attribute *templ;	/*in */
-  unsigned long count;		/*in */
-  ck_object_handle_t *phnewobject;	/*out */
+  ck_session_handle_t session; /*in*/
+  ck_object_handle_t hobject; /*in*/
+  struct ck_attribute *templ; /*in*/
+  unsigned long count; /*in*/
+  ck_object_handle_t *phnewobject; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -3955,7 +3553,7 @@ value camlidl_pkcs11_ML_CK_C_CopyObject(value _v_session,
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hobject, &hobject, _ctx);
   _c1 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &templ[_c2], _ctx);
@@ -3973,20 +3571,22 @@ value camlidl_pkcs11_ML_CK_C_CopyObject(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phnewobject, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phnewobject, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DestroyObject(value _v_session, value _v_hobject)
+value camlidl_pkcs11_ML_CK_C_DestroyObject(
+	value _v_session,
+	value _v_hobject)
 {
-  ck_session_handle_t session;	/*in */
-  ck_object_handle_t hobject;	/*in */
+  ck_session_handle_t session; /*in*/
+  ck_object_handle_t hobject; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4000,13 +3600,15 @@ value camlidl_pkcs11_ML_CK_C_DestroyObject(value _v_session, value _v_hobject)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetAttributeValue(value _v_session,
-					       value _v_hobject, value _v_templ)
+value camlidl_pkcs11_ML_CK_C_GetAttributeValue(
+	value _v_session,
+	value _v_hobject,
+	value _v_templ)
 {
-  ck_session_handle_t session;	/*in */
-  ck_object_handle_t hobject;	/*in */
-  struct ck_attribute *templ;	/*in,out */
-  unsigned long count;		/*in */
+  ck_session_handle_t session; /*in*/
+  ck_object_handle_t hobject; /*in*/
+  struct ck_attribute *templ; /*in,out*/
+  unsigned long count; /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4021,7 +3623,7 @@ value camlidl_pkcs11_ML_CK_C_GetAttributeValue(value _v_session,
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hobject, &hobject, _ctx);
   _c1 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &templ[_c2], _ctx);
@@ -4038,38 +3640,40 @@ value camlidl_pkcs11_ML_CK_C_GetAttributeValue(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(count, 0);
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(count, 0);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #endif
-  Begin_root(_vres[1]);
+    Begin_root(_vres[1]);
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  for (_c4 = 0; _c4 < count; _c4++) {
-    _v5 = camlidl_c2ml_pkcs11_struct_ck_attribute(&templ[_c4], _ctx);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  End_roots();
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+      for (_c4 = 0; _c4 < count; _c4++) {
+        _v5 = camlidl_c2ml_pkcs11_struct_ck_attribute(&templ[_c4], _ctx);
+        modify(&Field(_vres[1], _c4), _v5);
+      }
+    End_roots();
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_SetAttributeValue(value _v_session,
-					       value _v_hobject, value _v_templ)
+value camlidl_pkcs11_ML_CK_C_SetAttributeValue(
+	value _v_session,
+	value _v_hobject,
+	value _v_templ)
 {
-  ck_session_handle_t session;	/*in */
-  ck_object_handle_t hobject;	/*in */
-  struct ck_attribute *templ;	/*in */
-  unsigned long count;		/*in */
+  ck_session_handle_t session; /*in*/
+  ck_object_handle_t hobject; /*in*/
+  struct ck_attribute *templ; /*in*/
+  unsigned long count; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -4081,7 +3685,7 @@ value camlidl_pkcs11_ML_CK_C_SetAttributeValue(value _v_session,
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hobject, &hobject, _ctx);
   _c1 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &templ[_c2], _ctx);
@@ -4093,11 +3697,13 @@ value camlidl_pkcs11_ML_CK_C_SetAttributeValue(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetObjectSize(value _v_session, value _v_hobject)
+value camlidl_pkcs11_ML_CK_C_GetObjectSize(
+	value _v_session,
+	value _v_hobject)
 {
-  ck_session_handle_t session;	/*in */
-  ck_object_handle_t hobject;	/*in */
-  unsigned long *object_size;	/*out */
+  ck_session_handle_t session; /*in*/
+  ck_object_handle_t hobject; /*in*/
+  unsigned long *object_size; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4119,29 +3725,32 @@ value camlidl_pkcs11_ML_CK_C_GetObjectSize(value _v_session, value _v_hobject)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = custom_copy_int(*object_size);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    /* To handle OCaml client RPC layer int64 format */
+    _vres[1] = custom_copy_int(*object_size);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_WrapKey(value _v_session,
-				     value _v_mechanism,
-				     value _v_hwrappingkey, value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_WrapKey(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hwrappingkey,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hwrappingkey;	/*in */
-  ck_object_handle_t hkey;	/*in */
-  unsigned char *wrapped_key;
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hwrappingkey; /*in*/
+  ck_object_handle_t hkey; /*in*/
+  unsigned char *wrapped_key; /*out*/
+  /*in*/
   unsigned long tmp_wrapped_key_len = MAX_BUFF_LEN;
-  unsigned long *wrapped_key_len = &tmp_wrapped_key_len;	/*in */
+  unsigned long *wrapped_key_len = &tmp_wrapped_key_len;/*in*/
   unsigned char tmp_buff[MAX_BUFF_LEN];
-  /*in */
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4155,9 +3764,7 @@ value camlidl_pkcs11_ML_CK_C_WrapKey(value _v_session,
   camlidl_ml2c_pkcs11_struct_ck_mechanism(_v_mechanism, &mechanism, _ctx);
   camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hwrappingkey, &hwrappingkey, _ctx);
   camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hkey, &hkey, _ctx);
-  _res =
-      ML_CK_C_WrapKey(session, mechanism, hwrappingkey, hkey, wrapped_key,
-		      wrapped_key_len);
+  _res = ML_CK_C_WrapKey(session, mechanism, hwrappingkey, hkey, wrapped_key, wrapped_key_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -4168,33 +3775,35 @@ value camlidl_pkcs11_ML_CK_C_WrapKey(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*wrapped_key_len, 0);
-  for (_c1 = 0; _c1 < *wrapped_key_len; _c1++) {
-    _v2 = Val_int(wrapped_key[_c1]);
-    modify(&Field(_vres[1], _c1), _v2);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*wrapped_key_len, 0);
+    for (_c1 = 0; _c1 < *wrapped_key_len; _c1++) {
+      _v2 = Val_int(wrapped_key[_c1]);
+      modify(&Field(_vres[1], _c1), _v2);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_UnwrapKey(value _v_session,
-				       value _v_mechanism,
-				       value _v_hunwrappingkey,
-				       value _v_wrapped_key, value _v_templ)
-{
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hunwrappingkey;	/*in */
-  unsigned char *wrapped_key;	/*in */
-  unsigned long wrapped_key_len;	/*in */
-  struct ck_attribute *templ;	/*in */
-  unsigned long count;		/*in */
-  ck_object_handle_t *phobject;	/*out */
+value camlidl_pkcs11_ML_CK_C_UnwrapKey(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hunwrappingkey,
+	value _v_wrapped_key,
+	value _v_templ)
+{
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hunwrappingkey; /*in*/
+  unsigned char *wrapped_key; /*in*/
+  unsigned long wrapped_key_len; /*in*/
+  struct ck_attribute *templ; /*in*/
+  unsigned long count; /*in*/
+  ck_object_handle_t *phobject; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4210,26 +3819,23 @@ value camlidl_pkcs11_ML_CK_C_UnwrapKey(value _v_session,
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   camlidl_ml2c_pkcs11_struct_ck_mechanism(_v_mechanism, &mechanism, _ctx);
-  camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hunwrappingkey, &hunwrappingkey,
-					 _ctx);
+  camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hunwrappingkey, &hunwrappingkey, _ctx);
   _c1 = Wosize_val(_v_wrapped_key);
-  wrapped_key = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  wrapped_key = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_wrapped_key, _c2);
     wrapped_key[_c2] = Int_val(_v3);
   }
   wrapped_key_len = _c1;
   _c4 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c4 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c4 * sizeof(struct ck_attribute ), _ctx);
   for (_c5 = 0; _c5 < _c4; _c5++) {
     _v6 = Field(_v_templ, _c5);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v6, &templ[_c5], _ctx);
   }
   count = _c4;
   phobject = &_c7;
-  _res =
-      ML_CK_C_UnwrapKey(session, mechanism, hunwrappingkey, wrapped_key,
-			wrapped_key_len, templ, count, phobject);
+  _res = ML_CK_C_UnwrapKey(session, mechanism, hunwrappingkey, wrapped_key, wrapped_key_len, templ, count, phobject);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -4240,26 +3846,28 @@ value camlidl_pkcs11_ML_CK_C_UnwrapKey(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phobject, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phobject, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DeriveKey(value _v_session,
-				       value _v_mechanism,
-				       value _v_hbasekey, value _v_templ)
+value camlidl_pkcs11_ML_CK_C_DeriveKey(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hbasekey,
+	value _v_templ)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hbasekey;	/*in */
-  struct ck_attribute *templ;	/*in */
-  unsigned long count;		/*in */
-  ck_object_handle_t *phkey;	/*out */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hbasekey; /*in*/
+  struct ck_attribute *templ; /*in*/
+  unsigned long count; /*in*/
+  ck_object_handle_t *phkey; /*out*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4274,7 +3882,7 @@ value camlidl_pkcs11_ML_CK_C_DeriveKey(value _v_session,
   camlidl_ml2c_pkcs11_struct_ck_mechanism(_v_mechanism, &mechanism, _ctx);
   camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hbasekey, &hbasekey, _ctx);
   _c1 = Wosize_val(_v_templ);
-  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute), _ctx);
+  templ = camlidl_malloc(_c1 * sizeof(struct ck_attribute ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_templ, _c2);
     camlidl_ml2c_pkcs11_struct_ck_attribute(_v3, &templ[_c2], _ctx);
@@ -4292,20 +3900,22 @@ value camlidl_pkcs11_ML_CK_C_DeriveKey(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phkey, _ctx);
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_c2ml_pkcs11_ck_object_handle_t(&*phkey, _ctx);
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DigestInit(value _v_session, value _v_mechanism)
+value camlidl_pkcs11_ML_CK_C_DigestInit(
+	value _v_session,
+	value _v_mechanism)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4319,16 +3929,18 @@ value camlidl_pkcs11_ML_CK_C_DigestInit(value _v_session, value _v_mechanism)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_Digest(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_Digest(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *digest;
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *digest; /*out*/
+  /*in*/
   unsigned char tmp_buff[MAX_BUFF_LEN];
   unsigned long tmp_digest_len = MAX_BUFF_LEN;
-  unsigned long *digest_len = &tmp_digest_len;	/*in */
-  /*in */
+  unsigned long *digest_len = &tmp_digest_len;/*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4343,7 +3955,7 @@ value camlidl_pkcs11_ML_CK_C_Digest(value _v_session, value _v_data)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -4360,25 +3972,27 @@ value camlidl_pkcs11_ML_CK_C_Digest(value _v_session, value _v_data)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*digest_len, 0);
-  for (_c4 = 0; _c4 < *digest_len; _c4++) {
-    _v5 = Val_int(digest[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*digest_len, 0);
+    for (_c4 = 0; _c4 < *digest_len; _c4++) {
+      _v5 = Val_int(digest[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DigestUpdate(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_DigestUpdate(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -4389,7 +4003,7 @@ value camlidl_pkcs11_ML_CK_C_DigestUpdate(value _v_session, value _v_data)
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -4401,10 +4015,12 @@ value camlidl_pkcs11_ML_CK_C_DigestUpdate(value _v_session, value _v_data)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_DigestKey(value _v_session, value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_DigestKey(
+	value _v_session,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  ck_object_handle_t hkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  ck_object_handle_t hkey; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4418,14 +4034,15 @@ value camlidl_pkcs11_ML_CK_C_DigestKey(value _v_session, value _v_hkey)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_DigestFinal(value _v_session)
+value camlidl_pkcs11_ML_CK_C_DigestFinal(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *digest;
+  ck_session_handle_t session; /*in*/
+  unsigned char *digest; /*out*/
+  /*in*/
   unsigned long tmp_digest_len = MAX_BUFF_LEN;
-  unsigned long *digest_len = &tmp_digest_len;	/*in */
+  unsigned long *digest_len = &tmp_digest_len;/*in*/
   unsigned char tmp_buff[MAX_BUFF_LEN];
-  /*in */
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4447,26 +4064,28 @@ value camlidl_pkcs11_ML_CK_C_DigestFinal(value _v_session)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*digest_len, 0);
-  for (_c1 = 0; _c1 < *digest_len; _c1++) {
-    _v2 = Val_int(digest[_c1]);
-    modify(&Field(_vres[1], _c1), _v2);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*digest_len, 0);
+    for (_c1 = 0; _c1 < *digest_len; _c1++) {
+      _v2 = Val_int(digest[_c1]);
+      modify(&Field(_vres[1], _c1), _v2);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_SignInit(value _v_session,
-				      value _v_mechanism, value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_SignInit(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hkey; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4481,12 +4100,14 @@ value camlidl_pkcs11_ML_CK_C_SignInit(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_SignRecoverInit(value _v_session,
-					     value _v_mechanism, value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_SignRecoverInit(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hkey; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4501,16 +4122,18 @@ value camlidl_pkcs11_ML_CK_C_SignRecoverInit(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_Sign(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_Sign(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *signature;
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *signature; /*out*/
+  /*in*/
   unsigned long tmp_signed_len = MAX_BUFF_LEN;
-  unsigned long *signed_len = &tmp_signed_len;	/*in */
+  unsigned long *signed_len = &tmp_signed_len;/*in*/
   unsigned char tmp_buff[MAX_BUFF_LEN];
-  /*in */
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4525,7 +4148,7 @@ value camlidl_pkcs11_ML_CK_C_Sign(value _v_session, value _v_data)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -4542,30 +4165,32 @@ value camlidl_pkcs11_ML_CK_C_Sign(value _v_session, value _v_data)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*signed_len, 0);
-  for (_c4 = 0; _c4 < *signed_len; _c4++) {
-    _v5 = Val_int(signature[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*signed_len, 0);
+    for (_c4 = 0; _c4 < *signed_len; _c4++) {
+      _v5 = Val_int(signature[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_SignRecover(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_SignRecover(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *signature;
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *signature; /*out*/
+  /*in*/
   unsigned long tmp_signed_len = MAX_BUFF_LEN;
-  unsigned long *signed_len = &tmp_signed_len;	/*in */
+  unsigned long *signed_len = &tmp_signed_len;/*in*/
   unsigned char tmp_buff[MAX_BUFF_LEN];
-  /*in */
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4580,7 +4205,7 @@ value camlidl_pkcs11_ML_CK_C_SignRecover(value _v_session, value _v_data)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -4597,25 +4222,27 @@ value camlidl_pkcs11_ML_CK_C_SignRecover(value _v_session, value _v_data)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*signed_len, 0);
-  for (_c4 = 0; _c4 < *signed_len; _c4++) {
-    _v5 = Val_int(signature[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*signed_len, 0);
+    for (_c4 = 0; _c4 < *signed_len; _c4++) {
+      _v5 = Val_int(signature[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_SignUpdate(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_SignUpdate(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -4626,7 +4253,7 @@ value camlidl_pkcs11_ML_CK_C_SignUpdate(value _v_session, value _v_data)
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -4638,14 +4265,15 @@ value camlidl_pkcs11_ML_CK_C_SignUpdate(value _v_session, value _v_data)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_SignFinal(value _v_session)
+value camlidl_pkcs11_ML_CK_C_SignFinal(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *signature;
+  ck_session_handle_t session; /*in*/
+  unsigned char *signature; /*out*/
+  /*in*/
   unsigned long tmp_signed_len = MAX_BUFF_LEN;
-  unsigned long *signed_len = &tmp_signed_len;	/*in */
+  unsigned long *signed_len = &tmp_signed_len;/*in*/
   unsigned char tmp_buff[MAX_BUFF_LEN];
-  /*in */
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4667,26 +4295,28 @@ value camlidl_pkcs11_ML_CK_C_SignFinal(value _v_session)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*signed_len, 0);
-  for (_c1 = 0; _c1 < *signed_len; _c1++) {
-    _v2 = Val_int(signature[_c1]);
-    modify(&Field(_vres[1], _c1), _v2);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*signed_len, 0);
+    for (_c1 = 0; _c1 < *signed_len; _c1++) {
+      _v2 = Val_int(signature[_c1]);
+      modify(&Field(_vres[1], _c1), _v2);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_VerifyInit(value _v_session,
-					value _v_mechanism, value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_VerifyInit(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hkey; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4701,13 +4331,14 @@ value camlidl_pkcs11_ML_CK_C_VerifyInit(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_VerifyRecoverInit(value _v_session,
-					       value _v_mechanism,
-					       value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_VerifyRecoverInit(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hkey; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4722,14 +4353,16 @@ value camlidl_pkcs11_ML_CK_C_VerifyRecoverInit(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_Verify(value _v_session,
-				    value _v_data, value _v_signature)
+value camlidl_pkcs11_ML_CK_C_Verify(
+	value _v_session,
+	value _v_data,
+	value _v_signature)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *signature;	/*in */
-  unsigned long signed_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *signature; /*in*/
+  unsigned long signed_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -4743,14 +4376,14 @@ value camlidl_pkcs11_ML_CK_C_Verify(value _v_session,
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
   }
   data_len = _c1;
   _c4 = Wosize_val(_v_signature);
-  signature = camlidl_malloc(_c4 * sizeof(unsigned char), _ctx);
+  signature = camlidl_malloc(_c4 * sizeof(unsigned char ), _ctx);
   for (_c5 = 0; _c5 < _c4; _c5++) {
     _v6 = Field(_v_signature, _c5);
     signature[_c5] = Int_val(_v6);
@@ -4762,14 +4395,16 @@ value camlidl_pkcs11_ML_CK_C_Verify(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_VerifyRecover(value _v_session, value _v_signature)
+value camlidl_pkcs11_ML_CK_C_VerifyRecover(
+	value _v_session,
+	value _v_signature)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *signature;	/*in */
-  unsigned long signature_len;	/*in */
-  unsigned char *data;		/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *signature; /*in*/
+  unsigned long signature_len; /*in*/
+  unsigned char *data; /*out*/
   unsigned long tmp_data_len;
-  unsigned long *data_len = &tmp_data_len;	/*in *//*in */
+  unsigned long *data_len = &tmp_data_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4783,14 +4418,14 @@ value camlidl_pkcs11_ML_CK_C_VerifyRecover(value _v_session, value _v_signature)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_signature);
-  signature = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  signature = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_signature, _c2);
     signature[_c2] = Int_val(_v3);
   }
   signature_len = _c1;
   _res = ML_CK_C_VerifyRecover(session, signature, signature_len, &data,
-			       data_len);
+                               data_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -4801,28 +4436,30 @@ value camlidl_pkcs11_ML_CK_C_VerifyRecover(value _v_session, value _v_signature)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*data_len, 0);
-  for (_c4 = 0; _c4 < *data_len; _c4++) {
-    _v5 = Val_int(data[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*data_len, 0);
+    for (_c4 = 0; _c4 < *data_len; _c4++) {
+      _v5 = Val_int(data[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&data);
+      custom_free((void **)&data);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_VerifyUpdate(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_VerifyUpdate(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -4833,7 +4470,7 @@ value camlidl_pkcs11_ML_CK_C_VerifyUpdate(value _v_session, value _v_data)
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -4845,11 +4482,13 @@ value camlidl_pkcs11_ML_CK_C_VerifyUpdate(value _v_session, value _v_data)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_VerifyFinal(value _v_session, value _v_signature)
+value camlidl_pkcs11_ML_CK_C_VerifyFinal(
+	value _v_session,
+	value _v_signature)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *signature;	/*in */
-  unsigned long signed_len;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *signature; /*in*/
+  unsigned long signed_len; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -4860,7 +4499,7 @@ value camlidl_pkcs11_ML_CK_C_VerifyFinal(value _v_session, value _v_signature)
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_signature);
-  signature = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  signature = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_signature, _c2);
     signature[_c2] = Int_val(_v3);
@@ -4872,12 +4511,14 @@ value camlidl_pkcs11_ML_CK_C_VerifyFinal(value _v_session, value _v_signature)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_EncryptInit(value _v_session,
-					 value _v_mechanism, value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_EncryptInit(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hkey; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -4892,14 +4533,16 @@ value camlidl_pkcs11_ML_CK_C_EncryptInit(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_Encrypt(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_Encrypt(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *encrypted;	/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *encrypted; /*out*/
   unsigned long tmp_encrypted_len;
-  unsigned long *encrypted_len = &tmp_encrypted_len;	/*in *//*in */
+  unsigned long *encrypted_len = &tmp_encrypted_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4913,7 +4556,7 @@ value camlidl_pkcs11_ML_CK_C_Encrypt(value _v_session, value _v_data)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -4930,31 +4573,33 @@ value camlidl_pkcs11_ML_CK_C_Encrypt(value _v_session, value _v_data)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*encrypted_len, 0);
-  for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
-    _v5 = Val_int(encrypted[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*encrypted_len, 0);
+    for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
+      _v5 = Val_int(encrypted[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&encrypted);
+      custom_free((void **)&encrypted);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_EncryptUpdate(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_EncryptUpdate(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *encrypted;	/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *encrypted; /*out*/
   unsigned long tmp_encrypted_len;
-  unsigned long *encrypted_len = &tmp_encrypted_len;	/*in *//*in */
+  unsigned long *encrypted_len = &tmp_encrypted_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -4968,14 +4613,14 @@ value camlidl_pkcs11_ML_CK_C_EncryptUpdate(value _v_session, value _v_data)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
   }
   data_len = _c1;
   _res = ML_CK_C_EncryptUpdate(session, data, data_len, &encrypted,
-			       encrypted_len);
+                               encrypted_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -4986,29 +4631,30 @@ value camlidl_pkcs11_ML_CK_C_EncryptUpdate(value _v_session, value _v_data)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*encrypted_len, 0);
-  for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
-    _v5 = Val_int(encrypted[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*encrypted_len, 0);
+    for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
+      _v5 = Val_int(encrypted[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&encrypted);
+      custom_free((void **)&encrypted);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_EncryptFinal(value _v_session)
+value camlidl_pkcs11_ML_CK_C_EncryptFinal(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *encrypted;	/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *encrypted; /*out*/
   unsigned long tmp_encrypted_len;
-  unsigned long *encrypted_len = &tmp_encrypted_len;	/*in *//*in */
+  unsigned long *encrypted_len = &tmp_encrypted_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5029,32 +4675,33 @@ value camlidl_pkcs11_ML_CK_C_EncryptFinal(value _v_session)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*encrypted_len, 0);
-  for (_c1 = 0; _c1 < *encrypted_len; _c1++) {
-    _v2 = Val_int(encrypted[_c1]);
-    modify(&Field(_vres[1], _c1), _v2);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*encrypted_len, 0);
+    for (_c1 = 0; _c1 < *encrypted_len; _c1++) {
+      _v2 = Val_int(encrypted[_c1]);
+      modify(&Field(_vres[1], _c1), _v2);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&encrypted);
+      custom_free((void **)&encrypted);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DigestEncryptUpdate(value _v_session,
-						 value _v_data)
+value camlidl_pkcs11_ML_CK_C_DigestEncryptUpdate(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *encrypted;	/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *encrypted; /*out*/
   unsigned long tmp_encrypted_len;
-  unsigned long *encrypted_len = &tmp_encrypted_len;	/*in *//*in */
+  unsigned long *encrypted_len = &tmp_encrypted_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5068,14 +4715,14 @@ value camlidl_pkcs11_ML_CK_C_DigestEncryptUpdate(value _v_session,
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
   }
   data_len = _c1;
   _res = ML_CK_C_DigestEncryptUpdate(session, data, data_len, &encrypted,
-				     encrypted_len);
+                                     encrypted_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -5086,31 +4733,33 @@ value camlidl_pkcs11_ML_CK_C_DigestEncryptUpdate(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*encrypted_len, 0);
-  for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
-    _v5 = Val_int(encrypted[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*encrypted_len, 0);
+    for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
+      _v5 = Val_int(encrypted[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&encrypted);
+      custom_free((void **)&encrypted);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_SignEncryptUpdate(value _v_session, value _v_data)
+value camlidl_pkcs11_ML_CK_C_SignEncryptUpdate(
+	value _v_session,
+	value _v_data)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  unsigned char *encrypted;	/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  unsigned char *encrypted; /*out*/
   unsigned long tmp_encrypted_len;
-  unsigned long *encrypted_len = &tmp_encrypted_len;	/*in *//*in */
+  unsigned long *encrypted_len = &tmp_encrypted_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5124,14 +4773,14 @@ value camlidl_pkcs11_ML_CK_C_SignEncryptUpdate(value _v_session, value _v_data)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
   }
   data_len = _c1;
   _res = ML_CK_C_SignEncryptUpdate(session, data, data_len, &encrypted,
-				   encrypted_len);
+                                   encrypted_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -5142,29 +4791,31 @@ value camlidl_pkcs11_ML_CK_C_SignEncryptUpdate(value _v_session, value _v_data)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*encrypted_len, 0);
-  for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
-    _v5 = Val_int(encrypted[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*encrypted_len, 0);
+    for (_c4 = 0; _c4 < *encrypted_len; _c4++) {
+      _v5 = Val_int(encrypted[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&encrypted);
+      custom_free((void **)&encrypted);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DecryptInit(value _v_session,
-					 value _v_mechanism, value _v_hkey)
+value camlidl_pkcs11_ML_CK_C_DecryptInit(
+	value _v_session,
+	value _v_mechanism,
+	value _v_hkey)
 {
-  ck_session_handle_t session;	/*in */
-  struct ck_mechanism mechanism;	/*in */
-  ck_object_handle_t hkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  struct ck_mechanism mechanism; /*in*/
+  ck_object_handle_t hkey; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -5179,14 +4830,16 @@ value camlidl_pkcs11_ML_CK_C_DecryptInit(value _v_session,
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_Decrypt(value _v_session, value _v_encrypted)
+value camlidl_pkcs11_ML_CK_C_Decrypt(
+	value _v_session,
+	value _v_encrypted)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *encrypted;	/*in */
-  unsigned long encrypted_len;	/*in */
-  unsigned char *decrypted;	/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *encrypted; /*in*/
+  unsigned long encrypted_len; /*in*/
+  unsigned char *decrypted; /*out*/
   unsigned long tmp_decrypted_len;
-  unsigned long *decrypted_len = &tmp_decrypted_len;	/*in *//*in */
+  unsigned long *decrypted_len = &tmp_decrypted_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5200,14 +4853,14 @@ value camlidl_pkcs11_ML_CK_C_Decrypt(value _v_session, value _v_encrypted)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_encrypted);
-  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_encrypted, _c2);
     encrypted[_c2] = Int_val(_v3);
   }
   encrypted_len = _c1;
   _res = ML_CK_C_Decrypt(session, encrypted, encrypted_len, &decrypted,
-			 decrypted_len);
+                         decrypted_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -5218,31 +4871,33 @@ value camlidl_pkcs11_ML_CK_C_Decrypt(value _v_session, value _v_encrypted)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*decrypted_len, 0);
-  for (_c4 = 0; _c4 < *decrypted_len; _c4++) {
-    _v5 = Val_int(decrypted[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*decrypted_len, 0);
+    for (_c4 = 0; _c4 < *decrypted_len; _c4++) {
+      _v5 = Val_int(decrypted[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&decrypted);
+      custom_free((void **)&decrypted);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DecryptUpdate(value _v_session, value _v_encrypted)
+value camlidl_pkcs11_ML_CK_C_DecryptUpdate(
+	value _v_session,
+	value _v_encrypted)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *encrypted;	/*in */
-  unsigned long encrypted_len;	/*in */
-  unsigned char *data;		/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *encrypted; /*in*/
+  unsigned long encrypted_len; /*in*/
+  unsigned char *data; /*out*/
   unsigned long tmp_data_len;
-  unsigned long *data_len = &tmp_data_len;	/*in *//*in */
+  unsigned long *data_len = &tmp_data_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5256,14 +4911,14 @@ value camlidl_pkcs11_ML_CK_C_DecryptUpdate(value _v_session, value _v_encrypted)
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_encrypted);
-  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_encrypted, _c2);
     encrypted[_c2] = Int_val(_v3);
   }
   encrypted_len = _c1;
   _res = ML_CK_C_DecryptUpdate(session, encrypted, encrypted_len, &data,
-			       data_len);
+                               data_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -5274,29 +4929,30 @@ value camlidl_pkcs11_ML_CK_C_DecryptUpdate(value _v_session, value _v_encrypted)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*data_len, 0);
-  for (_c4 = 0; _c4 < *data_len; _c4++) {
-    _v5 = Val_int(data[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*data_len, 0);
+    for (_c4 = 0; _c4 < *data_len; _c4++) {
+      _v5 = Val_int(data[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&data);
+      custom_free((void **)&data);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DecryptFinal(value _v_session)
+value camlidl_pkcs11_ML_CK_C_DecryptFinal(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *decrypted;	/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *decrypted; /*out*/
   unsigned long tmp_decrypted_len;
-  unsigned long *decrypted_len = &tmp_decrypted_len;	/*in *//*in */
+  unsigned long *decrypted_len = &tmp_decrypted_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5317,32 +4973,33 @@ value camlidl_pkcs11_ML_CK_C_DecryptFinal(value _v_session)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*decrypted_len, 0);
-  for (_c1 = 0; _c1 < *decrypted_len; _c1++) {
-    _v2 = Val_int(decrypted[_c1]);
-    modify(&Field(_vres[1], _c1), _v2);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*decrypted_len, 0);
+    for (_c1 = 0; _c1 < *decrypted_len; _c1++) {
+      _v2 = Val_int(decrypted[_c1]);
+      modify(&Field(_vres[1], _c1), _v2);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&decrypted);
+      custom_free((void **)&decrypted);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DecryptDigestUpdate(value _v_session,
-						 value _v_encrypted)
+value camlidl_pkcs11_ML_CK_C_DecryptDigestUpdate(
+	value _v_session,
+	value _v_encrypted)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *encrypted;	/*in */
-  unsigned long encrypted_len;	/*in */
-  unsigned char *data;		/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *encrypted; /*in*/
+  unsigned long encrypted_len; /*in*/
+  unsigned char *data; /*out*/
   unsigned long tmp_data_len;
-  unsigned long *data_len = &tmp_data_len;	/*in *//*in */
+  unsigned long *data_len = &tmp_data_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5356,14 +5013,14 @@ value camlidl_pkcs11_ML_CK_C_DecryptDigestUpdate(value _v_session,
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_encrypted);
-  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_encrypted, _c2);
     encrypted[_c2] = Int_val(_v3);
   }
   encrypted_len = _c1;
-  _res = ML_CK_C_DecryptDigestUpdate(session, encrypted, encrypted_len,
-				     &data, data_len);
+  _res = ML_CK_C_DecryptDigestUpdate(session, encrypted, encrypted_len, &data,
+                                     data_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -5374,32 +5031,33 @@ value camlidl_pkcs11_ML_CK_C_DecryptDigestUpdate(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*data_len, 0);
-  for (_c4 = 0; _c4 < *data_len; _c4++) {
-    _v5 = Val_int(data[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*data_len, 0);
+    for (_c4 = 0; _c4 < *data_len; _c4++) {
+      _v5 = Val_int(data[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&data);
+      custom_free((void **)&data);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_DecryptVerifyUpdate(value _v_session,
-						 value _v_encrypted)
+value camlidl_pkcs11_ML_CK_C_DecryptVerifyUpdate(
+	value _v_session,
+	value _v_encrypted)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *encrypted;	/*in */
-  unsigned long encrypted_len;	/*in */
-  unsigned char *data;		/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *encrypted; /*in*/
+  unsigned long encrypted_len; /*in*/
+  unsigned char *data; /*out*/
   unsigned long tmp_data_len;
-  unsigned long *data_len = &tmp_data_len;	/*in *//*in */
+  unsigned long *data_len = &tmp_data_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5413,14 +5071,14 @@ value camlidl_pkcs11_ML_CK_C_DecryptVerifyUpdate(value _v_session,
 
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_encrypted);
-  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  encrypted = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_encrypted, _c2);
     encrypted[_c2] = Int_val(_v3);
   }
   encrypted_len = _c1;
-  _res = ML_CK_C_DecryptVerifyUpdate(session, encrypted, encrypted_len,
-				     &data, data_len);
+  _res = ML_CK_C_DecryptVerifyUpdate(session, encrypted, encrypted_len, &data,
+                                     data_len);
 /* We add this because of possible shadow warning  */
 /* (this is not our code: these are camlidl macros)*/
 #if GCC_VERSION > 40600
@@ -5431,29 +5089,30 @@ value camlidl_pkcs11_ML_CK_C_DecryptVerifyUpdate(value _v_session,
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*data_len, 0);
-  for (_c4 = 0; _c4 < *data_len; _c4++) {
-    _v5 = Val_int(data[_c4]);
-    modify(&Field(_vres[1], _c4), _v5);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*data_len, 0);
+    for (_c4 = 0; _c4 < *data_len; _c4++) {
+      _v5 = Val_int(data[_c4]);
+      modify(&Field(_vres[1], _c4), _v5);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&data);
+      custom_free((void **)&data);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetOperationState(value _v_session)
+value camlidl_pkcs11_ML_CK_C_GetOperationState(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*out */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*out*/
   unsigned long tmp_data_len;
-  unsigned long *data_len = &tmp_data_len;	/*in *//*in */
+  unsigned long *data_len = &tmp_data_len;/*in*/ /*in*/
   ck_rv_t _res;
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
@@ -5474,33 +5133,34 @@ value camlidl_pkcs11_ML_CK_C_GetOperationState(value _v_session)
 #if GCC_VERSION > 40600
 #pragma GCC diagnostic pop
 #endif
-  _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
-  _vres[1] = camlidl_alloc(*data_len, 0);
-  for (_c1 = 0; _c1 < *data_len; _c1++) {
-    _v2 = Val_int(data[_c1]);
-    modify(&Field(_vres[1], _c1), _v2);
-  }
-  _vresult = camlidl_alloc_small(2, 0);
-  Field(_vresult, 0) = _vres[0];
-  Field(_vresult, 1) = _vres[1];
+    _vres[0] = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
+    _vres[1] = camlidl_alloc(*data_len, 0);
+    for (_c1 = 0; _c1 < *data_len; _c1++) {
+      _v2 = Val_int(data[_c1]);
+      modify(&Field(_vres[1], _c1), _v2);
+    }
+    _vresult = camlidl_alloc_small(2, 0);
+    Field(_vresult, 0) = _vres[0];
+    Field(_vresult, 1) = _vres[1];
   End_roots();
   camlidl_free(_ctx);
   if (_res == CKR_OK) {
-    custom_free((void **)&data);
+      custom_free((void **)&data);
   }
   return _vresult;
 }
 
-value camlidl_pkcs11_ML_CK_C_SetOperationState(value _v_session,
-					       value _v_data,
-					       value _v_hencryptionkey,
-					       value _v_hauthenticationkey)
+value camlidl_pkcs11_ML_CK_C_SetOperationState(
+	value _v_session,
+	value _v_data,
+	value _v_hencryptionkey,
+	value _v_hauthenticationkey)
 {
-  ck_session_handle_t session;	/*in */
-  unsigned char *data;		/*in */
-  unsigned long data_len;	/*in */
-  ck_object_handle_t hencryptionkey;	/*in */
-  ck_object_handle_t hauthenticationkey;	/*in */
+  ck_session_handle_t session; /*in*/
+  unsigned char *data; /*in*/
+  unsigned long data_len; /*in*/
+  ck_object_handle_t hencryptionkey; /*in*/
+  ck_object_handle_t hauthenticationkey; /*in*/
   ck_rv_t _res;
   mlsize_t _c1;
   mlsize_t _c2;
@@ -5511,27 +5171,24 @@ value camlidl_pkcs11_ML_CK_C_SetOperationState(value _v_session,
   camlidl_ctx _ctx = &_ctxs;
   camlidl_ml2c_pkcs11_ck_session_handle_t(_v_session, &session, _ctx);
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
   }
   data_len = _c1;
-  camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hencryptionkey, &hencryptionkey,
-					 _ctx);
-  camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hauthenticationkey,
-					 &hauthenticationkey, _ctx);
-  _res =
-      ML_CK_C_SetOperationState(session, data, data_len, hencryptionkey,
-				hauthenticationkey);
+  camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hencryptionkey, &hencryptionkey, _ctx);
+  camlidl_ml2c_pkcs11_ck_object_handle_t(_v_hauthenticationkey, &hauthenticationkey, _ctx);
+  _res = ML_CK_C_SetOperationState(session, data, data_len, hencryptionkey, hauthenticationkey);
   _vres = camlidl_c2ml_pkcs11_ck_rv_t(&_res, _ctx);
   camlidl_free(_ctx);
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_GetFunctionStatus(value _v_session)
+value camlidl_pkcs11_ML_CK_C_GetFunctionStatus(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
+  ck_session_handle_t session; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -5544,9 +5201,10 @@ value camlidl_pkcs11_ML_CK_C_GetFunctionStatus(value _v_session)
   return _vres;
 }
 
-value camlidl_pkcs11_ML_CK_C_CancelFunction(value _v_session)
+value camlidl_pkcs11_ML_CK_C_CancelFunction(
+	value _v_session)
 {
-  ck_session_handle_t session;	/*in */
+  ck_session_handle_t session; /*in*/
   ck_rv_t _res;
   value _vres;
 
@@ -5559,18 +5217,20 @@ value camlidl_pkcs11_ML_CK_C_CancelFunction(value _v_session)
   return _vres;
 }
 
-value camlidl_pkcs11_int_to_ulong_char_array(value _v_input)
+value camlidl_pkcs11_int_to_ulong_char_array(
+	value _v_input)
 {
-  unsigned long input;		/*in */
-  unsigned char *data;		/*out */
+  unsigned long input; /*in*/
+  unsigned char *data; /*out*/
   mlsize_t _c1;
   value _v2;
   value _vres;
 
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
+  /* To handle OCaml client RPC layer int64 format */
   input = custom_int_val(_v_input);
-  data = camlidl_malloc(sizeof(unsigned long) * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(sizeof(unsigned long) * sizeof(unsigned char ), _ctx);
   int_to_ulong_char_array(input, data);
   _vres = camlidl_alloc(sizeof(unsigned long), 0);
   for (_c1 = 0; _c1 < sizeof(unsigned long); _c1++) {
@@ -5581,10 +5241,11 @@ value camlidl_pkcs11_int_to_ulong_char_array(value _v_input)
   return _vres;
 }
 
-value camlidl_pkcs11_char_array_to_ulong(value _v_data)
+value camlidl_pkcs11_char_array_to_ulong(
+	value _v_data)
 {
-  unsigned char *data;		/*in */
-  unsigned long output;		/*out */
+  unsigned char *data; /*in*/
+  unsigned long output; /*out*/
   mlsize_t _c1;
   mlsize_t _c2;
   value _v3;
@@ -5593,7 +5254,7 @@ value camlidl_pkcs11_char_array_to_ulong(value _v_data)
   struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
   camlidl_ctx _ctx = &_ctxs;
   _c1 = Wosize_val(_v_data);
-  data = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  data = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_data, _c2);
     data[_c2] = Int_val(_v3);
@@ -5604,11 +5265,12 @@ value camlidl_pkcs11_char_array_to_ulong(value _v_data)
   return _vres;
 }
 
-value camlidl_pkcs11_hton_char_array(value _v_in)
+value camlidl_pkcs11_hton_char_array(
+	value _v_in)
 {
-  unsigned char *in;		/*in */
-  unsigned char *out;		/*out */
-  unsigned long *out_len;	/*in */
+  unsigned char *in; /*in*/
+  unsigned char *out; /*out*/
+  unsigned long *out_len; /*in*/
   mlsize_t _c1;
   mlsize_t _c2;
   value _v3;
@@ -5623,7 +5285,7 @@ value camlidl_pkcs11_hton_char_array(value _v_in)
   out = (unsigned char *)tmp;
   out_len = &tmp_out_len;
   _c1 = Wosize_val(_v_in);
-  in = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  in = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_in, _c2);
     in[_c2] = Int_val(_v3);
@@ -5638,11 +5300,12 @@ value camlidl_pkcs11_hton_char_array(value _v_in)
   return _vres;
 }
 
-value camlidl_pkcs11_ntoh_char_array(value _v_in)
+value camlidl_pkcs11_ntoh_char_array(
+	value _v_in)
 {
-  unsigned char *in;		/*in */
-  unsigned char *out;		/*out */
-  unsigned long *out_len;	/*in */
+  unsigned char *in; /*in*/
+  unsigned char *out; /*out*/
+  unsigned long *out_len; /*in*/
   mlsize_t _c1;
   mlsize_t _c2;
   value _v3;
@@ -5657,7 +5320,7 @@ value camlidl_pkcs11_ntoh_char_array(value _v_in)
   out = (unsigned char *)tmp;
   out_len = &tmp_out_len;
   _c1 = Wosize_val(_v_in);
-  in = camlidl_malloc(_c1 * sizeof(unsigned char), _ctx);
+  in = camlidl_malloc(_c1 * sizeof(unsigned char ), _ctx);
   for (_c2 = 0; _c2 < _c1; _c2++) {
     _v3 = Field(_v_in, _c2);
     in[_c2] = Int_val(_v3);
@@ -5673,509 +5336,490 @@ value camlidl_pkcs11_ntoh_char_array(value _v_in)
 }
 
 #ifdef SERVER_ROLE
-int encode_ck_attribute_arch(struct ck_attribute *in, struct ck_attribute *out)
-{
-  uint32_t to_send32;
-  uint64_t to_send64;
-  out->type_ = in->type_;
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      memcpy(out->value, in->value, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+int encode_ck_attribute_arch(struct ck_attribute * in, struct ck_attribute * out){
+    uint32_t to_send32;
+    uint64_t to_send64;
+    out->type_ = in->type_;
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            memcpy(out->value, in->value, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint64_t)) {
-	return -1;
-      }
-      memcpy(out->value, in->value, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint64_t)){
+                return -1;
+            }
+            memcpy(out->value, in->value, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      memcpy(out->value, in->value, sizeof(uint32_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            memcpy(out->value, in->value, sizeof(uint32_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint64_t)) {
-	return -1;
-      }
-      memcpy(out->value, in->value, sizeof(uint64_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint64_t)){
+                return -1;
+            }
+            memcpy(out->value, in->value, sizeof(uint64_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      memcpy(out->value, in->value, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            memcpy(out->value, in->value, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      memcpy(out->value, in->value, sizeof(uint64_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            memcpy(out->value, in->value, sizeof(uint64_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      to_send32 = htobe32(*((uint32_t *) (in->value)));
-      memcpy(out->value, &to_send32, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            to_send32 = htobe32(*((uint32_t*)(in->value)));
+            memcpy(out->value, &to_send32, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      to_send32 = htole32(*((uint32_t *) (in->value)));
-      memcpy(out->value, &to_send32, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            to_send32 = htole32(*((uint32_t*)(in->value)));
+            memcpy(out->value, &to_send32, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint64_t)) {
-	return -1;
-      }
-      to_send64 = htobe64(*((uint64_t *) (in->value)));
-      memcpy(out->value, &to_send64, sizeof(uint64_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint64_t)){
+                return -1;
+            }
+            to_send64 = htobe64(*((uint64_t*)(in->value)));
+            memcpy(out->value, &to_send64, sizeof(uint64_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint64_t)) {
-	return -1;
-      }
-      to_send64 = htole64(*((uint64_t *) (in->value)));
-      memcpy(out->value, &to_send64, sizeof(uint64_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint64_t)){
+                return -1;
+            }
+            to_send64 = htole64(*((uint64_t*)(in->value)));
+            memcpy(out->value, &to_send64, sizeof(uint64_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint64_t)) {
-	return -1;
-      }
-      /* Endianness is different */
-      to_send32 = htobe32(*((uint32_t *) (in->value)));
-      memcpy(out->value, &to_send32, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint64_t)){
+                return -1;
+            }
+            /* Endianness is different */
+            to_send32 = htobe32(*((uint32_t*)(in->value)));
+            memcpy(out->value, &to_send32, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      /* Endianness is different */
-      to_send64 = htole64(*((uint32_t *) (in->value)));
-      memcpy(out->value, &to_send64, sizeof(uint64_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            /* Endianness is different */
+            to_send64 = htole64(*((uint32_t*)(in->value)));
+            memcpy(out->value, &to_send64, sizeof(uint64_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      /* Endianness is different */
-      to_send64 = htobe64(*((uint32_t *) (in->value)));
-      memcpy(out->value, &to_send64, sizeof(uint64_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            /* Endianness is different */
+            to_send64 = htobe64(*((uint32_t*)(in->value)));
+            memcpy(out->value, &to_send64, sizeof(uint64_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint64_t)) {
-	return -1;
-      }
-      /* Endianness is different */
-      to_send32 = htole32(*((uint32_t *) (in->value + 4)));
-      memcpy(out->value, &to_send32, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint64_t)){
+                return -1;
+            }
+            /* Endianness is different */
+            to_send32 = htole32(*((uint32_t*)(in->value+4)));
+            memcpy(out->value, &to_send32, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_64) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint32_t)) {
-	return -1;
-      }
-      /* Endianness is different */
-      to_send64 = htobe64(*((uint32_t *) (in->value)));
-      memcpy(out->value, &to_send64, sizeof(uint64_t));
-      out->value_len = sizeof(uint64_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint64_t);
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_64){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint32_t)){
+                return -1;
+            }
+            /* Endianness is different */
+            to_send64 = htobe64(*((uint32_t*)(in->value)));
+            memcpy(out->value, &to_send64, sizeof(uint64_t));
+            out->value_len = sizeof(uint64_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint64_t);
+        }
     }
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_32) {
-    if (in->value != NULL) {
-      if (in->value_len != sizeof(uint64_t)) {
-	return -1;
-      }
-      /* Endianness is different */
-      to_send32 = htobe32(*((uint32_t *) (in->value + 4)));
-      memcpy(out->value, &to_send32, sizeof(uint32_t));
-      out->value_len = sizeof(uint32_t);
-    } else {
-      out->value = NULL;
-      out->value_len = sizeof(uint32_t);
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_32){
+        if(in->value != NULL){
+            if(in->value_len != sizeof(uint64_t)){
+                return -1;
+            }
+            /* Endianness is different */
+            to_send32 = htobe32(*((uint32_t*)(in->value+4)));
+            memcpy(out->value, &to_send32, sizeof(uint32_t));
+            out->value_len = sizeof(uint32_t);
+        }
+        else{
+            out->value = NULL;
+            out->value_len = sizeof(uint32_t);
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 #endif
 #ifdef SERVER_ROLE
-int decode_ck_attribute_arch(value in, struct ck_attribute *out,
-			     camlidl_ctx _ctx)
-{
-  value vtmp;
-  unsigned long counter;
+int decode_ck_attribute_arch(value in, struct ck_attribute * out, camlidl_ctx _ctx){
+    value vtmp;
+    unsigned long counter;
 
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[counter] = Int_val(vtmp);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
     }
-    (*out).value_len = sizeof(uint32_t);
-  }
 
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
     }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[counter] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint32_t);
-  }
 
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter + sizeof(uint32_t));
-      (*out).value[counter] = Int_val(vtmp);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter + sizeof(uint32_t));
+            (*out).value[counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
     }
-    (*out).value_len = sizeof(uint32_t);
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[counter + sizeof(uint32_t)] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
     }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[counter + sizeof(uint32_t)] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint64_t);
-  }
 
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[counter] = Int_val(vtmp);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
     }
-    (*out).value_len = sizeof(uint64_t);
-  }
 
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint64_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
     }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint64_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[counter] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint64_t);
-  }
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == BIG_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[counter] = Int_val(vtmp);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
     }
-    (*out).value_len = sizeof(uint32_t);
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == BIG_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint64_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[counter] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint64_t);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint64_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
 
-  }
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
-#ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
     }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[(sizeof(uint32_t) - 1) - counter] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint32_t);
-
-  }
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[(sizeof(uint32_t) - 1) - counter] = Int_val(vtmp);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[(sizeof(uint32_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
+
     }
-    (*out).value_len = sizeof(uint32_t);
-  }
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[(sizeof(uint32_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
     }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint64_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[(sizeof(uint64_t) - 1) - counter] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint64_t);
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint64_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[(sizeof(uint64_t) - 1) - counter] = Int_val(vtmp);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint64_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[(sizeof(uint64_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
     }
-    (*out).value_len = sizeof(uint64_t);
-  }
-  if (my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint64_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[(sizeof(uint64_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
     }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[(sizeof(uint32_t) - 1) - counter] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint64_t);
-
-  }
-  if (my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == LITTLE_ENDIAN_64 && peer_arch == BIG_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
-    }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[(sizeof(uint32_t) - 1) - counter] = Int_val(vtmp);
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[(sizeof(uint32_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
+
     }
-    (*out).value_len = sizeof(uint32_t);
-  }
-  if (my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_64) {
-    if (Wosize_val(in) != sizeof(uint64_t)) {
+    if(my_arch == BIG_ENDIAN_32 && peer_arch == LITTLE_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint64_t));
-#endif
-      return -1;
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[(sizeof(uint32_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
     }
-    (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
-    memset((*out).value, 0, sizeof(uint32_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter + sizeof(uint32_t));
-      (*out).value[(sizeof(uint32_t) - 1) - counter] = Int_val(vtmp);
-    }
-    (*out).value_len = sizeof(uint32_t);
-
-  }
-  if (my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32) {
-    if (Wosize_val(in) != sizeof(uint32_t)) {
+    if(my_arch == LITTLE_ENDIAN_32 && peer_arch == BIG_ENDIAN_64){
+        if(Wosize_val(in) != sizeof(uint64_t)){
 #ifdef DEBUG
-      fprintf(stderr,
-	      "Something went wrong with the endianness transformation : got %lu instead of %lu\n",
-	      Wosize_val(in), sizeof(uint32_t));
-#endif
-      return -1;
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint64_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint32_t), _ctx);
+        memset((*out).value, 0, sizeof(uint32_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter + sizeof(uint32_t));
+            (*out).value[(sizeof(uint32_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint32_t);
+
     }
-    (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
-    memset((*out).value, 0, sizeof(uint64_t));
-    for (counter = 0; counter < sizeof(uint32_t); counter++) {
-      vtmp = Field(in, counter);
-      (*out).value[(sizeof(uint64_t) - 1) - counter] = Int_val(vtmp);
+    if(my_arch == BIG_ENDIAN_64 && peer_arch == LITTLE_ENDIAN_32){
+        if(Wosize_val(in) != sizeof(uint32_t)){
+#ifdef DEBUG
+            fprintf(stderr, "Something went wrong with the endianness transformation : got %lu instead of %lu\n", Wosize_val(in), sizeof(uint32_t));
+#endif
+            return -1;
+        }
+        (*out).value = camlidl_malloc(sizeof(uint64_t), _ctx);
+        memset((*out).value, 0, sizeof(uint64_t));
+        for(counter = 0; counter < sizeof(uint32_t); counter++) {
+            vtmp = Field(in, counter);
+            (*out).value[(sizeof(uint64_t) -1 ) - counter] = Int_val(vtmp);
+        }
+        (*out).value_len = sizeof(uint64_t);
     }
-    (*out).value_len = sizeof(uint64_t);
-  }
-  return 0;
+    return 0;
 }
 #endif
diff --git a/src/bindings-pkcs11/pkcs11_stubs.cocci b/src/bindings-pkcs11/pkcs11_stubs.cocci
index c0047a1..d15a553 100644
--- a/src/bindings-pkcs11/pkcs11_stubs.cocci
+++ b/src/bindings-pkcs11/pkcs11_stubs.cocci
@@ -334,6 +334,7 @@ identifier _ctx, _c2, _v4, _c5, _c6, _v7;
 +      }
 +#endif
 +    }
++    /* Fallthrough */
 +    default:  {
 +      if ((long)_c5 >= 0) {
 +        (*_c2).value = camlidl_malloc(_c5 * sizeof(char), _ctx);
diff --git a/src/client-lib/Makefile.Win32.mingw b/src/client-lib/Makefile.Win32.mingw
new file mode 100644
index 0000000..e19ca90
--- /dev/null
+++ b/src/client-lib/Makefile.Win32.mingw
@@ -0,0 +1,113 @@
+#Path to ONC-RPC library and generated STATIC lib file.
+#WARNING: your oncrpc.lib have to match your build configuration (Debug/Release), otherwise it will fail
+#Please download and compile your own (<add project URL>)
+RPC_INC=../../../oncrpc-win32/win32/include
+RPC_LIB32=../../../oncrpc-win32/win32/bin32/oncrpc.lib
+RPC_LIB64=../../../oncrpc-win32/win32/bin64/oncrpc.lib
+SSL_INC=../../../openssl-1.1.0f/include
+SSL_LIB32=../../../openssl-1.1.0f/win32/libssl.a
+CRYPTO_LIB32=../../../openssl-1.1.0f/win32/libcrypto.a
+SSL_LIB64=../../../openssl-1.1.0f/win64/libssl.a
+CRYPTO_LIB64=../../../openssl-1.1.0f/win64/libcrypto.a
+
+#Local include directory
+BINDING_INC=../bindings-pkcs11
+
+# Libname to compile
+LIBNAME="softhsm"
+ 
+# Output LIB
+CLIENTLIB=libp11client
+
+#Modify SOCKET_PATH LIBNAME to your convenience
+LCFLAGS=-g -I$(RPC_INC) -I$(BINDING_INC) -I.\
+	-DONCRPC_STATIC\
+	-DCRPC \
+	-fno-builtin-bcopy -fno-builtin-bcmp -fno-builtin-bzero \
+	-DTCP_SOCKET  -DSOCKET_PATH=127.0.0.1:4444\
+	-DLIBNAME=$(LIBNAME)\
+
+LINK_FLAGS32=$(RPC_LIB32)
+LINK_FLAGS64=$(RPC_LIB64)
+
+#Modify SOCKET_PATH LIBNAME to your convenience
+LCFLAGS_SSL=-g -I$(RPC_INC) -I$(BINDING_INC) -I. -I$(SSL_INC)\
+	-DONCRPC_STATIC\
+	-DCRPC \
+	-fno-builtin-bcopy -fno-builtin-bcmp -fno-builtin-bzero \
+	-DTCP_SOCKET  -DSOCKET_PATH=127.0.0.1:4444\
+	-DLIBNAME=$(LIBNAME)\
+	-DWITH_SSL -DSSL_FILES_ENV
+
+LINK_FLAGS32_SSL=$(RPC_LIB32) $(SSL_LIB32) $(CRYPTO_LIB32) -static-libgcc
+LINK_FLAGS64_SSL=$(RPC_LIB64) $(SSL_LIB64) $(CRYPTO_LIB64) -static-libgcc
+
+
+# Change to 64-bit mingw if you want 64-bit binaries
+MINGW32=i686-w64-mingw32
+MINGW64=x86_64-w64-mingw32
+CC32=$(MINGW32)-gcc
+CC64=$(MINGW64)-gcc
+
+TARGETS32=$(CLIENTLIB)_32.dll
+TARGETS64=$(CLIENTLIB)_64.dll
+TARGETS32_SSL=$(CLIENTLIB)_32_ssl.dll
+TARGETS64_SSL=$(CLIENTLIB)_64_ssl.dll
+TRASH=*.pdb *.lib *.exp *.idb *.manifest
+
+CLIENT_SRC =  \
+    pkcs11_rpc_xdr.c \
+	pkcs11_rpc_clnt.c \
+	modwrap.c \
+	modwrap_crpc.c \
+	modwrap_crpc_ssl.c \
+
+CLIENT_OBJ = $(patsubst %.c, %.o, $(CLIENT_SRC))
+ 	
+all:	winrpc objs32 clientlib32 objs64 clientlib64 objs32ssl clientlib32ssl objs64ssl clientlib64ssl
+
+clean:
+	rm -f $(TARGETS32) $(TARGETS64) $(TARGETS32_SSL) $(TARGETS64_SSL) $(CLIENT_OBJ) $(TRASH)
+
+# Copy the xdr files and generate the headers properly for 
+# the Win32 target 
+winrpc:
+	#Copy file in order to get correct include path in file generated
+	cp ../rpc-pkcs11/pkcs11_rpc.x ./
+	#Generate header for Win32 compatibility (i.e. without MT support)
+	rpcgen -h -N pkcs11_rpc.x > pkcs11_rpc.h
+	#Generate xdr helpers
+	rpcgen -c -N pkcs11_rpc.x > pkcs11_rpc_xdr.c
+	#Generate client stubs
+	rpcgen -l -N pkcs11_rpc.x > pkcs11_rpc_clnt.c
+	#Remove local copy of XDR file
+	rm pkcs11_rpc.x
+	#Patch generated xdr implementation (optional: remove unused buffer)
+	spatch --no-show-diff --sp-file ./pkcs11_rpc_xdr.cocci ./pkcs11_rpc_xdr.c --in-place
+
+
+#Compile and link 32-bit
+objs32:
+	$(CC32) $(LCFLAGS) -c $(CLIENT_SRC)
+
+clientlib32: $(CLIENT_OBJ)
+	$(CC32) -shared -o $(TARGETS32) $(CLIENT_OBJ) $(LINK_FLAGS32) -lwsock32
+
+objs32ssl:
+	$(CC32) $(LCFLAGS_SSL) -c $(CLIENT_SRC)
+
+clientlib32ssl: $(CLIENT_OBJ)
+	$(CC32) -shared -o $(TARGETS32_SSL) $(CLIENT_OBJ) $(LINK_FLAGS32_SSL) -lwsock32 -lgdi32 -lws2_32
+
+#Compile and link 64-bit
+objs64:
+	$(CC64) $(LCFLAGS) -c $(CLIENT_SRC)
+
+clientlib64: $(CLIENT_OBJ)
+	$(CC64) -shared -o $(TARGETS64) $(CLIENT_OBJ) $(LINK_FLAGS64) -lwsock32
+
+objs64ssl:
+	$(CC64) $(LCFLAGS_SSL) -c $(CLIENT_SRC)
+
+clientlib64ssl: $(CLIENT_OBJ)
+	$(CC64) -shared -o $(TARGETS64_SSL) $(CLIENT_OBJ) $(LINK_FLAGS64_SSL) -lwsock32 -lgdi32 -lws2_32
diff --git a/src/client-lib/Makefile.in b/src/client-lib/Makefile.in
index e8be4ba..c477bac 100644
--- a/src/client-lib/Makefile.in
+++ b/src/client-lib/Makefile.in
@@ -1,7 +1,7 @@
 CC = @CC@
-CFLAGS_OPT = -O2 -Wall -fPIC -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wuninitialized -fstack-protector-all
-CFLAGS_OPT += ${CPPFLAGS}
-LD_FLAGS = -lpthread @c_ssl_package@ @LDFLAGS@
+CFLAGS_OPT = -O2 -Wall -fPIC -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wuninitialized -fstack-protector-all -fcommon 
+CFLAGS_OPT += ${CPPFLAGS} @RPC_CPPFLAGS@
+LD_FLAGS = -lpthread @c_ssl_package@ @RPC_LDFLAGS@ @LDFLAGS@
 mem_prot_opt_caml=-ccopt -Wl,-z,relro,-z,now -ccopt -fstack-protector
 mem_prot_opt=-Wl,-z,relro,-z,now
 
@@ -22,9 +22,9 @@ ifeq ($(CUSTOM_SONAME),"")
         CUSTOM_SONAME=libp11client.so.0
 endif
 
-camlrpccompileclient = ocamlfind ocamlopt -verbose -pp "camlp4o pa_macro.cmo @caml_client_ssl_define@ -D@socket_type@ -DSOCKET_PATH=\\\"@socket_path@\\\" @caml_client_ssl_files@ @caml_client_ssl_ca_file@ @caml_client_ssl_cert_file@ @caml_client_ssl_privkey_file@ @caml_client_ssl_server@" -package "str,rpc" @caml_client_ssl_package@ $(include_dirs) -o client -c @srcdir@/client.ml
+camlrpccompileclient = ocamlfind ocamlopt @ocaml_options@ -verbose -pp "camlp4o pa_macro.cmo @caml_client_ssl_define@ -D@socket_type@ -DSOCKET_PATH=\\\"@socket_path@\\\" @caml_client_ssl_files@ @caml_client_ssl_ca_file@ @caml_client_ssl_cert_file@ @caml_client_ssl_privkey_file@ @caml_client_ssl_server@" -package "str,rpc" @caml_client_ssl_package@ $(include_dirs) -o client -c @srcdir@/client.ml
 camlrpccompilestubs = cp @srcdir@/modwrap.c modwrap_$(1).c && $(CC) $(2) -D@socket_type@ -DCAMLRPC -DLIBNAME=$(1) @libname_file@ -c modwrap_$(1).c @srcdir@/modwrap_camlrpc.c $(bindings_dir)/pkcs11_stubs.c $(c_include_dirs) $(CFLAGS_OPT) && rm modwrap_$(1).c
-camlrpccompilelib = ocamlfind ocamlopt -verbose $(2) $(mem_prot_opt_caml) -package "str,rpc" @caml_client_ssl_package@ -linkpkg -output-obj -o libp11client$(1).so pkcs11_stubs.o $(build_bindings_dir)/pkcs11_functions.o  modwrap_$(1).o modwrap_camlrpc.o $(build_bindings_dir)/pkcs11.cmx $(build_rpc_dir)/pkcs11_rpclib.cmxa client.cmx $(caml_link_flags)
+camlrpccompilelib = ocamlfind ocamlopt @ocaml_options@ -verbose $(2) $(mem_prot_opt_caml) -package "str,rpc" @caml_client_ssl_package@ -linkpkg -output-obj -o libp11client$(1).so pkcs11_stubs.o $(build_bindings_dir)/pkcs11_functions.o  modwrap_$(1).o modwrap_camlrpc.o $(build_bindings_dir)/pkcs11.cmx $(build_rpc_dir)/pkcs11_rpclib.cmxa client.cmx $(caml_link_flags)
 
 crpccompilestubs = cp @srcdir@/modwrap.c modwrap_$(1).c && $(CC) $(2) @rpc_mt_define@ @c_ssl_define@ @c_gnutls_define@ -D@socket_type@ -DSOCKET_PATH=@socket_path@ -DLIBNAME=$(1) @libname_file@ @c_client_ssl_files@ @c_client_ssl_ca_file@ @c_client_ssl_cert_file@ @c_client_ssl_privkey_file@ @c_client_ssl_server@ -DCRPC -c @srcdir@/pkcs11_rpc_xdr.c @srcdir@/pkcs11_rpc_clnt.c modwrap_$(1).c @srcdir@/modwrap_crpc.c @srcdir@/modwrap_crpc_ssl.c $(c_include_dirs) $(CFLAGS_OPT) && rm modwrap_$(1).c
 crpccompilelib = $(CC) $(2) $(mem_prot_opt) -shared -Wl,-soname,$(CUSTOM_SONAME) -fPIC -o libp11client$(1).so pkcs11_rpc_xdr.o pkcs11_rpc_clnt.o modwrap_$(1).o modwrap_crpc.o modwrap_crpc_ssl.o $(LD_FLAGS)
diff --git a/src/client-lib/client.ml b/src/client-lib/client.ml
index 11d67ba..08a1dcf 100644
--- a/src/client-lib/client.ml
+++ b/src/client-lib/client.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/client-lib/modwrap.c b/src/client-lib/modwrap.c
index 5cdc251..2aeaf92 100644
--- a/src/client-lib/modwrap.c
+++ b/src/client-lib/modwrap.c
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -105,6 +105,10 @@ void pthread_mutex_unlock(LPCRITICAL_SECTION mymutex){
   LeaveCriticalSection(mymutex);
   return;
 }
+void pthread_mutex_destroy(LPCRITICAL_SECTION mymutex){
+  DeleteCriticalSection(mymutex);
+  return;
+}
 #endif
 
 /* -------------------------------- */
@@ -346,6 +350,7 @@ void custom_sanitize_ck_mechanism(struct ck_mechanism *mech)
       (*mech).parameter = NULL;
       (*mech).parameter_len = 0;
     }
+    /* Fallthrough */
   default:
     {
       if ((*mech).parameter_len > MAX_BUFF_LEN) {
diff --git a/src/client-lib/modwrap.h b/src/client-lib/modwrap.h
index a75f21a..f018406 100644
--- a/src/client-lib/modwrap.h
+++ b/src/client-lib/modwrap.h
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -284,7 +284,7 @@
  */
 #if defined(CRPC) && defined(UNIX_SOCKET) && defined(_CS_GNU_LIBC_VERSION)
 #define MCALL_MSG_SIZE 24
-
+#if !defined(WITH_TIRPC) && !defined(WITH_SSL)
 struct ct_data
   {
     int ct_sock;
@@ -297,6 +297,24 @@ struct ct_data
     u_int ct_mpos;
     XDR ct_xdrs;
   };
+#elif !defined(WITH_SSL)
+/* XXX FIXME: this ugly stuff is fragile as it does not take into consideration structure packing */
+ struct ct_data {
+	int             ct_sock;          /* connection's fd */
+	void            *ct_fd_lock;
+	bool_t          ct_closeit;     /* close it on destroy */
+	struct timeval  ct_wait;        /* wait interval in milliseconds */
+	bool_t          ct_waitset;     /* wait set by clnt_control? */
+	struct netbuf   ct_addr;
+	struct rpc_err  ct_error;
+	union {
+		char    ct_mcallc[MCALL_MSG_SIZE];      /* marshalled callmsg */
+		u_int32_t ct_mcalli;
+	} ct_u;
+	u_int           ct_mpos;        /* pos after marshal */
+	XDR             ct_xdrs;        /* XDR stream */
+ };
+#endif
 #endif
 
 /* gethostbyname include */
@@ -318,13 +336,19 @@ int get_libname_from_file(char *);
 #endif
 
 #ifdef WITH_SSL
+#ifdef WIN32
+#include <winsock2.h>
+#else
 #include <sys/poll.h>
+#endif
 #include <errno.h>
 void override_net_functions(CLIENT *);
 int readnet(char *, char *, int);
 int writenet(char *, char *, int);
 
 #define MCALL_MSG_SIZE 24
+#ifndef WITH_TIRPC
+/* XXX FIXME: this ugly stuff is fragile as it does not take into consideration structure packing */
 struct ct_data {
   int ct_sock;
   bool_t ct_closeit;
@@ -340,6 +364,24 @@ struct ct_data {
   u_int ct_mpos;		/* pos after marshal */
   XDR ct_xdrs;
 };
+#else
+/* XXX FIXME: this ugly stuff is fragile as it does not take into consideration structure packing */
+ struct ct_data {
+	int             ct_sock;          /* connection's fd */
+	void            *ct_fd_lock;
+	bool_t          ct_closeit;     /* close it on destroy */
+	struct timeval  ct_wait;        /* wait interval in milliseconds */
+	bool_t          ct_waitset;     /* wait set by clnt_control? */
+	struct netbuf   ct_addr;
+	struct rpc_err  ct_error;
+	union {
+		char    ct_mcallc[MCALL_MSG_SIZE];      /* marshalled callmsg */
+		u_int32_t ct_mcalli;
+	} ct_u;
+	u_int           ct_mpos;        /* pos after marshal */
+	XDR             ct_xdrs;        /* XDR stream */
+ };
+#endif
 
 int provision_certificates(void);
 
diff --git a/src/client-lib/modwrap_camlrpc.c b/src/client-lib/modwrap_camlrpc.c
index 37001d8..28e2132 100644
--- a/src/client-lib/modwrap_camlrpc.c
+++ b/src/client-lib/modwrap_camlrpc.c
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/client-lib/modwrap_crpc.c b/src/client-lib/modwrap_crpc.c
index 39ebe66..5535e66 100644
--- a/src/client-lib/modwrap_crpc.c
+++ b/src/client-lib/modwrap_crpc.c
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/client-lib/modwrap_crpc_ssl.c b/src/client-lib/modwrap_crpc_ssl.c
index 566c86b..a9ed2b1 100644
--- a/src/client-lib/modwrap_crpc_ssl.c
+++ b/src/client-lib/modwrap_crpc_ssl.c
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -316,6 +316,63 @@ void override_net_functions(CLIENT * client)
   xdrrec_create(&(ct->ct_xdrs), 0, 0, (caddr_t) ct, readnet, writenet);
 }
 
+#ifdef WIN32 /* In the Windows case, use native WIN32 API */
+int readnet(char *ctptr, char *buf, int len)
+{
+  fd_set mask;
+  fd_set readfds;
+  struct ct_data *ct = (struct ct_data *)ctptr;
+
+#ifdef DEBUG
+  fprintf(stderr, "client: overriding readtcp, len = %d\n", len);
+#endif
+
+  if (len == 0)
+          return 0;
+  FD_ZERO(&mask);
+  FD_SET(ct->ct_sock, &mask);
+
+  while (TRUE) {
+    readfds = mask;
+    switch (select(0 /* unused in winsock */, &readfds, NULL, NULL,
+                   &(ct->ct_wait))) {
+    case 0:
+            ct->ct_error.re_status = RPC_TIMEDOUT;
+            return -1;
+
+    case -1:
+            if (WSAerrno == EINTR)
+                    continue;
+            ct->ct_error.re_status = RPC_CANTRECV;
+            ct->ct_error.re_errno = WSAerrno;
+            return -1;
+    }
+    break;
+  }
+#ifdef GNU_TLS
+  /* Perform the actual read using GnuTLS, which will read
+   * one TLS "record", which is hopefully a complete message.
+   */
+  len = gnutls_record_recv(gnutls_global_session, buf, len);
+#else
+  len = SSL_read(ssl, buf, len);
+#endif
+  switch (len) {
+  case 0:
+          /* premature eof */
+          ct->ct_error.re_errno = WSAECONNRESET;
+          ct->ct_error.re_status = RPC_CANTRECV;
+          len = -1;  /* it's really an error */
+          break;
+
+  case -1:
+          ct->ct_error.re_errno = WSAerrno;
+          ct->ct_error.re_status = RPC_CANTRECV;
+          break;
+  }
+  return len;
+}
+#else /* *NIX case */
 int readnet(char *ctptr, char *buf, int len)
 {
   struct ct_data *ct = (struct ct_data *)ctptr;
@@ -374,7 +431,11 @@ int readnet(char *ctptr, char *buf, int len)
 
   return len;
 }
+#endif /* end switch between WIN32 and non WIN32 */
 
+/* The writing SSL override is the same for WIN32 and 
+ * *NIX cases
+ */
 int writenet(char *ctptr, char *buf, int len)
 {
   struct ct_data *ct = (struct ct_data *)ctptr;
@@ -395,7 +456,7 @@ int writenet(char *ctptr, char *buf, int len)
 
   return len;
 }
-#endif
+#endif /* end of SSL case where we override read and write functions */
 
 /* A very basic TLS client, with X.509 authentication. */
 #ifdef GNU_TLS
@@ -658,16 +719,37 @@ int start_openssl(int sock)
   int i;
   X509_STORE *openssl_store;
 #endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+  /* Deprecated in openssl >= 1.1.0 */
   SSL_load_error_strings();
   SSL_library_init();
+#else
+  OPENSSL_init_ssl(0, NULL);
+#endif
   ERR_load_BIO_strings();
   OpenSSL_add_all_algorithms();
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
   ctx = SSL_CTX_new(TLSv1_2_method());
+#else
+  ctx = SSL_CTX_new(TLS_method());
+#endif
   if (ctx == NULL) {
     fprintf(stderr, "OpenSSL error could not create SSL CTX\n");
     return -1;
   }
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+  /* For openssl >= 1.1.0 set the minimum TLS version
+   * with SSL_CTX_set_min_proto_version
+   */
+  ret = SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION);
+  if(ret == 0){
+    fprintf(stderr, "OpenSSL error when setting TLS1_2 with SSL_CTX_set_min_proto_version\n");
+    return -1;
+  }
+#endif
+
 #ifdef SSL_OP_NO_COMPRESSION
   /* No compression and no SSL_v2 */
   SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_COMPRESSION);
diff --git a/src/client-lib/pkcs11_rpc.h b/src/client-lib/pkcs11_rpc.h
index 99e7b4e..0b2db32 100644
--- a/src/client-lib/pkcs11_rpc.h
+++ b/src/client-lib/pkcs11_rpc.h
@@ -1,84 +1,3 @@
-/*------------------------ MIT License HEADER ------------------------------------
-    Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
-    Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
-
-    This software is a computer program whose purpose is to implement
-    a PKCS#11 proxy as well as a PKCS#11 filter with security features
-    in mind. The project source tree is subdivided in six parts.
-    There are five main parts:
-      1] OCaml/C PKCS#11 bindings (using OCaml IDL).
-      2] XDR RPC generators (to be used with ocamlrpcgen and/or rpcgen).
-      3] A PKCS#11 RPC server (daemon) in OCaml using a Netplex RPC basis.
-      4] A PKCS#11 filtering module used as a backend to the RPC server.
-      5] A PKCS#11 client module that comes as a dynamic library offering
-         the PKCS#11 API to the software.
-    There is one "optional" part:
-      6] Tests in C and OCaml to be used with client module 5] or with the
-         bindings 1]
-
-    Here is a big picture of how the PKCS#11 proxy works:
-
- ----------------------   --------  socket (TCP or Unix)  --------------------
-| 3] PKCS#11 RPC server|-|2] RPC  |<+++++++++++++++++++> | 5] Client library  |
- ----------------------  |  Layer | [SSL/TLS optional]   |  --------          |
-           |              --------                       | |2] RPC  | PKCS#11 |
- ----------------------                                  | |  Layer |functions|
-| 4] PKCS#11 filter    |                                 |  --------          |
- ----------------------                                   --------------------
-           |                                                        |
- ----------------------                                             |
-| 1] PKCS#11 OCaml     |                                  { PKCS#11 INTERFACE }
-|       bindings       |                                            |
- ----------------------                                       APPLICATION
-           |
-           |
- { PKCS#11 INTERFACE }
-           |
- REAL PKCS#11 MIDDLEWARE
-    (shared library)
-
-    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:
-
-    The above copyright notice and this permission notice shall be included in
-    all copies or substantial portions of the Software.
-
-    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.
-
-    Except as contained in this notice, the name(s) of the above copyright holders
-    shall not be used in advertising or otherwise to promote the sale, use or other
-    dealings in this Software without prior written authorization.
-
-    The current source code is part of the client library 5] source tree:
-                                                          --------------------
-                                                         | 5] Client library  |
-                                                         |  --------          |
-                                                         | |        | PKCS#11 |
-                                                         | |        |functions|
-                                                         |  --------          |
-                                                          --------------------
-                                                                    |
-                                                                    |
-                                                          { PKCS#11 INTERFACE }
-                                                                    |
-                                                              APPLICATION
-
-    Project: PKCS#11 Filtering Proxy
-    File:    src/client-lib/pkcs11_rpc.h
-
--------------------------- MIT License HEADER ----------------------------------*/
 /*
  * Please do not edit this file.
  * It was generated using rpcgen.
@@ -99,1720 +18,1446 @@ extern "C" {
 #include <stdint.h>
 #define quad_t int64_t
 #endif
-  extern CLIENT *cl;
-
-  typedef quad_t pkcs11_int;
-
-  typedef pkcs11_int rpc_ck_rv_t;
-
-  typedef pkcs11_int rpc_ck_slot_id_t;
-
-  typedef pkcs11_int rpc_ck_mechanism_type_t;
-
-  typedef pkcs11_int rpc_ck_session_handle_t;
-
-  typedef pkcs11_int rpc_ck_user_type_t;
-
-  typedef pkcs11_int rpc_ck_state_t;
-
-  typedef pkcs11_int rpc_ck_object_handle_t;
-
-  typedef pkcs11_int rpc_ck_object_class_t;
-
-  typedef pkcs11_int rpc_ck_hw_feature_type_t;
-
-  typedef pkcs11_int rpc_ck_key_type_t;
-
-  typedef pkcs11_int rpc_ck_certificate_type_t;
-
-  typedef pkcs11_int rpc_ck_attribute_type_t;
-
-  typedef pkcs11_int rpc_ck_flags_t;
-
-  typedef pkcs11_int rpc_ck_notification_t;
-
-  typedef struct {
-    u_int opaque_data_len;
-    char *opaque_data_val;
-  } opaque_data;
-
-  struct rpc_ck_version {
-    struct {
-      u_int major_len;
-      char *major_val;
-    } major;
-    struct {
-      u_int minor_len;
-      char *minor_val;
-    } minor;
-  };
-  typedef struct rpc_ck_version rpc_ck_version;
-
-  struct rpc_ck_info {
-    rpc_ck_version rpc_ck_info_cryptoki_version;
-    struct {
-      u_int rpc_ck_info_manufacturer_id_len;
-      char *rpc_ck_info_manufacturer_id_val;
-    } rpc_ck_info_manufacturer_id;
-    rpc_ck_flags_t rpc_ck_info_flags;
-    struct {
-      u_int rpc_ck_info_library_description_len;
-      char *rpc_ck_info_library_description_val;
-    } rpc_ck_info_library_description;
-    rpc_ck_version rpc_ck_info_library_version;
-  };
-  typedef struct rpc_ck_info rpc_ck_info;
-
-  struct rpc_ck_slot_info {
-    struct {
-      u_int rpc_ck_slot_info_slot_description_len;
-      char *rpc_ck_slot_info_slot_description_val;
-    } rpc_ck_slot_info_slot_description;
-    struct {
-      u_int rpc_ck_slot_info_manufacturer_id_len;
-      char *rpc_ck_slot_info_manufacturer_id_val;
-    } rpc_ck_slot_info_manufacturer_id;
-    rpc_ck_flags_t rpc_ck_slot_info_flags;
-    rpc_ck_version rpc_ck_slot_info_hardware_version;
-    rpc_ck_version rpc_ck_slot_info_firmware_version;
-  };
-  typedef struct rpc_ck_slot_info rpc_ck_slot_info;
-
-  struct rpc_ck_token_info {
-    struct {
-      u_int rpc_ck_token_info_label_len;
-      char *rpc_ck_token_info_label_val;
-    } rpc_ck_token_info_label;
-    struct {
-      u_int rpc_ck_token_info_manufacturer_id_len;
-      char *rpc_ck_token_info_manufacturer_id_val;
-    } rpc_ck_token_info_manufacturer_id;
-    struct {
-      u_int rpc_ck_token_info_model_len;
-      char *rpc_ck_token_info_model_val;
-    } rpc_ck_token_info_model;
-    struct {
-      u_int rpc_ck_token_info_serial_number_len;
-      char *rpc_ck_token_info_serial_number_val;
-    } rpc_ck_token_info_serial_number;
-    rpc_ck_flags_t rpc_ck_token_info_flags;
-    pkcs11_int rpc_ck_token_info_max_session_count;
-    pkcs11_int rpc_ck_token_info_session_count;
-    pkcs11_int rpc_ck_token_info_max_rw_session_count;
-    pkcs11_int rpc_ck_token_info_rw_session_count;
-    pkcs11_int rpc_ck_token_info_max_pin_len;
-    pkcs11_int rpc_ck_token_info_min_pin_len;
-    pkcs11_int rpc_ck_token_info_total_public_memory;
-    pkcs11_int rpc_ck_token_info_free_public_memory;
-    pkcs11_int rpc_ck_token_info_total_private_memory;
-    pkcs11_int rpc_ck_token_info_free_private_memory;
-    rpc_ck_version rpc_ck_token_info_hardware_version;
-    rpc_ck_version rpc_ck_token_info_firmware_version;
-    struct {
-      u_int rpc_ck_token_info_utc_time_len;
-      char *rpc_ck_token_info_utc_time_val;
-    } rpc_ck_token_info_utc_time;
-  };
-  typedef struct rpc_ck_token_info rpc_ck_token_info;
-
-  struct rpc_ck_mechanism {
-    rpc_ck_mechanism_type_t rpc_ck_mechanism_mechanism;
-    struct {
-      u_int rpc_ck_mechanism_parameter_len;
-      char *rpc_ck_mechanism_parameter_val;
-    } rpc_ck_mechanism_parameter;
-  };
-  typedef struct rpc_ck_mechanism rpc_ck_mechanism;
-
-  struct rpc_ck_session_info {
-    rpc_ck_slot_id_t rpc_ck_session_info_slot_id;
-    rpc_ck_state_t rpc_ck_session_info_state;
-    rpc_ck_flags_t rpc_ck_session_info_flags;
-    pkcs11_int rpc_ck_session_info_device_error;
-  };
-  typedef struct rpc_ck_session_info rpc_ck_session_info;
-
-  struct rpc_ck_mechanism_info {
-    pkcs11_int rpc_ck_mechanism_info_min_key_size;
-    pkcs11_int rpc_ck_mechanism_info_max_key_size;
-    rpc_ck_flags_t rpc_ck_mechanism_info_flags;
-  };
-  typedef struct rpc_ck_mechanism_info rpc_ck_mechanism_info;
-
-  struct rpc_ck_attribute {
-    rpc_ck_attribute_type_t rpc_ck_attribute_type;
-    struct {
-      u_int rpc_ck_attribute_value_len;
-      char *rpc_ck_attribute_value_val;
-    } rpc_ck_attribute_value;
-    pkcs11_int rpc_ck_attribute_value_len;
-  };
-  typedef struct rpc_ck_attribute rpc_ck_attribute;
-
-  typedef struct {
-    u_int rpc_ck_attribute_array_len;
-    rpc_ck_attribute *rpc_ck_attribute_array_val;
-  } rpc_ck_attribute_array;
-
-  struct rpc_ck_date {
-    struct {
-      u_int rpc_ck_date_year_len;
-      char *rpc_ck_date_year_val;
-    } rpc_ck_date_year;
-    struct {
-      u_int rpc_ck_date_month_len;
-      char *rpc_ck_date_month_val;
-    } rpc_ck_date_month;
-    struct {
-      u_int rpc_ck_date_day_len;
-      char *rpc_ck_date_day_val;
-    } rpc_ck_date_day;
-  };
-  typedef struct rpc_ck_date rpc_ck_date;
-
-  struct ck_rv_c_GetSlotList {
-    rpc_ck_rv_t c_GetSlotList_rv;
-    struct {
-      u_int c_GetSlotList_slot_list_len;
-      rpc_ck_slot_id_t *c_GetSlotList_slot_list_val;
-    } c_GetSlotList_slot_list;
-    pkcs11_int c_GetSlotList_count;
-  };
-  typedef struct ck_rv_c_GetSlotList ck_rv_c_GetSlotList;
-
-  struct ck_rv_c_GetSlotInfo {
-    rpc_ck_rv_t c_GetSlotInfo_rv;
-    rpc_ck_slot_info c_GetSlotInfo_slot_info;
-  };
-  typedef struct ck_rv_c_GetSlotInfo ck_rv_c_GetSlotInfo;
-
-  struct ck_rv_c_GetTokenInfo {
-    rpc_ck_rv_t c_GetTokenInfo_rv;
-    rpc_ck_token_info c_GetTokenInfo_token_info;
-  };
-  typedef struct ck_rv_c_GetTokenInfo ck_rv_c_GetTokenInfo;
-
-  struct ck_rv_c_GetInfo {
-    rpc_ck_rv_t c_GetInfo_rv;
-    rpc_ck_info c_GetInfo_info;
-  };
-  typedef struct ck_rv_c_GetInfo ck_rv_c_GetInfo;
-
-  struct ck_rv_c_WaitForSlotEvent {
-    rpc_ck_rv_t c_WaitForSlotEvent_rv;
-    rpc_ck_slot_id_t c_WaitForSlotEvent_count;
-  };
-  typedef struct ck_rv_c_WaitForSlotEvent ck_rv_c_WaitForSlotEvent;
-
-  struct ck_rv_c_OpenSession {
-    rpc_ck_rv_t c_OpenSession_rv;
-    rpc_ck_session_handle_t c_OpenSession_handle;
-  };
-  typedef struct ck_rv_c_OpenSession ck_rv_c_OpenSession;
-
-  struct ck_rv_c_GetMechanismList {
-    rpc_ck_rv_t c_GetMechanismList_rv;
-    struct {
-      u_int c_GetMechanismList_list_len;
-      rpc_ck_mechanism_type_t *c_GetMechanismList_list_val;
-    } c_GetMechanismList_list;
-    pkcs11_int c_GetMechanismList_count;
-  };
-  typedef struct ck_rv_c_GetMechanismList ck_rv_c_GetMechanismList;
-
-  struct ck_rv_c_GetSessionInfo {
-    rpc_ck_rv_t c_GetSessionInfo_rv;
-    rpc_ck_session_info c_GetSessionInfo_info;
-  };
-  typedef struct ck_rv_c_GetSessionInfo ck_rv_c_GetSessionInfo;
-
-  struct ck_rv_c_GetMechanismInfo {
-    rpc_ck_rv_t c_GetMechanismInfo_rv;
-    rpc_ck_mechanism_info c_GetMechanismInfo_info;
-  };
-  typedef struct ck_rv_c_GetMechanismInfo ck_rv_c_GetMechanismInfo;
-
-  struct ck_rv_c_GenerateRandom {
-    rpc_ck_rv_t c_GenerateRandom_rv;
-    struct {
-      u_int c_GenerateRandom_data_len;
-      char *c_GenerateRandom_data_val;
-    } c_GenerateRandom_data;
-  };
-  typedef struct ck_rv_c_GenerateRandom ck_rv_c_GenerateRandom;
-
-  struct ck_rv_c_FindObjects {
-    rpc_ck_rv_t c_FindObjects_rv;
-    struct {
-      u_int c_FindObjects_objects_len;
-      rpc_ck_object_handle_t *c_FindObjects_objects_val;
-    } c_FindObjects_objects;
-    pkcs11_int c_FindObjects_count;
-  };
-  typedef struct ck_rv_c_FindObjects ck_rv_c_FindObjects;
-
-  struct ck_rv_c_GenerateKey {
-    rpc_ck_rv_t c_GenerateKey_rv;
-    rpc_ck_object_handle_t c_GenerateKey_handle;
-  };
-  typedef struct ck_rv_c_GenerateKey ck_rv_c_GenerateKey;
-
-  struct ck_rv_c_GenerateKeyPair {
-    rpc_ck_rv_t c_GenerateKeyPair_rv;
-    rpc_ck_object_handle_t c_GenerateKeyPair_pubhandle;
-    rpc_ck_object_handle_t c_GenerateKeyPair_privhandle;
-  };
-  typedef struct ck_rv_c_GenerateKeyPair ck_rv_c_GenerateKeyPair;
-
-  struct ck_rv_c_CreateObject {
-    rpc_ck_rv_t c_CreateObject_rv;
-    rpc_ck_object_handle_t c_CreateObject_handle;
-  };
-  typedef struct ck_rv_c_CreateObject ck_rv_c_CreateObject;
-
-  struct ck_rv_c_CopyObject {
-    rpc_ck_rv_t c_CopyObject_rv;
-    rpc_ck_object_handle_t c_CopyObject_handle;
-  };
-  typedef struct ck_rv_c_CopyObject ck_rv_c_CopyObject;
-
-  struct ck_rv_c_GetAttributeValue {
-    rpc_ck_rv_t c_GetAttributeValue_rv;
-    rpc_ck_attribute_array c_GetAttributeValue_value;
-  };
-  typedef struct ck_rv_c_GetAttributeValue ck_rv_c_GetAttributeValue;
-
-  struct ck_rv_c_GetObjectSize {
-    rpc_ck_rv_t c_GetObjectSize_rv;
-    pkcs11_int c_GetObjectSize_size;
-  };
-  typedef struct ck_rv_c_GetObjectSize ck_rv_c_GetObjectSize;
-
-  struct ck_rv_c_WrapKey {
-    rpc_ck_rv_t c_WrapKey_rv;
-    struct {
-      u_int c_WrapKey_value_len;
-      char *c_WrapKey_value_val;
-    } c_WrapKey_value;
-  };
-  typedef struct ck_rv_c_WrapKey ck_rv_c_WrapKey;
-
-  struct ck_rv_c_UnwrapKey {
-    rpc_ck_rv_t c_UnwrapKey_rv;
-    rpc_ck_object_handle_t c_UnwrapKey_handle;
-  };
-  typedef struct ck_rv_c_UnwrapKey ck_rv_c_UnwrapKey;
-
-  struct ck_rv_c_DeriveKey {
-    rpc_ck_rv_t c_DeriveKey_rv;
-    rpc_ck_object_handle_t c_DeriveKey_handle;
-  };
-  typedef struct ck_rv_c_DeriveKey ck_rv_c_DeriveKey;
-
-  struct ck_rv_c_Digest {
-    rpc_ck_rv_t c_Digest_rv;
-    struct {
-      u_int c_Digest_value_len;
-      char *c_Digest_value_val;
-    } c_Digest_value;
-  };
-  typedef struct ck_rv_c_Digest ck_rv_c_Digest;
-
-  struct ck_rv_c_DigestFinal {
-    rpc_ck_rv_t c_DigestFinal_rv;
-    struct {
-      u_int c_DigestFinal_value_len;
-      char *c_DigestFinal_value_val;
-    } c_DigestFinal_value;
-  };
-  typedef struct ck_rv_c_DigestFinal ck_rv_c_DigestFinal;
-
-  struct ck_rv_c_Sign {
-    rpc_ck_rv_t c_Sign_rv;
-    struct {
-      u_int c_Sign_value_len;
-      char *c_Sign_value_val;
-    } c_Sign_value;
-  };
-  typedef struct ck_rv_c_Sign ck_rv_c_Sign;
-
-  struct ck_rv_c_SignFinal {
-    rpc_ck_rv_t c_SignFinal_rv;
-    struct {
-      u_int c_SignFinal_value_len;
-      char *c_SignFinal_value_val;
-    } c_SignFinal_value;
-  };
-  typedef struct ck_rv_c_SignFinal ck_rv_c_SignFinal;
-
-  struct ck_rv_c_Encrypt {
-    rpc_ck_rv_t c_Encrypt_rv;
-    struct {
-      u_int c_Encrypt_value_len;
-      char *c_Encrypt_value_val;
-    } c_Encrypt_value;
-  };
-  typedef struct ck_rv_c_Encrypt ck_rv_c_Encrypt;
-
-  struct ck_rv_c_EncryptUpdate {
-    rpc_ck_rv_t c_EncryptUpdate_rv;
-    struct {
-      u_int c_EncryptUpdate_value_len;
-      char *c_EncryptUpdate_value_val;
-    } c_EncryptUpdate_value;
-  };
-  typedef struct ck_rv_c_EncryptUpdate ck_rv_c_EncryptUpdate;
-
-  struct ck_rv_c_EncryptFinal {
-    rpc_ck_rv_t c_EncryptFinal_rv;
-    struct {
-      u_int c_EncryptFinal_value_len;
-      char *c_EncryptFinal_value_val;
-    } c_EncryptFinal_value;
-  };
-  typedef struct ck_rv_c_EncryptFinal ck_rv_c_EncryptFinal;
-
-  struct ck_rv_c_Decrypt {
-    rpc_ck_rv_t c_Decrypt_rv;
-    struct {
-      u_int c_Decrypt_value_len;
-      char *c_Decrypt_value_val;
-    } c_Decrypt_value;
-  };
-  typedef struct ck_rv_c_Decrypt ck_rv_c_Decrypt;
-
-  struct ck_rv_c_DecryptUpdate {
-    rpc_ck_rv_t c_DecryptUpdate_rv;
-    struct {
-      u_int c_DecryptUpdate_value_len;
-      char *c_DecryptUpdate_value_val;
-    } c_DecryptUpdate_value;
-  };
-  typedef struct ck_rv_c_DecryptUpdate ck_rv_c_DecryptUpdate;
-
-  struct ck_rv_c_DecryptFinal {
-    rpc_ck_rv_t c_DecryptFinal_rv;
-    struct {
-      u_int c_DecryptFinal_value_len;
-      char *c_DecryptFinal_value_val;
-    } c_DecryptFinal_value;
-  };
-  typedef struct ck_rv_c_DecryptFinal ck_rv_c_DecryptFinal;
-
-  struct ck_rv_c_SignRecover {
-    rpc_ck_rv_t c_SignRecover_rv;
-    struct {
-      u_int c_SignRecover_value_len;
-      char *c_SignRecover_value_val;
-    } c_SignRecover_value;
-  };
-  typedef struct ck_rv_c_SignRecover ck_rv_c_SignRecover;
-
-  struct ck_rv_c_VerifyRecover {
-    rpc_ck_rv_t c_VerifyRecover_rv;
-    struct {
-      u_int c_VerifyRecover_value_len;
-      char *c_VerifyRecover_value_val;
-    } c_VerifyRecover_value;
-  };
-  typedef struct ck_rv_c_VerifyRecover ck_rv_c_VerifyRecover;
-
-  struct ck_rv_c_DigestEncryptUpdate {
-    rpc_ck_rv_t c_DigestEncryptUpdate_rv;
-    struct {
-      u_int c_DigestEncryptUpdate_value_len;
-      char *c_DigestEncryptUpdate_value_val;
-    } c_DigestEncryptUpdate_value;
-  };
-  typedef struct ck_rv_c_DigestEncryptUpdate ck_rv_c_DigestEncryptUpdate;
-
-  struct ck_rv_c_DecryptDigestUpdate {
-    rpc_ck_rv_t c_DecryptDigestUpdate_rv;
-    struct {
-      u_int c_DecryptDigestUpdate_value_len;
-      char *c_DecryptDigestUpdate_value_val;
-    } c_DecryptDigestUpdate_value;
-  };
-  typedef struct ck_rv_c_DecryptDigestUpdate ck_rv_c_DecryptDigestUpdate;
-
-  struct ck_rv_c_SignEncryptUpdate {
-    rpc_ck_rv_t c_SignEncryptUpdate_rv;
-    struct {
-      u_int c_SignEncryptUpdate_value_len;
-      char *c_SignEncryptUpdate_value_val;
-    } c_SignEncryptUpdate_value;
-  };
-  typedef struct ck_rv_c_SignEncryptUpdate ck_rv_c_SignEncryptUpdate;
-
-  struct ck_rv_c_DecryptVerifyUpdate {
-    rpc_ck_rv_t c_DecryptVerifyUpdate_rv;
-    struct {
-      u_int c_DecryptVerifyUpdate_value_len;
-      char *c_DecryptVerifyUpdate_value_val;
-    } c_DecryptVerifyUpdate_value;
-  };
-  typedef struct ck_rv_c_DecryptVerifyUpdate ck_rv_c_DecryptVerifyUpdate;
-
-  struct ck_rv_c_GetOperationState {
-    rpc_ck_rv_t c_GetOperationState_rv;
-    struct {
-      u_int c_GetOperationState_value_len;
-      char *c_GetOperationState_value_val;
-    } c_GetOperationState_value;
-  };
-  typedef struct ck_rv_c_GetOperationState ck_rv_c_GetOperationState;
-
-  struct c_getslotlist_3_argument {
-    pkcs11_int arg1;
-    pkcs11_int arg2;
-  };
-  typedef struct c_getslotlist_3_argument c_getslotlist_3_argument;
-
-  struct c_login_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_user_type_t arg2;
-    opaque_data arg3;
-  };
-  typedef struct c_login_3_argument c_login_3_argument;
-
-  struct c_opensession_3_argument {
-    rpc_ck_slot_id_t arg1;
-    rpc_ck_flags_t arg2;
-  };
-  typedef struct c_opensession_3_argument c_opensession_3_argument;
-
-  struct c_getmechanismlist_3_argument {
-    rpc_ck_slot_id_t arg1;
-    pkcs11_int arg2;
-  };
-  typedef struct c_getmechanismlist_3_argument c_getmechanismlist_3_argument;
-
-  struct c_getmechanisminfo_3_argument {
-    rpc_ck_slot_id_t arg1;
-    rpc_ck_mechanism_type_t arg2;
-  };
-  typedef struct c_getmechanisminfo_3_argument c_getmechanisminfo_3_argument;
-
-  struct c_initpin_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_initpin_3_argument c_initpin_3_argument;
-
-  struct c_setpin_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-    opaque_data arg3;
-  };
-  typedef struct c_setpin_3_argument c_setpin_3_argument;
-
-  struct c_seedrandom_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_seedrandom_3_argument c_seedrandom_3_argument;
-
-  struct c_inittoken_3_argument {
-    rpc_ck_slot_id_t arg1;
-    opaque_data arg2;
-    opaque_data arg3;
-  };
-  typedef struct c_inittoken_3_argument c_inittoken_3_argument;
-
-  struct c_generaterandom_3_argument {
-    rpc_ck_session_handle_t arg1;
-    pkcs11_int arg2;
-  };
-  typedef struct c_generaterandom_3_argument c_generaterandom_3_argument;
-
-  struct c_findobjectsinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_attribute_array arg2;
-  };
-  typedef struct c_findobjectsinit_3_argument c_findobjectsinit_3_argument;
-
-  struct c_findobjects_3_argument {
-    rpc_ck_session_handle_t arg1;
-    pkcs11_int arg2;
-  };
-  typedef struct c_findobjects_3_argument c_findobjects_3_argument;
-
-  struct c_generatekey_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_attribute_array arg3;
-  };
-  typedef struct c_generatekey_3_argument c_generatekey_3_argument;
-
-  struct c_generatekeypair_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_attribute_array arg3;
-    rpc_ck_attribute_array arg4;
-  };
-  typedef struct c_generatekeypair_3_argument c_generatekeypair_3_argument;
-
-  struct c_createobject_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_attribute_array arg2;
-  };
-  typedef struct c_createobject_3_argument c_createobject_3_argument;
-
-  struct c_copyobject_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_object_handle_t arg2;
-    rpc_ck_attribute_array arg3;
-  };
-  typedef struct c_copyobject_3_argument c_copyobject_3_argument;
-
-  struct c_destroyobject_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_object_handle_t arg2;
-  };
-  typedef struct c_destroyobject_3_argument c_destroyobject_3_argument;
-
-  struct c_getattributevalue_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_object_handle_t arg2;
-    rpc_ck_attribute_array arg3;
-  };
-  typedef struct c_getattributevalue_3_argument c_getattributevalue_3_argument;
-
-  struct c_setattributevalue_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_object_handle_t arg2;
-    rpc_ck_attribute_array arg3;
-  };
-  typedef struct c_setattributevalue_3_argument c_setattributevalue_3_argument;
-
-  struct c_getobjectsize_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_object_handle_t arg2;
-  };
-  typedef struct c_getobjectsize_3_argument c_getobjectsize_3_argument;
-
-  struct c_wrapkey_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-    rpc_ck_object_handle_t arg4;
-  };
-  typedef struct c_wrapkey_3_argument c_wrapkey_3_argument;
-
-  struct c_unwrapkey_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-    opaque_data arg4;
-    rpc_ck_attribute_array arg5;
-  };
-  typedef struct c_unwrapkey_3_argument c_unwrapkey_3_argument;
-
-  struct c_derivekey_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-    rpc_ck_attribute_array arg4;
-  };
-  typedef struct c_derivekey_3_argument c_derivekey_3_argument;
-
-  struct c_digestinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-  };
-  typedef struct c_digestinit_3_argument c_digestinit_3_argument;
-
-  struct c_digest_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_digest_3_argument c_digest_3_argument;
-
-  struct c_digestupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_digestupdate_3_argument c_digestupdate_3_argument;
-
-  struct c_digestkey_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_object_handle_t arg2;
-  };
-  typedef struct c_digestkey_3_argument c_digestkey_3_argument;
-
-  struct c_signinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-  };
-  typedef struct c_signinit_3_argument c_signinit_3_argument;
-
-  struct c_sign_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_sign_3_argument c_sign_3_argument;
-
-  struct c_signupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_signupdate_3_argument c_signupdate_3_argument;
-
-  struct c_verifyinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-  };
-  typedef struct c_verifyinit_3_argument c_verifyinit_3_argument;
-
-  struct c_verify_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-    opaque_data arg3;
-  };
-  typedef struct c_verify_3_argument c_verify_3_argument;
-
-  struct c_verifyupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_verifyupdate_3_argument c_verifyupdate_3_argument;
-
-  struct c_verifyfinal_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_verifyfinal_3_argument c_verifyfinal_3_argument;
-
-  struct c_encryptinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-  };
-  typedef struct c_encryptinit_3_argument c_encryptinit_3_argument;
-
-  struct c_encrypt_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_encrypt_3_argument c_encrypt_3_argument;
-
-  struct c_encryptupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_encryptupdate_3_argument c_encryptupdate_3_argument;
-
-  struct c_decryptinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-  };
-  typedef struct c_decryptinit_3_argument c_decryptinit_3_argument;
-
-  struct c_decrypt_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_decrypt_3_argument c_decrypt_3_argument;
-
-  struct c_decryptupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_decryptupdate_3_argument c_decryptupdate_3_argument;
-
-  struct c_signrecoverinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-  };
-  typedef struct c_signrecoverinit_3_argument c_signrecoverinit_3_argument;
-
-  struct c_signrecover_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_signrecover_3_argument c_signrecover_3_argument;
-
-  struct c_verifyrecoverinit_3_argument {
-    rpc_ck_session_handle_t arg1;
-    rpc_ck_mechanism arg2;
-    rpc_ck_object_handle_t arg3;
-  };
-  typedef struct c_verifyrecoverinit_3_argument c_verifyrecoverinit_3_argument;
-
-  struct c_verifyrecover_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_verifyrecover_3_argument c_verifyrecover_3_argument;
-
-  struct c_digestencryptupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_digestencryptupdate_3_argument
-   c_digestencryptupdate_3_argument;
-
-  struct c_signencryptupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_signencryptupdate_3_argument c_signencryptupdate_3_argument;
-
-  struct c_decryptdigestupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_decryptdigestupdate_3_argument
-   c_decryptdigestupdate_3_argument;
-
-  struct c_decryptverifyupdate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-  };
-  typedef struct c_decryptverifyupdate_3_argument
-   c_decryptverifyupdate_3_argument;
-
-  struct c_setoperationstate_3_argument {
-    rpc_ck_session_handle_t arg1;
-    opaque_data arg2;
-    rpc_ck_object_handle_t arg3;
-    rpc_ck_object_handle_t arg4;
-  };
-  typedef struct c_setoperationstate_3_argument c_setoperationstate_3_argument;
+extern CLIENT *cl;
+
+typedef quad_t pkcs11_int;
+
+typedef pkcs11_int rpc_ck_rv_t;
+
+typedef pkcs11_int rpc_ck_slot_id_t;
+
+typedef pkcs11_int rpc_ck_mechanism_type_t;
+
+typedef pkcs11_int rpc_ck_session_handle_t;
+
+typedef pkcs11_int rpc_ck_user_type_t;
+
+typedef pkcs11_int rpc_ck_state_t;
+
+typedef pkcs11_int rpc_ck_object_handle_t;
+
+typedef pkcs11_int rpc_ck_object_class_t;
+
+typedef pkcs11_int rpc_ck_hw_feature_type_t;
+
+typedef pkcs11_int rpc_ck_key_type_t;
+
+typedef pkcs11_int rpc_ck_certificate_type_t;
+
+typedef pkcs11_int rpc_ck_attribute_type_t;
+
+typedef pkcs11_int rpc_ck_flags_t;
+
+typedef pkcs11_int rpc_ck_notification_t;
+
+typedef struct {
+	u_int opaque_data_len;
+	char *opaque_data_val;
+} opaque_data;
+
+struct rpc_ck_version {
+	struct {
+		u_int major_len;
+		char *major_val;
+	} major;
+	struct {
+		u_int minor_len;
+		char *minor_val;
+	} minor;
+};
+typedef struct rpc_ck_version rpc_ck_version;
+
+struct rpc_ck_info {
+	rpc_ck_version rpc_ck_info_cryptoki_version;
+	struct {
+		u_int rpc_ck_info_manufacturer_id_len;
+		char *rpc_ck_info_manufacturer_id_val;
+	} rpc_ck_info_manufacturer_id;
+	rpc_ck_flags_t rpc_ck_info_flags;
+	struct {
+		u_int rpc_ck_info_library_description_len;
+		char *rpc_ck_info_library_description_val;
+	} rpc_ck_info_library_description;
+	rpc_ck_version rpc_ck_info_library_version;
+};
+typedef struct rpc_ck_info rpc_ck_info;
+
+struct rpc_ck_slot_info {
+	struct {
+		u_int rpc_ck_slot_info_slot_description_len;
+		char *rpc_ck_slot_info_slot_description_val;
+	} rpc_ck_slot_info_slot_description;
+	struct {
+		u_int rpc_ck_slot_info_manufacturer_id_len;
+		char *rpc_ck_slot_info_manufacturer_id_val;
+	} rpc_ck_slot_info_manufacturer_id;
+	rpc_ck_flags_t rpc_ck_slot_info_flags;
+	rpc_ck_version rpc_ck_slot_info_hardware_version;
+	rpc_ck_version rpc_ck_slot_info_firmware_version;
+};
+typedef struct rpc_ck_slot_info rpc_ck_slot_info;
+
+struct rpc_ck_token_info {
+	struct {
+		u_int rpc_ck_token_info_label_len;
+		char *rpc_ck_token_info_label_val;
+	} rpc_ck_token_info_label;
+	struct {
+		u_int rpc_ck_token_info_manufacturer_id_len;
+		char *rpc_ck_token_info_manufacturer_id_val;
+	} rpc_ck_token_info_manufacturer_id;
+	struct {
+		u_int rpc_ck_token_info_model_len;
+		char *rpc_ck_token_info_model_val;
+	} rpc_ck_token_info_model;
+	struct {
+		u_int rpc_ck_token_info_serial_number_len;
+		char *rpc_ck_token_info_serial_number_val;
+	} rpc_ck_token_info_serial_number;
+	rpc_ck_flags_t rpc_ck_token_info_flags;
+	pkcs11_int rpc_ck_token_info_max_session_count;
+	pkcs11_int rpc_ck_token_info_session_count;
+	pkcs11_int rpc_ck_token_info_max_rw_session_count;
+	pkcs11_int rpc_ck_token_info_rw_session_count;
+	pkcs11_int rpc_ck_token_info_max_pin_len;
+	pkcs11_int rpc_ck_token_info_min_pin_len;
+	pkcs11_int rpc_ck_token_info_total_public_memory;
+	pkcs11_int rpc_ck_token_info_free_public_memory;
+	pkcs11_int rpc_ck_token_info_total_private_memory;
+	pkcs11_int rpc_ck_token_info_free_private_memory;
+	rpc_ck_version rpc_ck_token_info_hardware_version;
+	rpc_ck_version rpc_ck_token_info_firmware_version;
+	struct {
+		u_int rpc_ck_token_info_utc_time_len;
+		char *rpc_ck_token_info_utc_time_val;
+	} rpc_ck_token_info_utc_time;
+};
+typedef struct rpc_ck_token_info rpc_ck_token_info;
+
+struct rpc_ck_mechanism {
+	rpc_ck_mechanism_type_t rpc_ck_mechanism_mechanism;
+	struct {
+		u_int rpc_ck_mechanism_parameter_len;
+		char *rpc_ck_mechanism_parameter_val;
+	} rpc_ck_mechanism_parameter;
+};
+typedef struct rpc_ck_mechanism rpc_ck_mechanism;
+
+struct rpc_ck_session_info {
+	rpc_ck_slot_id_t rpc_ck_session_info_slot_id;
+	rpc_ck_state_t rpc_ck_session_info_state;
+	rpc_ck_flags_t rpc_ck_session_info_flags;
+	pkcs11_int rpc_ck_session_info_device_error;
+};
+typedef struct rpc_ck_session_info rpc_ck_session_info;
+
+struct rpc_ck_mechanism_info {
+	pkcs11_int rpc_ck_mechanism_info_min_key_size;
+	pkcs11_int rpc_ck_mechanism_info_max_key_size;
+	rpc_ck_flags_t rpc_ck_mechanism_info_flags;
+};
+typedef struct rpc_ck_mechanism_info rpc_ck_mechanism_info;
+
+struct rpc_ck_attribute {
+	rpc_ck_attribute_type_t rpc_ck_attribute_type;
+	struct {
+		u_int rpc_ck_attribute_value_len;
+		char *rpc_ck_attribute_value_val;
+	} rpc_ck_attribute_value;
+	pkcs11_int rpc_ck_attribute_value_len;
+};
+typedef struct rpc_ck_attribute rpc_ck_attribute;
+
+typedef struct {
+	u_int rpc_ck_attribute_array_len;
+	rpc_ck_attribute *rpc_ck_attribute_array_val;
+} rpc_ck_attribute_array;
+
+struct rpc_ck_date {
+	struct {
+		u_int rpc_ck_date_year_len;
+		char *rpc_ck_date_year_val;
+	} rpc_ck_date_year;
+	struct {
+		u_int rpc_ck_date_month_len;
+		char *rpc_ck_date_month_val;
+	} rpc_ck_date_month;
+	struct {
+		u_int rpc_ck_date_day_len;
+		char *rpc_ck_date_day_val;
+	} rpc_ck_date_day;
+};
+typedef struct rpc_ck_date rpc_ck_date;
+
+struct ck_rv_c_GetSlotList {
+	rpc_ck_rv_t c_GetSlotList_rv;
+	struct {
+		u_int c_GetSlotList_slot_list_len;
+		rpc_ck_slot_id_t *c_GetSlotList_slot_list_val;
+	} c_GetSlotList_slot_list;
+	pkcs11_int c_GetSlotList_count;
+};
+typedef struct ck_rv_c_GetSlotList ck_rv_c_GetSlotList;
+
+struct ck_rv_c_GetSlotInfo {
+	rpc_ck_rv_t c_GetSlotInfo_rv;
+	rpc_ck_slot_info c_GetSlotInfo_slot_info;
+};
+typedef struct ck_rv_c_GetSlotInfo ck_rv_c_GetSlotInfo;
+
+struct ck_rv_c_GetTokenInfo {
+	rpc_ck_rv_t c_GetTokenInfo_rv;
+	rpc_ck_token_info c_GetTokenInfo_token_info;
+};
+typedef struct ck_rv_c_GetTokenInfo ck_rv_c_GetTokenInfo;
+
+struct ck_rv_c_GetInfo {
+	rpc_ck_rv_t c_GetInfo_rv;
+	rpc_ck_info c_GetInfo_info;
+};
+typedef struct ck_rv_c_GetInfo ck_rv_c_GetInfo;
+
+struct ck_rv_c_WaitForSlotEvent {
+	rpc_ck_rv_t c_WaitForSlotEvent_rv;
+	rpc_ck_slot_id_t c_WaitForSlotEvent_count;
+};
+typedef struct ck_rv_c_WaitForSlotEvent ck_rv_c_WaitForSlotEvent;
+
+struct ck_rv_c_OpenSession {
+	rpc_ck_rv_t c_OpenSession_rv;
+	rpc_ck_session_handle_t c_OpenSession_handle;
+};
+typedef struct ck_rv_c_OpenSession ck_rv_c_OpenSession;
+
+struct ck_rv_c_GetMechanismList {
+	rpc_ck_rv_t c_GetMechanismList_rv;
+	struct {
+		u_int c_GetMechanismList_list_len;
+		rpc_ck_mechanism_type_t *c_GetMechanismList_list_val;
+	} c_GetMechanismList_list;
+	pkcs11_int c_GetMechanismList_count;
+};
+typedef struct ck_rv_c_GetMechanismList ck_rv_c_GetMechanismList;
+
+struct ck_rv_c_GetSessionInfo {
+	rpc_ck_rv_t c_GetSessionInfo_rv;
+	rpc_ck_session_info c_GetSessionInfo_info;
+};
+typedef struct ck_rv_c_GetSessionInfo ck_rv_c_GetSessionInfo;
+
+struct ck_rv_c_GetMechanismInfo {
+	rpc_ck_rv_t c_GetMechanismInfo_rv;
+	rpc_ck_mechanism_info c_GetMechanismInfo_info;
+};
+typedef struct ck_rv_c_GetMechanismInfo ck_rv_c_GetMechanismInfo;
+
+struct ck_rv_c_GenerateRandom {
+	rpc_ck_rv_t c_GenerateRandom_rv;
+	struct {
+		u_int c_GenerateRandom_data_len;
+		char *c_GenerateRandom_data_val;
+	} c_GenerateRandom_data;
+};
+typedef struct ck_rv_c_GenerateRandom ck_rv_c_GenerateRandom;
+
+struct ck_rv_c_FindObjects {
+	rpc_ck_rv_t c_FindObjects_rv;
+	struct {
+		u_int c_FindObjects_objects_len;
+		rpc_ck_object_handle_t *c_FindObjects_objects_val;
+	} c_FindObjects_objects;
+	pkcs11_int c_FindObjects_count;
+};
+typedef struct ck_rv_c_FindObjects ck_rv_c_FindObjects;
+
+struct ck_rv_c_GenerateKey {
+	rpc_ck_rv_t c_GenerateKey_rv;
+	rpc_ck_object_handle_t c_GenerateKey_handle;
+};
+typedef struct ck_rv_c_GenerateKey ck_rv_c_GenerateKey;
+
+struct ck_rv_c_GenerateKeyPair {
+	rpc_ck_rv_t c_GenerateKeyPair_rv;
+	rpc_ck_object_handle_t c_GenerateKeyPair_pubhandle;
+	rpc_ck_object_handle_t c_GenerateKeyPair_privhandle;
+};
+typedef struct ck_rv_c_GenerateKeyPair ck_rv_c_GenerateKeyPair;
+
+struct ck_rv_c_CreateObject {
+	rpc_ck_rv_t c_CreateObject_rv;
+	rpc_ck_object_handle_t c_CreateObject_handle;
+};
+typedef struct ck_rv_c_CreateObject ck_rv_c_CreateObject;
+
+struct ck_rv_c_CopyObject {
+	rpc_ck_rv_t c_CopyObject_rv;
+	rpc_ck_object_handle_t c_CopyObject_handle;
+};
+typedef struct ck_rv_c_CopyObject ck_rv_c_CopyObject;
+
+struct ck_rv_c_GetAttributeValue {
+	rpc_ck_rv_t c_GetAttributeValue_rv;
+	rpc_ck_attribute_array c_GetAttributeValue_value;
+};
+typedef struct ck_rv_c_GetAttributeValue ck_rv_c_GetAttributeValue;
+
+struct ck_rv_c_GetObjectSize {
+	rpc_ck_rv_t c_GetObjectSize_rv;
+	pkcs11_int c_GetObjectSize_size;
+};
+typedef struct ck_rv_c_GetObjectSize ck_rv_c_GetObjectSize;
+
+struct ck_rv_c_WrapKey {
+	rpc_ck_rv_t c_WrapKey_rv;
+	struct {
+		u_int c_WrapKey_value_len;
+		char *c_WrapKey_value_val;
+	} c_WrapKey_value;
+};
+typedef struct ck_rv_c_WrapKey ck_rv_c_WrapKey;
+
+struct ck_rv_c_UnwrapKey {
+	rpc_ck_rv_t c_UnwrapKey_rv;
+	rpc_ck_object_handle_t c_UnwrapKey_handle;
+};
+typedef struct ck_rv_c_UnwrapKey ck_rv_c_UnwrapKey;
+
+struct ck_rv_c_DeriveKey {
+	rpc_ck_rv_t c_DeriveKey_rv;
+	rpc_ck_object_handle_t c_DeriveKey_handle;
+};
+typedef struct ck_rv_c_DeriveKey ck_rv_c_DeriveKey;
+
+struct ck_rv_c_Digest {
+	rpc_ck_rv_t c_Digest_rv;
+	struct {
+		u_int c_Digest_value_len;
+		char *c_Digest_value_val;
+	} c_Digest_value;
+};
+typedef struct ck_rv_c_Digest ck_rv_c_Digest;
+
+struct ck_rv_c_DigestFinal {
+	rpc_ck_rv_t c_DigestFinal_rv;
+	struct {
+		u_int c_DigestFinal_value_len;
+		char *c_DigestFinal_value_val;
+	} c_DigestFinal_value;
+};
+typedef struct ck_rv_c_DigestFinal ck_rv_c_DigestFinal;
+
+struct ck_rv_c_Sign {
+	rpc_ck_rv_t c_Sign_rv;
+	struct {
+		u_int c_Sign_value_len;
+		char *c_Sign_value_val;
+	} c_Sign_value;
+};
+typedef struct ck_rv_c_Sign ck_rv_c_Sign;
+
+struct ck_rv_c_SignFinal {
+	rpc_ck_rv_t c_SignFinal_rv;
+	struct {
+		u_int c_SignFinal_value_len;
+		char *c_SignFinal_value_val;
+	} c_SignFinal_value;
+};
+typedef struct ck_rv_c_SignFinal ck_rv_c_SignFinal;
+
+struct ck_rv_c_Encrypt {
+	rpc_ck_rv_t c_Encrypt_rv;
+	struct {
+		u_int c_Encrypt_value_len;
+		char *c_Encrypt_value_val;
+	} c_Encrypt_value;
+};
+typedef struct ck_rv_c_Encrypt ck_rv_c_Encrypt;
+
+struct ck_rv_c_EncryptUpdate {
+	rpc_ck_rv_t c_EncryptUpdate_rv;
+	struct {
+		u_int c_EncryptUpdate_value_len;
+		char *c_EncryptUpdate_value_val;
+	} c_EncryptUpdate_value;
+};
+typedef struct ck_rv_c_EncryptUpdate ck_rv_c_EncryptUpdate;
+
+struct ck_rv_c_EncryptFinal {
+	rpc_ck_rv_t c_EncryptFinal_rv;
+	struct {
+		u_int c_EncryptFinal_value_len;
+		char *c_EncryptFinal_value_val;
+	} c_EncryptFinal_value;
+};
+typedef struct ck_rv_c_EncryptFinal ck_rv_c_EncryptFinal;
+
+struct ck_rv_c_Decrypt {
+	rpc_ck_rv_t c_Decrypt_rv;
+	struct {
+		u_int c_Decrypt_value_len;
+		char *c_Decrypt_value_val;
+	} c_Decrypt_value;
+};
+typedef struct ck_rv_c_Decrypt ck_rv_c_Decrypt;
+
+struct ck_rv_c_DecryptUpdate {
+	rpc_ck_rv_t c_DecryptUpdate_rv;
+	struct {
+		u_int c_DecryptUpdate_value_len;
+		char *c_DecryptUpdate_value_val;
+	} c_DecryptUpdate_value;
+};
+typedef struct ck_rv_c_DecryptUpdate ck_rv_c_DecryptUpdate;
+
+struct ck_rv_c_DecryptFinal {
+	rpc_ck_rv_t c_DecryptFinal_rv;
+	struct {
+		u_int c_DecryptFinal_value_len;
+		char *c_DecryptFinal_value_val;
+	} c_DecryptFinal_value;
+};
+typedef struct ck_rv_c_DecryptFinal ck_rv_c_DecryptFinal;
+
+struct ck_rv_c_SignRecover {
+	rpc_ck_rv_t c_SignRecover_rv;
+	struct {
+		u_int c_SignRecover_value_len;
+		char *c_SignRecover_value_val;
+	} c_SignRecover_value;
+};
+typedef struct ck_rv_c_SignRecover ck_rv_c_SignRecover;
+
+struct ck_rv_c_VerifyRecover {
+	rpc_ck_rv_t c_VerifyRecover_rv;
+	struct {
+		u_int c_VerifyRecover_value_len;
+		char *c_VerifyRecover_value_val;
+	} c_VerifyRecover_value;
+};
+typedef struct ck_rv_c_VerifyRecover ck_rv_c_VerifyRecover;
+
+struct ck_rv_c_DigestEncryptUpdate {
+	rpc_ck_rv_t c_DigestEncryptUpdate_rv;
+	struct {
+		u_int c_DigestEncryptUpdate_value_len;
+		char *c_DigestEncryptUpdate_value_val;
+	} c_DigestEncryptUpdate_value;
+};
+typedef struct ck_rv_c_DigestEncryptUpdate ck_rv_c_DigestEncryptUpdate;
+
+struct ck_rv_c_DecryptDigestUpdate {
+	rpc_ck_rv_t c_DecryptDigestUpdate_rv;
+	struct {
+		u_int c_DecryptDigestUpdate_value_len;
+		char *c_DecryptDigestUpdate_value_val;
+	} c_DecryptDigestUpdate_value;
+};
+typedef struct ck_rv_c_DecryptDigestUpdate ck_rv_c_DecryptDigestUpdate;
+
+struct ck_rv_c_SignEncryptUpdate {
+	rpc_ck_rv_t c_SignEncryptUpdate_rv;
+	struct {
+		u_int c_SignEncryptUpdate_value_len;
+		char *c_SignEncryptUpdate_value_val;
+	} c_SignEncryptUpdate_value;
+};
+typedef struct ck_rv_c_SignEncryptUpdate ck_rv_c_SignEncryptUpdate;
+
+struct ck_rv_c_DecryptVerifyUpdate {
+	rpc_ck_rv_t c_DecryptVerifyUpdate_rv;
+	struct {
+		u_int c_DecryptVerifyUpdate_value_len;
+		char *c_DecryptVerifyUpdate_value_val;
+	} c_DecryptVerifyUpdate_value;
+};
+typedef struct ck_rv_c_DecryptVerifyUpdate ck_rv_c_DecryptVerifyUpdate;
+
+struct ck_rv_c_GetOperationState {
+	rpc_ck_rv_t c_GetOperationState_rv;
+	struct {
+		u_int c_GetOperationState_value_len;
+		char *c_GetOperationState_value_val;
+	} c_GetOperationState_value;
+};
+typedef struct ck_rv_c_GetOperationState ck_rv_c_GetOperationState;
+
+struct c_getslotlist_3_argument {
+	pkcs11_int arg1;
+	pkcs11_int arg2;
+};
+typedef struct c_getslotlist_3_argument c_getslotlist_3_argument;
+
+struct c_login_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_user_type_t arg2;
+	opaque_data arg3;
+};
+typedef struct c_login_3_argument c_login_3_argument;
+
+struct c_opensession_3_argument {
+	rpc_ck_slot_id_t arg1;
+	rpc_ck_flags_t arg2;
+};
+typedef struct c_opensession_3_argument c_opensession_3_argument;
+
+struct c_getmechanismlist_3_argument {
+	rpc_ck_slot_id_t arg1;
+	pkcs11_int arg2;
+};
+typedef struct c_getmechanismlist_3_argument c_getmechanismlist_3_argument;
+
+struct c_getmechanisminfo_3_argument {
+	rpc_ck_slot_id_t arg1;
+	rpc_ck_mechanism_type_t arg2;
+};
+typedef struct c_getmechanisminfo_3_argument c_getmechanisminfo_3_argument;
+
+struct c_initpin_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_initpin_3_argument c_initpin_3_argument;
+
+struct c_setpin_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+	opaque_data arg3;
+};
+typedef struct c_setpin_3_argument c_setpin_3_argument;
+
+struct c_seedrandom_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_seedrandom_3_argument c_seedrandom_3_argument;
+
+struct c_inittoken_3_argument {
+	rpc_ck_slot_id_t arg1;
+	opaque_data arg2;
+	opaque_data arg3;
+};
+typedef struct c_inittoken_3_argument c_inittoken_3_argument;
+
+struct c_generaterandom_3_argument {
+	rpc_ck_session_handle_t arg1;
+	pkcs11_int arg2;
+};
+typedef struct c_generaterandom_3_argument c_generaterandom_3_argument;
+
+struct c_findobjectsinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_attribute_array arg2;
+};
+typedef struct c_findobjectsinit_3_argument c_findobjectsinit_3_argument;
+
+struct c_findobjects_3_argument {
+	rpc_ck_session_handle_t arg1;
+	pkcs11_int arg2;
+};
+typedef struct c_findobjects_3_argument c_findobjects_3_argument;
+
+struct c_generatekey_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_attribute_array arg3;
+};
+typedef struct c_generatekey_3_argument c_generatekey_3_argument;
+
+struct c_generatekeypair_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_attribute_array arg3;
+	rpc_ck_attribute_array arg4;
+};
+typedef struct c_generatekeypair_3_argument c_generatekeypair_3_argument;
+
+struct c_createobject_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_attribute_array arg2;
+};
+typedef struct c_createobject_3_argument c_createobject_3_argument;
+
+struct c_copyobject_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_object_handle_t arg2;
+	rpc_ck_attribute_array arg3;
+};
+typedef struct c_copyobject_3_argument c_copyobject_3_argument;
+
+struct c_destroyobject_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_object_handle_t arg2;
+};
+typedef struct c_destroyobject_3_argument c_destroyobject_3_argument;
+
+struct c_getattributevalue_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_object_handle_t arg2;
+	rpc_ck_attribute_array arg3;
+};
+typedef struct c_getattributevalue_3_argument c_getattributevalue_3_argument;
+
+struct c_setattributevalue_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_object_handle_t arg2;
+	rpc_ck_attribute_array arg3;
+};
+typedef struct c_setattributevalue_3_argument c_setattributevalue_3_argument;
+
+struct c_getobjectsize_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_object_handle_t arg2;
+};
+typedef struct c_getobjectsize_3_argument c_getobjectsize_3_argument;
+
+struct c_wrapkey_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+	rpc_ck_object_handle_t arg4;
+};
+typedef struct c_wrapkey_3_argument c_wrapkey_3_argument;
+
+struct c_unwrapkey_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+	opaque_data arg4;
+	rpc_ck_attribute_array arg5;
+};
+typedef struct c_unwrapkey_3_argument c_unwrapkey_3_argument;
+
+struct c_derivekey_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+	rpc_ck_attribute_array arg4;
+};
+typedef struct c_derivekey_3_argument c_derivekey_3_argument;
+
+struct c_digestinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+};
+typedef struct c_digestinit_3_argument c_digestinit_3_argument;
+
+struct c_digest_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_digest_3_argument c_digest_3_argument;
+
+struct c_digestupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_digestupdate_3_argument c_digestupdate_3_argument;
+
+struct c_digestkey_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_object_handle_t arg2;
+};
+typedef struct c_digestkey_3_argument c_digestkey_3_argument;
+
+struct c_signinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+};
+typedef struct c_signinit_3_argument c_signinit_3_argument;
+
+struct c_sign_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_sign_3_argument c_sign_3_argument;
+
+struct c_signupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_signupdate_3_argument c_signupdate_3_argument;
+
+struct c_verifyinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+};
+typedef struct c_verifyinit_3_argument c_verifyinit_3_argument;
+
+struct c_verify_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+	opaque_data arg3;
+};
+typedef struct c_verify_3_argument c_verify_3_argument;
+
+struct c_verifyupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_verifyupdate_3_argument c_verifyupdate_3_argument;
+
+struct c_verifyfinal_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_verifyfinal_3_argument c_verifyfinal_3_argument;
+
+struct c_encryptinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+};
+typedef struct c_encryptinit_3_argument c_encryptinit_3_argument;
+
+struct c_encrypt_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_encrypt_3_argument c_encrypt_3_argument;
+
+struct c_encryptupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_encryptupdate_3_argument c_encryptupdate_3_argument;
+
+struct c_decryptinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+};
+typedef struct c_decryptinit_3_argument c_decryptinit_3_argument;
+
+struct c_decrypt_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_decrypt_3_argument c_decrypt_3_argument;
+
+struct c_decryptupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_decryptupdate_3_argument c_decryptupdate_3_argument;
+
+struct c_signrecoverinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+};
+typedef struct c_signrecoverinit_3_argument c_signrecoverinit_3_argument;
+
+struct c_signrecover_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_signrecover_3_argument c_signrecover_3_argument;
+
+struct c_verifyrecoverinit_3_argument {
+	rpc_ck_session_handle_t arg1;
+	rpc_ck_mechanism arg2;
+	rpc_ck_object_handle_t arg3;
+};
+typedef struct c_verifyrecoverinit_3_argument c_verifyrecoverinit_3_argument;
+
+struct c_verifyrecover_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_verifyrecover_3_argument c_verifyrecover_3_argument;
+
+struct c_digestencryptupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_digestencryptupdate_3_argument c_digestencryptupdate_3_argument;
+
+struct c_signencryptupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_signencryptupdate_3_argument c_signencryptupdate_3_argument;
+
+struct c_decryptdigestupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_decryptdigestupdate_3_argument c_decryptdigestupdate_3_argument;
+
+struct c_decryptverifyupdate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+};
+typedef struct c_decryptverifyupdate_3_argument c_decryptverifyupdate_3_argument;
+
+struct c_setoperationstate_3_argument {
+	rpc_ck_session_handle_t arg1;
+	opaque_data arg2;
+	rpc_ck_object_handle_t arg3;
+	rpc_ck_object_handle_t arg4;
+};
+typedef struct c_setoperationstate_3_argument c_setoperationstate_3_argument;
 
 #define P 4
 #define V 3
 
 #if defined(__STDC__) || defined(__cplusplus)
 #define c_SetupArch 2
-  extern enum clnt_stat c_setuparch_3(pkcs11_int, rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_setuparch_3_svc(pkcs11_int, rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_setuparch_3(pkcs11_int , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_setuparch_3_svc(pkcs11_int , rpc_ck_rv_t *, struct svc_req *);
 #define c_Initialize 3
-  extern enum clnt_stat c_initialize_3(rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_initialize_3_svc(rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_initialize_3(rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_initialize_3_svc(rpc_ck_rv_t *, struct svc_req *);
 #define c_GetSlotList 4
-  extern enum clnt_stat c_getslotlist_3(pkcs11_int, pkcs11_int,
-					ck_rv_c_GetSlotList *, CLIENT *);
-  extern bool_t c_getslotlist_3_svc(pkcs11_int, pkcs11_int,
-				    ck_rv_c_GetSlotList *, struct svc_req *);
+extern  enum clnt_stat c_getslotlist_3(pkcs11_int , pkcs11_int , ck_rv_c_GetSlotList *, CLIENT *);
+extern  bool_t c_getslotlist_3_svc(pkcs11_int , pkcs11_int , ck_rv_c_GetSlotList *, struct svc_req *);
 #define c_GetInfo 5
-  extern enum clnt_stat c_getinfo_3(ck_rv_c_GetInfo *, CLIENT *);
-  extern bool_t c_getinfo_3_svc(ck_rv_c_GetInfo *, struct svc_req *);
+extern  enum clnt_stat c_getinfo_3(ck_rv_c_GetInfo *, CLIENT *);
+extern  bool_t c_getinfo_3_svc(ck_rv_c_GetInfo *, struct svc_req *);
 #define c_WaitForSlotEvent 6
-  extern enum clnt_stat c_waitforslotevent_3(rpc_ck_flags_t,
-					     ck_rv_c_WaitForSlotEvent *,
-					     CLIENT *);
-  extern bool_t c_waitforslotevent_3_svc(rpc_ck_flags_t,
-					 ck_rv_c_WaitForSlotEvent *,
-					 struct svc_req *);
+extern  enum clnt_stat c_waitforslotevent_3(rpc_ck_flags_t , ck_rv_c_WaitForSlotEvent *, CLIENT *);
+extern  bool_t c_waitforslotevent_3_svc(rpc_ck_flags_t , ck_rv_c_WaitForSlotEvent *, struct svc_req *);
 #define c_GetSlotInfo 7
-  extern enum clnt_stat c_getslotinfo_3(rpc_ck_slot_id_t, ck_rv_c_GetSlotInfo *,
-					CLIENT *);
-  extern bool_t c_getslotinfo_3_svc(rpc_ck_slot_id_t, ck_rv_c_GetSlotInfo *,
-				    struct svc_req *);
+extern  enum clnt_stat c_getslotinfo_3(rpc_ck_slot_id_t , ck_rv_c_GetSlotInfo *, CLIENT *);
+extern  bool_t c_getslotinfo_3_svc(rpc_ck_slot_id_t , ck_rv_c_GetSlotInfo *, struct svc_req *);
 #define c_GetTokenInfo 8
-  extern enum clnt_stat c_gettokeninfo_3(rpc_ck_slot_id_t,
-					 ck_rv_c_GetTokenInfo *, CLIENT *);
-  extern bool_t c_gettokeninfo_3_svc(rpc_ck_slot_id_t, ck_rv_c_GetTokenInfo *,
-				     struct svc_req *);
+extern  enum clnt_stat c_gettokeninfo_3(rpc_ck_slot_id_t , ck_rv_c_GetTokenInfo *, CLIENT *);
+extern  bool_t c_gettokeninfo_3_svc(rpc_ck_slot_id_t , ck_rv_c_GetTokenInfo *, struct svc_req *);
 #define c_Login 9
-  extern enum clnt_stat c_login_3(rpc_ck_session_handle_t, rpc_ck_user_type_t,
-				  opaque_data, rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_login_3_svc(rpc_ck_session_handle_t, rpc_ck_user_type_t,
-			      opaque_data, rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_login_3(rpc_ck_session_handle_t , rpc_ck_user_type_t , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_login_3_svc(rpc_ck_session_handle_t , rpc_ck_user_type_t , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_Logout 10
-  extern enum clnt_stat c_logout_3(rpc_ck_session_handle_t, rpc_ck_rv_t *,
-				   CLIENT *);
-  extern bool_t c_logout_3_svc(rpc_ck_session_handle_t, rpc_ck_rv_t *,
-			       struct svc_req *);
+extern  enum clnt_stat c_logout_3(rpc_ck_session_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_logout_3_svc(rpc_ck_session_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_OpenSession 11
-  extern enum clnt_stat c_opensession_3(rpc_ck_slot_id_t, rpc_ck_flags_t,
-					ck_rv_c_OpenSession *, CLIENT *);
-  extern bool_t c_opensession_3_svc(rpc_ck_slot_id_t, rpc_ck_flags_t,
-				    ck_rv_c_OpenSession *, struct svc_req *);
+extern  enum clnt_stat c_opensession_3(rpc_ck_slot_id_t , rpc_ck_flags_t , ck_rv_c_OpenSession *, CLIENT *);
+extern  bool_t c_opensession_3_svc(rpc_ck_slot_id_t , rpc_ck_flags_t , ck_rv_c_OpenSession *, struct svc_req *);
 #define c_CloseSession 12
-  extern enum clnt_stat c_closesession_3(rpc_ck_session_handle_t, rpc_ck_rv_t *,
-					 CLIENT *);
-  extern bool_t c_closesession_3_svc(rpc_ck_session_handle_t, rpc_ck_rv_t *,
-				     struct svc_req *);
+extern  enum clnt_stat c_closesession_3(rpc_ck_session_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_closesession_3_svc(rpc_ck_session_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_Finalize 13
-  extern enum clnt_stat c_finalize_3(rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_finalize_3_svc(rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_finalize_3(rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_finalize_3_svc(rpc_ck_rv_t *, struct svc_req *);
 #define c_GetMechanismList 14
-  extern enum clnt_stat c_getmechanismlist_3(rpc_ck_slot_id_t, pkcs11_int,
-					     ck_rv_c_GetMechanismList *,
-					     CLIENT *);
-  extern bool_t c_getmechanismlist_3_svc(rpc_ck_slot_id_t, pkcs11_int,
-					 ck_rv_c_GetMechanismList *,
-					 struct svc_req *);
+extern  enum clnt_stat c_getmechanismlist_3(rpc_ck_slot_id_t , pkcs11_int , ck_rv_c_GetMechanismList *, CLIENT *);
+extern  bool_t c_getmechanismlist_3_svc(rpc_ck_slot_id_t , pkcs11_int , ck_rv_c_GetMechanismList *, struct svc_req *);
 #define c_CloseAllSessions 15
-  extern enum clnt_stat c_closeallsessions_3(rpc_ck_slot_id_t, rpc_ck_rv_t *,
-					     CLIENT *);
-  extern bool_t c_closeallsessions_3_svc(rpc_ck_slot_id_t, rpc_ck_rv_t *,
-					 struct svc_req *);
+extern  enum clnt_stat c_closeallsessions_3(rpc_ck_slot_id_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_closeallsessions_3_svc(rpc_ck_slot_id_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_GetSessionInfo 16
-  extern enum clnt_stat c_getsessioninfo_3(rpc_ck_session_handle_t,
-					   ck_rv_c_GetSessionInfo *, CLIENT *);
-  extern bool_t c_getsessioninfo_3_svc(rpc_ck_session_handle_t,
-				       ck_rv_c_GetSessionInfo *,
-				       struct svc_req *);
+extern  enum clnt_stat c_getsessioninfo_3(rpc_ck_session_handle_t , ck_rv_c_GetSessionInfo *, CLIENT *);
+extern  bool_t c_getsessioninfo_3_svc(rpc_ck_session_handle_t , ck_rv_c_GetSessionInfo *, struct svc_req *);
 #define c_GetMechanismInfo 17
-  extern enum clnt_stat c_getmechanisminfo_3(rpc_ck_slot_id_t,
-					     rpc_ck_mechanism_type_t,
-					     ck_rv_c_GetMechanismInfo *,
-					     CLIENT *);
-  extern bool_t c_getmechanisminfo_3_svc(rpc_ck_slot_id_t,
-					 rpc_ck_mechanism_type_t,
-					 ck_rv_c_GetMechanismInfo *,
-					 struct svc_req *);
+extern  enum clnt_stat c_getmechanisminfo_3(rpc_ck_slot_id_t , rpc_ck_mechanism_type_t , ck_rv_c_GetMechanismInfo *, CLIENT *);
+extern  bool_t c_getmechanisminfo_3_svc(rpc_ck_slot_id_t , rpc_ck_mechanism_type_t , ck_rv_c_GetMechanismInfo *, struct svc_req *);
 #define c_InitPIN 18
-  extern enum clnt_stat c_initpin_3(rpc_ck_session_handle_t, opaque_data,
-				    rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_initpin_3_svc(rpc_ck_session_handle_t, opaque_data,
-				rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_initpin_3(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_initpin_3_svc(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_SetPIN 19
-  extern enum clnt_stat c_setpin_3(rpc_ck_session_handle_t, opaque_data,
-				   opaque_data, rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_setpin_3_svc(rpc_ck_session_handle_t, opaque_data,
-			       opaque_data, rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_setpin_3(rpc_ck_session_handle_t , opaque_data , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_setpin_3_svc(rpc_ck_session_handle_t , opaque_data , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_SeedRandom 20
-  extern enum clnt_stat c_seedrandom_3(rpc_ck_session_handle_t, opaque_data,
-				       rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_seedrandom_3_svc(rpc_ck_session_handle_t, opaque_data,
-				   rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_seedrandom_3(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_seedrandom_3_svc(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_InitToken 21
-  extern enum clnt_stat c_inittoken_3(rpc_ck_slot_id_t, opaque_data,
-				      opaque_data, rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_inittoken_3_svc(rpc_ck_slot_id_t, opaque_data, opaque_data,
-				  rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_inittoken_3(rpc_ck_slot_id_t , opaque_data , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_inittoken_3_svc(rpc_ck_slot_id_t , opaque_data , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_GenerateRandom 22
-  extern enum clnt_stat c_generaterandom_3(rpc_ck_session_handle_t, pkcs11_int,
-					   ck_rv_c_GenerateRandom *, CLIENT *);
-  extern bool_t c_generaterandom_3_svc(rpc_ck_session_handle_t, pkcs11_int,
-				       ck_rv_c_GenerateRandom *,
-				       struct svc_req *);
+extern  enum clnt_stat c_generaterandom_3(rpc_ck_session_handle_t , pkcs11_int , ck_rv_c_GenerateRandom *, CLIENT *);
+extern  bool_t c_generaterandom_3_svc(rpc_ck_session_handle_t , pkcs11_int , ck_rv_c_GenerateRandom *, struct svc_req *);
 #define c_FindObjectsInit 23
-  extern enum clnt_stat c_findobjectsinit_3(rpc_ck_session_handle_t,
-					    rpc_ck_attribute_array,
-					    rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_findobjectsinit_3_svc(rpc_ck_session_handle_t,
-					rpc_ck_attribute_array, rpc_ck_rv_t *,
-					struct svc_req *);
+extern  enum clnt_stat c_findobjectsinit_3(rpc_ck_session_handle_t , rpc_ck_attribute_array , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_findobjectsinit_3_svc(rpc_ck_session_handle_t , rpc_ck_attribute_array , rpc_ck_rv_t *, struct svc_req *);
 #define c_FindObjects 24
-  extern enum clnt_stat c_findobjects_3(rpc_ck_session_handle_t, pkcs11_int,
-					ck_rv_c_FindObjects *, CLIENT *);
-  extern bool_t c_findobjects_3_svc(rpc_ck_session_handle_t, pkcs11_int,
-				    ck_rv_c_FindObjects *, struct svc_req *);
+extern  enum clnt_stat c_findobjects_3(rpc_ck_session_handle_t , pkcs11_int , ck_rv_c_FindObjects *, CLIENT *);
+extern  bool_t c_findobjects_3_svc(rpc_ck_session_handle_t , pkcs11_int , ck_rv_c_FindObjects *, struct svc_req *);
 #define c_FindObjectsFinal 25
-  extern enum clnt_stat c_findobjectsfinal_3(rpc_ck_session_handle_t,
-					     rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_findobjectsfinal_3_svc(rpc_ck_session_handle_t, rpc_ck_rv_t *,
-					 struct svc_req *);
+extern  enum clnt_stat c_findobjectsfinal_3(rpc_ck_session_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_findobjectsfinal_3_svc(rpc_ck_session_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_GenerateKey 26
-  extern enum clnt_stat c_generatekey_3(rpc_ck_session_handle_t,
-					rpc_ck_mechanism,
-					rpc_ck_attribute_array,
-					ck_rv_c_GenerateKey *, CLIENT *);
-  extern bool_t c_generatekey_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				    rpc_ck_attribute_array,
-				    ck_rv_c_GenerateKey *, struct svc_req *);
+extern  enum clnt_stat c_generatekey_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_attribute_array , ck_rv_c_GenerateKey *, CLIENT *);
+extern  bool_t c_generatekey_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_attribute_array , ck_rv_c_GenerateKey *, struct svc_req *);
 #define c_GenerateKeyPair 27
-  extern enum clnt_stat c_generatekeypair_3(rpc_ck_session_handle_t,
-					    rpc_ck_mechanism,
-					    rpc_ck_attribute_array,
-					    rpc_ck_attribute_array,
-					    ck_rv_c_GenerateKeyPair *,
-					    CLIENT *);
-  extern bool_t c_generatekeypair_3_svc(rpc_ck_session_handle_t,
-					rpc_ck_mechanism,
-					rpc_ck_attribute_array,
-					rpc_ck_attribute_array,
-					ck_rv_c_GenerateKeyPair *,
-					struct svc_req *);
+extern  enum clnt_stat c_generatekeypair_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_attribute_array , rpc_ck_attribute_array , ck_rv_c_GenerateKeyPair *, CLIENT *);
+extern  bool_t c_generatekeypair_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_attribute_array , rpc_ck_attribute_array , ck_rv_c_GenerateKeyPair *, struct svc_req *);
 #define c_CreateObject 28
-  extern enum clnt_stat c_createobject_3(rpc_ck_session_handle_t,
-					 rpc_ck_attribute_array,
-					 ck_rv_c_CreateObject *, CLIENT *);
-  extern bool_t c_createobject_3_svc(rpc_ck_session_handle_t,
-				     rpc_ck_attribute_array,
-				     ck_rv_c_CreateObject *, struct svc_req *);
+extern  enum clnt_stat c_createobject_3(rpc_ck_session_handle_t , rpc_ck_attribute_array , ck_rv_c_CreateObject *, CLIENT *);
+extern  bool_t c_createobject_3_svc(rpc_ck_session_handle_t , rpc_ck_attribute_array , ck_rv_c_CreateObject *, struct svc_req *);
 #define c_CopyObject 29
-  extern enum clnt_stat c_copyobject_3(rpc_ck_session_handle_t,
-				       rpc_ck_object_handle_t,
-				       rpc_ck_attribute_array,
-				       ck_rv_c_CopyObject *, CLIENT *);
-  extern bool_t c_copyobject_3_svc(rpc_ck_session_handle_t,
-				   rpc_ck_object_handle_t,
-				   rpc_ck_attribute_array, ck_rv_c_CopyObject *,
-				   struct svc_req *);
+extern  enum clnt_stat c_copyobject_3(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_attribute_array , ck_rv_c_CopyObject *, CLIENT *);
+extern  bool_t c_copyobject_3_svc(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_attribute_array , ck_rv_c_CopyObject *, struct svc_req *);
 #define c_DestroyObject 30
-  extern enum clnt_stat c_destroyobject_3(rpc_ck_session_handle_t,
-					  rpc_ck_object_handle_t, rpc_ck_rv_t *,
-					  CLIENT *);
-  extern bool_t c_destroyobject_3_svc(rpc_ck_session_handle_t,
-				      rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				      struct svc_req *);
+extern  enum clnt_stat c_destroyobject_3(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_destroyobject_3_svc(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_GetAttributeValue 31
-  extern enum clnt_stat c_getattributevalue_3(rpc_ck_session_handle_t,
-					      rpc_ck_object_handle_t,
-					      rpc_ck_attribute_array,
-					      ck_rv_c_GetAttributeValue *,
-					      CLIENT *);
-  extern bool_t c_getattributevalue_3_svc(rpc_ck_session_handle_t,
-					  rpc_ck_object_handle_t,
-					  rpc_ck_attribute_array,
-					  ck_rv_c_GetAttributeValue *,
-					  struct svc_req *);
+extern  enum clnt_stat c_getattributevalue_3(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_attribute_array , ck_rv_c_GetAttributeValue *, CLIENT *);
+extern  bool_t c_getattributevalue_3_svc(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_attribute_array , ck_rv_c_GetAttributeValue *, struct svc_req *);
 #define c_SetAttributeValue 32
-  extern enum clnt_stat c_setattributevalue_3(rpc_ck_session_handle_t,
-					      rpc_ck_object_handle_t,
-					      rpc_ck_attribute_array,
-					      rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_setattributevalue_3_svc(rpc_ck_session_handle_t,
-					  rpc_ck_object_handle_t,
-					  rpc_ck_attribute_array, rpc_ck_rv_t *,
-					  struct svc_req *);
+extern  enum clnt_stat c_setattributevalue_3(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_attribute_array , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_setattributevalue_3_svc(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_attribute_array , rpc_ck_rv_t *, struct svc_req *);
 #define c_GetObjectSize 33
-  extern enum clnt_stat c_getobjectsize_3(rpc_ck_session_handle_t,
-					  rpc_ck_object_handle_t,
-					  ck_rv_c_GetObjectSize *, CLIENT *);
-  extern bool_t c_getobjectsize_3_svc(rpc_ck_session_handle_t,
-				      rpc_ck_object_handle_t,
-				      ck_rv_c_GetObjectSize *,
-				      struct svc_req *);
+extern  enum clnt_stat c_getobjectsize_3(rpc_ck_session_handle_t , rpc_ck_object_handle_t , ck_rv_c_GetObjectSize *, CLIENT *);
+extern  bool_t c_getobjectsize_3_svc(rpc_ck_session_handle_t , rpc_ck_object_handle_t , ck_rv_c_GetObjectSize *, struct svc_req *);
 #define c_WrapKey 34
-  extern enum clnt_stat c_wrapkey_3(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				    rpc_ck_object_handle_t,
-				    rpc_ck_object_handle_t, ck_rv_c_WrapKey *,
-				    CLIENT *);
-  extern bool_t c_wrapkey_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				rpc_ck_object_handle_t, rpc_ck_object_handle_t,
-				ck_rv_c_WrapKey *, struct svc_req *);
+extern  enum clnt_stat c_wrapkey_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_object_handle_t , ck_rv_c_WrapKey *, CLIENT *);
+extern  bool_t c_wrapkey_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_object_handle_t , ck_rv_c_WrapKey *, struct svc_req *);
 #define c_UnwrapKey 35
-  extern enum clnt_stat c_unwrapkey_3(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				      rpc_ck_object_handle_t, opaque_data,
-				      rpc_ck_attribute_array,
-				      ck_rv_c_UnwrapKey *, CLIENT *);
-  extern bool_t c_unwrapkey_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				  rpc_ck_object_handle_t, opaque_data,
-				  rpc_ck_attribute_array, ck_rv_c_UnwrapKey *,
-				  struct svc_req *);
+extern  enum clnt_stat c_unwrapkey_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , opaque_data , rpc_ck_attribute_array , ck_rv_c_UnwrapKey *, CLIENT *);
+extern  bool_t c_unwrapkey_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , opaque_data , rpc_ck_attribute_array , ck_rv_c_UnwrapKey *, struct svc_req *);
 #define c_DeriveKey 36
-  extern enum clnt_stat c_derivekey_3(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				      rpc_ck_object_handle_t,
-				      rpc_ck_attribute_array,
-				      ck_rv_c_DeriveKey *, CLIENT *);
-  extern bool_t c_derivekey_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				  rpc_ck_object_handle_t,
-				  rpc_ck_attribute_array, ck_rv_c_DeriveKey *,
-				  struct svc_req *);
+extern  enum clnt_stat c_derivekey_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_attribute_array , ck_rv_c_DeriveKey *, CLIENT *);
+extern  bool_t c_derivekey_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_attribute_array , ck_rv_c_DeriveKey *, struct svc_req *);
 #define c_DigestInit 37
-  extern enum clnt_stat c_digestinit_3(rpc_ck_session_handle_t,
-				       rpc_ck_mechanism, rpc_ck_rv_t *,
-				       CLIENT *);
-  extern bool_t c_digestinit_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				   rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_digestinit_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_digestinit_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_rv_t *, struct svc_req *);
 #define c_Digest 38
-  extern enum clnt_stat c_digest_3(rpc_ck_session_handle_t, opaque_data,
-				   ck_rv_c_Digest *, CLIENT *);
-  extern bool_t c_digest_3_svc(rpc_ck_session_handle_t, opaque_data,
-			       ck_rv_c_Digest *, struct svc_req *);
+extern  enum clnt_stat c_digest_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Digest *, CLIENT *);
+extern  bool_t c_digest_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Digest *, struct svc_req *);
 #define c_DigestUpdate 39
-  extern enum clnt_stat c_digestupdate_3(rpc_ck_session_handle_t, opaque_data,
-					 rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_digestupdate_3_svc(rpc_ck_session_handle_t, opaque_data,
-				     rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_digestupdate_3(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_digestupdate_3_svc(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_DigestFinal 40
-  extern enum clnt_stat c_digestfinal_3(rpc_ck_session_handle_t,
-					ck_rv_c_DigestFinal *, CLIENT *);
-  extern bool_t c_digestfinal_3_svc(rpc_ck_session_handle_t,
-				    ck_rv_c_DigestFinal *, struct svc_req *);
+extern  enum clnt_stat c_digestfinal_3(rpc_ck_session_handle_t , ck_rv_c_DigestFinal *, CLIENT *);
+extern  bool_t c_digestfinal_3_svc(rpc_ck_session_handle_t , ck_rv_c_DigestFinal *, struct svc_req *);
 #define c_DigestKey 41
-  extern enum clnt_stat c_digestkey_3(rpc_ck_session_handle_t,
-				      rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				      CLIENT *);
-  extern bool_t c_digestkey_3_svc(rpc_ck_session_handle_t,
-				  rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				  struct svc_req *);
+extern  enum clnt_stat c_digestkey_3(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_digestkey_3_svc(rpc_ck_session_handle_t , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_SignInit 42
-  extern enum clnt_stat c_signinit_3(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				     rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				     CLIENT *);
-  extern bool_t c_signinit_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				 rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				 struct svc_req *);
+extern  enum clnt_stat c_signinit_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_signinit_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_Sign 43
-  extern enum clnt_stat c_sign_3(rpc_ck_session_handle_t, opaque_data,
-				 ck_rv_c_Sign *, CLIENT *);
-  extern bool_t c_sign_3_svc(rpc_ck_session_handle_t, opaque_data,
-			     ck_rv_c_Sign *, struct svc_req *);
+extern  enum clnt_stat c_sign_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Sign *, CLIENT *);
+extern  bool_t c_sign_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Sign *, struct svc_req *);
 #define c_SignUpdate 44
-  extern enum clnt_stat c_signupdate_3(rpc_ck_session_handle_t, opaque_data,
-				       rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_signupdate_3_svc(rpc_ck_session_handle_t, opaque_data,
-				   rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_signupdate_3(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_signupdate_3_svc(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_SignFinal 45
-  extern enum clnt_stat c_signfinal_3(rpc_ck_session_handle_t,
-				      ck_rv_c_SignFinal *, CLIENT *);
-  extern bool_t c_signfinal_3_svc(rpc_ck_session_handle_t, ck_rv_c_SignFinal *,
-				  struct svc_req *);
+extern  enum clnt_stat c_signfinal_3(rpc_ck_session_handle_t , ck_rv_c_SignFinal *, CLIENT *);
+extern  bool_t c_signfinal_3_svc(rpc_ck_session_handle_t , ck_rv_c_SignFinal *, struct svc_req *);
 #define c_VerifyInit 46
-  extern enum clnt_stat c_verifyinit_3(rpc_ck_session_handle_t,
-				       rpc_ck_mechanism, rpc_ck_object_handle_t,
-				       rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_verifyinit_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				   rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				   struct svc_req *);
+extern  enum clnt_stat c_verifyinit_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_verifyinit_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_Verify 47
-  extern enum clnt_stat c_verify_3(rpc_ck_session_handle_t, opaque_data,
-				   opaque_data, rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_verify_3_svc(rpc_ck_session_handle_t, opaque_data,
-			       opaque_data, rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_verify_3(rpc_ck_session_handle_t , opaque_data , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_verify_3_svc(rpc_ck_session_handle_t , opaque_data , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_VerifyUpdate 48
-  extern enum clnt_stat c_verifyupdate_3(rpc_ck_session_handle_t, opaque_data,
-					 rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_verifyupdate_3_svc(rpc_ck_session_handle_t, opaque_data,
-				     rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_verifyupdate_3(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_verifyupdate_3_svc(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_VerifyFinal 49
-  extern enum clnt_stat c_verifyfinal_3(rpc_ck_session_handle_t, opaque_data,
-					rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_verifyfinal_3_svc(rpc_ck_session_handle_t, opaque_data,
-				    rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_verifyfinal_3(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_verifyfinal_3_svc(rpc_ck_session_handle_t , opaque_data , rpc_ck_rv_t *, struct svc_req *);
 #define c_EncryptInit 50
-  extern enum clnt_stat c_encryptinit_3(rpc_ck_session_handle_t,
-					rpc_ck_mechanism,
-					rpc_ck_object_handle_t, rpc_ck_rv_t *,
-					CLIENT *);
-  extern bool_t c_encryptinit_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				    rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				    struct svc_req *);
+extern  enum clnt_stat c_encryptinit_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_encryptinit_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_Encrypt 51
-  extern enum clnt_stat c_encrypt_3(rpc_ck_session_handle_t, opaque_data,
-				    ck_rv_c_Encrypt *, CLIENT *);
-  extern bool_t c_encrypt_3_svc(rpc_ck_session_handle_t, opaque_data,
-				ck_rv_c_Encrypt *, struct svc_req *);
+extern  enum clnt_stat c_encrypt_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Encrypt *, CLIENT *);
+extern  bool_t c_encrypt_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Encrypt *, struct svc_req *);
 #define c_EncryptUpdate 52
-  extern enum clnt_stat c_encryptupdate_3(rpc_ck_session_handle_t, opaque_data,
-					  ck_rv_c_EncryptUpdate *, CLIENT *);
-  extern bool_t c_encryptupdate_3_svc(rpc_ck_session_handle_t, opaque_data,
-				      ck_rv_c_EncryptUpdate *,
-				      struct svc_req *);
+extern  enum clnt_stat c_encryptupdate_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_EncryptUpdate *, CLIENT *);
+extern  bool_t c_encryptupdate_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_EncryptUpdate *, struct svc_req *);
 #define c_EncryptFinal 53
-  extern enum clnt_stat c_encryptfinal_3(rpc_ck_session_handle_t,
-					 ck_rv_c_EncryptFinal *, CLIENT *);
-  extern bool_t c_encryptfinal_3_svc(rpc_ck_session_handle_t,
-				     ck_rv_c_EncryptFinal *, struct svc_req *);
+extern  enum clnt_stat c_encryptfinal_3(rpc_ck_session_handle_t , ck_rv_c_EncryptFinal *, CLIENT *);
+extern  bool_t c_encryptfinal_3_svc(rpc_ck_session_handle_t , ck_rv_c_EncryptFinal *, struct svc_req *);
 #define c_DecryptInit 54
-  extern enum clnt_stat c_decryptinit_3(rpc_ck_session_handle_t,
-					rpc_ck_mechanism,
-					rpc_ck_object_handle_t, rpc_ck_rv_t *,
-					CLIENT *);
-  extern bool_t c_decryptinit_3_svc(rpc_ck_session_handle_t, rpc_ck_mechanism,
-				    rpc_ck_object_handle_t, rpc_ck_rv_t *,
-				    struct svc_req *);
+extern  enum clnt_stat c_decryptinit_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_decryptinit_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_Decrypt 55
-  extern enum clnt_stat c_decrypt_3(rpc_ck_session_handle_t, opaque_data,
-				    ck_rv_c_Decrypt *, CLIENT *);
-  extern bool_t c_decrypt_3_svc(rpc_ck_session_handle_t, opaque_data,
-				ck_rv_c_Decrypt *, struct svc_req *);
+extern  enum clnt_stat c_decrypt_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Decrypt *, CLIENT *);
+extern  bool_t c_decrypt_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_Decrypt *, struct svc_req *);
 #define c_DecryptUpdate 56
-  extern enum clnt_stat c_decryptupdate_3(rpc_ck_session_handle_t, opaque_data,
-					  ck_rv_c_DecryptUpdate *, CLIENT *);
-  extern bool_t c_decryptupdate_3_svc(rpc_ck_session_handle_t, opaque_data,
-				      ck_rv_c_DecryptUpdate *,
-				      struct svc_req *);
+extern  enum clnt_stat c_decryptupdate_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DecryptUpdate *, CLIENT *);
+extern  bool_t c_decryptupdate_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DecryptUpdate *, struct svc_req *);
 #define c_DecryptFinal 57
-  extern enum clnt_stat c_decryptfinal_3(rpc_ck_session_handle_t,
-					 ck_rv_c_DecryptFinal *, CLIENT *);
-  extern bool_t c_decryptfinal_3_svc(rpc_ck_session_handle_t,
-				     ck_rv_c_DecryptFinal *, struct svc_req *);
+extern  enum clnt_stat c_decryptfinal_3(rpc_ck_session_handle_t , ck_rv_c_DecryptFinal *, CLIENT *);
+extern  bool_t c_decryptfinal_3_svc(rpc_ck_session_handle_t , ck_rv_c_DecryptFinal *, struct svc_req *);
 #define c_SignRecoverInit 58
-  extern enum clnt_stat c_signrecoverinit_3(rpc_ck_session_handle_t,
-					    rpc_ck_mechanism,
-					    rpc_ck_object_handle_t,
-					    rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_signrecoverinit_3_svc(rpc_ck_session_handle_t,
-					rpc_ck_mechanism,
-					rpc_ck_object_handle_t, rpc_ck_rv_t *,
-					struct svc_req *);
+extern  enum clnt_stat c_signrecoverinit_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_signrecoverinit_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_SignRecover 59
-  extern enum clnt_stat c_signrecover_3(rpc_ck_session_handle_t, opaque_data,
-					ck_rv_c_SignRecover *, CLIENT *);
-  extern bool_t c_signrecover_3_svc(rpc_ck_session_handle_t, opaque_data,
-				    ck_rv_c_SignRecover *, struct svc_req *);
+extern  enum clnt_stat c_signrecover_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_SignRecover *, CLIENT *);
+extern  bool_t c_signrecover_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_SignRecover *, struct svc_req *);
 #define c_VerifyRecoverInit 60
-  extern enum clnt_stat c_verifyrecoverinit_3(rpc_ck_session_handle_t,
-					      rpc_ck_mechanism,
-					      rpc_ck_object_handle_t,
-					      rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_verifyrecoverinit_3_svc(rpc_ck_session_handle_t,
-					  rpc_ck_mechanism,
-					  rpc_ck_object_handle_t, rpc_ck_rv_t *,
-					  struct svc_req *);
+extern  enum clnt_stat c_verifyrecoverinit_3(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_verifyrecoverinit_3_svc(rpc_ck_session_handle_t , rpc_ck_mechanism , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_VerifyRecover 61
-  extern enum clnt_stat c_verifyrecover_3(rpc_ck_session_handle_t, opaque_data,
-					  ck_rv_c_VerifyRecover *, CLIENT *);
-  extern bool_t c_verifyrecover_3_svc(rpc_ck_session_handle_t, opaque_data,
-				      ck_rv_c_VerifyRecover *,
-				      struct svc_req *);
+extern  enum clnt_stat c_verifyrecover_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_VerifyRecover *, CLIENT *);
+extern  bool_t c_verifyrecover_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_VerifyRecover *, struct svc_req *);
 #define c_DigestEncryptUpdate 62
-  extern enum clnt_stat c_digestencryptupdate_3(rpc_ck_session_handle_t,
-						opaque_data,
-						ck_rv_c_DigestEncryptUpdate *,
-						CLIENT *);
-  extern bool_t c_digestencryptupdate_3_svc(rpc_ck_session_handle_t,
-					    opaque_data,
-					    ck_rv_c_DigestEncryptUpdate *,
-					    struct svc_req *);
+extern  enum clnt_stat c_digestencryptupdate_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DigestEncryptUpdate *, CLIENT *);
+extern  bool_t c_digestencryptupdate_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DigestEncryptUpdate *, struct svc_req *);
 #define c_SignEncryptUpdate 63
-  extern enum clnt_stat c_signencryptupdate_3(rpc_ck_session_handle_t,
-					      opaque_data,
-					      ck_rv_c_SignEncryptUpdate *,
-					      CLIENT *);
-  extern bool_t c_signencryptupdate_3_svc(rpc_ck_session_handle_t, opaque_data,
-					  ck_rv_c_SignEncryptUpdate *,
-					  struct svc_req *);
+extern  enum clnt_stat c_signencryptupdate_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_SignEncryptUpdate *, CLIENT *);
+extern  bool_t c_signencryptupdate_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_SignEncryptUpdate *, struct svc_req *);
 #define c_DecryptDigestUpdate 64
-  extern enum clnt_stat c_decryptdigestupdate_3(rpc_ck_session_handle_t,
-						opaque_data,
-						ck_rv_c_DecryptDigestUpdate *,
-						CLIENT *);
-  extern bool_t c_decryptdigestupdate_3_svc(rpc_ck_session_handle_t,
-					    opaque_data,
-					    ck_rv_c_DecryptDigestUpdate *,
-					    struct svc_req *);
+extern  enum clnt_stat c_decryptdigestupdate_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DecryptDigestUpdate *, CLIENT *);
+extern  bool_t c_decryptdigestupdate_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DecryptDigestUpdate *, struct svc_req *);
 #define c_DecryptVerifyUpdate 65
-  extern enum clnt_stat c_decryptverifyupdate_3(rpc_ck_session_handle_t,
-						opaque_data,
-						ck_rv_c_DecryptVerifyUpdate *,
-						CLIENT *);
-  extern bool_t c_decryptverifyupdate_3_svc(rpc_ck_session_handle_t,
-					    opaque_data,
-					    ck_rv_c_DecryptVerifyUpdate *,
-					    struct svc_req *);
+extern  enum clnt_stat c_decryptverifyupdate_3(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DecryptVerifyUpdate *, CLIENT *);
+extern  bool_t c_decryptverifyupdate_3_svc(rpc_ck_session_handle_t , opaque_data , ck_rv_c_DecryptVerifyUpdate *, struct svc_req *);
 #define c_GetOperationState 66
-  extern enum clnt_stat c_getoperationstate_3(rpc_ck_session_handle_t,
-					      ck_rv_c_GetOperationState *,
-					      CLIENT *);
-  extern bool_t c_getoperationstate_3_svc(rpc_ck_session_handle_t,
-					  ck_rv_c_GetOperationState *,
-					  struct svc_req *);
+extern  enum clnt_stat c_getoperationstate_3(rpc_ck_session_handle_t , ck_rv_c_GetOperationState *, CLIENT *);
+extern  bool_t c_getoperationstate_3_svc(rpc_ck_session_handle_t , ck_rv_c_GetOperationState *, struct svc_req *);
 #define c_SetOperationState 67
-  extern enum clnt_stat c_setoperationstate_3(rpc_ck_session_handle_t,
-					      opaque_data,
-					      rpc_ck_object_handle_t,
-					      rpc_ck_object_handle_t,
-					      rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_setoperationstate_3_svc(rpc_ck_session_handle_t, opaque_data,
-					  rpc_ck_object_handle_t,
-					  rpc_ck_object_handle_t, rpc_ck_rv_t *,
-					  struct svc_req *);
+extern  enum clnt_stat c_setoperationstate_3(rpc_ck_session_handle_t , opaque_data , rpc_ck_object_handle_t , rpc_ck_object_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_setoperationstate_3_svc(rpc_ck_session_handle_t , opaque_data , rpc_ck_object_handle_t , rpc_ck_object_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_GetFunctionStatus 68
-  extern enum clnt_stat c_getfunctionstatus_3(rpc_ck_session_handle_t,
-					      rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_getfunctionstatus_3_svc(rpc_ck_session_handle_t,
-					  rpc_ck_rv_t *, struct svc_req *);
+extern  enum clnt_stat c_getfunctionstatus_3(rpc_ck_session_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_getfunctionstatus_3_svc(rpc_ck_session_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_CancelFunction 69
-  extern enum clnt_stat c_cancelfunction_3(rpc_ck_session_handle_t,
-					   rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_cancelfunction_3_svc(rpc_ck_session_handle_t, rpc_ck_rv_t *,
-				       struct svc_req *);
+extern  enum clnt_stat c_cancelfunction_3(rpc_ck_session_handle_t , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_cancelfunction_3_svc(rpc_ck_session_handle_t , rpc_ck_rv_t *, struct svc_req *);
 #define c_LoadModule 70
-  extern enum clnt_stat c_loadmodule_3(opaque_data, rpc_ck_rv_t *, CLIENT *);
-  extern bool_t c_loadmodule_3_svc(opaque_data, rpc_ck_rv_t *,
-				   struct svc_req *);
-  extern int p_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
+extern  enum clnt_stat c_loadmodule_3(opaque_data , rpc_ck_rv_t *, CLIENT *);
+extern  bool_t c_loadmodule_3_svc(opaque_data , rpc_ck_rv_t *, struct svc_req *);
+extern int p_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
 
-#else				/* K&R C */
+#else /* K&R C */
 #define c_SetupArch 2
-  extern enum clnt_stat c_setuparch_3();
-  extern bool_t c_setuparch_3_svc();
+extern  enum clnt_stat c_setuparch_3();
+extern  bool_t c_setuparch_3_svc();
 #define c_Initialize 3
-  extern enum clnt_stat c_initialize_3();
-  extern bool_t c_initialize_3_svc();
+extern  enum clnt_stat c_initialize_3();
+extern  bool_t c_initialize_3_svc();
 #define c_GetSlotList 4
-  extern enum clnt_stat c_getslotlist_3();
-  extern bool_t c_getslotlist_3_svc();
+extern  enum clnt_stat c_getslotlist_3();
+extern  bool_t c_getslotlist_3_svc();
 #define c_GetInfo 5
-  extern enum clnt_stat c_getinfo_3();
-  extern bool_t c_getinfo_3_svc();
+extern  enum clnt_stat c_getinfo_3();
+extern  bool_t c_getinfo_3_svc();
 #define c_WaitForSlotEvent 6
-  extern enum clnt_stat c_waitforslotevent_3();
-  extern bool_t c_waitforslotevent_3_svc();
+extern  enum clnt_stat c_waitforslotevent_3();
+extern  bool_t c_waitforslotevent_3_svc();
 #define c_GetSlotInfo 7
-  extern enum clnt_stat c_getslotinfo_3();
-  extern bool_t c_getslotinfo_3_svc();
+extern  enum clnt_stat c_getslotinfo_3();
+extern  bool_t c_getslotinfo_3_svc();
 #define c_GetTokenInfo 8
-  extern enum clnt_stat c_gettokeninfo_3();
-  extern bool_t c_gettokeninfo_3_svc();
+extern  enum clnt_stat c_gettokeninfo_3();
+extern  bool_t c_gettokeninfo_3_svc();
 #define c_Login 9
-  extern enum clnt_stat c_login_3();
-  extern bool_t c_login_3_svc();
+extern  enum clnt_stat c_login_3();
+extern  bool_t c_login_3_svc();
 #define c_Logout 10
-  extern enum clnt_stat c_logout_3();
-  extern bool_t c_logout_3_svc();
+extern  enum clnt_stat c_logout_3();
+extern  bool_t c_logout_3_svc();
 #define c_OpenSession 11
-  extern enum clnt_stat c_opensession_3();
-  extern bool_t c_opensession_3_svc();
+extern  enum clnt_stat c_opensession_3();
+extern  bool_t c_opensession_3_svc();
 #define c_CloseSession 12
-  extern enum clnt_stat c_closesession_3();
-  extern bool_t c_closesession_3_svc();
+extern  enum clnt_stat c_closesession_3();
+extern  bool_t c_closesession_3_svc();
 #define c_Finalize 13
-  extern enum clnt_stat c_finalize_3();
-  extern bool_t c_finalize_3_svc();
+extern  enum clnt_stat c_finalize_3();
+extern  bool_t c_finalize_3_svc();
 #define c_GetMechanismList 14
-  extern enum clnt_stat c_getmechanismlist_3();
-  extern bool_t c_getmechanismlist_3_svc();
+extern  enum clnt_stat c_getmechanismlist_3();
+extern  bool_t c_getmechanismlist_3_svc();
 #define c_CloseAllSessions 15
-  extern enum clnt_stat c_closeallsessions_3();
-  extern bool_t c_closeallsessions_3_svc();
+extern  enum clnt_stat c_closeallsessions_3();
+extern  bool_t c_closeallsessions_3_svc();
 #define c_GetSessionInfo 16
-  extern enum clnt_stat c_getsessioninfo_3();
-  extern bool_t c_getsessioninfo_3_svc();
+extern  enum clnt_stat c_getsessioninfo_3();
+extern  bool_t c_getsessioninfo_3_svc();
 #define c_GetMechanismInfo 17
-  extern enum clnt_stat c_getmechanisminfo_3();
-  extern bool_t c_getmechanisminfo_3_svc();
+extern  enum clnt_stat c_getmechanisminfo_3();
+extern  bool_t c_getmechanisminfo_3_svc();
 #define c_InitPIN 18
-  extern enum clnt_stat c_initpin_3();
-  extern bool_t c_initpin_3_svc();
+extern  enum clnt_stat c_initpin_3();
+extern  bool_t c_initpin_3_svc();
 #define c_SetPIN 19
-  extern enum clnt_stat c_setpin_3();
-  extern bool_t c_setpin_3_svc();
+extern  enum clnt_stat c_setpin_3();
+extern  bool_t c_setpin_3_svc();
 #define c_SeedRandom 20
-  extern enum clnt_stat c_seedrandom_3();
-  extern bool_t c_seedrandom_3_svc();
+extern  enum clnt_stat c_seedrandom_3();
+extern  bool_t c_seedrandom_3_svc();
 #define c_InitToken 21
-  extern enum clnt_stat c_inittoken_3();
-  extern bool_t c_inittoken_3_svc();
+extern  enum clnt_stat c_inittoken_3();
+extern  bool_t c_inittoken_3_svc();
 #define c_GenerateRandom 22
-  extern enum clnt_stat c_generaterandom_3();
-  extern bool_t c_generaterandom_3_svc();
+extern  enum clnt_stat c_generaterandom_3();
+extern  bool_t c_generaterandom_3_svc();
 #define c_FindObjectsInit 23
-  extern enum clnt_stat c_findobjectsinit_3();
-  extern bool_t c_findobjectsinit_3_svc();
+extern  enum clnt_stat c_findobjectsinit_3();
+extern  bool_t c_findobjectsinit_3_svc();
 #define c_FindObjects 24
-  extern enum clnt_stat c_findobjects_3();
-  extern bool_t c_findobjects_3_svc();
+extern  enum clnt_stat c_findobjects_3();
+extern  bool_t c_findobjects_3_svc();
 #define c_FindObjectsFinal 25
-  extern enum clnt_stat c_findobjectsfinal_3();
-  extern bool_t c_findobjectsfinal_3_svc();
+extern  enum clnt_stat c_findobjectsfinal_3();
+extern  bool_t c_findobjectsfinal_3_svc();
 #define c_GenerateKey 26
-  extern enum clnt_stat c_generatekey_3();
-  extern bool_t c_generatekey_3_svc();
+extern  enum clnt_stat c_generatekey_3();
+extern  bool_t c_generatekey_3_svc();
 #define c_GenerateKeyPair 27
-  extern enum clnt_stat c_generatekeypair_3();
-  extern bool_t c_generatekeypair_3_svc();
+extern  enum clnt_stat c_generatekeypair_3();
+extern  bool_t c_generatekeypair_3_svc();
 #define c_CreateObject 28
-  extern enum clnt_stat c_createobject_3();
-  extern bool_t c_createobject_3_svc();
+extern  enum clnt_stat c_createobject_3();
+extern  bool_t c_createobject_3_svc();
 #define c_CopyObject 29
-  extern enum clnt_stat c_copyobject_3();
-  extern bool_t c_copyobject_3_svc();
+extern  enum clnt_stat c_copyobject_3();
+extern  bool_t c_copyobject_3_svc();
 #define c_DestroyObject 30
-  extern enum clnt_stat c_destroyobject_3();
-  extern bool_t c_destroyobject_3_svc();
+extern  enum clnt_stat c_destroyobject_3();
+extern  bool_t c_destroyobject_3_svc();
 #define c_GetAttributeValue 31
-  extern enum clnt_stat c_getattributevalue_3();
-  extern bool_t c_getattributevalue_3_svc();
+extern  enum clnt_stat c_getattributevalue_3();
+extern  bool_t c_getattributevalue_3_svc();
 #define c_SetAttributeValue 32
-  extern enum clnt_stat c_setattributevalue_3();
-  extern bool_t c_setattributevalue_3_svc();
+extern  enum clnt_stat c_setattributevalue_3();
+extern  bool_t c_setattributevalue_3_svc();
 #define c_GetObjectSize 33
-  extern enum clnt_stat c_getobjectsize_3();
-  extern bool_t c_getobjectsize_3_svc();
+extern  enum clnt_stat c_getobjectsize_3();
+extern  bool_t c_getobjectsize_3_svc();
 #define c_WrapKey 34
-  extern enum clnt_stat c_wrapkey_3();
-  extern bool_t c_wrapkey_3_svc();
+extern  enum clnt_stat c_wrapkey_3();
+extern  bool_t c_wrapkey_3_svc();
 #define c_UnwrapKey 35
-  extern enum clnt_stat c_unwrapkey_3();
-  extern bool_t c_unwrapkey_3_svc();
+extern  enum clnt_stat c_unwrapkey_3();
+extern  bool_t c_unwrapkey_3_svc();
 #define c_DeriveKey 36
-  extern enum clnt_stat c_derivekey_3();
-  extern bool_t c_derivekey_3_svc();
+extern  enum clnt_stat c_derivekey_3();
+extern  bool_t c_derivekey_3_svc();
 #define c_DigestInit 37
-  extern enum clnt_stat c_digestinit_3();
-  extern bool_t c_digestinit_3_svc();
+extern  enum clnt_stat c_digestinit_3();
+extern  bool_t c_digestinit_3_svc();
 #define c_Digest 38
-  extern enum clnt_stat c_digest_3();
-  extern bool_t c_digest_3_svc();
+extern  enum clnt_stat c_digest_3();
+extern  bool_t c_digest_3_svc();
 #define c_DigestUpdate 39
-  extern enum clnt_stat c_digestupdate_3();
-  extern bool_t c_digestupdate_3_svc();
+extern  enum clnt_stat c_digestupdate_3();
+extern  bool_t c_digestupdate_3_svc();
 #define c_DigestFinal 40
-  extern enum clnt_stat c_digestfinal_3();
-  extern bool_t c_digestfinal_3_svc();
+extern  enum clnt_stat c_digestfinal_3();
+extern  bool_t c_digestfinal_3_svc();
 #define c_DigestKey 41
-  extern enum clnt_stat c_digestkey_3();
-  extern bool_t c_digestkey_3_svc();
+extern  enum clnt_stat c_digestkey_3();
+extern  bool_t c_digestkey_3_svc();
 #define c_SignInit 42
-  extern enum clnt_stat c_signinit_3();
-  extern bool_t c_signinit_3_svc();
+extern  enum clnt_stat c_signinit_3();
+extern  bool_t c_signinit_3_svc();
 #define c_Sign 43
-  extern enum clnt_stat c_sign_3();
-  extern bool_t c_sign_3_svc();
+extern  enum clnt_stat c_sign_3();
+extern  bool_t c_sign_3_svc();
 #define c_SignUpdate 44
-  extern enum clnt_stat c_signupdate_3();
-  extern bool_t c_signupdate_3_svc();
+extern  enum clnt_stat c_signupdate_3();
+extern  bool_t c_signupdate_3_svc();
 #define c_SignFinal 45
-  extern enum clnt_stat c_signfinal_3();
-  extern bool_t c_signfinal_3_svc();
+extern  enum clnt_stat c_signfinal_3();
+extern  bool_t c_signfinal_3_svc();
 #define c_VerifyInit 46
-  extern enum clnt_stat c_verifyinit_3();
-  extern bool_t c_verifyinit_3_svc();
+extern  enum clnt_stat c_verifyinit_3();
+extern  bool_t c_verifyinit_3_svc();
 #define c_Verify 47
-  extern enum clnt_stat c_verify_3();
-  extern bool_t c_verify_3_svc();
+extern  enum clnt_stat c_verify_3();
+extern  bool_t c_verify_3_svc();
 #define c_VerifyUpdate 48
-  extern enum clnt_stat c_verifyupdate_3();
-  extern bool_t c_verifyupdate_3_svc();
+extern  enum clnt_stat c_verifyupdate_3();
+extern  bool_t c_verifyupdate_3_svc();
 #define c_VerifyFinal 49
-  extern enum clnt_stat c_verifyfinal_3();
-  extern bool_t c_verifyfinal_3_svc();
+extern  enum clnt_stat c_verifyfinal_3();
+extern  bool_t c_verifyfinal_3_svc();
 #define c_EncryptInit 50
-  extern enum clnt_stat c_encryptinit_3();
-  extern bool_t c_encryptinit_3_svc();
+extern  enum clnt_stat c_encryptinit_3();
+extern  bool_t c_encryptinit_3_svc();
 #define c_Encrypt 51
-  extern enum clnt_stat c_encrypt_3();
-  extern bool_t c_encrypt_3_svc();
+extern  enum clnt_stat c_encrypt_3();
+extern  bool_t c_encrypt_3_svc();
 #define c_EncryptUpdate 52
-  extern enum clnt_stat c_encryptupdate_3();
-  extern bool_t c_encryptupdate_3_svc();
+extern  enum clnt_stat c_encryptupdate_3();
+extern  bool_t c_encryptupdate_3_svc();
 #define c_EncryptFinal 53
-  extern enum clnt_stat c_encryptfinal_3();
-  extern bool_t c_encryptfinal_3_svc();
+extern  enum clnt_stat c_encryptfinal_3();
+extern  bool_t c_encryptfinal_3_svc();
 #define c_DecryptInit 54
-  extern enum clnt_stat c_decryptinit_3();
-  extern bool_t c_decryptinit_3_svc();
+extern  enum clnt_stat c_decryptinit_3();
+extern  bool_t c_decryptinit_3_svc();
 #define c_Decrypt 55
-  extern enum clnt_stat c_decrypt_3();
-  extern bool_t c_decrypt_3_svc();
+extern  enum clnt_stat c_decrypt_3();
+extern  bool_t c_decrypt_3_svc();
 #define c_DecryptUpdate 56
-  extern enum clnt_stat c_decryptupdate_3();
-  extern bool_t c_decryptupdate_3_svc();
+extern  enum clnt_stat c_decryptupdate_3();
+extern  bool_t c_decryptupdate_3_svc();
 #define c_DecryptFinal 57
-  extern enum clnt_stat c_decryptfinal_3();
-  extern bool_t c_decryptfinal_3_svc();
+extern  enum clnt_stat c_decryptfinal_3();
+extern  bool_t c_decryptfinal_3_svc();
 #define c_SignRecoverInit 58
-  extern enum clnt_stat c_signrecoverinit_3();
-  extern bool_t c_signrecoverinit_3_svc();
+extern  enum clnt_stat c_signrecoverinit_3();
+extern  bool_t c_signrecoverinit_3_svc();
 #define c_SignRecover 59
-  extern enum clnt_stat c_signrecover_3();
-  extern bool_t c_signrecover_3_svc();
+extern  enum clnt_stat c_signrecover_3();
+extern  bool_t c_signrecover_3_svc();
 #define c_VerifyRecoverInit 60
-  extern enum clnt_stat c_verifyrecoverinit_3();
-  extern bool_t c_verifyrecoverinit_3_svc();
+extern  enum clnt_stat c_verifyrecoverinit_3();
+extern  bool_t c_verifyrecoverinit_3_svc();
 #define c_VerifyRecover 61
-  extern enum clnt_stat c_verifyrecover_3();
-  extern bool_t c_verifyrecover_3_svc();
+extern  enum clnt_stat c_verifyrecover_3();
+extern  bool_t c_verifyrecover_3_svc();
 #define c_DigestEncryptUpdate 62
-  extern enum clnt_stat c_digestencryptupdate_3();
-  extern bool_t c_digestencryptupdate_3_svc();
+extern  enum clnt_stat c_digestencryptupdate_3();
+extern  bool_t c_digestencryptupdate_3_svc();
 #define c_SignEncryptUpdate 63
-  extern enum clnt_stat c_signencryptupdate_3();
-  extern bool_t c_signencryptupdate_3_svc();
+extern  enum clnt_stat c_signencryptupdate_3();
+extern  bool_t c_signencryptupdate_3_svc();
 #define c_DecryptDigestUpdate 64
-  extern enum clnt_stat c_decryptdigestupdate_3();
-  extern bool_t c_decryptdigestupdate_3_svc();
+extern  enum clnt_stat c_decryptdigestupdate_3();
+extern  bool_t c_decryptdigestupdate_3_svc();
 #define c_DecryptVerifyUpdate 65
-  extern enum clnt_stat c_decryptverifyupdate_3();
-  extern bool_t c_decryptverifyupdate_3_svc();
+extern  enum clnt_stat c_decryptverifyupdate_3();
+extern  bool_t c_decryptverifyupdate_3_svc();
 #define c_GetOperationState 66
-  extern enum clnt_stat c_getoperationstate_3();
-  extern bool_t c_getoperationstate_3_svc();
+extern  enum clnt_stat c_getoperationstate_3();
+extern  bool_t c_getoperationstate_3_svc();
 #define c_SetOperationState 67
-  extern enum clnt_stat c_setoperationstate_3();
-  extern bool_t c_setoperationstate_3_svc();
+extern  enum clnt_stat c_setoperationstate_3();
+extern  bool_t c_setoperationstate_3_svc();
 #define c_GetFunctionStatus 68
-  extern enum clnt_stat c_getfunctionstatus_3();
-  extern bool_t c_getfunctionstatus_3_svc();
+extern  enum clnt_stat c_getfunctionstatus_3();
+extern  bool_t c_getfunctionstatus_3_svc();
 #define c_CancelFunction 69
-  extern enum clnt_stat c_cancelfunction_3();
-  extern bool_t c_cancelfunction_3_svc();
+extern  enum clnt_stat c_cancelfunction_3();
+extern  bool_t c_cancelfunction_3_svc();
 #define c_LoadModule 70
-  extern enum clnt_stat c_loadmodule_3();
-  extern bool_t c_loadmodule_3_svc();
-  extern int p_3_freeresult();
-#endif				/* K&R C */
+extern  enum clnt_stat c_loadmodule_3();
+extern  bool_t c_loadmodule_3_svc();
+extern int p_3_freeresult ();
+#endif /* K&R C */
 
 /* the xdr functions */
 
 #if defined(__STDC__) || defined(__cplusplus)
-  extern bool_t xdr_pkcs11_int(XDR *, pkcs11_int *);
-  extern bool_t xdr_rpc_ck_rv_t(XDR *, rpc_ck_rv_t *);
-  extern bool_t xdr_rpc_ck_slot_id_t(XDR *, rpc_ck_slot_id_t *);
-  extern bool_t xdr_rpc_ck_mechanism_type_t(XDR *, rpc_ck_mechanism_type_t *);
-  extern bool_t xdr_rpc_ck_session_handle_t(XDR *, rpc_ck_session_handle_t *);
-  extern bool_t xdr_rpc_ck_user_type_t(XDR *, rpc_ck_user_type_t *);
-  extern bool_t xdr_rpc_ck_state_t(XDR *, rpc_ck_state_t *);
-  extern bool_t xdr_rpc_ck_object_handle_t(XDR *, rpc_ck_object_handle_t *);
-  extern bool_t xdr_rpc_ck_object_class_t(XDR *, rpc_ck_object_class_t *);
-  extern bool_t xdr_rpc_ck_hw_feature_type_t(XDR *, rpc_ck_hw_feature_type_t *);
-  extern bool_t xdr_rpc_ck_key_type_t(XDR *, rpc_ck_key_type_t *);
-  extern bool_t xdr_rpc_ck_certificate_type_t(XDR *,
-					      rpc_ck_certificate_type_t *);
-  extern bool_t xdr_rpc_ck_attribute_type_t(XDR *, rpc_ck_attribute_type_t *);
-  extern bool_t xdr_rpc_ck_flags_t(XDR *, rpc_ck_flags_t *);
-  extern bool_t xdr_rpc_ck_notification_t(XDR *, rpc_ck_notification_t *);
-  extern bool_t xdr_opaque_data(XDR *, opaque_data *);
-  extern bool_t xdr_rpc_ck_version(XDR *, rpc_ck_version *);
-  extern bool_t xdr_rpc_ck_info(XDR *, rpc_ck_info *);
-  extern bool_t xdr_rpc_ck_slot_info(XDR *, rpc_ck_slot_info *);
-  extern bool_t xdr_rpc_ck_token_info(XDR *, rpc_ck_token_info *);
-  extern bool_t xdr_rpc_ck_mechanism(XDR *, rpc_ck_mechanism *);
-  extern bool_t xdr_rpc_ck_session_info(XDR *, rpc_ck_session_info *);
-  extern bool_t xdr_rpc_ck_mechanism_info(XDR *, rpc_ck_mechanism_info *);
-  extern bool_t xdr_rpc_ck_attribute(XDR *, rpc_ck_attribute *);
-  extern bool_t xdr_rpc_ck_attribute_array(XDR *, rpc_ck_attribute_array *);
-  extern bool_t xdr_rpc_ck_date(XDR *, rpc_ck_date *);
-  extern bool_t xdr_ck_rv_c_GetSlotList(XDR *, ck_rv_c_GetSlotList *);
-  extern bool_t xdr_ck_rv_c_GetSlotInfo(XDR *, ck_rv_c_GetSlotInfo *);
-  extern bool_t xdr_ck_rv_c_GetTokenInfo(XDR *, ck_rv_c_GetTokenInfo *);
-  extern bool_t xdr_ck_rv_c_GetInfo(XDR *, ck_rv_c_GetInfo *);
-  extern bool_t xdr_ck_rv_c_WaitForSlotEvent(XDR *, ck_rv_c_WaitForSlotEvent *);
-  extern bool_t xdr_ck_rv_c_OpenSession(XDR *, ck_rv_c_OpenSession *);
-  extern bool_t xdr_ck_rv_c_GetMechanismList(XDR *, ck_rv_c_GetMechanismList *);
-  extern bool_t xdr_ck_rv_c_GetSessionInfo(XDR *, ck_rv_c_GetSessionInfo *);
-  extern bool_t xdr_ck_rv_c_GetMechanismInfo(XDR *, ck_rv_c_GetMechanismInfo *);
-  extern bool_t xdr_ck_rv_c_GenerateRandom(XDR *, ck_rv_c_GenerateRandom *);
-  extern bool_t xdr_ck_rv_c_FindObjects(XDR *, ck_rv_c_FindObjects *);
-  extern bool_t xdr_ck_rv_c_GenerateKey(XDR *, ck_rv_c_GenerateKey *);
-  extern bool_t xdr_ck_rv_c_GenerateKeyPair(XDR *, ck_rv_c_GenerateKeyPair *);
-  extern bool_t xdr_ck_rv_c_CreateObject(XDR *, ck_rv_c_CreateObject *);
-  extern bool_t xdr_ck_rv_c_CopyObject(XDR *, ck_rv_c_CopyObject *);
-  extern bool_t xdr_ck_rv_c_GetAttributeValue(XDR *,
-					      ck_rv_c_GetAttributeValue *);
-  extern bool_t xdr_ck_rv_c_GetObjectSize(XDR *, ck_rv_c_GetObjectSize *);
-  extern bool_t xdr_ck_rv_c_WrapKey(XDR *, ck_rv_c_WrapKey *);
-  extern bool_t xdr_ck_rv_c_UnwrapKey(XDR *, ck_rv_c_UnwrapKey *);
-  extern bool_t xdr_ck_rv_c_DeriveKey(XDR *, ck_rv_c_DeriveKey *);
-  extern bool_t xdr_ck_rv_c_Digest(XDR *, ck_rv_c_Digest *);
-  extern bool_t xdr_ck_rv_c_DigestFinal(XDR *, ck_rv_c_DigestFinal *);
-  extern bool_t xdr_ck_rv_c_Sign(XDR *, ck_rv_c_Sign *);
-  extern bool_t xdr_ck_rv_c_SignFinal(XDR *, ck_rv_c_SignFinal *);
-  extern bool_t xdr_ck_rv_c_Encrypt(XDR *, ck_rv_c_Encrypt *);
-  extern bool_t xdr_ck_rv_c_EncryptUpdate(XDR *, ck_rv_c_EncryptUpdate *);
-  extern bool_t xdr_ck_rv_c_EncryptFinal(XDR *, ck_rv_c_EncryptFinal *);
-  extern bool_t xdr_ck_rv_c_Decrypt(XDR *, ck_rv_c_Decrypt *);
-  extern bool_t xdr_ck_rv_c_DecryptUpdate(XDR *, ck_rv_c_DecryptUpdate *);
-  extern bool_t xdr_ck_rv_c_DecryptFinal(XDR *, ck_rv_c_DecryptFinal *);
-  extern bool_t xdr_ck_rv_c_SignRecover(XDR *, ck_rv_c_SignRecover *);
-  extern bool_t xdr_ck_rv_c_VerifyRecover(XDR *, ck_rv_c_VerifyRecover *);
-  extern bool_t xdr_ck_rv_c_DigestEncryptUpdate(XDR *,
-						ck_rv_c_DigestEncryptUpdate *);
-  extern bool_t xdr_ck_rv_c_DecryptDigestUpdate(XDR *,
-						ck_rv_c_DecryptDigestUpdate *);
-  extern bool_t xdr_ck_rv_c_SignEncryptUpdate(XDR *,
-					      ck_rv_c_SignEncryptUpdate *);
-  extern bool_t xdr_ck_rv_c_DecryptVerifyUpdate(XDR *,
-						ck_rv_c_DecryptVerifyUpdate *);
-  extern bool_t xdr_ck_rv_c_GetOperationState(XDR *,
-					      ck_rv_c_GetOperationState *);
-  extern bool_t xdr_c_getslotlist_3_argument(XDR *, c_getslotlist_3_argument *);
-  extern bool_t xdr_c_login_3_argument(XDR *, c_login_3_argument *);
-  extern bool_t xdr_c_opensession_3_argument(XDR *, c_opensession_3_argument *);
-  extern bool_t xdr_c_getmechanismlist_3_argument(XDR *,
-						  c_getmechanismlist_3_argument
-						  *);
-  extern bool_t xdr_c_getmechanisminfo_3_argument(XDR *,
-						  c_getmechanisminfo_3_argument
-						  *);
-  extern bool_t xdr_c_initpin_3_argument(XDR *, c_initpin_3_argument *);
-  extern bool_t xdr_c_setpin_3_argument(XDR *, c_setpin_3_argument *);
-  extern bool_t xdr_c_seedrandom_3_argument(XDR *, c_seedrandom_3_argument *);
-  extern bool_t xdr_c_inittoken_3_argument(XDR *, c_inittoken_3_argument *);
-  extern bool_t xdr_c_generaterandom_3_argument(XDR *,
-						c_generaterandom_3_argument *);
-  extern bool_t xdr_c_findobjectsinit_3_argument(XDR *,
-						 c_findobjectsinit_3_argument
-						 *);
-  extern bool_t xdr_c_findobjects_3_argument(XDR *, c_findobjects_3_argument *);
-  extern bool_t xdr_c_generatekey_3_argument(XDR *, c_generatekey_3_argument *);
-  extern bool_t xdr_c_generatekeypair_3_argument(XDR *,
-						 c_generatekeypair_3_argument
-						 *);
-  extern bool_t xdr_c_createobject_3_argument(XDR *,
-					      c_createobject_3_argument *);
-  extern bool_t xdr_c_copyobject_3_argument(XDR *, c_copyobject_3_argument *);
-  extern bool_t xdr_c_destroyobject_3_argument(XDR *,
-					       c_destroyobject_3_argument *);
-  extern bool_t xdr_c_getattributevalue_3_argument(XDR *,
-						   c_getattributevalue_3_argument
-						   *);
-  extern bool_t xdr_c_setattributevalue_3_argument(XDR *,
-						   c_setattributevalue_3_argument
-						   *);
-  extern bool_t xdr_c_getobjectsize_3_argument(XDR *,
-					       c_getobjectsize_3_argument *);
-  extern bool_t xdr_c_wrapkey_3_argument(XDR *, c_wrapkey_3_argument *);
-  extern bool_t xdr_c_unwrapkey_3_argument(XDR *, c_unwrapkey_3_argument *);
-  extern bool_t xdr_c_derivekey_3_argument(XDR *, c_derivekey_3_argument *);
-  extern bool_t xdr_c_digestinit_3_argument(XDR *, c_digestinit_3_argument *);
-  extern bool_t xdr_c_digest_3_argument(XDR *, c_digest_3_argument *);
-  extern bool_t xdr_c_digestupdate_3_argument(XDR *,
-					      c_digestupdate_3_argument *);
-  extern bool_t xdr_c_digestkey_3_argument(XDR *, c_digestkey_3_argument *);
-  extern bool_t xdr_c_signinit_3_argument(XDR *, c_signinit_3_argument *);
-  extern bool_t xdr_c_sign_3_argument(XDR *, c_sign_3_argument *);
-  extern bool_t xdr_c_signupdate_3_argument(XDR *, c_signupdate_3_argument *);
-  extern bool_t xdr_c_verifyinit_3_argument(XDR *, c_verifyinit_3_argument *);
-  extern bool_t xdr_c_verify_3_argument(XDR *, c_verify_3_argument *);
-  extern bool_t xdr_c_verifyupdate_3_argument(XDR *,
-					      c_verifyupdate_3_argument *);
-  extern bool_t xdr_c_verifyfinal_3_argument(XDR *, c_verifyfinal_3_argument *);
-  extern bool_t xdr_c_encryptinit_3_argument(XDR *, c_encryptinit_3_argument *);
-  extern bool_t xdr_c_encrypt_3_argument(XDR *, c_encrypt_3_argument *);
-  extern bool_t xdr_c_encryptupdate_3_argument(XDR *,
-					       c_encryptupdate_3_argument *);
-  extern bool_t xdr_c_decryptinit_3_argument(XDR *, c_decryptinit_3_argument *);
-  extern bool_t xdr_c_decrypt_3_argument(XDR *, c_decrypt_3_argument *);
-  extern bool_t xdr_c_decryptupdate_3_argument(XDR *,
-					       c_decryptupdate_3_argument *);
-  extern bool_t xdr_c_signrecoverinit_3_argument(XDR *,
-						 c_signrecoverinit_3_argument
-						 *);
-  extern bool_t xdr_c_signrecover_3_argument(XDR *, c_signrecover_3_argument *);
-  extern bool_t xdr_c_verifyrecoverinit_3_argument(XDR *,
-						   c_verifyrecoverinit_3_argument
-						   *);
-  extern bool_t xdr_c_verifyrecover_3_argument(XDR *,
-					       c_verifyrecover_3_argument *);
-  extern bool_t xdr_c_digestencryptupdate_3_argument(XDR *,
-						     c_digestencryptupdate_3_argument
-						     *);
-  extern bool_t xdr_c_signencryptupdate_3_argument(XDR *,
-						   c_signencryptupdate_3_argument
-						   *);
-  extern bool_t xdr_c_decryptdigestupdate_3_argument(XDR *,
-						     c_decryptdigestupdate_3_argument
-						     *);
-  extern bool_t xdr_c_decryptverifyupdate_3_argument(XDR *,
-						     c_decryptverifyupdate_3_argument
-						     *);
-  extern bool_t xdr_c_setoperationstate_3_argument(XDR *,
-						   c_setoperationstate_3_argument
-						   *);
-
-#else				/* K&R C */
-  extern bool_t xdr_pkcs11_int();
-  extern bool_t xdr_rpc_ck_rv_t();
-  extern bool_t xdr_rpc_ck_slot_id_t();
-  extern bool_t xdr_rpc_ck_mechanism_type_t();
-  extern bool_t xdr_rpc_ck_session_handle_t();
-  extern bool_t xdr_rpc_ck_user_type_t();
-  extern bool_t xdr_rpc_ck_state_t();
-  extern bool_t xdr_rpc_ck_object_handle_t();
-  extern bool_t xdr_rpc_ck_object_class_t();
-  extern bool_t xdr_rpc_ck_hw_feature_type_t();
-  extern bool_t xdr_rpc_ck_key_type_t();
-  extern bool_t xdr_rpc_ck_certificate_type_t();
-  extern bool_t xdr_rpc_ck_attribute_type_t();
-  extern bool_t xdr_rpc_ck_flags_t();
-  extern bool_t xdr_rpc_ck_notification_t();
-  extern bool_t xdr_opaque_data();
-  extern bool_t xdr_rpc_ck_version();
-  extern bool_t xdr_rpc_ck_info();
-  extern bool_t xdr_rpc_ck_slot_info();
-  extern bool_t xdr_rpc_ck_token_info();
-  extern bool_t xdr_rpc_ck_mechanism();
-  extern bool_t xdr_rpc_ck_session_info();
-  extern bool_t xdr_rpc_ck_mechanism_info();
-  extern bool_t xdr_rpc_ck_attribute();
-  extern bool_t xdr_rpc_ck_attribute_array();
-  extern bool_t xdr_rpc_ck_date();
-  extern bool_t xdr_ck_rv_c_GetSlotList();
-  extern bool_t xdr_ck_rv_c_GetSlotInfo();
-  extern bool_t xdr_ck_rv_c_GetTokenInfo();
-  extern bool_t xdr_ck_rv_c_GetInfo();
-  extern bool_t xdr_ck_rv_c_WaitForSlotEvent();
-  extern bool_t xdr_ck_rv_c_OpenSession();
-  extern bool_t xdr_ck_rv_c_GetMechanismList();
-  extern bool_t xdr_ck_rv_c_GetSessionInfo();
-  extern bool_t xdr_ck_rv_c_GetMechanismInfo();
-  extern bool_t xdr_ck_rv_c_GenerateRandom();
-  extern bool_t xdr_ck_rv_c_FindObjects();
-  extern bool_t xdr_ck_rv_c_GenerateKey();
-  extern bool_t xdr_ck_rv_c_GenerateKeyPair();
-  extern bool_t xdr_ck_rv_c_CreateObject();
-  extern bool_t xdr_ck_rv_c_CopyObject();
-  extern bool_t xdr_ck_rv_c_GetAttributeValue();
-  extern bool_t xdr_ck_rv_c_GetObjectSize();
-  extern bool_t xdr_ck_rv_c_WrapKey();
-  extern bool_t xdr_ck_rv_c_UnwrapKey();
-  extern bool_t xdr_ck_rv_c_DeriveKey();
-  extern bool_t xdr_ck_rv_c_Digest();
-  extern bool_t xdr_ck_rv_c_DigestFinal();
-  extern bool_t xdr_ck_rv_c_Sign();
-  extern bool_t xdr_ck_rv_c_SignFinal();
-  extern bool_t xdr_ck_rv_c_Encrypt();
-  extern bool_t xdr_ck_rv_c_EncryptUpdate();
-  extern bool_t xdr_ck_rv_c_EncryptFinal();
-  extern bool_t xdr_ck_rv_c_Decrypt();
-  extern bool_t xdr_ck_rv_c_DecryptUpdate();
-  extern bool_t xdr_ck_rv_c_DecryptFinal();
-  extern bool_t xdr_ck_rv_c_SignRecover();
-  extern bool_t xdr_ck_rv_c_VerifyRecover();
-  extern bool_t xdr_ck_rv_c_DigestEncryptUpdate();
-  extern bool_t xdr_ck_rv_c_DecryptDigestUpdate();
-  extern bool_t xdr_ck_rv_c_SignEncryptUpdate();
-  extern bool_t xdr_ck_rv_c_DecryptVerifyUpdate();
-  extern bool_t xdr_ck_rv_c_GetOperationState();
-  extern bool_t xdr_c_getslotlist_3_argument();
-  extern bool_t xdr_c_login_3_argument();
-  extern bool_t xdr_c_opensession_3_argument();
-  extern bool_t xdr_c_getmechanismlist_3_argument();
-  extern bool_t xdr_c_getmechanisminfo_3_argument();
-  extern bool_t xdr_c_initpin_3_argument();
-  extern bool_t xdr_c_setpin_3_argument();
-  extern bool_t xdr_c_seedrandom_3_argument();
-  extern bool_t xdr_c_inittoken_3_argument();
-  extern bool_t xdr_c_generaterandom_3_argument();
-  extern bool_t xdr_c_findobjectsinit_3_argument();
-  extern bool_t xdr_c_findobjects_3_argument();
-  extern bool_t xdr_c_generatekey_3_argument();
-  extern bool_t xdr_c_generatekeypair_3_argument();
-  extern bool_t xdr_c_createobject_3_argument();
-  extern bool_t xdr_c_copyobject_3_argument();
-  extern bool_t xdr_c_destroyobject_3_argument();
-  extern bool_t xdr_c_getattributevalue_3_argument();
-  extern bool_t xdr_c_setattributevalue_3_argument();
-  extern bool_t xdr_c_getobjectsize_3_argument();
-  extern bool_t xdr_c_wrapkey_3_argument();
-  extern bool_t xdr_c_unwrapkey_3_argument();
-  extern bool_t xdr_c_derivekey_3_argument();
-  extern bool_t xdr_c_digestinit_3_argument();
-  extern bool_t xdr_c_digest_3_argument();
-  extern bool_t xdr_c_digestupdate_3_argument();
-  extern bool_t xdr_c_digestkey_3_argument();
-  extern bool_t xdr_c_signinit_3_argument();
-  extern bool_t xdr_c_sign_3_argument();
-  extern bool_t xdr_c_signupdate_3_argument();
-  extern bool_t xdr_c_verifyinit_3_argument();
-  extern bool_t xdr_c_verify_3_argument();
-  extern bool_t xdr_c_verifyupdate_3_argument();
-  extern bool_t xdr_c_verifyfinal_3_argument();
-  extern bool_t xdr_c_encryptinit_3_argument();
-  extern bool_t xdr_c_encrypt_3_argument();
-  extern bool_t xdr_c_encryptupdate_3_argument();
-  extern bool_t xdr_c_decryptinit_3_argument();
-  extern bool_t xdr_c_decrypt_3_argument();
-  extern bool_t xdr_c_decryptupdate_3_argument();
-  extern bool_t xdr_c_signrecoverinit_3_argument();
-  extern bool_t xdr_c_signrecover_3_argument();
-  extern bool_t xdr_c_verifyrecoverinit_3_argument();
-  extern bool_t xdr_c_verifyrecover_3_argument();
-  extern bool_t xdr_c_digestencryptupdate_3_argument();
-  extern bool_t xdr_c_signencryptupdate_3_argument();
-  extern bool_t xdr_c_decryptdigestupdate_3_argument();
-  extern bool_t xdr_c_decryptverifyupdate_3_argument();
-  extern bool_t xdr_c_setoperationstate_3_argument();
-
-#endif				/* K&R C */
+extern  bool_t xdr_pkcs11_int (XDR *, pkcs11_int*);
+extern  bool_t xdr_rpc_ck_rv_t (XDR *, rpc_ck_rv_t*);
+extern  bool_t xdr_rpc_ck_slot_id_t (XDR *, rpc_ck_slot_id_t*);
+extern  bool_t xdr_rpc_ck_mechanism_type_t (XDR *, rpc_ck_mechanism_type_t*);
+extern  bool_t xdr_rpc_ck_session_handle_t (XDR *, rpc_ck_session_handle_t*);
+extern  bool_t xdr_rpc_ck_user_type_t (XDR *, rpc_ck_user_type_t*);
+extern  bool_t xdr_rpc_ck_state_t (XDR *, rpc_ck_state_t*);
+extern  bool_t xdr_rpc_ck_object_handle_t (XDR *, rpc_ck_object_handle_t*);
+extern  bool_t xdr_rpc_ck_object_class_t (XDR *, rpc_ck_object_class_t*);
+extern  bool_t xdr_rpc_ck_hw_feature_type_t (XDR *, rpc_ck_hw_feature_type_t*);
+extern  bool_t xdr_rpc_ck_key_type_t (XDR *, rpc_ck_key_type_t*);
+extern  bool_t xdr_rpc_ck_certificate_type_t (XDR *, rpc_ck_certificate_type_t*);
+extern  bool_t xdr_rpc_ck_attribute_type_t (XDR *, rpc_ck_attribute_type_t*);
+extern  bool_t xdr_rpc_ck_flags_t (XDR *, rpc_ck_flags_t*);
+extern  bool_t xdr_rpc_ck_notification_t (XDR *, rpc_ck_notification_t*);
+extern  bool_t xdr_opaque_data (XDR *, opaque_data*);
+extern  bool_t xdr_rpc_ck_version (XDR *, rpc_ck_version*);
+extern  bool_t xdr_rpc_ck_info (XDR *, rpc_ck_info*);
+extern  bool_t xdr_rpc_ck_slot_info (XDR *, rpc_ck_slot_info*);
+extern  bool_t xdr_rpc_ck_token_info (XDR *, rpc_ck_token_info*);
+extern  bool_t xdr_rpc_ck_mechanism (XDR *, rpc_ck_mechanism*);
+extern  bool_t xdr_rpc_ck_session_info (XDR *, rpc_ck_session_info*);
+extern  bool_t xdr_rpc_ck_mechanism_info (XDR *, rpc_ck_mechanism_info*);
+extern  bool_t xdr_rpc_ck_attribute (XDR *, rpc_ck_attribute*);
+extern  bool_t xdr_rpc_ck_attribute_array (XDR *, rpc_ck_attribute_array*);
+extern  bool_t xdr_rpc_ck_date (XDR *, rpc_ck_date*);
+extern  bool_t xdr_ck_rv_c_GetSlotList (XDR *, ck_rv_c_GetSlotList*);
+extern  bool_t xdr_ck_rv_c_GetSlotInfo (XDR *, ck_rv_c_GetSlotInfo*);
+extern  bool_t xdr_ck_rv_c_GetTokenInfo (XDR *, ck_rv_c_GetTokenInfo*);
+extern  bool_t xdr_ck_rv_c_GetInfo (XDR *, ck_rv_c_GetInfo*);
+extern  bool_t xdr_ck_rv_c_WaitForSlotEvent (XDR *, ck_rv_c_WaitForSlotEvent*);
+extern  bool_t xdr_ck_rv_c_OpenSession (XDR *, ck_rv_c_OpenSession*);
+extern  bool_t xdr_ck_rv_c_GetMechanismList (XDR *, ck_rv_c_GetMechanismList*);
+extern  bool_t xdr_ck_rv_c_GetSessionInfo (XDR *, ck_rv_c_GetSessionInfo*);
+extern  bool_t xdr_ck_rv_c_GetMechanismInfo (XDR *, ck_rv_c_GetMechanismInfo*);
+extern  bool_t xdr_ck_rv_c_GenerateRandom (XDR *, ck_rv_c_GenerateRandom*);
+extern  bool_t xdr_ck_rv_c_FindObjects (XDR *, ck_rv_c_FindObjects*);
+extern  bool_t xdr_ck_rv_c_GenerateKey (XDR *, ck_rv_c_GenerateKey*);
+extern  bool_t xdr_ck_rv_c_GenerateKeyPair (XDR *, ck_rv_c_GenerateKeyPair*);
+extern  bool_t xdr_ck_rv_c_CreateObject (XDR *, ck_rv_c_CreateObject*);
+extern  bool_t xdr_ck_rv_c_CopyObject (XDR *, ck_rv_c_CopyObject*);
+extern  bool_t xdr_ck_rv_c_GetAttributeValue (XDR *, ck_rv_c_GetAttributeValue*);
+extern  bool_t xdr_ck_rv_c_GetObjectSize (XDR *, ck_rv_c_GetObjectSize*);
+extern  bool_t xdr_ck_rv_c_WrapKey (XDR *, ck_rv_c_WrapKey*);
+extern  bool_t xdr_ck_rv_c_UnwrapKey (XDR *, ck_rv_c_UnwrapKey*);
+extern  bool_t xdr_ck_rv_c_DeriveKey (XDR *, ck_rv_c_DeriveKey*);
+extern  bool_t xdr_ck_rv_c_Digest (XDR *, ck_rv_c_Digest*);
+extern  bool_t xdr_ck_rv_c_DigestFinal (XDR *, ck_rv_c_DigestFinal*);
+extern  bool_t xdr_ck_rv_c_Sign (XDR *, ck_rv_c_Sign*);
+extern  bool_t xdr_ck_rv_c_SignFinal (XDR *, ck_rv_c_SignFinal*);
+extern  bool_t xdr_ck_rv_c_Encrypt (XDR *, ck_rv_c_Encrypt*);
+extern  bool_t xdr_ck_rv_c_EncryptUpdate (XDR *, ck_rv_c_EncryptUpdate*);
+extern  bool_t xdr_ck_rv_c_EncryptFinal (XDR *, ck_rv_c_EncryptFinal*);
+extern  bool_t xdr_ck_rv_c_Decrypt (XDR *, ck_rv_c_Decrypt*);
+extern  bool_t xdr_ck_rv_c_DecryptUpdate (XDR *, ck_rv_c_DecryptUpdate*);
+extern  bool_t xdr_ck_rv_c_DecryptFinal (XDR *, ck_rv_c_DecryptFinal*);
+extern  bool_t xdr_ck_rv_c_SignRecover (XDR *, ck_rv_c_SignRecover*);
+extern  bool_t xdr_ck_rv_c_VerifyRecover (XDR *, ck_rv_c_VerifyRecover*);
+extern  bool_t xdr_ck_rv_c_DigestEncryptUpdate (XDR *, ck_rv_c_DigestEncryptUpdate*);
+extern  bool_t xdr_ck_rv_c_DecryptDigestUpdate (XDR *, ck_rv_c_DecryptDigestUpdate*);
+extern  bool_t xdr_ck_rv_c_SignEncryptUpdate (XDR *, ck_rv_c_SignEncryptUpdate*);
+extern  bool_t xdr_ck_rv_c_DecryptVerifyUpdate (XDR *, ck_rv_c_DecryptVerifyUpdate*);
+extern  bool_t xdr_ck_rv_c_GetOperationState (XDR *, ck_rv_c_GetOperationState*);
+extern  bool_t xdr_c_getslotlist_3_argument (XDR *, c_getslotlist_3_argument*);
+extern  bool_t xdr_c_login_3_argument (XDR *, c_login_3_argument*);
+extern  bool_t xdr_c_opensession_3_argument (XDR *, c_opensession_3_argument*);
+extern  bool_t xdr_c_getmechanismlist_3_argument (XDR *, c_getmechanismlist_3_argument*);
+extern  bool_t xdr_c_getmechanisminfo_3_argument (XDR *, c_getmechanisminfo_3_argument*);
+extern  bool_t xdr_c_initpin_3_argument (XDR *, c_initpin_3_argument*);
+extern  bool_t xdr_c_setpin_3_argument (XDR *, c_setpin_3_argument*);
+extern  bool_t xdr_c_seedrandom_3_argument (XDR *, c_seedrandom_3_argument*);
+extern  bool_t xdr_c_inittoken_3_argument (XDR *, c_inittoken_3_argument*);
+extern  bool_t xdr_c_generaterandom_3_argument (XDR *, c_generaterandom_3_argument*);
+extern  bool_t xdr_c_findobjectsinit_3_argument (XDR *, c_findobjectsinit_3_argument*);
+extern  bool_t xdr_c_findobjects_3_argument (XDR *, c_findobjects_3_argument*);
+extern  bool_t xdr_c_generatekey_3_argument (XDR *, c_generatekey_3_argument*);
+extern  bool_t xdr_c_generatekeypair_3_argument (XDR *, c_generatekeypair_3_argument*);
+extern  bool_t xdr_c_createobject_3_argument (XDR *, c_createobject_3_argument*);
+extern  bool_t xdr_c_copyobject_3_argument (XDR *, c_copyobject_3_argument*);
+extern  bool_t xdr_c_destroyobject_3_argument (XDR *, c_destroyobject_3_argument*);
+extern  bool_t xdr_c_getattributevalue_3_argument (XDR *, c_getattributevalue_3_argument*);
+extern  bool_t xdr_c_setattributevalue_3_argument (XDR *, c_setattributevalue_3_argument*);
+extern  bool_t xdr_c_getobjectsize_3_argument (XDR *, c_getobjectsize_3_argument*);
+extern  bool_t xdr_c_wrapkey_3_argument (XDR *, c_wrapkey_3_argument*);
+extern  bool_t xdr_c_unwrapkey_3_argument (XDR *, c_unwrapkey_3_argument*);
+extern  bool_t xdr_c_derivekey_3_argument (XDR *, c_derivekey_3_argument*);
+extern  bool_t xdr_c_digestinit_3_argument (XDR *, c_digestinit_3_argument*);
+extern  bool_t xdr_c_digest_3_argument (XDR *, c_digest_3_argument*);
+extern  bool_t xdr_c_digestupdate_3_argument (XDR *, c_digestupdate_3_argument*);
+extern  bool_t xdr_c_digestkey_3_argument (XDR *, c_digestkey_3_argument*);
+extern  bool_t xdr_c_signinit_3_argument (XDR *, c_signinit_3_argument*);
+extern  bool_t xdr_c_sign_3_argument (XDR *, c_sign_3_argument*);
+extern  bool_t xdr_c_signupdate_3_argument (XDR *, c_signupdate_3_argument*);
+extern  bool_t xdr_c_verifyinit_3_argument (XDR *, c_verifyinit_3_argument*);
+extern  bool_t xdr_c_verify_3_argument (XDR *, c_verify_3_argument*);
+extern  bool_t xdr_c_verifyupdate_3_argument (XDR *, c_verifyupdate_3_argument*);
+extern  bool_t xdr_c_verifyfinal_3_argument (XDR *, c_verifyfinal_3_argument*);
+extern  bool_t xdr_c_encryptinit_3_argument (XDR *, c_encryptinit_3_argument*);
+extern  bool_t xdr_c_encrypt_3_argument (XDR *, c_encrypt_3_argument*);
+extern  bool_t xdr_c_encryptupdate_3_argument (XDR *, c_encryptupdate_3_argument*);
+extern  bool_t xdr_c_decryptinit_3_argument (XDR *, c_decryptinit_3_argument*);
+extern  bool_t xdr_c_decrypt_3_argument (XDR *, c_decrypt_3_argument*);
+extern  bool_t xdr_c_decryptupdate_3_argument (XDR *, c_decryptupdate_3_argument*);
+extern  bool_t xdr_c_signrecoverinit_3_argument (XDR *, c_signrecoverinit_3_argument*);
+extern  bool_t xdr_c_signrecover_3_argument (XDR *, c_signrecover_3_argument*);
+extern  bool_t xdr_c_verifyrecoverinit_3_argument (XDR *, c_verifyrecoverinit_3_argument*);
+extern  bool_t xdr_c_verifyrecover_3_argument (XDR *, c_verifyrecover_3_argument*);
+extern  bool_t xdr_c_digestencryptupdate_3_argument (XDR *, c_digestencryptupdate_3_argument*);
+extern  bool_t xdr_c_signencryptupdate_3_argument (XDR *, c_signencryptupdate_3_argument*);
+extern  bool_t xdr_c_decryptdigestupdate_3_argument (XDR *, c_decryptdigestupdate_3_argument*);
+extern  bool_t xdr_c_decryptverifyupdate_3_argument (XDR *, c_decryptverifyupdate_3_argument*);
+extern  bool_t xdr_c_setoperationstate_3_argument (XDR *, c_setoperationstate_3_argument*);
+
+#else /* K&R C */
+extern bool_t xdr_pkcs11_int ();
+extern bool_t xdr_rpc_ck_rv_t ();
+extern bool_t xdr_rpc_ck_slot_id_t ();
+extern bool_t xdr_rpc_ck_mechanism_type_t ();
+extern bool_t xdr_rpc_ck_session_handle_t ();
+extern bool_t xdr_rpc_ck_user_type_t ();
+extern bool_t xdr_rpc_ck_state_t ();
+extern bool_t xdr_rpc_ck_object_handle_t ();
+extern bool_t xdr_rpc_ck_object_class_t ();
+extern bool_t xdr_rpc_ck_hw_feature_type_t ();
+extern bool_t xdr_rpc_ck_key_type_t ();
+extern bool_t xdr_rpc_ck_certificate_type_t ();
+extern bool_t xdr_rpc_ck_attribute_type_t ();
+extern bool_t xdr_rpc_ck_flags_t ();
+extern bool_t xdr_rpc_ck_notification_t ();
+extern bool_t xdr_opaque_data ();
+extern bool_t xdr_rpc_ck_version ();
+extern bool_t xdr_rpc_ck_info ();
+extern bool_t xdr_rpc_ck_slot_info ();
+extern bool_t xdr_rpc_ck_token_info ();
+extern bool_t xdr_rpc_ck_mechanism ();
+extern bool_t xdr_rpc_ck_session_info ();
+extern bool_t xdr_rpc_ck_mechanism_info ();
+extern bool_t xdr_rpc_ck_attribute ();
+extern bool_t xdr_rpc_ck_attribute_array ();
+extern bool_t xdr_rpc_ck_date ();
+extern bool_t xdr_ck_rv_c_GetSlotList ();
+extern bool_t xdr_ck_rv_c_GetSlotInfo ();
+extern bool_t xdr_ck_rv_c_GetTokenInfo ();
+extern bool_t xdr_ck_rv_c_GetInfo ();
+extern bool_t xdr_ck_rv_c_WaitForSlotEvent ();
+extern bool_t xdr_ck_rv_c_OpenSession ();
+extern bool_t xdr_ck_rv_c_GetMechanismList ();
+extern bool_t xdr_ck_rv_c_GetSessionInfo ();
+extern bool_t xdr_ck_rv_c_GetMechanismInfo ();
+extern bool_t xdr_ck_rv_c_GenerateRandom ();
+extern bool_t xdr_ck_rv_c_FindObjects ();
+extern bool_t xdr_ck_rv_c_GenerateKey ();
+extern bool_t xdr_ck_rv_c_GenerateKeyPair ();
+extern bool_t xdr_ck_rv_c_CreateObject ();
+extern bool_t xdr_ck_rv_c_CopyObject ();
+extern bool_t xdr_ck_rv_c_GetAttributeValue ();
+extern bool_t xdr_ck_rv_c_GetObjectSize ();
+extern bool_t xdr_ck_rv_c_WrapKey ();
+extern bool_t xdr_ck_rv_c_UnwrapKey ();
+extern bool_t xdr_ck_rv_c_DeriveKey ();
+extern bool_t xdr_ck_rv_c_Digest ();
+extern bool_t xdr_ck_rv_c_DigestFinal ();
+extern bool_t xdr_ck_rv_c_Sign ();
+extern bool_t xdr_ck_rv_c_SignFinal ();
+extern bool_t xdr_ck_rv_c_Encrypt ();
+extern bool_t xdr_ck_rv_c_EncryptUpdate ();
+extern bool_t xdr_ck_rv_c_EncryptFinal ();
+extern bool_t xdr_ck_rv_c_Decrypt ();
+extern bool_t xdr_ck_rv_c_DecryptUpdate ();
+extern bool_t xdr_ck_rv_c_DecryptFinal ();
+extern bool_t xdr_ck_rv_c_SignRecover ();
+extern bool_t xdr_ck_rv_c_VerifyRecover ();
+extern bool_t xdr_ck_rv_c_DigestEncryptUpdate ();
+extern bool_t xdr_ck_rv_c_DecryptDigestUpdate ();
+extern bool_t xdr_ck_rv_c_SignEncryptUpdate ();
+extern bool_t xdr_ck_rv_c_DecryptVerifyUpdate ();
+extern bool_t xdr_ck_rv_c_GetOperationState ();
+extern bool_t xdr_c_getslotlist_3_argument ();
+extern bool_t xdr_c_login_3_argument ();
+extern bool_t xdr_c_opensession_3_argument ();
+extern bool_t xdr_c_getmechanismlist_3_argument ();
+extern bool_t xdr_c_getmechanisminfo_3_argument ();
+extern bool_t xdr_c_initpin_3_argument ();
+extern bool_t xdr_c_setpin_3_argument ();
+extern bool_t xdr_c_seedrandom_3_argument ();
+extern bool_t xdr_c_inittoken_3_argument ();
+extern bool_t xdr_c_generaterandom_3_argument ();
+extern bool_t xdr_c_findobjectsinit_3_argument ();
+extern bool_t xdr_c_findobjects_3_argument ();
+extern bool_t xdr_c_generatekey_3_argument ();
+extern bool_t xdr_c_generatekeypair_3_argument ();
+extern bool_t xdr_c_createobject_3_argument ();
+extern bool_t xdr_c_copyobject_3_argument ();
+extern bool_t xdr_c_destroyobject_3_argument ();
+extern bool_t xdr_c_getattributevalue_3_argument ();
+extern bool_t xdr_c_setattributevalue_3_argument ();
+extern bool_t xdr_c_getobjectsize_3_argument ();
+extern bool_t xdr_c_wrapkey_3_argument ();
+extern bool_t xdr_c_unwrapkey_3_argument ();
+extern bool_t xdr_c_derivekey_3_argument ();
+extern bool_t xdr_c_digestinit_3_argument ();
+extern bool_t xdr_c_digest_3_argument ();
+extern bool_t xdr_c_digestupdate_3_argument ();
+extern bool_t xdr_c_digestkey_3_argument ();
+extern bool_t xdr_c_signinit_3_argument ();
+extern bool_t xdr_c_sign_3_argument ();
+extern bool_t xdr_c_signupdate_3_argument ();
+extern bool_t xdr_c_verifyinit_3_argument ();
+extern bool_t xdr_c_verify_3_argument ();
+extern bool_t xdr_c_verifyupdate_3_argument ();
+extern bool_t xdr_c_verifyfinal_3_argument ();
+extern bool_t xdr_c_encryptinit_3_argument ();
+extern bool_t xdr_c_encrypt_3_argument ();
+extern bool_t xdr_c_encryptupdate_3_argument ();
+extern bool_t xdr_c_decryptinit_3_argument ();
+extern bool_t xdr_c_decrypt_3_argument ();
+extern bool_t xdr_c_decryptupdate_3_argument ();
+extern bool_t xdr_c_signrecoverinit_3_argument ();
+extern bool_t xdr_c_signrecover_3_argument ();
+extern bool_t xdr_c_verifyrecoverinit_3_argument ();
+extern bool_t xdr_c_verifyrecover_3_argument ();
+extern bool_t xdr_c_digestencryptupdate_3_argument ();
+extern bool_t xdr_c_signencryptupdate_3_argument ();
+extern bool_t xdr_c_decryptdigestupdate_3_argument ();
+extern bool_t xdr_c_decryptverifyupdate_3_argument ();
+extern bool_t xdr_c_setoperationstate_3_argument ();
+
+#endif /* K&R C */
 
 #ifdef __cplusplus
 }
 #endif
-#endif				/* !_PKCS11_RPC_H_RPCGEN */
+
+#endif /* !_PKCS11_RPC_H_RPCGEN */
diff --git a/src/filter/backend/Makefile.in b/src/filter/backend/Makefile.in
index 781ae45..5b65266 100644
--- a/src/filter/backend/Makefile.in
+++ b/src/filter/backend/Makefile.in
@@ -1,6 +1,6 @@
 bindings_dir = ../../bindings-pkcs11/
 
 all:
-	ocamlopt -I $(bindings_dir) -o backend -c @srcdir@/backend.ml
+	ocamlopt @ocaml_options@ -I $(bindings_dir) -o backend -c @srcdir@/backend.ml
 clean:
 	@rm -f @srcdir@/*.cmi @srcdir@/*.cmx @srcdir@/*.o @srcdir@/*.cmo @srcdir@/*~ @srcdir@/*.opt
diff --git a/src/filter/backend/backend.ml b/src/filter/backend/backend.ml
index 6456e25..5f00357 100644
--- a/src/filter/backend/backend.ml
+++ b/src/filter/backend/backend.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/Makefile.in b/src/filter/filter/Makefile.in
index 88f4a5f..99e59b4 100644
--- a/src/filter/filter/Makefile.in
+++ b/src/filter/filter/Makefile.in
@@ -1,7 +1,7 @@
 all:
-	ocamlfind ocamlopt -pp "camlp4o pa_macro.cmo -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter_common -c @srcdir@/filter_common.ml
-	ocamlfind ocamlopt -pp "camlp4o pa_macro.cmo -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter_actions -c @srcdir@/filter_actions.ml
-	ocamlfind ocamlopt -pp "camlp4o pa_macro.cmo -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter_configuration -c @srcdir@/filter_configuration.ml
-	ocamlfind ocamlopt -pp "camlp4o pa_macro.cmo -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter -c @srcdir@/filter.ml
+	ocamlfind ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@ -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter_common -c @srcdir@/filter_common.ml
+	ocamlfind ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@ -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter_actions -c @srcdir@/filter_actions.ml
+	ocamlfind ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@ -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter_configuration -c @srcdir@/filter_configuration.ml
+	ocamlfind ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@ -I @srcdir@  " -package "str,config-file,netplex" -I ../../bindings-pkcs11 -I ../backend -o filter -c @srcdir@/filter.ml
 clean:
 	@rm -f *.cmi *.cmx *.o *.cmo *~ *.opt 
diff --git a/src/filter/filter/filter.ml b/src/filter/filter/filter.ml
index 42df598..1b73886 100644
--- a/src/filter/filter/filter.ml
+++ b/src/filter/filter/filter.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -293,9 +293,9 @@ let remove_elements_from_array array_ref to_remove =
 
 let pickup_elements_in_array array_ref count = 
   (* Exract count elements from the array *)
-  let extracted = try Array.sub !array_ref 0 (Nativeint.to_int count)
+  let extracted = (try Array.sub !array_ref 0 (Nativeint.to_int count)
     (* If count is larger than the size, we return the whole *)
-    with Invalid_argument "Array.sub" -> (Array.copy !array_ref)  in
+    with Invalid_argument _ -> (Array.copy !array_ref))  in
   let _ = remove_elements_from_array array_ref extracted in
   (extracted)
 
diff --git a/src/filter/filter/filter_actions.ml b/src/filter/filter/filter_actions.ml
index 1016623..b387d3a 100644
--- a/src/filter/filter/filter_actions.ml
+++ b/src/filter/filter/filter_actions.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/filter_actions_helpers/helpers_patch.ml b/src/filter/filter/filter_actions_helpers/helpers_patch.ml
index d9d0f4b..0b90336 100644
--- a/src/filter/filter/filter_actions_helpers/helpers_patch.ml
+++ b/src/filter/filter/filter_actions_helpers/helpers_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -73,6 +73,12 @@
     File:    src/filter/filter/filter_actions_helpers/helpers_patch.ml
 
 ************************** MIT License HEADER ***********************************)
+
+(* Use aliases if this is an old version (< 4.02) of OCaml without a Bytes module *)
+IFDEF OCAML_NO_BYTES_MODULE THEN
+module Bytes = String
+ENDIF
+
 (* Global value to tell if we want to segregate usage *)
 let segregate_usage = ref false
 
@@ -120,16 +126,19 @@ let critical_attributes key_segregation = if compare key_segregation true = 0 th
 let expurge_template_from_values templates_array =
   (Array.map (fun templ -> {Pkcs11.type_ = templ.Pkcs11.type_; Pkcs11.value = Array.make (Array.length templ.Pkcs11.value) (Char.chr 0)}) templates_array)
 
-let remove_asked_value_type_from_template templates_array = 
+let remove_asked_specific_type_from_template templates_array the_attribute =
   let (new_templates_array, positions, current_position) = Array.fold_left (
     fun (curr_array, pos, curr_pos) templ ->
-      if compare templ.Pkcs11.type_ Pkcs11.cKA_VALUE = 0 then
+      if compare templ.Pkcs11.type_ the_attribute = 0 then
         (curr_array, Array.append pos [|curr_pos|], curr_pos+1)
       else
         (Array.append curr_array [|templ|], pos, curr_pos+1)
   ) ([||], [||], 0) templates_array in
   (new_templates_array, positions)
 
+let remove_asked_value_type_from_template templates_array =
+  (remove_asked_specific_type_from_template templates_array Pkcs11.cKA_VALUE)
+
 let insert_in_array the_array element position = 
   if compare position 0 = 0 then
     (Array.concat [[| element |]; the_array])
@@ -276,6 +285,17 @@ let is_object_class_key attributes =
         | _ -> (false)
       end
 
+let is_object_class_private_key attributes = 
+  let object_class_ = get_object_class attributes in
+  match object_class_ with 
+    None -> (false)
+   |Some object_class -> 
+      begin
+      match Pkcs11.match_cKO_value object_class with
+        "cKO_PRIVATE_KEY" -> (true)
+        | _ -> (false)
+      end
+
 let is_existing_object_class_key sessionh objecth =
   (* Get the CKA_CLASS attributes *)
   let cka_class_template = [| {Pkcs11.type_ = Pkcs11.cKA_CLASS; Pkcs11.value = [||]} |] in
@@ -292,6 +312,23 @@ let is_existing_object_class_key sessionh objecth =
     (* GetAttributeValue returned an error, fail with an exception *)
     let s = "[User defined extensions] C_GettAttributeValue CRITICAL ERROR when getting CKA_CLASS (this should not happen ...)\n" in netplex_log_critical s; failwith s
 
+let is_existing_object_class_private_key sessionh objecth =
+  (* Get the CKA_CLASS attributes *)
+  let cka_class_template = [| {Pkcs11.type_ = Pkcs11.cKA_CLASS; Pkcs11.value = [||]} |] in
+  let (ret, attributes) = Backend.c_GetAttributeValue sessionh objecth cka_class_template in
+  if compare ret Pkcs11.cKR_OK = 0 then
+    let (ret, attributes) = Backend.c_GetAttributeValue sessionh objecth attributes in    
+    if compare ret Pkcs11.cKR_OK = 0 then
+      (* We have got the class, now check it *)
+      (is_object_class_private_key attributes)
+    else
+      (* GetAttributeValue returned an error, fail with an exception *)
+      let s = "[User defined extensions] C_GettAttributeValue CRITICAL ERROR when getting CKA_CLASS (this should not happen ...)\n" in netplex_log_critical s; failwith s
+  else
+    (* GetAttributeValue returned an error, fail with an exception *)
+    let s = "[User defined extensions] C_GettAttributeValue CRITICAL ERROR when getting CKA_CLASS (this should not happen ...)\n" in netplex_log_critical s; failwith s
+
+
 (* Check if two templates are compatible regarding their defined attributes *)
 let check_are_templates_nonconforming fun_name attributes new_attributes =
   let check = Array.fold_left (
@@ -426,13 +463,14 @@ let detect_conflicting_attributes_on_existing_object function_name sessionh obje
       (check)
 
 
+IFDEF OCAML_NO_BYTES_MODULE THEN
 let execute_external_command command data argvs env =
   let buffer_size = 2048 in
   let buffer_stdout = Buffer.create buffer_size in
   let buffer_stderr = Buffer.create buffer_size in
   (* Append the argvs to the command *)
   let command = String.concat " " (List.concat [ [command]; Array.to_list argvs ]) in
-  let string = String.create buffer_size in
+  let str_buffer = Bytes.create buffer_size in
   let (in_channel_stdout, out_channel, in_channel_stderr) = Unix.open_process_full command [||] in
   (* Write data to out_channel *)
   output out_channel data 0 (String.length data);
@@ -442,16 +480,48 @@ let execute_external_command command data argvs env =
   (* Read result data on the in_channel stdout *)
   let chars_read_stdout = ref 1 in
   while !chars_read_stdout <> 0 do
-    chars_read_stdout := input in_channel_stdout string 0 buffer_size;
-    Buffer.add_substring buffer_stdout string 0 !chars_read_stdout
+    chars_read_stdout := input in_channel_stdout str_buffer 0 buffer_size;
+    Buffer.add_substring buffer_stdout str_buffer 0 !chars_read_stdout
+  done;
+  (* Command done, read stderr *)
+  let chars_read_stderr = ref 1 in
+  while !chars_read_stderr <> 0 do
+    chars_read_stderr := input in_channel_stderr str_buffer 0 buffer_size;
+    Buffer.add_substring buffer_stderr str_buffer 0 !chars_read_stderr
+  done;
+  let ret_status = Unix.close_process_full (in_channel_stdout, out_channel, in_channel_stderr) in
+  match ret_status with
+    Unix.WEXITED(0) -> (true, Buffer.contents buffer_stdout, Buffer.contents buffer_stderr)
+   | _ -> (false, "", Buffer.contents buffer_stderr)
+ENDIF
+IFNDEF OCAML_NO_BYTES_MODULE THEN
+let execute_external_command command data argvs env =
+  let buffer_size = 2048 in
+  let buffer_stdout = Buffer.create buffer_size in
+  let buffer_stderr = Buffer.create buffer_size in
+  (* Append the argvs to the command *)
+  let command = String.concat " " (List.concat [ [command]; Array.to_list argvs ]) in
+  let str_buffer = Bytes.create buffer_size in
+  let (in_channel_stdout, out_channel, in_channel_stderr) = Unix.open_process_full command [||] in
+  (* Write data to out_channel *)
+  output_string out_channel data;
+  (* Close out_channel to tell it's over *)
+  flush out_channel;
+  close_out out_channel;
+  (* Read result data on the in_channel stdout *)
+  let chars_read_stdout = ref 1 in
+  while !chars_read_stdout <> 0 do
+    chars_read_stdout := input in_channel_stdout str_buffer 0 buffer_size;
+    Buffer.add_subbytes buffer_stdout str_buffer 0 !chars_read_stdout
   done;
   (* Command done, read stderr *)
   let chars_read_stderr = ref 1 in
   while !chars_read_stderr <> 0 do
-    chars_read_stderr := input in_channel_stderr string 0 buffer_size;
-    Buffer.add_substring buffer_stderr string 0 !chars_read_stderr
+    chars_read_stderr := input in_channel_stderr str_buffer 0 buffer_size;
+    Buffer.add_subbytes buffer_stderr str_buffer 0 !chars_read_stderr
   done;
   let ret_status = Unix.close_process_full (in_channel_stdout, out_channel, in_channel_stderr) in
   match ret_status with
     Unix.WEXITED(0) -> (true, Buffer.contents buffer_stdout, Buffer.contents buffer_stderr)
    | _ -> (false, "", Buffer.contents buffer_stderr)
+ENDIF
diff --git a/src/filter/filter/filter_common.ml b/src/filter/filter/filter_common.ml
index 8e219ff..11bacf3 100644
--- a/src/filter/filter/filter_common.ml
+++ b/src/filter/filter/filter_common.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/filter_configuration.ml b/src/filter/filter/filter_configuration.ml
index 94010b6..2701567 100644
--- a/src/filter/filter/filter_configuration.ml
+++ b/src/filter/filter/filter_configuration.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -78,6 +78,11 @@ open Config_file
 open Filter_common
 open Filter_actions
 
+(* Use aliases if this is an old version (< 4.02) of OCaml without a Bytes module *)
+IFDEF OCAML_NO_BYTES_MODULE THEN
+module Bytes = String
+ENDIF
+
 let string_check_function a = match a with
   "C_LoadModule" -> a
 | "C_Initialize" -> a
@@ -656,13 +661,23 @@ let print_some_help groupable_cp _ _ filename _ =
    end;
    () 
 
+IFDEF OCAML_NO_BYTES_MODULE THEN
 let load_file f =
   let ic = open_in f in
   let n = in_channel_length ic in
-  let s = String.create n in
+  let s = Bytes.create n in
   really_input ic s 0 n;
   close_in ic;
   (s)
+ENDIF
+IFNDEF OCAML_NO_BYTES_MODULE THEN
+let load_file f =
+  let ic = open_in f in
+  let n = in_channel_length ic in
+  let s = really_input_string ic n in
+  close_in ic;
+  (s)
+ENDIF
 
 let check_occurences big_string to_match conf_file message = 
   let regexp = Str.regexp to_match in
diff --git a/src/filter/filter/p11fix_patches/cmac.ml b/src/filter/filter/p11fix_patches/cmac.ml
index 3f70319..2304ee2 100644
--- a/src/filter/filter/p11fix_patches/cmac.ml
+++ b/src/filter/filter/p11fix_patches/cmac.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/p11fix_patches/conflicting_attributes_patch.ml b/src/filter/filter/p11fix_patches/conflicting_attributes_patch.ml
index ff6480b..2bbfc3d 100644
--- a/src/filter/filter/p11fix_patches/conflicting_attributes_patch.ml
+++ b/src/filter/filter/p11fix_patches/conflicting_attributes_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/p11fix_patches/existing_sensitive_keys_patch.ml b/src/filter/filter/p11fix_patches/existing_sensitive_keys_patch.ml
index 00cc47a..085b272 100644
--- a/src/filter/filter/p11fix_patches/existing_sensitive_keys_patch.ml
+++ b/src/filter/filter/p11fix_patches/existing_sensitive_keys_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/p11fix_patches/non_local_objects_patch.ml b/src/filter/filter/p11fix_patches/non_local_objects_patch.ml
index 5304945..a1e1038 100644
--- a/src/filter/filter/p11fix_patches/non_local_objects_patch.ml
+++ b/src/filter/filter/p11fix_patches/non_local_objects_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/p11fix_patches/sanitize_creation_templates_patch.ml b/src/filter/filter/p11fix_patches/sanitize_creation_templates_patch.ml
index 7b26284..5816f26 100644
--- a/src/filter/filter/p11fix_patches/sanitize_creation_templates_patch.ml
+++ b/src/filter/filter/p11fix_patches/sanitize_creation_templates_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/p11fix_patches/secure_templates_patch.ml b/src/filter/filter/p11fix_patches/secure_templates_patch.ml
index a5551c2..35ce4d5 100644
--- a/src/filter/filter/p11fix_patches/secure_templates_patch.ml
+++ b/src/filter/filter/p11fix_patches/secure_templates_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/p11fix_patches/sensitive_leak_patch.ml b/src/filter/filter/p11fix_patches/sensitive_leak_patch.ml
index 42144bc..000d3a9 100644
--- a/src/filter/filter/p11fix_patches/sensitive_leak_patch.ml
+++ b/src/filter/filter/p11fix_patches/sensitive_leak_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -80,6 +80,48 @@
 (* CKA_NEVER_EXTRACTABLE                                               *)
 (* see http://secgroup.dais.unive.it/projects/security-apis/cryptokix/ *)
 
+(* Specific cases where the sensitive part of the key is not a CKA_VALUE *)
+(* FIXME: Check if there is no other algorithm than RSA falling in this category *)
+(* FIXME: This function is kind of ugly, it can be rewritten in a more elegant way *)
+let handle_object_sensitive_not_cka_value fun_name sessionh objecth attributes =
+  (* Get the key type if it is relevant *)
+  if is_existing_object_class_private_key sessionh objecth  = true then
+    let (ret, templates) = filter_getAttributeValue sessionh objecth [| { Pkcs11.type_ = Pkcs11.cKA_KEY_TYPE; Pkcs11.value = [||] } |] in
+    let (ret, templates_values) = filter_getAttributeValue sessionh objecth templates in
+    if compare ret Pkcs11.cKR_OK <> 0 then
+      (* There was an error, fallback to the CKA_VALUE check *)
+      (2, Pkcs11.cKR_OK, [||])
+    else
+      if compare (Pkcs11.char_array_to_ulong templates_values.(0).Pkcs11.value) Pkcs11.cKK_RSA = 0 then
+        (* We have RSA key *)
+        if (compare (check_is_attribute_asked fun_name Pkcs11.cKA_PRIVATE_EXPONENT attributes) true = 0) 
+           || (compare (check_is_attribute_asked fun_name Pkcs11.cKA_PRIME_1 attributes) true = 0)
+           || (compare (check_is_attribute_asked fun_name Pkcs11.cKA_PRIME_2 attributes) true = 0)
+           || (compare (check_is_attribute_asked fun_name Pkcs11.cKA_EXPONENT_1 attributes) true = 0)
+           || (compare (check_is_attribute_asked fun_name Pkcs11.cKA_EXPONENT_2 attributes) true = 0)
+           || (compare (check_is_attribute_asked fun_name Pkcs11.cKA_COEFFICIENT attributes) true = 0) then
+          (* We have a RSA key and some sensitive attributes are asked *)
+          let filtered_attributes = attributes in
+          let (filtered_attributes, positions_private_exp) = remove_asked_specific_type_from_template filtered_attributes Pkcs11.cKA_PRIVATE_EXPONENT in
+          let (filtered_attributes, positions_prime_1) = remove_asked_specific_type_from_template filtered_attributes Pkcs11.cKA_PRIME_1 in
+          let (filtered_attributes, positions_prime_2) = remove_asked_specific_type_from_template filtered_attributes Pkcs11.cKA_PRIME_2 in
+          let (filtered_attributes, positions_exp_1) = remove_asked_specific_type_from_template filtered_attributes Pkcs11.cKA_EXPONENT_1 in
+          let (filtered_attributes, positions_exp_2) = remove_asked_specific_type_from_template filtered_attributes Pkcs11.cKA_EXPONENT_2 in
+          let (filtered_attributes, positions_coeff) = remove_asked_specific_type_from_template filtered_attributes Pkcs11.cKA_COEFFICIENT in
+          let (ret, returned_attributes) = Backend.c_GetAttributeValue sessionh objecth filtered_attributes in
+          (* Now, we reinsert the sensitive types in the template with zeroes *)
+          let filtered_attributes = insert_purged_value_type_in_template filtered_attributes (Array.concat [ positions_private_exp; positions_prime_1; positions_prime_2; positions_exp_1; positions_exp_2; positions_coeff ]) in
+          (1, ret, filtered_attributes)
+        else
+          (* We have a RSA key without asking for sensitive attributes, passthrough *)
+          (0, Pkcs11.cKR_OK, [||])
+      else 
+        (* Not a RSA key, fallback to the CKA_VALUE check *)
+        (2, Pkcs11.cKR_OK, [||])
+   else
+     (* Not a private key, fallback to the CKA_VALUE check *)
+     (2, Pkcs11.cKR_OK, [||])
+
 let prevent_sensitive_leak_patch fun_name arg = 
   match fun_name with
     "C_GetAttributeValue" ->
@@ -95,23 +137,41 @@ let prevent_sensitive_leak_patch fun_name arg =
         if compare ret Pkcs11.cKR_OK <> 0 then
           let s = "[User defined extensions] C_GettAttributeValue CRITICAL ERROR when getting critical attributes (it is not possible to get these attributes from the backend ...): inside SENSITIVE_LEAK\n" in let _ = netplex_log_critical s in netplex_log_critical s; failwith s;
         else
-          (* If the object is sensitive or non-extractable, and we ask for a value, we return an error *)
-          if (compare (check_is_attribute_asked fun_name Pkcs11.cKA_VALUE attributes) true = 0) && 
-             ((compare (check_is_attribute_set fun_name Pkcs11.cKA_SENSITIVE templates_values) true = 0) 
+          (* If the object is sensitive or non-extractable, and we ask for a sensitive attribute, we return an error *)
+          if ((compare (check_is_attribute_set fun_name Pkcs11.cKA_SENSITIVE templates_values) true = 0) 
               || (compare (check_is_attribute_set fun_name Pkcs11.cKA_EXTRACTABLE templates_values) true = 0)) then
-            let error_type = 
-              if (compare (check_is_attribute_set fun_name Pkcs11.cKA_SENSITIVE templates_values) true = 0) then "SENSITIVE" else "NON EXTRACTABLE" in
-            let info_string = Printf.sprintf "[User defined extensions]: SENSITIVE_LEAK asked during %s for a %s key" fun_name error_type in
-            let _ = print_debug info_string 1 in
-            (* We expurge the template from the value type and call the backend *)
-            let (new_attributes, positions) = remove_asked_value_type_from_template attributes in
-            let (ret, returned_attributes) = Backend.c_GetAttributeValue sessionh objecth new_attributes in
-            (* Now, we reinsert the value type in the template with zeroes *)
-            let filtered_attributes = insert_purged_value_type_in_template returned_attributes positions in
-            (serialize (true, (Pkcs11.cKR_ATTRIBUTE_SENSITIVE, filtered_attributes)))
-          else
-            (* If we are here, we passthrough the call *)
-            (serialize (false, ()))
+            (* Specific cases where CKA_VALUE is NOT (or not only ...) the sensitive part of the object *)
+            let (check, ret, filtered_attributes) = handle_object_sensitive_not_cka_value fun_name sessionh objecth attributes in
+            match check with
+              |0 -> 
+                (* Case 0: we pass through without doing anything *)
+                (serialize (false, ())) 
+              |1 ->
+                (* Case 1: we return a specific error *)
+                (serialize (true, (ret, filtered_attributes))) 
+              |2 -> 
+                (* Case 2: we fall in the case where we want to test the specific CKA_VALUE case *)
+                (* Key type has sensitive value in CKA_VALUE attribute *)
+                if (compare (check_is_attribute_asked fun_name Pkcs11.cKA_VALUE attributes) true = 0) then 
+                  let error_type = 
+                    if (compare (check_is_attribute_set fun_name Pkcs11.cKA_SENSITIVE templates_values) true = 0) then "SENSITIVE" else "NON EXTRACTABLE" in
+                  let info_string = Printf.sprintf "[User defined extensions]: SENSITIVE_LEAK asked during %s for a %s key" fun_name error_type in
+                  let _ = print_debug info_string 1 in
+                  (* We expurge the template from the value type and call the backend *)
+                  let (new_attributes, positions) = remove_asked_value_type_from_template attributes in
+                  let (ret, returned_attributes) = Backend.c_GetAttributeValue sessionh objecth new_attributes in
+                  (* Now, we reinsert the value type in the template with zeroes *)
+                  let filtered_attributes = insert_purged_value_type_in_template returned_attributes positions in
+                  (serialize (true, (Pkcs11.cKR_ATTRIBUTE_SENSITIVE, filtered_attributes)))
+                else
+                  (* If we are here, we passthrough the call *)
+                  (serialize (false, ()))
+              |_ ->
+                (* This case should not happen by construction *)
+                 let s = "[User defined extensions] C_GettAttributeValue CRITICAL ERROR when checking for sensitive or extractible object attributes\n" in let _ = netplex_log_critical s in netplex_log_critical s; failwith s;        
+           else
+             (* If we are here, we passthrough the call *)
+             (serialize (false, ()))
   | "C_SetAttributeValue" ->
       let (sessionh, objecth, attributes) = deserialize arg in
       let (ret, templates) = filter_getAttributeValue sessionh objecth (critical_attributes !segregate_usage) in
diff --git a/src/filter/filter/p11fix_patches/sticky_attributes_patch.ml b/src/filter/filter/p11fix_patches/sticky_attributes_patch.ml
index ca57437..3f97765 100644
--- a/src/filter/filter/p11fix_patches/sticky_attributes_patch.ml
+++ b/src/filter/filter/p11fix_patches/sticky_attributes_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/filter/p11fix_patches/wrapping_format_patch.ml b/src/filter/filter/p11fix_patches/wrapping_format_patch.ml
index 182c73e..e6b7990 100644
--- a/src/filter/filter/p11fix_patches/wrapping_format_patch.ml
+++ b/src/filter/filter/p11fix_patches/wrapping_format_patch.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/filter/frontend/Makefile.in b/src/filter/frontend/Makefile.in
index cd0b788..ffe9cde 100644
--- a/src/filter/frontend/Makefile.in
+++ b/src/filter/frontend/Makefile.in
@@ -1,6 +1,6 @@
 filter_dir = ../filter
 
 all:
-	ocamlopt -I $(filter_dir) -o frontend -c @srcdir@/frontend.ml
+	ocamlopt @ocaml_options@ -I $(filter_dir) -o frontend -c @srcdir@/frontend.ml
 clean:
 	@rm -f @srcdir@/*.cmi @srcdir@/*.cmx @srcdir@/*.o @srcdir@/*.cmo @srcdir@/*~ @srcdir@/*.opt
diff --git a/src/filter/frontend/frontend.ml b/src/filter/frontend/frontend.ml
index a8992da..3785053 100644
--- a/src/filter/frontend/frontend.ml
+++ b/src/filter/frontend/frontend.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/pkcs11proxyd/Makefile.in b/src/pkcs11proxyd/Makefile.in
index 140ddb0..1ddb505 100644
--- a/src/pkcs11proxyd/Makefile.in
+++ b/src/pkcs11proxyd/Makefile.in
@@ -11,8 +11,8 @@ sysconf=${DESTDIR}@sysconfdir@
 
 all:
 	#Compile Server
-	ocamlfind ocamlopt -pp "camlp4o pa_macro.cmo @caml_server_daemonize_define@ @caml_server_ssl_define@ @filter_define@" -package "netplex" @filter_include@ @caml_server_ssl_package@ -I $(bindings_dir) -I $(rpc-pkcs11_dir) -o server -c @srcdir@/server.ml
-	ocamlfind ocamlopt @filter_include@ -package "str,netplex,config-file" @caml_server_ssl_package@ -linkpkg $(bindings_dir)/pkcs11.cmxa @filter_files@ $(rpc-pkcs11_dir)/pkcs11_rpclib.cmxa server.cmx $(caml_link_dirs) $(mem_prot_opt_caml) -o $(server_name)
+	ocamlfind ocamlopt @ocaml_options@ -pp "camlp4o pa_macro.cmo @ocaml_bytes_module_define@ -I @srcdir@ @caml_server_daemonize_define@ @caml_server_ssl_define@ @filter_define@" -package "netplex" @filter_include@ @caml_server_ssl_package@ -I $(bindings_dir) -I $(rpc-pkcs11_dir) -o server -c @srcdir@/server.ml
+	ocamlfind ocamlopt @ocaml_options@ @filter_include@ -package "str,netplex,config-file" @caml_server_ssl_package@ -linkpkg $(bindings_dir)/pkcs11.cmxa @filter_files@ $(rpc-pkcs11_dir)/pkcs11_rpclib.cmxa server.cmx $(caml_link_dirs) $(mem_prot_opt_caml) -o $(server_name)
 
 install:
 	echo "Installing $(server_name) to ${prefix}/bin/$(server_name)"
@@ -22,11 +22,11 @@ install:
 	install -m 640 -D @srcdir@/filter.conf ${sysconf}/$(server_name)/filter.conf
 
 uninstall:
-	echo "Removing $(server_name) to ${prefix}/bin/$(server_name)"
+	echo "Removing $(server_name) from ${prefix}/bin/$(server_name)"
 	rm ${prefix}/bin/$(server_name)
-	echo "Removing $(server_name).conf to ${sysconf}/$(server_name)/$(server_name).conf"
-	rm ${sysconf}/etc/$(server_name)/$(server_name).conf
-	rm ${sysconf}/etc/$(server_name)/filter.conf
+	echo "Removing $(server_name).conf from ${sysconf}/$(server_name)/$(server_name).conf"
+	rm ${sysconf}/$(server_name)/$(server_name).conf
+	rm ${sysconf}/$(server_name)/filter.conf
 
 clean:
 	@rm -f @srcdir@/*.cmi @srcdir@/*.cmo @srcdir@/*.cma @srcdir@/*.cmx @srcdir@/*.o @srcdir@/*.a @srcdir@/*.cmxa @srcdir@/dll* @srcdir@/packlist-* @srcdir@/ocamldoc.dump @srcdir@/META @srcdir@/depend @srcdir@/$(server_name) @srcdir@/*.astamp @srcdir@/*.cstamp @srcdir@/*.s2stamp
diff --git a/src/pkcs11proxyd/pkcs11proxyd.conf b/src/pkcs11proxyd/pkcs11proxyd.conf
index 696fcb5..03dbf03 100644
--- a/src/pkcs11proxyd/pkcs11proxyd.conf
+++ b/src/pkcs11proxyd/pkcs11proxyd.conf
@@ -29,6 +29,12 @@ netplex {
       (* This section creates the socket *)
       name = "rpc_pkcs11";
 
+      (* OCamlnet 4 support the following to set Unix socket permissions:*)
+      (*
+      local_chmod = "0o777";
+      *)
+
+      (* This section creates the socket *)
       (* Socket can either be TCP or UNIX *)
       address {
         (* Default here is TCP localhost on port 4444 *)
@@ -36,7 +42,7 @@ netplex {
         bind = "127.0.0.1:4444";
 
         (* For Unix
-           WARNING: Since it is not (yet) possible to set the socket permission,
+           WARNING: For OCamlnet < 4 it is not possible to set the socket permission,
                     you will have to manually fix it to allow multi-user
                     access (e.g. chmod 777 <socket>, or umask prior launching).
         *)
@@ -59,8 +65,44 @@ netplex {
       (* filter_config is used to supply the filtering configuration when compiled in *)
       filter_config="/usr/local/etc/pkcs11proxyd/filter.conf";
 
-      (* SSL support is activated at compile-time, otherwise, the SSL parameters are ignored *)
+      (*************** TLS support begin ***********************)
+      (* use_ssl = false to disable SSL support on server side *)
+      (* use_ssl = true to enable SSL support on server side   *)
       use_ssl = false;
+
+      (* TLS support for Caml Crush compiled with OCamlnet 4.x *)
+      (* Uncomment to enable TLS when using OCamlnet 4.x *)
+      (*
+      tls {
+        (* Ciphersuites, GnuTLS syntax *)
+        (* TLS 1.2, PFS-only suites, no DSS, no CAMELLIA *)
+        algorithms = "SECURE256:+SECURE128:-VERS-TLS-ALL:+VERS-TLS1.2:-RSA:-DHE-DSS:-CAMELLIA-128-CBC:-CAMELLIA-256-CBC";
+
+        (* Force peer client authentication *)
+        peer_auth = "required";
+
+        (* Uncomment to enable DHE parameters, used for PFS *)
+        (*
+        dh_params {
+          (* Pre-computed DH parameters *)
+          pkcs3_file = "/etc/pkcs11proxyd/dhparams.pem";
+          (* Run-time created DH parameters, warning: this takes a long time *)
+          (*bits = 2048;*)
+        };
+        *)
+        x509 {
+         key {
+           crt_file = "server.pem";
+           key_file = "server.key";
+         };
+         trust {
+           crt_file = "cacert.pem";
+         };
+        }
+      };
+      *)
+
+      (* LEGACY SSL support for Caml Crush <= 1.0.6 or OCamlnet 3.x *)
       (* OpenSSL cipher syntax, one or many suites can be configured, or alias such as HIGH *)
       cipher_suite="DHE-RSA-AES128-SHA";
       (* Provide full certificate chain in cafile *)
@@ -74,6 +116,8 @@ netplex {
       (* Optional, allows to use a custom certificate verification depth *)
       verify_depth = 4;
 
+      (***************TLS support end  *************************)
+
     };
     workload_manager {
       type = "dynamic";
diff --git a/src/pkcs11proxyd/server.ml b/src/pkcs11proxyd/server.ml
index 5413bb8..1d2976b 100644
--- a/src/pkcs11proxyd/server.ml
+++ b/src/pkcs11proxyd/server.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -81,11 +81,15 @@ ELSE
 DEFINE CALLP11=Frontend
 ENDIF
 
+INCLUDE "server_ssl.ml"
+
 (* PKCS#11 functions debug variable *)
 let ref_pkcs_debug = ref 0
 let ref_daemonize_args = ref ""
+IFNDEF WITH_SSL THEN
 let libnames_config_ref = ref ""
 let filter_config_file_ref = ref ""
+ENDIF
 
 (* Debug helper *)
 (* This function prints the name of the calling function *)
@@ -772,430 +776,8 @@ let setup srv _ =
     ~proc_c_loadmodule: c_LoadModule
     srv
 
-(* WITH SSL *)
-IFDEF WITH_SSL THEN
-IFDEF WITHOUT_FILTER THEN
-let configure cf addr =
-  (* Handle filter passthrough for the specific C_LoadModule call *)
-  let filter_config_file =
-    try
-      Some (cf # string_param (cf # resolve_parameter addr "filter_config"))
-    with
-      | Not_found -> (None); in
-  if filter_config_file <> None
-  then
-  begin
-      let s = Printf.sprintf "CONFIGURATION: unused option 'filter_config' found in the server configuration file while the server has been compiled with filter passthrough!" in
-      Netplex_cenv.log `Info s;
-  end;
-  let libnames_config =
-    try
-      cf # string_param (cf # resolve_parameter addr "libnames")
-    with
-      | Not_found -> failwith "Required parameter libnames is missing! (server compiled with filter passthrough mode)!" in
-    libnames_config_ref := libnames_config;
-  let use_ssl =
-    try
-      cf # bool_param (cf # resolve_parameter addr "use_ssl")
-    with
-      | Not_found -> false in
-  match use_ssl with
-  | true ->
-      let cafile =
-        try
-          cf # string_param (cf # resolve_parameter addr "cafile")
-        with
-          | Not_found ->
-          failwith "Required parameter cafile is missing!" in
-      let certfile =
-        try
-          cf # string_param (cf # resolve_parameter addr "certfile")
-        with
-          | Not_found ->
-          failwith "Required parameter certfile is missing!" in
-      let certkey =
-        try
-          cf # string_param (cf # resolve_parameter addr "certkey")
-        with
-          | Not_found ->
-          failwith "Required parameter certkey is missing!" in
-      let cipher_suite =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "cipher_suite"))
-        with
-          | Not_found -> (None); in
-      (* PFS handling *)
-      let dh_params =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "dh_params"))
-        with
-          | Not_found -> (None); in
-      let ec_curve_name =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "ec_curve_name"))
-        with
-          | Not_found -> (None); in
-      if cipher_suite = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any cipher_suite list, it will use the OpenSSL HIGH suites!" in
-          Netplex_cenv.log `Info s;
-      end;
-      (* Certificate verification depth *)
-      let verify_depth =
-        try
-          Some (cf # int_param (cf # resolve_parameter addr "verify_depth"))
-        with
-          | Not_found -> (None); in
-
-      (* DHE PFS handling *)
-      if dh_params = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any dh_params list, PFS DHE suites disabled" in
-          Netplex_cenv.log `Info s;
-      end;
-      (* ECDHE PFS handling *)
-      if ec_curve_name = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any ec_curve_name list, PFS ECDHE suites disabled" in
-          Netplex_cenv.log `Info s;
-      end;
-      let allowed_clients_cert_path =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "allowed_clients_cert_path"))
-        with
-          | Not_found -> (None); in
-      if allowed_clients_cert_path = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any allowed_clients_cert_path, any client with a proper certificate will be accepted" in
-          Netplex_cenv.log `Info s;
-      end
-      else
-      begin
-        let path = (match allowed_clients_cert_path with Some x -> x | _ -> "") in
-        let check_dir = (try Sys.is_directory path with
-           _ -> false) in
-         if check_dir = false then
-           let s = Printf.sprintf "Error: forbidden client certificates folder %s does not exist!" path in
-           failwith s
-      end;
-        (use_ssl, cafile, certfile, certkey, cipher_suite, dh_params, ec_curve_name, verify_depth, allowed_clients_cert_path)
-  | false -> (use_ssl, "", "", "", None, None, None, None, None)
-ELSE
-let configure cf addr =
-  (* Handle configuration file for the filter *)
-  let libnames_config =
-    try
-      Some (cf # string_param (cf # resolve_parameter addr "libnames"))
-    with
-      | Not_found -> (None); in
-  if libnames_config <> None
-  then
-  begin
-      let s = Printf.sprintf "CONFIGURATION: unused option 'libnames' found in the server configuration file while the server has been compiled to use the filter module!" in
-      Netplex_cenv.log `Info s;
-  end;
-  let filter_config_file =
-    try
-      cf # string_param (cf # resolve_parameter addr "filter_config")
-    with
-      | Not_found -> failwith "Required parameter filter_config is missing! (this is a path to the filter configuration rules)" in
-    filter_config_file_ref := filter_config_file;
-  let use_ssl =
-    try
-      cf # bool_param (cf # resolve_parameter addr "use_ssl")
-    with
-      | Not_found -> false in
-  match use_ssl with
-  | true ->
-      let cafile =
-        try
-          cf # string_param (cf # resolve_parameter addr "cafile")
-        with
-          | Not_found ->
-          failwith "Required parameter cafile is missing!" in
-      let certfile =
-        try
-          cf # string_param (cf # resolve_parameter addr "certfile")
-        with
-          | Not_found ->
-          failwith "Required parameter certfile is missing!" in
-      let certkey =
-        try
-          cf # string_param (cf # resolve_parameter addr "certkey")
-        with
-          | Not_found ->
-          failwith "Required parameter certkey is missing!" in
-      let cipher_suite =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "cipher_suite"))
-        with
-          | Not_found -> (None); in
-      if cipher_suite = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any cipher_suite list, it will use the OpenSSL HIGH suites!" in
-          Netplex_cenv.log `Info s;
-      end;
-      (* PFS handling *)
-      let dh_params =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "dh_params"))
-        with
-          | Not_found -> (None); in
-      let ec_curve_name =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "ec_curve_name"))
-        with
-          | Not_found -> (None); in
-      if cipher_suite = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any cipher_suite list, it will use the OpenSSL HIGH suites!" in
-          Netplex_cenv.log `Info s;
-      end;
-
-      (* DHE PFS handling *)
-      if dh_params = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any dh_params list, PFS DHE suites disabled" in
-          Netplex_cenv.log `Info s;
-      end;
-      (* ECDHE PFS handling *)
-      if ec_curve_name = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any ec_curve_name list, PFS ECDHE suites disabled" in
-          Netplex_cenv.log `Info s;
-      end;
-      (* Certificate verification depth *)
-      let verify_depth =
-        try
-          Some (cf # int_param (cf # resolve_parameter addr "verify_depth"))
-        with
-          | Not_found -> (None); in
-
-      let allowed_clients_cert_path =
-        try
-          Some (cf # string_param (cf # resolve_parameter addr "allowed_clients_cert_path"))
-        with
-          | Not_found -> (None); in
-      if allowed_clients_cert_path = None
-      then
-      begin
-          let s = Printf.sprintf "CONFIGURATION: you did not set any allowed_clients_cert_path, any client with a proper certificate will be accepted" in
-          Netplex_cenv.log `Info s;
-      end
-      else
-      begin
-        let path = (match allowed_clients_cert_path with Some x -> x | _ -> "") in
-        let check_dir = (try Sys.is_directory path with
-           _ -> false) in
-         if check_dir = false then
-           let s = Printf.sprintf "Error: forbidden client certificates folder %s does not exist!" path in
-           failwith s
-      end;
-        (use_ssl, cafile, certfile, certkey, cipher_suite, dh_params, ec_curve_name, verify_depth, allowed_clients_cert_path)
-  | false -> (use_ssl, "", "", "", None, None, None, None, None)
-
-ENDIF
-(* FIXME: ocaml-ssl does not currently support setting up PFS and other DH ciphers, 
-          if DH, ECDH suites are asked, we have to inform the user about it's
-          non-availability and remove them from the list 
-   TODO: patches have been submitted to ocaml-ssl to support new cipher suites, so 
-         these might become mainstream soon. Until then, we keep using the unsupported suites 
-         list.
-*)
-let unsupported_suites = ref ["ECDHE-RSA-RC4-SHA"; "ECDHE-ECDSA-RC4-SHA"; "ECDH-RSA-RC4-SHA"; "ECDH-ECDSA-RC4-SHA"; "DH-DSS-AES256-GCM-SHA384"; "DH-RSA-AES256-GCM-SHA384"; "DH-RSA-AES256-SHA256"; "DH-DSS-AES256-SHA256"; "DH-RSA-AES256-SHA"; "DH-DSS-AES256-SHA"; "DH-RSA-CAMELLIA256-SHA"; "DH-DSS-CAMELLIA256-SHA"; "ECDH-RSA-AES256-GCM-SHA384"; "ECDH-ECDSA-AES256-GCM-SHA384"; "ECDH-RSA-AES256-SHA384"; "ECDH-ECDSA-AES256-SHA384"; "ECDH-RSA-AES256-SHA"; "ECDH-ECDSA-AES256-SHA"; "DH-DSS-AES128-GCM-SHA256"; "DH-RSA-AES128-GCM-SHA256"; "DH-RSA-AES128-SHA256"; "DH-DSS-AES128-SHA256"; "DH-RSA-AES128-SHA"; "DH-DSS-AES128-SHA"; "DH-RSA-CAMELLIA128-SHA"; "DH-DSS-CAMELLIA128-SHA"; "ECDH-RSA-AES128-GCM-SHA256"; "ECDH-ECDSA-AES128-GCM-SHA256"; "ECDH-RSA-AES128-SHA256"; "ECDH-ECDSA-AES128-SHA256"; "ECDH-RSA-AES128-SHA"; "ECDH-ECDSA-AES128-SHA"]
-
-
-(* We do not let OpenSSL fallback to ugly ciphers *)
-let exclude_bad_ciphers = ref "!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4"
-
-
-(* Check if an element is in a list *)
-let check_element_in_suites_list the_list element =
-  (* Find the element *)
-  let found = try Some (List.find (fun a -> compare a element = 0) the_list) with
-  (* If not found, return false *)
-  Not_found -> (None) in
-  if found = None
-  then
-    (false)
-  else
-  begin
-    (* Notify the user that the suite he specified is unsupported *)
-    let s = Printf.sprintf "CONFIGURATION: the '%s' SSL cipher suite is currently *not* supported by OCaml OpenSSL bindings => it is *removed* from the cipher suites that will be used!" element in
-    Netplex_cenv.log `Info s;
-    (true)
-  end
-
-(* Filter the unsupported suites *)
-let filter_PFS_ciphers ciphers =
-  (* Split the string with : *)
-  let the_list = Str.split (Str.regexp ":") ciphers in
-  (* For each suite, check if it is unsupported, and don't keep it if this is the case *)
-  let new_list = List.filter (fun a -> check_element_in_suites_list !unsupported_suites a = false) the_list in
-  let new_ciphers = String.concat ":" new_list in
-  (new_ciphers)
-
-(* Filter the empty ciphers suite or the one only containing *)
-(* negative expressions                                      *)
-let check_negative_only_ciphers ciphers = 
-  (* Split the string with : *)
-  let the_list = Str.split (Str.regexp ":") ciphers in
-  let check = List.fold_left (fun boolean element -> if compare (Str.string_match (Str.regexp "!") element 0) false = 0 then false else boolean) true the_list in
-  (check)
-
-let check_empty_negative_only_suites ciphers =
-  if compare ciphers "" = 0 then
-  begin
-    (* Empty ciphers suite case *)
-    let ciphers =  String.concat ":" ["HIGH"; ciphers] in
-    let s = Printf.sprintf "CONFIGURATION: the cipher_suite list is empty => we will use the OpenSSL HIGH suites!" in
-    Netplex_cenv.log `Info s;
-    (ciphers)
-  end
-  else
-  begin
-    (* Check for the presence of negative only expressions *)
-    let check_neg = check_negative_only_ciphers ciphers in
-    if compare check_neg true = 0 then
-    begin
-      let ciphers =  String.concat ":" ["HIGH"; ciphers] in
-      let s = Printf.sprintf "CONFIGURATION: the cipher_suite list only contains negative expressions => we will append the OpenSSL HIGH suites!" in
-       Netplex_cenv.log `Info s;
-      (ciphers)
-    end
-    else
-      (* If there was no problem, just return the input ciphers *)
-      (ciphers)
-  end
-
-(* This function checks in the allowed_clients_cert_path folder if a given client *)
-(* is allowed                                                                     *)
-let read_file f =
-  let ic = open_in f in
-  let n = in_channel_length ic in
-  let s = String.create n in
-  really_input ic s 0 n;
-  close_in ic;
-  (s)
-
-let check_is_client_certificate_allowed allowed_clients_cert_path client_cert =
-  match allowed_clients_cert_path with
-     None -> true
-   | Some path ->
-     (* Go through all the client certificates in the path *)
-     let check_dir = (try Sys.is_directory path with
-       _ -> false) in
-     if check_dir = true then
-       (* List all files in the directory *)
-       let cert_files = Sys.readdir path in
-       (* Get the client certificate string *)
-       let tmp_file = Filename.temp_file "pkcs11proxy_server" "client_cert" in
-       let _ = Ssl.write_certificate tmp_file client_cert in
-       (* Read the cert file as a string *)
-       let client_cert_string = read_file tmp_file in
-       let check = ref false in
-       Array.iter (
-         fun file_name ->
-           let to_compare = (try read_file (path ^ Filename.dir_sep ^ file_name) with
-             _ ->  ""
-           )  in
-           if compare to_compare "" = 0 then
-             check := !check || false
-           else
-             if compare to_compare client_cert_string = 0 then
-               check := !check || true
-             else
-               check := !check || false
-       ) cert_files;
-       (!check)
-     else
-       let s = Printf.sprintf "Error: forbidden client certificates folder %s does not exist!" path in
-       failwith s
-
-let my_socket_config use_ssl cafile certfile certkey cipher_suite dh_params ec_curve_name verify_depth allowed_clients_cert_path =
-  match use_ssl with
-  | true ->
-    flush stdout;
-    Ssl.init();
-    let ctx = Ssl.create_context Ssl.TLSv1_2 Ssl.Server_context in
-    Ssl.set_verify ctx [ Ssl.Verify_peer; Ssl.Verify_fail_if_no_peer_cert ] None;
-
-    (* Setup given cipher_suite *)
-    begin
-    match cipher_suite with
-        None -> (let new_cipher = String.concat ":" ["HIGH"; !exclude_bad_ciphers] in 
-                            try 
-                                Ssl.set_cipher_list ctx new_cipher
-                            with
-                                _ -> let s = Printf.sprintf "Unsupported cipher suite when configuring OpenSSL" in
-                                                    failwith s)
-       | Some ciphers -> ( let new_ciphers = filter_PFS_ciphers ciphers in
-                           let new_ciphers = check_empty_negative_only_suites new_ciphers in
-                           let new_cipher = String.concat ":" [new_ciphers; !exclude_bad_ciphers] in 
-                            try 
-                                Ssl.set_cipher_list ctx new_cipher
-                            with
-                                _ -> let s = Printf.sprintf "Unsupported cipher list %s" ciphers in
-                                                    failwith s)
-    end;
-
-    Ssl.set_client_CA_list_from_file ctx cafile;
-    begin
-    match verify_depth with
-     None -> Ssl.set_verify_depth ctx 4;
-    | Some params -> Ssl.set_verify_depth ctx params;
-    end;
-
-    Ssl.load_verify_locations ctx cafile "" ;
-    Ssl.use_certificate ctx certfile certkey;
-
-    begin
-    match dh_params with
-     None -> ()
-    | Some params -> try Ssl.init_dh_from_file ctx params
-                        with _ -> let s = Printf.sprintf "Could not set DH params from file %s" params in
-                        failwith s
-    end;
-
-    begin
-    match ec_curve_name with
-     None -> ()
-    | Some params -> try Ssl.init_ec_from_named_curve ctx params
-                        with _ -> let s = Printf.sprintf "Could not set EC curve name %s" params in
-                        failwith s
-    end;
-
-    Rpc_ssl.ssl_server_socket_config
-      ~get_peer_user_name:(fun _ sslsock ->
-                   prerr_endline "get_peer_user_name";
-                   let cert = Ssl.get_certificate sslsock in
-                   let user = Ssl.get_subject cert in
-                   (* Check peer client certificate *)
-                   let is_client_allowed = check_is_client_certificate_allowed allowed_clients_cert_path cert in
-                   if is_client_allowed = false then
-                     let s = Printf.sprintf "Unsupported client certificate for user=%s" user in
-                     (* Close the socket and quit *)
-                     let _ = Ssl.shutdown sslsock in
-                     failwith s
-                   else
-                     prerr_endline ("user=" ^ user);
-                     Some user)
-        ctx
-    | false -> Rpc_server.default_socket_config
-
-let socket_config (use_ssl, cafile, certfile, certkey, cipher_suite, dh_params, ec_curve_name, verify_depth, allowed_clients_cert_path) =
-  my_socket_config use_ssl cafile certfile certkey cipher_suite dh_params ec_curve_name verify_depth allowed_clients_cert_path
-
-ELSE
 (* WITHOUT SSL *)
+IFNDEF WITH_SSL THEN
 
 let socket_config _ = Rpc_server.default_socket_config
 
diff --git a/src/pkcs11proxyd/server_ssl.ml b/src/pkcs11proxyd/server_ssl.ml
new file mode 100644
index 0000000..ed930a7
--- /dev/null
+++ b/src/pkcs11proxyd/server_ssl.ml
@@ -0,0 +1,514 @@
+(************************* MIT License HEADER **********************************
+    Copyright ANSSI (2013)
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com] and
+    Thomas CALDERON [calderon.thomas@gmail.com]
+    Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
+
+    This software is a computer program whose purpose is to implement
+    a PKCS#11 proxy as well as a PKCS#11 filter with security features
+    in mind. The project source tree is subdivided in six parts.
+    There are five main parts:
+      1] OCaml/C PKCS#11 bindings (using OCaml IDL).
+      2] XDR RPC generators (to be used with ocamlrpcgen and/or rpcgen).
+      3] A PKCS#11 RPC server (daemon) in OCaml using a Netplex RPC basis.
+      4] A PKCS#11 filtering module used as a backend to the RPC server.
+      5] A PKCS#11 client module that comes as a dynamic library offering
+         the PKCS#11 API to the software.
+    There is one "optional" part:
+      6] Tests in C and OCaml to be used with client module 5] or with the
+         bindings 1]
+
+    Here is a big picture of how the PKCS#11 proxy works:
+
+ ----------------------   --------  socket (TCP or Unix)  --------------------
+| 3] PKCS#11 RPC server|-|2] RPC  |<+++++++++++++++++++> | 5] Client library  |
+ ----------------------  |  Layer | [SSL/TLS optional]   |  --------          |
+           |              --------                       | |2] RPC  | PKCS#11 |
+ ----------------------                                  | |  Layer |functions|
+| 4] PKCS#11 filter    |                                 |  --------          |
+ ----------------------                                   --------------------
+           |                                                        |
+ ----------------------                                             |
+| 1] PKCS#11 OCaml     |                                  { PKCS#11 INTERFACE }
+|       bindings       |                                            |
+ ----------------------                                       APPLICATION
+           |
+           |
+ { PKCS#11 INTERFACE }
+           |
+ REAL PKCS#11 MIDDLEWARE
+    (shared library)
+
+    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:
+
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+
+    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.
+
+    Except as contained in this notice, the name(s) of the above copyright holders
+    shall not be used in advertising or otherwise to promote the sale, use or other
+    dealings in this Software without prior written authorization.
+
+    The current source code is part of the PKCS#11 daemon 3] source tree:
+ ---------------------- 
+| 3] PKCS#11 RPC server|
+ ---------------------- 
+
+    Project: PKCS#11 Filtering Proxy
+    File:    src/pkcs11proxyd/server_ssl.ml
+
+************************** MIT License HEADER *********************************)
+(* Use aliases if this is an old version (< 4.02) of OCaml without a Bytes module *)
+IFDEF OCAML_NO_BYTES_MODULE THEN
+module Bytes = String
+ENDIF
+
+IFDEF WITH_SSL THEN
+(* Reference those two variables here to avoid circulare dependencies *)
+let libnames_config_ref = ref ""
+let filter_config_file_ref = ref ""
+IFNDEF WITH_SSL_LEGACY THEN
+Nettls_gnutls.init();
+ENDIF
+ENDIF
+
+(* Basic helpers *)
+IFDEF OCAML_NO_BYTES_MODULE THEN
+let read_file f =
+  let ic = open_in f in
+  let n = in_channel_length ic in
+  let s = Bytes.create n in
+  really_input ic s 0 n;
+  close_in ic;
+  (s)
+ENDIF
+IFNDEF OCAML_NO_BYTES_MODULE THEN
+let read_file f =
+  let ic = open_in f in
+  let n = in_channel_length ic in
+  let s = really_input_string ic n in
+  close_in ic;
+  (s)
+ENDIF
+
+let write_file f s =
+  let oc = open_out f in
+  Printf.fprintf oc "%s" s;
+  close_out oc;
+  ()
+
+(**** For OCamlnet >= 4, we do two things:                                   *)
+(*     - (Dirty) Workaround for an issue with default peer_auth verification *)
+(*     - Implement a proper certificate white list verification              *)
+(* Ocamlnet is 4.x *)
+
+IFDEF WITH_SSL_LEGACY THEN
+let write_certificate tmp_file client_cert = Ssl.write_certificate tmp_file client_cert
+ELSE
+let write_certificate tmp_file client_cert = write_file tmp_file client_cert
+ENDIF
+
+let check_is_client_certificate_allowed allowed_clients_cert_path client_cert =
+  match allowed_clients_cert_path with
+     None -> true
+   | Some path ->
+     (* Go through all the client certificates in the path *)
+     let check_dir = (try Sys.is_directory path with
+       _ -> false) in
+     if check_dir = true then
+       (* List all files in the directory *)
+       let cert_files = Sys.readdir path in
+       (* Get the client certificate string *)
+       let tmp_file = Filename.temp_file "pkcs11proxy_server" "client_cert" in
+       let _ = write_certificate tmp_file client_cert in
+       (* Read the cert file as a string *)
+       let client_cert_string = read_file tmp_file in
+       let check = ref false in
+       Array.iter (
+         fun file_name ->
+           let to_compare = (try read_file (path ^ Filename.dir_sep ^ file_name) with
+             _ ->  ""
+           )  in
+           if compare to_compare "" = 0 then
+             check := !check || false
+           else
+             if compare to_compare client_cert_string = 0 then
+               check := !check || true
+             else
+               check := !check || false
+       ) cert_files;
+       (!check)
+     else
+       let s = Printf.sprintf "Error: forbidden client certificates folder %s does not exist!" path in
+       Netplex_cenv.log `Err s;
+       (false)
+
+IFDEF WITH_SSL THEN
+IFNDEF WITH_SSL_LEGACY THEN
+(* Stolen from OCamlnet Nettls *)
+let create_pem header_tag data =
+  let b64 = Netencoding.Base64.encode ~linelength:64 data in
+  "-----BEGIN " ^ header_tag ^ "-----\n" ^ 
+    b64 ^
+      "-----END " ^ header_tag ^ "-----\n"
+
+let allowed_clients_cert_path_ref = ref None
+let my_cert_check cert =
+  (* Extract the DER string *)
+  match cert with
+  | `X509(der_cert) -> 
+    (* We have two cases here: either we have a white list of client certificates, or not *)
+    let x509_cert = new Netx509.x509_certificate_from_DER der_cert in
+    let user = x509_cert # subject # string in
+    (* DER to PEM *)
+    let pem_cert = create_pem "CERTIFICATE" der_cert in
+    let is_client_allowed = check_is_client_certificate_allowed !allowed_clients_cert_path_ref pem_cert in
+    if is_client_allowed = false then
+      let s = Printf.sprintf "Unsupported client certificate for user=%s" user in
+      Netplex_cenv.log `Err s;
+      (false)
+    else
+      let s = Printf.sprintf "user=%s is authenticated and connected" user in
+      Netplex_cenv.log `Info s;
+      (true)
+  | _ -> (false)
+
+
+let verify endpoint p_trust p_hostmatch =
+  let module Endpoint = (val endpoint : Netsys_crypto_types.TLS_ENDPOINT) in
+  let cert = Endpoint.TLS.get_peer_creds Endpoint.endpoint in
+  (* We do not check for the host name since we deal with a client! (this is a dirty 'hack' of the way *)
+  (* OCamlnet TLS module deals with name verification in the client case ...                           *)
+  (* FIXME: add the '&& p_hostmatch' boolean in the return value when fixed in OCamlnet                *)
+  (p_trust && (my_cert_check cert))
+ENDIF
+ENDIF
+
+IFDEF WITH_SSL THEN
+let fetch_ssl_params use_ssl cf addr =
+IFNDEF WITH_SSL_LEGACY THEN
+  (* First, we extract our client certificate white list if there is one *)
+  let _ = (allowed_clients_cert_path_ref :=
+    try
+      Some (cf # string_param (cf # resolve_parameter addr "allowed_clients_cert_path"))
+    with
+      | Not_found -> (None);) in
+  let _ = (if !allowed_clients_cert_path_ref = None
+  then
+  begin
+      let s = Printf.sprintf "CONFIGURATION: you did not set any allowed_clients_cert_path, any client with a proper certificate will be accepted" in
+      Netplex_cenv.log `Info s;
+  end) in
+  (* Note: we override the ~verify parameter here to properly implement a peer_auth "required" and *)
+  (* also implement our certificate white list verification *)
+  let tls_config = Netplex_config.read_tls_config ~verify cf addr (Netsys_crypto.current_tls_opt()) in
+    (use_ssl, tls_config)
+ELSE
+  match use_ssl with
+  | true ->
+      let cafile =
+        try
+          cf # string_param (cf # resolve_parameter addr "cafile")
+        with
+          | Not_found ->
+          failwith "Required parameter cafile is missing!" in
+      let certfile =
+        try
+          cf # string_param (cf # resolve_parameter addr "certfile")
+        with
+          | Not_found ->
+          failwith "Required parameter certfile is missing!" in
+      let certkey =
+        try
+          cf # string_param (cf # resolve_parameter addr "certkey")
+        with
+          | Not_found ->
+          failwith "Required parameter certkey is missing!" in
+      let cipher_suite =
+        try
+          Some (cf # string_param (cf # resolve_parameter addr "cipher_suite"))
+        with
+          | Not_found -> (None); in
+      (* PFS handling *)
+      let dh_params =
+        try
+          Some (cf # string_param (cf # resolve_parameter addr "dh_params"))
+        with
+          | Not_found -> (None); in
+      let ec_curve_name =
+        try
+          Some (cf # string_param (cf # resolve_parameter addr "ec_curve_name"))
+        with
+          | Not_found -> (None); in
+      if cipher_suite = None
+      then
+      begin
+          let s = Printf.sprintf "CONFIGURATION: you did not set any cipher_suite list, it will use the OpenSSL HIGH suites!" in
+          Netplex_cenv.log `Info s;
+      end;
+      (* Certificate verification depth *)
+      let verify_depth =
+        try
+          Some (cf # int_param (cf # resolve_parameter addr "verify_depth"))
+        with
+          | Not_found -> (None); in
+
+      (* DHE PFS handling *)
+      if dh_params = None
+      then
+      begin
+          let s = Printf.sprintf "CONFIGURATION: you did not set any dh_params list, PFS DHE suites disabled" in
+          Netplex_cenv.log `Info s;
+      end;
+      (* ECDHE PFS handling *)
+      if ec_curve_name = None
+      then
+      begin
+          let s = Printf.sprintf "CONFIGURATION: you did not set any ec_curve_name list, PFS ECDHE suites disabled" in
+          Netplex_cenv.log `Info s;
+      end;
+      let allowed_clients_cert_path =
+        try
+          Some (cf # string_param (cf # resolve_parameter addr "allowed_clients_cert_path"))
+        with
+          | Not_found -> (None); in
+      if allowed_clients_cert_path = None
+      then
+      begin
+          let s = Printf.sprintf "CONFIGURATION: you did not set any allowed_clients_cert_path, any client with a proper certificate will be accepted" in
+          Netplex_cenv.log `Info s;
+      end
+      else
+      begin
+        let path = (match allowed_clients_cert_path with Some x -> x | _ -> "") in
+        let check_dir = (try Sys.is_directory path with
+           _ -> false) in
+         if check_dir = false then
+           let s = Printf.sprintf "Error: forbidden client certificates folder %s does not exist!" path in
+           failwith s
+      end;
+        (use_ssl, cafile, certfile, certkey, cipher_suite, dh_params, ec_curve_name, verify_depth, allowed_clients_cert_path)
+  | false -> (use_ssl, "", "", "", None, None, None, None, None)
+ENDIF
+ENDIF
+
+(* WITH SSL *)
+IFDEF WITH_SSL THEN
+let configure cf addr =
+  (* Handle filter passthrough for the specific C_LoadModule call *)
+  let filter_config_file =
+    try
+      Some (cf # string_param (cf # resolve_parameter addr "filter_config"))
+    with
+      | Not_found -> (None); in
+  let libnames_config =
+    try
+      Some (cf # string_param (cf # resolve_parameter addr "libnames"))
+    with
+      | Not_found -> (None); in
+  let use_ssl =
+    try
+      cf # bool_param (cf # resolve_parameter addr "use_ssl")
+    with
+      | Not_found -> false in
+IFDEF WITHOUT_FILTER THEN
+  if filter_config_file <> None
+  then
+  begin
+      let s = Printf.sprintf "CONFIGURATION: unused option 'filter_config' found in the server configuration file while the server has been compiled with filter passthrough!" in
+      Netplex_cenv.log `Info s;
+  end;
+  if libnames_config = None
+  then
+  begin
+      failwith "Required parameter libnames is missing! (server compiled with filter passthrough mode)!";
+  end;
+  libnames_config_ref := (match libnames_config with None -> "" | Some x -> x);
+  (fetch_ssl_params use_ssl cf addr)
+ELSE
+  if libnames_config <> None
+  then
+  begin
+      let s = Printf.sprintf "CONFIGURATION: unused option 'libnames' found in the server configuration file while the server has been compiled to use the filter module!" in
+      Netplex_cenv.log `Info s;
+  end;
+  if filter_config_file = None
+  then
+  begin
+      failwith "Required parameter filter_config is missing! (this is a path to the filter configuration rules)";
+  end;
+  filter_config_file_ref := (match filter_config_file with
+                                          Some value -> (value)
+                                          | None -> "");
+  (fetch_ssl_params use_ssl cf addr)
+
+ENDIF
+ENDIF
+
+IFDEF WITH_SSL_LEGACY THEN
+(* Note: since we check for Ocaml-ssl > 0.4.7, we should *)
+(* not have issues with unsupported ciphers anymore      *)
+let unsupported_suites = ref [""]
+
+
+(* We do not let OpenSSL fallback to ugly ciphers *)
+let exclude_bad_ciphers = ref "!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4"
+
+
+(* Check if an element is in a list *)
+let check_element_in_suites_list the_list element =
+  (* Find the element *)
+  let found = try Some (List.find (fun a -> compare a element = 0) the_list) with
+  (* If not found, return false *)
+  Not_found -> (None) in
+  if found = None
+  then
+    (false)
+  else
+  begin
+    (* Notify the user that the suite he specified is unsupported *)
+    let s = Printf.sprintf "CONFIGURATION: the '%s' SSL cipher suite is currently *not* supported by OCaml OpenSSL bindings => it is *removed* from the cipher suites that will be used!" element in
+    Netplex_cenv.log `Info s;
+    (true)
+  end
+
+(* Filter the unsupported suites *)
+let filter_PFS_ciphers ciphers =
+  (* Split the string with : *)
+  let the_list = Str.split (Str.regexp ":") ciphers in
+  (* For each suite, check if it is unsupported, and don't keep it if this is the case *)
+  let new_list = List.filter (fun a -> check_element_in_suites_list !unsupported_suites a = false) the_list in
+  let new_ciphers = String.concat ":" new_list in
+  (new_ciphers)
+
+(* Filter the empty ciphers suite or the one only containing *)
+(* negative expressions                                      *)
+let check_negative_only_ciphers ciphers = 
+  (* Split the string with : *)
+  let the_list = Str.split (Str.regexp ":") ciphers in
+  let check = List.fold_left (fun boolean element -> if compare (Str.string_match (Str.regexp "!") element 0) false = 0 then false else boolean) true the_list in
+  (check)
+
+let check_empty_negative_only_suites ciphers =
+  if compare ciphers "" = 0 then
+  begin
+    (* Empty ciphers suite case *)
+    let ciphers =  String.concat ":" ["HIGH"; ciphers] in
+    let s = Printf.sprintf "CONFIGURATION: the cipher_suite list is empty => we will use the OpenSSL HIGH suites!" in
+    Netplex_cenv.log `Info s;
+    (ciphers)
+  end
+  else
+  begin
+    (* Check for the presence of negative only expressions *)
+    let check_neg = check_negative_only_ciphers ciphers in
+    if compare check_neg true = 0 then
+    begin
+      let ciphers =  String.concat ":" ["HIGH"; ciphers] in
+      let s = Printf.sprintf "CONFIGURATION: the cipher_suite list only contains negative expressions => we will append the OpenSSL HIGH suites!" in
+       Netplex_cenv.log `Info s;
+      (ciphers)
+    end
+    else
+      (* If there was no problem, just return the input ciphers *)
+      (ciphers)
+  end
+
+let my_socket_config use_ssl cafile certfile certkey cipher_suite dh_params ec_curve_name verify_depth allowed_clients_cert_path =
+  match use_ssl with
+  | true ->
+    flush stdout;
+    Ssl.init();
+    let ctx = Ssl.create_context Ssl.TLSv1_2 Ssl.Server_context in
+    Ssl.set_verify ctx [ Ssl.Verify_peer; Ssl.Verify_fail_if_no_peer_cert ] None;
+
+    (* Setup given cipher_suite *)
+    begin
+    match cipher_suite with
+        None -> (let new_cipher = String.concat ":" ["HIGH"; !exclude_bad_ciphers] in 
+                            try 
+                                Ssl.set_cipher_list ctx new_cipher
+                            with
+                                _ -> let s = Printf.sprintf "Unsupported cipher suite when configuring OpenSSL" in
+                                                    failwith s)
+       | Some ciphers -> ( let new_ciphers = filter_PFS_ciphers ciphers in
+                           let new_ciphers = check_empty_negative_only_suites new_ciphers in
+                           let new_cipher = String.concat ":" [new_ciphers; !exclude_bad_ciphers] in 
+                            try 
+                                Ssl.set_cipher_list ctx new_cipher
+                            with
+                                _ -> let s = Printf.sprintf "Unsupported cipher list %s" ciphers in
+                                                    failwith s)
+    end;
+
+    Ssl.set_client_CA_list_from_file ctx cafile;
+    begin
+    match verify_depth with
+     None -> Ssl.set_verify_depth ctx 4;
+    | Some params -> Ssl.set_verify_depth ctx params;
+    end;
+
+    Ssl.load_verify_locations ctx cafile "" ;
+    Ssl.use_certificate ctx certfile certkey;
+
+    begin
+    match dh_params with
+     None -> ()
+    | Some params -> try Ssl.init_dh_from_file ctx params
+                        with _ -> let s = Printf.sprintf "Could not set DH params from file %s" params in
+                        failwith s
+    end;
+
+    begin
+    match ec_curve_name with
+     None -> ()
+    | Some params -> try Ssl.init_ec_from_named_curve ctx params
+                        with _ -> let s = Printf.sprintf "Could not set EC curve name %s" params in
+                        failwith s
+    end;
+
+    Rpc_ssl.ssl_server_socket_config
+      ~get_peer_user_name:(fun _ sslsock ->
+                   let cert = Ssl.get_certificate sslsock in
+                   let user = Ssl.get_subject cert in
+                   (* Check peer client certificate *)
+                   let is_client_allowed = check_is_client_certificate_allowed allowed_clients_cert_path cert in
+                   if is_client_allowed = false then
+                     let s = Printf.sprintf "Unsupported client certificate for user=%s" user in
+                     (* Close the socket and quit *)
+                     let _ = Ssl.shutdown sslsock in
+                     failwith s
+                   else
+                     let s = Printf.sprintf "user=%s is authenticated and connected" user in
+                     Netplex_cenv.log `Info s;
+                     Some user)
+        ctx
+    | false -> Rpc_server.default_socket_config
+
+ENDIF
+
+IFDEF WITH_SSL THEN
+IFDEF WITH_SSL_LEGACY THEN
+let socket_config (use_ssl, cafile, certfile, certkey, cipher_suite, dh_params, ec_curve_name, verify_depth, allowed_clients_cert_path) =
+  my_socket_config use_ssl cafile certfile certkey cipher_suite dh_params ec_curve_name verify_depth allowed_clients_cert_path
+ELSE
+let socket_config (use_ssl, tls_config) =
+  match use_ssl with
+  | false -> Rpc_server.default_socket_config
+  | true -> (match tls_config with
+     None -> failwith "Failed to read tls configuration"
+    |Some config -> Rpc_server.tls_socket_config config)
+ENDIF
+ENDIF
diff --git a/src/rpc-pkcs11/Makefile.in b/src/rpc-pkcs11/Makefile.in
index c975b61..02117fc 100644
--- a/src/rpc-pkcs11/Makefile.in
+++ b/src/rpc-pkcs11/Makefile.in
@@ -7,16 +7,16 @@ mem_prot_opt_caml=-ccopt -fPIC -ccopt -fPIE -ccopt -Wl,-z,relro,-z,now -ccopt -f
 
 all:	@caml_rpc_gen@
 	#Compile RPC files
-	ocamlfind ocamlopt -package "rpc" -o pkcs11_rpc_aux -c @srcdir@/pkcs11_rpc_aux.mli
-	ocamlfind ocamlopt -package "rpc" -o pkcs11_rpc_aux -c @srcdir@/pkcs11_rpc_aux.ml
-	ocamlfind ocamlopt -package "rpc" -o pkcs11_rpc_clnt -c @srcdir@/pkcs11_rpc_clnt.mli
-	ocamlfind ocamlopt -package "rpc" -o pkcs11_rpc_clnt -c @srcdir@/pkcs11_rpc_clnt.ml
-	ocamlfind ocamlopt -package "rpc" -o pkcs11_rpc_srv -c @srcdir@/pkcs11_rpc_srv.mli
-	ocamlfind ocamlopt -package "rpc" -o pkcs11_rpc_srv -c @srcdir@/pkcs11_rpc_srv.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "rpc" -o pkcs11_rpc_aux -c @srcdir@/pkcs11_rpc_aux.mli
+	ocamlfind ocamlopt @ocaml_options@ -package "rpc" -o pkcs11_rpc_aux -c @srcdir@/pkcs11_rpc_aux.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "rpc" -o pkcs11_rpc_clnt -c @srcdir@/pkcs11_rpc_clnt.mli
+	ocamlfind ocamlopt @ocaml_options@ -package "rpc" -o pkcs11_rpc_clnt -c @srcdir@/pkcs11_rpc_clnt.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "rpc" -o pkcs11_rpc_srv -c @srcdir@/pkcs11_rpc_srv.mli
+	ocamlfind ocamlopt @ocaml_options@ -package "rpc" -o pkcs11_rpc_srv -c @srcdir@/pkcs11_rpc_srv.ml
 	#Build RPC helpers
-	ocamlopt -I $(bindings_dir) -o rpc_helpers -c @srcdir@/rpc_helpers.ml
+	ocamlopt @ocaml_options@ -I $(bindings_dir) -o rpc_helpers -c @srcdir@/rpc_helpers.ml
 	#Build a library from RPC files
-	ocamlopt -o pkcs11_rpclib.cmxa -a pkcs11_rpc_aux.cmx pkcs11_rpc_clnt.cmx pkcs11_rpc_srv.cmx rpc_helpers.cmx
+	ocamlopt @ocaml_options@ -o pkcs11_rpclib.cmxa -a pkcs11_rpc_aux.cmx pkcs11_rpc_clnt.cmx pkcs11_rpc_srv.cmx rpc_helpers.cmx
 
 rpc:
 	#Ocaml RPC Generation
diff --git a/src/rpc-pkcs11/pkcs11_rpc.x b/src/rpc-pkcs11/pkcs11_rpc.x
index e6a623c..e559be4 100644
--- a/src/rpc-pkcs11/pkcs11_rpc.x
+++ b/src/rpc-pkcs11/pkcs11_rpc.x
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/rpc-pkcs11/rpc_helpers.ml b/src/rpc-pkcs11/rpc_helpers.ml
index f409f45..674e753 100644
--- a/src/rpc-pkcs11/rpc_helpers.ml
+++ b/src/rpc-pkcs11/rpc_helpers.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/rpc-pkcs11/test_pkcs11.ml b/src/rpc-pkcs11/test_pkcs11.ml
index de46daa..7dcf7d5 100644
--- a/src/rpc-pkcs11/test_pkcs11.ml
+++ b/src/rpc-pkcs11/test_pkcs11.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/c-based/main-shared.c b/src/tests/c-based/main-shared.c
index 35c3b28..11c7111 100644
--- a/src/tests/c-based/main-shared.c
+++ b/src/tests/c-based/main-shared.c
@@ -1,7 +1,7 @@
 /*------------------------ MIT License HEADER ------------------------------------
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/integration/Dockerfile.debian-integration b/src/tests/integration/Dockerfile.debian-integration
new file mode 100644
index 0000000..77d27e6
--- /dev/null
+++ b/src/tests/integration/Dockerfile.debian-integration
@@ -0,0 +1,35 @@
+# Override with --build-arg dist=ubuntu --build-arg flavor=bionic
+ARG dist=debian
+ARG flavor=sid
+
+FROM ${dist}:${flavor} as builder
+
+
+RUN apt-get update && apt-get install -y --no-install-recommends autoconf make gcc \
+                     automake autotools-dev \
+                     ocaml-nox camlidl coccinelle \
+                     libocamlnet-ocaml-dev libocamlnet-ocaml-bin \
+                     libocamlnet-ssl-ocaml libocamlnet-ssl-ocaml-dev \
+                     libssl-dev gnutls-dev \
+                     libconfig-file-ocaml-dev camlp4 \
+                     opensc libtool pkg-config unzip g++ wget
+
+WORKDIR /softhsm
+RUN wget --no-check-certificate https://github.com/opendnssec/SoftHSMv2/archive/refs/tags/2.6.1.zip && unzip 2.6.1.zip
+
+WORKDIR /softhsm/SoftHSMv2-2.6.1
+RUN ./autogen.sh && ./configure && make && make install
+
+FROM builder
+COPY . /build
+
+WORKDIR /build
+
+RUN ./autogen.sh
+RUN ./configure --with-idlgen --with-rpcgen --with-libnames=foo
+RUN make
+RUN make install
+
+RUN softhsm2-util --init-token --slot 0 --label caml-crush-int-tests --pin 1234 --so-pin 123456
+
+ENTRYPOINT [ "/build/src/tests/integration/run-tests.sh" ]
\ No newline at end of file
diff --git a/src/tests/integration/Dockerfile.debian-integration-tls b/src/tests/integration/Dockerfile.debian-integration-tls
new file mode 100644
index 0000000..e597c5e
--- /dev/null
+++ b/src/tests/integration/Dockerfile.debian-integration-tls
@@ -0,0 +1,35 @@
+# Override with --build-arg dist=ubuntu --build-arg flavor=bionic
+ARG dist=debian
+ARG flavor=sid
+
+FROM ${dist}:${flavor} as builder
+
+
+RUN apt-get update && apt-get install -y --no-install-recommends autoconf make gcc \
+                     automake autotools-dev \
+                     ocaml-nox camlidl coccinelle \
+                     libocamlnet-ocaml-dev libocamlnet-ocaml-bin \
+                     libocamlnet-ssl-ocaml libocamlnet-ssl-ocaml-dev \
+                     libssl-dev gnutls-dev \
+                     libconfig-file-ocaml-dev camlp4 \
+                     opensc libtool pkg-config unzip g++ wget
+
+WORKDIR /softhsm
+RUN wget --no-check-certificate https://github.com/opendnssec/SoftHSMv2/archive/refs/tags/2.6.1.zip && unzip 2.6.1.zip
+
+WORKDIR /softhsm/SoftHSMv2-2.6.1
+RUN ./autogen.sh && ./configure && make && make install
+
+FROM builder
+COPY . /build
+
+WORKDIR /build
+
+RUN ./autogen.sh
+RUN ./configure --with-idlgen --with-rpcgen --with-ssl --with-ssl-clientfiles='env' --with-libnames=foo
+RUN make
+RUN make install
+
+RUN softhsm2-util --init-token --slot 0 --label caml-crush-int-tests --pin 1234 --so-pin 123456
+
+ENTRYPOINT [ "/build/src/tests/integration/run-tests.sh" ]
\ No newline at end of file
diff --git a/src/tests/integration/Dockerfile.debian-integration-unix b/src/tests/integration/Dockerfile.debian-integration-unix
new file mode 100644
index 0000000..76bb9bc
--- /dev/null
+++ b/src/tests/integration/Dockerfile.debian-integration-unix
@@ -0,0 +1,35 @@
+# Override with --build-arg dist=ubuntu --build-arg flavor=bionic
+ARG dist=debian
+ARG flavor=sid
+
+FROM ${dist}:${flavor} as builder
+
+
+RUN apt-get update && apt-get install -y --no-install-recommends autoconf make gcc \
+                     automake autotools-dev \
+                     ocaml-nox camlidl coccinelle \
+                     libocamlnet-ocaml-dev libocamlnet-ocaml-bin \
+                     libocamlnet-ssl-ocaml libocamlnet-ssl-ocaml-dev \
+                     libssl-dev gnutls-dev \
+                     libconfig-file-ocaml-dev camlp4 \
+                     opensc libtool pkg-config unzip g++ wget
+
+WORKDIR /softhsm
+RUN wget --no-check-certificate https://github.com/opendnssec/SoftHSMv2/archive/refs/tags/2.6.1.zip && unzip 2.6.1.zip
+
+WORKDIR /softhsm/SoftHSMv2-2.6.1
+RUN ./autogen.sh && ./configure && make && make install
+
+FROM builder
+COPY . /build
+
+WORKDIR /build
+
+RUN ./autogen.sh
+RUN ./configure --with-idlgen --with-rpcgen --with-libnames=foo --with-client-socket=unix,/var/run/pkcs11proxyd.socket
+RUN make
+RUN make install
+
+RUN softhsm2-util --init-token --slot 0 --label caml-crush-int-tests --pin 1234 --so-pin 123456
+
+ENTRYPOINT [ "/build/src/tests/integration/run-tests.sh" ]
\ No newline at end of file
diff --git a/src/tests/integration/Dockerfile.debian-integration-unix-tls b/src/tests/integration/Dockerfile.debian-integration-unix-tls
new file mode 100644
index 0000000..943a4cc
--- /dev/null
+++ b/src/tests/integration/Dockerfile.debian-integration-unix-tls
@@ -0,0 +1,35 @@
+# Override with --build-arg dist=ubuntu --build-arg flavor=bionic
+ARG dist=debian
+ARG flavor=sid
+
+FROM ${dist}:${flavor} as builder
+
+
+RUN apt-get update && apt-get install -y --no-install-recommends autoconf make gcc \
+                     automake autotools-dev \
+                     ocaml-nox camlidl coccinelle \
+                     libocamlnet-ocaml-dev libocamlnet-ocaml-bin \
+                     libocamlnet-ssl-ocaml libocamlnet-ssl-ocaml-dev \
+                     libssl-dev gnutls-dev \
+                     libconfig-file-ocaml-dev camlp4 \
+                     opensc libtool pkg-config unzip g++ wget
+
+WORKDIR /softhsm
+RUN wget --no-check-certificate https://github.com/opendnssec/SoftHSMv2/archive/refs/tags/2.6.1.zip && unzip 2.6.1.zip
+
+WORKDIR /softhsm/SoftHSMv2-2.6.1
+RUN ./autogen.sh && ./configure && make && make install
+
+FROM builder
+COPY . /build
+
+WORKDIR /build
+
+RUN ./autogen.sh
+RUN ./configure --with-idlgen --with-rpcgen --with-ssl --with-ssl-clientfiles='env' --with-libnames=foo --with-client-socket=unix,/var/run/pkcs11proxyd.socket
+RUN make
+RUN make install
+
+RUN softhsm2-util --init-token --slot 0 --label caml-crush-int-tests --pin 1234 --so-pin 123456
+
+ENTRYPOINT [ "/build/src/tests/integration/run-tests.sh" ]
\ No newline at end of file
diff --git a/src/tests/integration/certs/ca-config.json b/src/tests/integration/certs/ca-config.json
new file mode 100644
index 0000000..344440e
--- /dev/null
+++ b/src/tests/integration/certs/ca-config.json
@@ -0,0 +1,26 @@
+{
+    "signing": {
+        "default": {
+            "expiry": "168h"
+        },
+        "profiles": {
+            "server": {
+                "expiry": "8760h",
+                "usages": [
+                    "signing",
+                    "key encipherment",
+                    "server auth"
+                ]
+            },
+            "client": {
+                "expiry": "8760h",
+                "usages": [
+                    "signing",
+                    "key encipherment",
+                    "client auth"
+                ]
+            }
+        }
+    }
+}
+
diff --git a/src/tests/integration/certs/ca-key.pem b/src/tests/integration/certs/ca-key.pem
new file mode 100644
index 0000000..f33ac14
--- /dev/null
+++ b/src/tests/integration/certs/ca-key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpQIBAAKCAQEA1oxLTdpPOGLneo52GEDuTe0fz2sKNrXYaMQ3HfqgjKuZ4QK+
+LbT+muULrm8MeYlhcXiUQBTMkk9GoLCkomtwMk/6j3EydZeCntOBVStab/zfZALE
+8ekmMcT5m0LvYdO64fZXVpptF//0aLsGTAYyoPrlvS/+WcfMLUcdzrbypnLCIt3M
+UM5gFVrmK/KV/2G0tdX/yc3dSJBH3M9aOZ3gRLnRK+vCVpwESNIVUKUren4nKYra
+Q57W8LT0Ns/x28ilHh1JdV6iLspxgKbMosmNNTwtzY3Cac8A+/qrul+tnnXkrLNf
+KwdUx3R1Vgge4woAIS1fUYFGausvthHxgg8XZQIDAQABAoIBAQCPtWVzfnl18XnP
+s8ESudtlwyF9k9tBjkio1FV+9TO5RfBKscWlZAjuw+ExNB0NA6KLmRLkYYotroBG
+fkuop4J9kOjqUA5Wiefqbw3AeMuZG66elORKjbsRtzjicNFbm7EgThtuXP4aB041
+IKE1JymefrCIKq+af6QZ5/rlTdH2/sknG3zaIpn24vp92OWZgWpX0bmOCa3/kjAJ
+H/4J3fZpYdi/GQZqPoBkAXiaXKs0+lfXrVSq+m8rvd1rKz17ar5bNAkgK0oymrxS
+6gHlZR8L7jcu2ZcbPKtJeSLXw/W5HfcIijLO85VpVFtpY3D0K66zeZsicnx5imPo
+j1yo+O55AoGBAOETkT8PlxhgeYxj6miaA/QdgRs28PvgHUeOf72bMVOQLIDFdeKV
+8rxvID4Zh74Vy7B6VIoJNSHPwJ9d+gwo6/qtG4VLASTvebKUIM7VHsvKrakTmNz1
+0Xh33tj0L1gewOqJXQQ31A3CcXBe+QGnNb/Qhb7PIqH+rtURuqgfRijDAoGBAPQG
+a2DdtPzXmMLmF5OEsyoPWzHbVP1whOshEYhKVLVARy5oVu8SJel9kPg8QEezBP0y
+xLuxZYIBy6GNGeoXigUu2YyHpYspkcOLb3D7o2G2Pq0NXmdX8+5lINM5Sky4wSQi
+j3OQkoHJP/fPa/zksyU50+XQGMjn39rXLKBhmPy3AoGACrDsQEuUSMMkYufIFanj
+MDBKlqlYbw5pNaHuLWp2wFpj0sYOYHHw8sRwiqKZ0Qyl/T8CTwA69t0wcCF9pCA5
+fVHFseIrLr71T+c7W7fB27pH33Uf2LcQeSFwg2ut6Ail7z4RHgcs2m53Bvhr6Ykw
+w2i7QaIDKiC320UZUa0SnxMCgYEA7iv5z/B0frd6/PcQmcXSDMIyMwYs/LQ+tzNu
+ZkSOSt2y2+OwveRLpooM3YwI/TIIM4zCoaLyPSK9ei861NUmvApPAS8/7wSipWXJ
+Xk/s1ijHIaZDtsAMcGi50g8/qoRE1pz4wEWiCRTA34DOmGUrSLEZVVt3ZVeTkIel
+od/ALx8CgYEAyCErlcx/CnxuW1j18W63aFhtNItJtPVMiT4IApJFTUhkSSeucYG6
+yU+zyX+Z7LDIRj0GsIPcJ2/WOCm4M7KmVfvVHkpo9tXfC9zf+4N9BTntEUBxxuTz
+oxgW32dNf2VzKp98bR8D8ob9aKMWyWZQlB5y7DPKe68kJjwPU4nguG8=
+-----END RSA PRIVATE KEY-----
diff --git a/src/tests/integration/certs/ca.csr b/src/tests/integration/certs/ca.csr
new file mode 100644
index 0000000..77ca171
--- /dev/null
+++ b/src/tests/integration/certs/ca.csr
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICmTCCAYECAQAwVDELMAkGA1UEBhMCR0IxDzANBgNVBAgTBkxvbmRvbjEXMBUG
+A1UEChMOQ2FtbCBDcnVzaCBPcmcxGzAZBgNVBAMTEkNhbWwgQ3J1c2ggVGVzdCBD
+QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANaMS03aTzhi53qOdhhA
+7k3tH89rCja12GjENx36oIyrmeECvi20/prlC65vDHmJYXF4lEAUzJJPRqCwpKJr
+cDJP+o9xMnWXgp7TgVUrWm/832QCxPHpJjHE+ZtC72HTuuH2V1aabRf/9Gi7BkwG
+MqD65b0v/lnHzC1HHc628qZywiLdzFDOYBVa5ivylf9htLXV/8nN3UiQR9zPWjmd
+4ES50SvrwlacBEjSFVClK3p+JymK2kOe1vC09DbP8dvIpR4dSXVeoi7KcYCmzKLJ
+jTU8Lc2NwmnPAPv6q7pfrZ515KyzXysHVMd0dVYIHuMKACEtX1GBRmrrL7YR8YIP
+F2UCAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4IBAQCm7Va0OXlAs3bBqeuOdk2QPPRW
+Wk7EyGSgYizRDUK3fcnPqITeEUYoRJvbKpzTYFZxeXoqSbyVXNklY05uQgVQkgKK
+wERJpNTXRaCwifJoV3REElBU9Oj6Pmaj/dJB3fcWKT2sWb9UiBFdbu/Jyeiy8WzX
+BY4GUr3TzUekboyc0YDFUtArBHQnbthypov2M1K9k8+4eDOqqyFT21Ui7DJeUlVu
+IDNFjAHcnHIi/zkbdnHYcDV3nPZ+8QK1eVZ/C60tAf4JQZuATvIrbceVG7gK5h82
+l+RWOO162M1mwj4KvOLSkDpi7Xfvli85wqVkRnWPaBZyQsYzL3QtWMbzWZFI
+-----END CERTIFICATE REQUEST-----
diff --git a/src/tests/integration/certs/ca.json b/src/tests/integration/certs/ca.json
new file mode 100644
index 0000000..852043d
--- /dev/null
+++ b/src/tests/integration/certs/ca.json
@@ -0,0 +1,14 @@
+{
+    "CN": "Caml Crush Test CA",
+    "key": {
+        "algo": "rsa",
+        "size": 2048
+    },
+    "names": [
+        {
+            "C": "GB",
+            "O": "Caml Crush Org",
+            "ST": "London"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/src/tests/integration/certs/ca.pem b/src/tests/integration/certs/ca.pem
new file mode 100644
index 0000000..6b1bb5d
--- /dev/null
+++ b/src/tests/integration/certs/ca.pem
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDeDCCAmCgAwIBAgIUYltQ6kD1bMXQ7wR0Zmqm8TLQtEkwDQYJKoZIhvcNAQEL
+BQAwVDELMAkGA1UEBhMCR0IxDzANBgNVBAgTBkxvbmRvbjEXMBUGA1UEChMOQ2Ft
+bCBDcnVzaCBPcmcxGzAZBgNVBAMTEkNhbWwgQ3J1c2ggVGVzdCBDQTAeFw0yMTA4
+MjYxMDQ4MDBaFw0yNjA4MjUxMDQ4MDBaMFQxCzAJBgNVBAYTAkdCMQ8wDQYDVQQI
+EwZMb25kb24xFzAVBgNVBAoTDkNhbWwgQ3J1c2ggT3JnMRswGQYDVQQDExJDYW1s
+IENydXNoIFRlc3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDW
+jEtN2k84Yud6jnYYQO5N7R/Pawo2tdhoxDcd+qCMq5nhAr4ttP6a5Quubwx5iWFx
+eJRAFMyST0agsKSia3AyT/qPcTJ1l4Ke04FVK1pv/N9kAsTx6SYxxPmbQu9h07rh
+9ldWmm0X//RouwZMBjKg+uW9L/5Zx8wtRx3OtvKmcsIi3cxQzmAVWuYr8pX/YbS1
+1f/Jzd1IkEfcz1o5neBEudEr68JWnARI0hVQpSt6ficpitpDntbwtPQ2z/HbyKUe
+HUl1XqIuynGApsyiyY01PC3NjcJpzwD7+qu6X62edeSss18rB1THdHVWCB7jCgAh
+LV9RgUZq6y+2EfGCDxdlAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB
+Af8EBTADAQH/MB0GA1UdDgQWBBQK8Z4LQF692R6SsqqOnMUhR5JMwDANBgkqhkiG
+9w0BAQsFAAOCAQEAedy4hBpBXq/Ka/ax4Iacb2aOamjBb00HV/CbkgAf8v7whh9C
+ABLrGXqI0xmXlKInAO6INlqik3hwH1qhcVwB+gN1IXFIqiOKa5uSCEeqqPuthCod
+yBOSPmRUxzAVG3djaeBTABOaUqUjzxH7qg2YlYmidY3KHsWMI6oLaArnpAlBcBrZ
+ZZaQwP+G/ymR4tYFzsgvuJdXE+FDM10e3NF7qxknTRIzTPzXlXzHsIQ92aAdnsBc
+liT9oo+HKQxZrFOP6i1L0ChX/brqfr3VtrAi94oMxf5T1uq6LmRrho9op3yEY20y
+CBg3C9Tdu5AxSbAPbS0ACLc00GytpDcSgp/P1A==
+-----END CERTIFICATE-----
diff --git a/src/tests/integration/certs/client-key.pem b/src/tests/integration/certs/client-key.pem
new file mode 100644
index 0000000..5022a52
--- /dev/null
+++ b/src/tests/integration/certs/client-key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEA1d8oGGMOX7YkK5pXXgWQ8BYKoipsue+3339jFQ81u986lefK
+K07sd5cnWzNraCN1bnbwSeMjXLeCcKzuiuzPsGJ9elrV5WNlzq7T5HGN9BIZfbke
+9Q+EfUQer5pdqt39e+W2pJpFicpbbZXAsELHHOmU3B4NLMRUu9RTgxl7lwskfRS/
+/xsjSkqjMmDaN9i/Xba/9aWrLmr1ThCQ+2DfnnjK4y8ZpaVF4mnZs9iIoBCM9Ww+
+yGXADwOQapCPWoCSgTf1HIxH+KWY7EFhT7o0QFxwDq/xEF3TMwxuPctS+6u8ZIdT
+sh33eFJVU0n0FQ0xoodNENnD+HkvKDVWUVkA4QIDAQABAoIBAQCLne2P1gKJKt97
+83q7b0jJ4qm4aZem3j4b0g49rjs21ShqufE5yoEGJQ/VMsEYL6W2okCFC5mHKmkl
+406qNKP0kqc1W90srXHFtk2vYQ35WmN3toTmF+Y23GRn4I7rP5X97t0HoYppxEdh
+R5SNvFo9nqLF+3xAUD68i4SlHdqXo8XW2CA+7ArsKAJ7Cb34OgFIhFmtrjK628ub
+sw6l/d1r3U/bskfYSZDW+RNzXGHDEXwtg5SpNGrNrYnAcMMeaiIVm468boT/tCvp
+/xu2EF21NwFT6NYfCHIhpz1Wz5w561sfnUE8iUoNtgrlWgP2XGMRwe4hj0DAgsuv
+UXrhgk1BAoGBAOJXiUfnIRHwsALQS93HIrw/Tfevfc76Gr2DnLatLJ1MV3d1lKoq
+BMuF1nft+uCUMopoxR+WFMmwjGYq/1BflJwwjJ3n51zpPj8QBgrhiHVIlvjKhg75
+XmjbyaGZ4MK8Edl9m6gEA+3U7mPxR2JoHnPg9MF/PSHUYqv99ET6ZW3pAoGBAPHl
+UO4gpsUTJYKPZqzhop864cJhQzWKWYB3OLOyzgT0KfremrUeHgt7ECa0kWldU+AH
+kK0PHSAro1WCruv3qkOpalyb5avLF8tSaNC8Zo8wzbbRylwDoZD4j5gSxTN8drO3
+Acf/AoxT8cbLa047LLYxIFRLaLFvyk2QAXjQykg5AoGBALduKZtT/MEFRh+Bn3pE
+gCn/Q7iPSG4M0s7zcnW5Mobn75qod6rQEsK93GmlO8P1VmBFODu47W/m3GGQRwlj
+7JQH5G20GxR5EjEZU0xOKsCh63gE6VAJWDGyrV2Bz10B/ZU87oDjgCumfOwSBcAC
+kWtny/Nkoq5f6PdqACRGqRzBAoGAen0maA68pBq36c73rR9sm7jTTPy3bcsq2zSD
+z+sBC90fzNsf+ArSJ/ofCZpx76rEqDLsfdWjaADw6oIMVYzJ+Q02wMJooH9tAxYt
+4VUlkeiioqrFD6b/D0vuWpFWrmWeLg7DpiRpg+mWCpZDNhAc6f0iY8zzrLXw+Sms
+tSL063ECgYAQTbI+Zxo08B9gHpOga85iyFBH4S/nhR+5h9DSS3S31QwryMnW46qq
+a0581muYJaRxxOqDHlrY0KepLJIFbFGHk1m56ejBJvsR588h6coywqT74TfH0eaP
+tdefcYqdXRTLzZk5IzGFAgfP8Nsi7G45TVHmq+rAtkngUU4ZejsncQ==
+-----END RSA PRIVATE KEY-----
diff --git a/src/tests/integration/certs/client.csr b/src/tests/integration/certs/client.csr
new file mode 100644
index 0000000..3850b58
--- /dev/null
+++ b/src/tests/integration/certs/client.csr
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICfzCCAWcCAQAwOjELMAkGA1UEBhMCR0IxDzANBgNVBAcTBkxvbmRvbjEaMBgG
+A1UEAxMRY2FtbC1jcnVzaC1jbGllbnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
+ggEKAoIBAQDV3ygYYw5ftiQrmldeBZDwFgqiKmy577fff2MVDzW73zqV58orTux3
+lydbM2toI3VudvBJ4yNct4JwrO6K7M+wYn16WtXlY2XOrtPkcY30Ehl9uR71D4R9
+RB6vml2q3f175bakmkWJylttlcCwQscc6ZTcHg0sxFS71FODGXuXCyR9FL//GyNK
+SqMyYNo32L9dtr/1pasuavVOEJD7YN+eeMrjLxmlpUXiadmz2IigEIz1bD7IZcAP
+A5BqkI9agJKBN/UcjEf4pZjsQWFPujRAXHAOr/EQXdMzDG49y1L7q7xkh1OyHfd4
+UlVTSfQVDTGih00Q2cP4eS8oNVZRWQDhAgMBAAGgADANBgkqhkiG9w0BAQsFAAOC
+AQEAM4IT+ayzj+npnkKNg5WUk2l0usLutPIMvtn3OelaB0oExS8dfWTfE/bJJKWr
+lqFTY/pl3qm/OTBOufYVuL6lkWZ+xVMGxVt7cyX/hy1c2dptirsnKQjSEcjUEP93
+tKngeIVawhX8D1FdPQlOtEFqcsZbPl4sCedF44VLolKJpdwZjSD7NYN8p6Q2uRVB
+k4IxR3iGKoLUQCB9v2kkBmGFScft8WprenKgYJdQ4P5R3PLRnxNz8s6Jq0W6vlnn
+5eanrfiJQX9FliSUbBKUC/Sd8hmQGJrUOoi/zt74L6VBGyp05LupJ8BfLhfcJ4MB
+5SpmoaJ+bB8sd27z7nIfoCIWoQ==
+-----END CERTIFICATE REQUEST-----
diff --git a/src/tests/integration/certs/client.json b/src/tests/integration/certs/client.json
new file mode 100644
index 0000000..274c30d
--- /dev/null
+++ b/src/tests/integration/certs/client.json
@@ -0,0 +1,14 @@
+{
+    "CN": "caml-crush-client",
+    "key": {
+        "algo": "rsa",
+        "size": 2048
+    },
+    "names": [
+        {
+            "C": "GB",
+            "L": "London"
+        }
+    ]
+}
+
diff --git a/src/tests/integration/certs/client.pem b/src/tests/integration/certs/client.pem
new file mode 100644
index 0000000..c672d2f
--- /dev/null
+++ b/src/tests/integration/certs/client.pem
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDkTCCAnmgAwIBAgIUMhl+AVO4/je3OZs1IV8UsSgJnjswDQYJKoZIhvcNAQEL
+BQAwVDELMAkGA1UEBhMCR0IxDzANBgNVBAgTBkxvbmRvbjEXMBUGA1UEChMOQ2Ft
+bCBDcnVzaCBPcmcxGzAZBgNVBAMTEkNhbWwgQ3J1c2ggVGVzdCBDQTAeFw0yMTA4
+MjYxMDQ4MDBaFw0yMjA4MjYxMDQ4MDBaMDoxCzAJBgNVBAYTAkdCMQ8wDQYDVQQH
+EwZMb25kb24xGjAYBgNVBAMTEWNhbWwtY3J1c2gtY2xpZW50MIIBIjANBgkqhkiG
+9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1d8oGGMOX7YkK5pXXgWQ8BYKoipsue+3339j
+FQ81u986lefKK07sd5cnWzNraCN1bnbwSeMjXLeCcKzuiuzPsGJ9elrV5WNlzq7T
+5HGN9BIZfbke9Q+EfUQer5pdqt39e+W2pJpFicpbbZXAsELHHOmU3B4NLMRUu9RT
+gxl7lwskfRS//xsjSkqjMmDaN9i/Xba/9aWrLmr1ThCQ+2DfnnjK4y8ZpaVF4mnZ
+s9iIoBCM9Ww+yGXADwOQapCPWoCSgTf1HIxH+KWY7EFhT7o0QFxwDq/xEF3TMwxu
+PctS+6u8ZIdTsh33eFJVU0n0FQ0xoodNENnD+HkvKDVWUVkA4QIDAQABo3UwczAO
+BgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDAYDVR0TAQH/BAIw
+ADAdBgNVHQ4EFgQU5167zMemHtIkweQ4wKLtrIz4CYMwHwYDVR0jBBgwFoAUCvGe
+C0BevdkekrKqjpzFIUeSTMAwDQYJKoZIhvcNAQELBQADggEBAH2W/GhNtIlSZTw+
+pS1t6c1TK2T8mBoeIxF3TyKmwznCO+ERjBiqF3UxVJyG87fea4betCVAHmm3RvZX
+cvr8adfLnUVGxSeDmcxStlMOSjbvbzu17yK6Bc8zB43i21fEwD7FCJ8yIfRaGSG4
+s18CUSKwR9HTcc7NtW1LzJUds3Ahn5chtNHmdIHjRacKkWw72sJIVuice9O/mBXo
+AG+5bra/igSfYrVPcUCgzn4RpSMO8snOxRXTg1oAqPNgZbDcOJyOt4tdMPZqZwSa
+4dp4YA5RSPJQMNMq9A4pWCTLavCbKDxtd9GMZopxeJReM29kntdKWlli7HC0r9Ze
+iM3e61s=
+-----END CERTIFICATE-----
diff --git a/src/tests/integration/certs/server-key.pem b/src/tests/integration/certs/server-key.pem
new file mode 100644
index 0000000..ee49dcb
--- /dev/null
+++ b/src/tests/integration/certs/server-key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAxIyJ3squHS+FlQesJ58peuxtcE+/9YKDa/QSdoQLUdQSuvqI
+t0lAiZ1CHW0SHogyuBSx3VsRtcfDUfe/bOQVlfrOLNx3U1XS7rwvksPR0MVAuen4
+WHmK2onMRcrvi7rblU53+DhwXkB9DQOWTAywS/4R6j0/Bt4PYUI65h0aSVxbK9g4
+cgxMo7wwHbsNyBCRSEWpm9fnwzZG6kJOJzBHV+zwQmWn1yzxfaHuYVvx9QU4LYpC
+khicEkWuk/tPelinc8S4a9+Os9TA0UoqGR7UIZ+VQqBRZt1g8fig6zRJwRYwcwce
+hQqNdK4NPrxZ6/GIshvICb1fQtlDKA+mn7H0fQIDAQABAoIBAC7HfDDocFRF8Tct
+Ik4z1X2KM+ndMUTPkVPqPVKzzrXlEagq5Msqxg96vDegtAVMSTYCxup2OFrZdqVV
+n9vc1T5i+Rs4RbYx4QgtBe2aaZ+UsvkMtKzqEKA+171stWK+UHDSwj7zv9rO4nRs
+fCMRigwsJjtn5E5QH7z4NGh8WLtIsybeGt2gpjvpaRuU6X9wjBQz5Lhl4J6DdQUQ
+DO+iHUrmjOmkwo7icTbaup2WlItSmQ/r0gDgZEQpcfsqFKnDScA0FIY5JKDSalfk
+Siq2WEUSsAvbmKc/Za63/mf9VZUEOvH1985cetGmGP6RqNOKNgQxPiAIivpUvPVh
+ujJKywECgYEA5IrysHB3/W+KXo6euh37Vf+3+GmJWI762qa51qFSF14abICDgvhO
+16skuzF9owZonjw4d0QMFM5vprdu1W2cIW+VPxWA6c/muPFCwUeGZPGP7DE8lqaQ
+SA85yOe0YdmoNnm+Omv5Eff8ZFzmCh9IMJxDztuPml3PN3DGeu1aTWECgYEA3CmX
+SBFop5/dktj3SGZU/C6W7wAseHuf6DOQDKacGJaHtc/W2VjDHgkLcCuMeWBD1kQW
+xsvkdqWG9B+1BKNnFrdQDpYe6tck1DQ2xkl+6dSYhWlMzzhOuSJVEGgk/QmSBMUc
+e6TuAyZIxi8HuQx0qu2lQQNEEsX94SPspQyggJ0CgYBngEXIgibVL96KVCyuPUXF
+/LlkVudMo/QXccpX2VdEHen5mXn1pl6ObYOFAzTSz+QxRTSNTtPp2FPYPNqE7c73
+lYERwLtRKEZlG14QCkRjEsMLRIEb+PL+r2aMBeM7LUdw5FGyQ5PY/2XeTfQgQWqA
+GUTcObMfRbzCbuB0a2mqAQKBgQCBeEPqsbIlwTGABe+FuAgKNSu1aRi90ZV767au
+edwZ6YvtM0hZkIVNyGvdjv6Q8jdybaAnUAgObdErBupgy+b3yN1fdpC/8b1KvVno
+yZfE0qzO59mvkqFY5gO4HkaCN3qTK4dQfvEpEP6C7W1ROS3yxsYDsXP6xkxCdenY
+NdC9UQKBgHRl3kVRaGUFQpSeLkCaTRIoATbDzd49rcRcuTg1fzIlWNcUsHPJZzd8
+XBzE9+iv8nWkXZjgxu8/Ewh4hJF8p5sUyt7zjox1N61G6wwKyOR9PxB6Pb1kxtKJ
+cuWrPOYqOd+89SSFrHGQJSHJehyyw1BJV7+n/S1ZJHkL8mtDYmaj
+-----END RSA PRIVATE KEY-----
diff --git a/src/tests/integration/certs/server.csr b/src/tests/integration/certs/server.csr
new file mode 100644
index 0000000..fdcdff6
--- /dev/null
+++ b/src/tests/integration/certs/server.csr
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICqDCCAZACAQAwNzELMAkGA1UEBhMCR0IxDzANBgNVBAcTBkxvbmRvbjEXMBUG
+A1UEAxMOcGtjMTFwcm94eWR0bHMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
+AoIBAQDEjIneyq4dL4WVB6wnnyl67G1wT7/1goNr9BJ2hAtR1BK6+oi3SUCJnUId
+bRIeiDK4FLHdWxG1x8NR979s5BWV+s4s3HdTVdLuvC+Sw9HQxUC56fhYeYraicxF
+yu+LutuVTnf4OHBeQH0NA5ZMDLBL/hHqPT8G3g9hQjrmHRpJXFsr2DhyDEyjvDAd
+uw3IEJFIRamb1+fDNkbqQk4nMEdX7PBCZafXLPF9oe5hW/H1BTgtikKSGJwSRa6T
++096WKdzxLhr346z1MDRSioZHtQhn5VCoFFm3WDx+KDrNEnBFjBzBx6FCo10rg0+
+vFnr8YiyG8gJvV9C2UMoD6afsfR9AgMBAAGgLDAqBgkqhkiG9w0BCQ4xHTAbMBkG
+A1UdEQQSMBCCDnBrYzExcHJveHlkdGxzMA0GCSqGSIb3DQEBCwUAA4IBAQABhU4T
+lTPiOc4Bvq7rMDu3I6aCL2Wo7GnKWxx8SxorUoBt5ugi414K2lNwA6czL3IP7iJ8
+qqiTm2RkbO093ikdrkCVCD6Mxr/kWzaK7EY9PuavFkTQwtteHWjbTbjdQbOKzk9v
++hPzFWj/mJ7icGWi/LuuwmT9/rufGYaJz8CjiM1syy3/sMNutELMXHvmMvlhLq69
+m8LAajHCzRUyGaAet4G0tIHXMvemHlCt+Zmx/bpVkiN2xZeakx8jmX5wtLlQBUpd
+zTKG9Zf61QfnUcfPezXpY931zR9jIrb0L28FlHWcAuPCeBK+cpO/AY4Bj4nGm/Dk
+Cp68Ukydael0XkzK
+-----END CERTIFICATE REQUEST-----
diff --git a/src/tests/integration/certs/server.json b/src/tests/integration/certs/server.json
new file mode 100644
index 0000000..8aa5046
--- /dev/null
+++ b/src/tests/integration/certs/server.json
@@ -0,0 +1,17 @@
+{
+    "CN": "pkc11proxydtls",
+    "hosts": [
+        "pkc11proxydtls"
+    ],
+    "key": {
+        "algo": "rsa",
+        "size": 2048
+    },
+    "names": [
+        {
+            "C": "GB",
+            "L": "London"
+        }
+    ]
+}
+
diff --git a/src/tests/integration/certs/server.pem b/src/tests/integration/certs/server.pem
new file mode 100644
index 0000000..f11b5aa
--- /dev/null
+++ b/src/tests/integration/certs/server.pem
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDqzCCApOgAwIBAgIUAnpmr19LEylmSLJmemnbngf22bcwDQYJKoZIhvcNAQEL
+BQAwVDELMAkGA1UEBhMCR0IxDzANBgNVBAgTBkxvbmRvbjEXMBUGA1UEChMOQ2Ft
+bCBDcnVzaCBPcmcxGzAZBgNVBAMTEkNhbWwgQ3J1c2ggVGVzdCBDQTAeFw0yMTA4
+MjYxMDQ4MDBaFw0yMjA4MjYxMDQ4MDBaMDcxCzAJBgNVBAYTAkdCMQ8wDQYDVQQH
+EwZMb25kb24xFzAVBgNVBAMTDnBrYzExcHJveHlkdGxzMIIBIjANBgkqhkiG9w0B
+AQEFAAOCAQ8AMIIBCgKCAQEAxIyJ3squHS+FlQesJ58peuxtcE+/9YKDa/QSdoQL
+UdQSuvqIt0lAiZ1CHW0SHogyuBSx3VsRtcfDUfe/bOQVlfrOLNx3U1XS7rwvksPR
+0MVAuen4WHmK2onMRcrvi7rblU53+DhwXkB9DQOWTAywS/4R6j0/Bt4PYUI65h0a
+SVxbK9g4cgxMo7wwHbsNyBCRSEWpm9fnwzZG6kJOJzBHV+zwQmWn1yzxfaHuYVvx
+9QU4LYpCkhicEkWuk/tPelinc8S4a9+Os9TA0UoqGR7UIZ+VQqBRZt1g8fig6zRJ
+wRYwcwcehQqNdK4NPrxZ6/GIshvICb1fQtlDKA+mn7H0fQIDAQABo4GRMIGOMA4G
+A1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAA
+MB0GA1UdDgQWBBQwlFpNmFxhYU5THk4dMtwxkD9JqzAfBgNVHSMEGDAWgBQK8Z4L
+QF692R6SsqqOnMUhR5JMwDAZBgNVHREEEjAQgg5wa2MxMXByb3h5ZHRsczANBgkq
+hkiG9w0BAQsFAAOCAQEAFv84RjZJ/WJ3yC10eK8MqaAb/5B9ncr9DUxVdjbHXfp/
+SER4SXw7BX02GFlzkC14/c0Ffph7CHfab5vnOStmMKd/s4LvmjFxPPsimbl/Boro
+5OEOxZml1VKu6Wt27A2ExD1lsDTI4R84DV/0tWeSt/h8buT5c3K5zEarPhFdvQpe
+yTxQgv7XXCsdkrz2XVDrMCwwrki6sS2IdSCnXddMiReTMhptYDQSuEmGuIbwAQgD
+GHGBjeEzTUXmu6xDfnj16SzHswZWJd3UrBhTWcM8k9LKvZsBdpCzA5TNT/X9do3o
+5GBgzN2GP9pBUwMjOuqcLp9YojNrV1XTcZqE+k7dzw==
+-----END CERTIFICATE-----
diff --git a/src/tests/integration/certs/ssl-init.sh b/src/tests/integration/certs/ssl-init.sh
new file mode 100644
index 0000000..1b6d91f
--- /dev/null
+++ b/src/tests/integration/certs/ssl-init.sh
@@ -0,0 +1,4 @@
+#No need to run but those were the commends to setup certificates
+cfssl genkey -initca ca.json | cfssljson -bare ca
+cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server server.json | cfssljson -bare server
+cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client client.json | cfssljson -bare client
\ No newline at end of file
diff --git a/src/tests/integration/filter.conf b/src/tests/integration/filter.conf
new file mode 100644
index 0000000..c2e459d
--- /dev/null
+++ b/src/tests/integration/filter.conf
@@ -0,0 +1,245 @@
+(* debug = integer between 0 and 3
+    0 = merely no log at all, except critical errors and printing the debug
+        level itself
+    1 = level 0 + positive filtering matches (i.e. when the filter detects
+        something to block)
+    2 = level 1 + negative filtering matches (i.e. when the filter detects
+        that it must not block something)
+    3 = level 2 + print all the fetched configuration variables in the filter
+        configuration file (modules aliasing, filtered labels, filtered ids,
+        ...)
+*)
+debug = 0
+
+(* wrapping_format_key = configure the AES-128 key used for the wrapping
+   format. The format is 32 char long string in hexadecimal format.
+   You MUST uncomment and configure to a cryptographically sound random value
+   when using the wrapping_format_patch function of the patchset 1 which is the
+   default configuration.
+*)
+wrapping_format_key = "00112233445566778899aabbccddeeff"
+
+(* modules = [(a1, b1), (a2, b2) ...] is a list of couples of strings (a, b)
+   with 'a' being an alias, and 'b' being a PATH to the aliased
+   PKCS#11 module
+*)
+modules = [("softhsm", "/usr/local/lib/softhsm/libsofthsm2.so"), ("opencryptoki", "/usr/local/lib/opencryptoki/libopencryptoki.so")]
+
+(* log_subchannel = string representing the filter log subchannel in the server *)
+log_subchannel = filter
+
+(* forbidden_mechanisms = [(a1, b1), (a2, b2) ...] is a list of couples where
+   'a' is a regular expression string representing modules and 'b' is a list
+   of PKCS#11 mechanisms with the PKCS#11 definition syntax (CKM_RSA_X_509 for
+   instance)
+*)
+forbidden_mechanisms = [("sof.*", [CKM_RSA_X_509]), ("opencrypto.*", [])]
+
+(* allowed_labels = [(a1, b1), (a2, b2) ...] is a list of couples where 'a1',
+   'a2', ... are regular expression strings representing module names, and
+   'b1', 'b2', ... are regular expressions representing labels
+
+   example: allowed_labels  = [("opencryptoki", ["not_filtered_.*", "test"])]
+   Here, only objects with CKA_LABEL such as "not_filtered_.*" and "test" are
+   usable for the "opencryptoki" alias.
+
+   default: NO filtering, uncomment and configure below to filter objects
+*)
+(*
+allowed_labels  = [("opencryptoki", ["not_filtered_.*", "test"])]
+*)
+
+(* allowed_ids = [(a1, b1), (a2, b2) ...] is a list of couples where 'a1',
+   'a2', ... are regular expression strings representing module names, and
+   'b1', 'b2', ... are regular expressions representing ids
+
+   example: allowed_ids  = [("softhsm", [".*"])]
+   Here, this rule allows all CKA_ID to be used for the "softhsm" alias.
+
+   default: NO filtering, uncomment and configure below to filter objects
+*)
+(*
+allowed_ids  = [("softhsm", [".*"])]
+*)
+
+(* forbidden_functions = [(a1, b1), (a2, b2) ...] is a list of couples where
+   'a1', 'a2', ... are regular expression strings representing module names,
+   and 'b1', 'b2', ... are lists of PKCS#11 functions with the PKCS#11 naming
+   convention (C_Login, C_Logout ...)
+
+   default OFF, uncomment and configure below to enable;
+*)
+(*
+forbidden_functions  = [("soft.*", []), ("softhsm", [])]
+*)
+
+(* enforce_ro_sessions = [(a1, b1), (a2, b2) ...] is a list of couples where
+   'a' is a regular expression string representing module names, and 'b1',
+   'b2', ... are booleans that can take 'true', 'false', 'yes' and 'no' as
+    possible values
+
+   default OFF, uncomment and configure below to enable;
+*)
+(*
+enforce_ro_sessions  = [(".*", no)]
+*)
+
+(* forbid_admin_operations = [(a1, b1), (a2, b2) ...] is a list of couples
+   where 'a' is a regular expression string representing module names, and
+   'b1', 'b2', ... are booleans that can take 'true', 'false', 'yes' and 'no'
+   as possible values
+
+   default OFF, uncomment and configure below to enable;
+*)
+(*
+forbid_admin_operations = [(".*", yes)]
+*)
+
+(* remove_padding_oracles = [(a1, b1), (a2, b2) ...] is a list of couples where
+   'a' is a regular expression string representing module names, and 'b1',
+   'b2', ... are a lists of cryptographic operations type that can take as
+   possible values 'wrap', 'unwrap', 'encrypt', 'sign' and 'all' (this last
+   one represents the sum of all the values)
+
+   default OFF, uncomment and configure below to enable;
+*)
+(*
+remove_padding_oracles = [(".*", [wrap, unwrap, encrypt])]
+*)
+
+(* filter_actions = list of couples of [string_regexp x list of couples of
+   [PKCS#11_function x custom_function]]). This option is a way to extend
+   the filter features as the user can provide its own hooks on every PKCS#11
+   function. See FILTER.md for more information.
+
+   default OFF, uncomment and configure below to enable;
+*)
+(* filter_actions = [
+                  (".*", [(C_Login, c_Login_hook), (C_Initialize, c_Initialize_hook)]), 
+                  ("soft.*", [(C_CloseSession, identity)])
+                 ]
+*)
+
+(**** Fixing PKCS#11 with patchset 1 *
+   See FILTER.md for a detailed explanation of patchset 1 and 2.
+
+   default ON;
+*)
+filter_actions_post = [ (".*", 
+                          [
+                           (******** This is optional: key usage segregation ******************************)
+                           (* (C_Initialize, do_segregate_usage), *)
+
+                           (******** Check for key creation and attribute manipulation on non local keys **)
+                           (C_CreateObject, non_local_objects_patch),
+                           (C_CopyObject, non_local_objects_patch),
+                           (C_SetAttributeValue, non_local_objects_patch),
+
+                           (******** Check for value extraction on sensitive/nonextractable keys **********)
+                           (C_GetAttributeValue, prevent_sensitive_leak_patch),
+                           (C_SetAttributeValue, prevent_sensitive_leak_patch),
+
+                           (******** CryptokiX conflicting attributes patch addendum for existing objects *) 
+                           (C_EncryptInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_DecryptInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_SignInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_SignRecoverInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_VerifyInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_VerifyRecoverInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_DeriveKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_DigestKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_WrapKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_UnwrapKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_FindObjects, conflicting_attributes_patch_on_existing_objects),
+
+                           (******** Patch addendum to handle key escrow (or not) *)
+                           (C_EncryptInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_DecryptInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_SignInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_SignRecoverInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_VerifyInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_VerifyRecoverInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_DeriveKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_DigestKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_WrapKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_UnwrapKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_FindObjects, dangerous_sensitive_keys_escrow_encrypt),
+                             
+                           (******** CryptokiX conflicting attributes patch *******************************)
+                           (C_CreateObject, conflicting_attributes_patch), (C_CopyObject, conflicting_attributes_patch), 
+                           (C_UnwrapKey, conflicting_attributes_patch), (C_GenerateKey, conflicting_attributes_patch), 
+                           (C_GenerateKeyPair, conflicting_attributes_patch), (C_DeriveKey, conflicting_attributes_patch), 
+                           (C_SetAttributeValue, conflicting_attributes_patch),
+
+                           (******** CryptokiX sticky attributes patch ************************************)
+                           (C_CopyObject, sticky_attributes_patch), 
+                           (C_SetAttributeValue, sticky_attributes_patch),
+
+                           (******** CryptokiX Wrapping format patch **************************************)
+                           (C_WrapKey, wrapping_format_patch), 
+                           (C_UnwrapKey, wrapping_format_patch),
+
+                           (******** Sanitizing the creation attributes patch *****************************)
+                           (C_CreateObject, sanitize_creation_templates_patch), (C_CopyObject, sanitize_creation_templates_patch), 
+                           (C_GenerateKey, sanitize_creation_templates_patch), (C_GenerateKeyPair, sanitize_creation_templates_patch), 
+                           (C_DeriveKey, sanitize_creation_templates_patch), (C_UnwrapKey, sanitize_creation_templates_patch) 
+                          ]
+                   )
+                 ]
+
+(**** Fixing PKCS#11 with patchset 2 *
+   See FILTER.md for a detailed explanation of patchset 1 and 2.
+
+   default OFF, WARNING patchset 1 and 2 are incompatible, make sure it is not
+                enabled before enabling this one
+*)
+(*
+filter_actions_post = [ (".*", 
+                          [
+                           (******** This is optional: key usage segregation ******************************)
+                           (* (C_Initialize, do_segregate_usage), *)
+
+                           (******** CryptokiX conflicting attributes patch addendum for existing objects *) 
+                           (C_EncryptInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_DecryptInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_SignInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_SignRecoverInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_VerifyInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_VerifyRecoverInit, conflicting_attributes_patch_on_existing_objects),
+                           (C_DeriveKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_DigestKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_WrapKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_UnwrapKey, conflicting_attributes_patch_on_existing_objects),
+                           (C_FindObjects, conflicting_attributes_patch_on_existing_objects),
+
+                           (******** Patch addendum to handle key escrow (or not) *)
+                           (C_EncryptInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_DecryptInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_SignInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_SignRecoverInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_VerifyInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_VerifyRecoverInit, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_DeriveKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_DigestKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_WrapKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_UnwrapKey, dangerous_sensitive_keys_escrow_encrypt),
+                           (C_FindObjects, dangerous_sensitive_keys_escrow_encrypt),
+
+                           (******** CryptokiX secure templates patch on key creation and import **********)
+                           (C_SetAttributeValue, secure_templates_patch),
+                           (C_GenerateKey, secure_templates_patch), (C_GenerateKeyPair, secure_templates_patch),
+                           (C_CreateObject, secure_templates_patch), (C_CopyObject, secure_templates_patch),
+                           (C_UnwrapKey, secure_templates_patch), (C_DeriveKey, secure_templates_patch),
+
+                           (******** Check for value extraction on sensitive/nonextractable keys **********)
+                           (C_GetAttributeValue, prevent_sensitive_leak_patch),
+                           (C_SetAttributeValue, prevent_sensitive_leak_patch),
+
+                           (******** Sanitizing the creation attributes patch *****************************)
+                           (C_CreateObject, sanitize_creation_templates_patch), (C_CopyObject, sanitize_creation_templates_patch), 
+                           (C_GenerateKey, sanitize_creation_templates_patch), (C_GenerateKeyPair, sanitize_creation_templates_patch), 
+                           (C_DeriveKey, sanitize_creation_templates_patch), (C_UnwrapKey, sanitize_creation_templates_patch) 
+                          ]
+                   )
+                 ]
+*)
diff --git a/src/tests/integration/pkcs11proxyd-tcp-tls.conf b/src/tests/integration/pkcs11proxyd-tcp-tls.conf
new file mode 100644
index 0000000..40f74b0
--- /dev/null
+++ b/src/tests/integration/pkcs11proxyd-tcp-tls.conf
@@ -0,0 +1,115 @@
+netplex {
+  controller {
+    max_level = "debug";    (* Log level *)
+
+    (* configure "admin" socket directory, default "/tmp/.netplex" *)
+    (*
+    socket_directory = "/tmp/.netplex";
+    *)
+
+    logging {
+      (* type can either be "stderr", "syslog", "file", "multi_file"
+       * see http://projects.camlcity.org/projects/dl/ocamlnet-3.6/doc/html-main/Netplex_admin.html
+       *)
+      type = "stderr";      (* Log to stderr *)
+    };
+  };
+  service {
+    name = "PKCS#11 Filtering Proxy";
+    (* These parameters can be used to change UID/GID of worker processes *)
+    (*
+    user = "root";
+    group = "root";
+    *)
+
+    (* Do NOT change conn_limit, this would be a serious SECURITY ISSUE *)
+    conn_limit = 1;
+
+    protocol {
+      (* This section creates the socket *)
+      name = "rpc_pkcs11";
+
+      (* OCamlnet 4 support the following to set Unix socket permissions:*)
+      (*
+      local_chmod = "0o777";
+      *)
+
+      (* This section creates the socket *)
+      (* Socket can either be TCP or UNIX *)
+      address {
+        (* Default here is TCP localhost on port 4444 *)
+        type = "internet";
+        bind = "0.0.0.0:4444";
+
+        (* For Unix
+           WARNING: For OCamlnet < 4 it is not possible to set the socket permission,
+                    you will have to manually fix it to allow multi-user
+                    access (e.g. chmod 777 <socket>, or umask prior launching).
+        *)
+        (*
+        type = "local";
+        path = "/var/run/pkcs11proxyd.socket";
+        *)
+      };
+    };
+    processor {
+      (* This section specifies how to process data of the socket *)
+      type = "rpc_pkcs11";
+
+      (* libnames param is used when the proxy is compiled WITHOUT filtering support *)
+      (* syntax is: libnames="<module_name>:<path_to_middleware>;<...>:<...>;"; *)
+      (*
+      libnames="softhsm:/usr/lib/softhsm/libsofthsm2.so;";
+      *)
+
+      (* filter_config is used to supply the filtering configuration when compiled in *)
+      filter_config="/build/src/tests/integration/filter.conf";
+
+      (*************** TLS support begin ***********************)
+      (* use_ssl = false to disable SSL support on server side *)
+      (* use_ssl = true to enable SSL support on server side   *)
+      use_ssl = true;
+
+      (* TLS support for Caml Crush compiled with OCamlnet 4.x *)
+      (* Uncomment to enable TLS when using OCamlnet 4.x *)
+
+      tls {
+        (* Ciphersuites, GnuTLS syntax *)
+        (* TLS 1.2, PFS-only suites, no DSS, no CAMELLIA *)
+        algorithms = "SECURE256:+SECURE128:-VERS-TLS-ALL:+VERS-TLS1.2:-RSA:-DHE-DSS:-CAMELLIA-128-CBC:-CAMELLIA-256-CBC";
+
+        (* Force peer client authentication *)
+        peer_auth = "required";
+
+        (* Uncomment to enable DHE parameters, used for PFS *)
+        (*
+        dh_params {
+          (* Pre-computed DH parameters *)
+          pkcs3_file = "/etc/pkcs11proxyd/dhparams.pem";
+          (* Run-time created DH parameters, warning: this takes a long time *)
+          (*bits = 2048;*)
+        };
+        *)
+        x509 {
+         key {
+           crt_file = "server.pem";
+           key_file = "server-key.pem";
+         };
+         trust {
+           crt_file = "ca.pem";
+         };
+        }
+      };
+
+      (***************TLS support end  *************************)
+
+    };
+    workload_manager {
+      type = "dynamic";
+      max_jobs_per_thread = 1;  (* Everything else is senseless *)
+      min_free_jobs_capacity = 1;
+      max_free_jobs_capacity = 1;
+      max_threads = 100;
+    };
+  }
+}
diff --git a/src/tests/integration/pkcs11proxyd-tcp.conf b/src/tests/integration/pkcs11proxyd-tcp.conf
new file mode 100644
index 0000000..07b3991
--- /dev/null
+++ b/src/tests/integration/pkcs11proxyd-tcp.conf
@@ -0,0 +1,130 @@
+netplex {
+  controller {
+    max_level = "debug";    (* Log level *)
+
+    (* configure "admin" socket directory, default "/tmp/.netplex" *)
+    (*
+    socket_directory = "/tmp/.netplex";
+    *)
+
+    logging {
+      (* type can either be "stderr", "syslog", "file", "multi_file"
+       * see http://projects.camlcity.org/projects/dl/ocamlnet-3.6/doc/html-main/Netplex_admin.html
+       *)
+      type = "stderr";      (* Log to stderr *)
+    };
+  };
+  service {
+    name = "PKCS#11 Filtering Proxy";
+    (* These parameters can be used to change UID/GID of worker processes *)
+    (*
+    user = "root";
+    group = "root";
+    *)
+
+    (* Do NOT change conn_limit, this would be a serious SECURITY ISSUE *)
+    conn_limit = 1;
+
+    protocol {
+      (* This section creates the socket *)
+      name = "rpc_pkcs11";
+
+      (* OCamlnet 4 support the following to set Unix socket permissions:*)
+      (*
+      local_chmod = "0o777";
+      *)
+
+      (* This section creates the socket *)
+      (* Socket can either be TCP or UNIX *)
+      address {
+        (* Default here is TCP localhost on port 4444 *)
+        type = "internet";
+        bind = "0.0.0.0:4444";
+
+        (* For Unix
+           WARNING: For OCamlnet < 4 it is not possible to set the socket permission,
+                    you will have to manually fix it to allow multi-user
+                    access (e.g. chmod 777 <socket>, or umask prior launching).
+        *)
+        (*
+        type = "local";
+        path = "/var/run/pkcs11proxyd.socket";
+        *)
+      };
+    };
+    processor {
+      (* This section specifies how to process data of the socket *)
+      type = "rpc_pkcs11";
+
+      (* libnames param is used when the proxy is compiled WITHOUT filtering support *)
+      (* syntax is: libnames="<module_name>:<path_to_middleware>;<...>:<...>;"; *)
+      (*
+      libnames="softhsm:/usr/lib/softhsm/libsofthsm2.so;";
+      *)
+
+      (* filter_config is used to supply the filtering configuration when compiled in *)
+      filter_config="/build/src/tests/integration/filter.conf";
+
+      (*************** TLS support begin ***********************)
+      (* use_ssl = false to disable SSL support on server side *)
+      (* use_ssl = true to enable SSL support on server side   *)
+      use_ssl = false;
+
+      (* TLS support for Caml Crush compiled with OCamlnet 4.x *)
+      (* Uncomment to enable TLS when using OCamlnet 4.x *)
+      (*
+      tls {
+        (* Ciphersuites, GnuTLS syntax *)
+        (* TLS 1.2, PFS-only suites, no DSS, no CAMELLIA *)
+        algorithms = "SECURE256:+SECURE128:-VERS-TLS-ALL:+VERS-TLS1.2:-RSA:-DHE-DSS:-CAMELLIA-128-CBC:-CAMELLIA-256-CBC";
+
+        (* Force peer client authentication *)
+        peer_auth = "required";
+
+        (* Uncomment to enable DHE parameters, used for PFS *)
+        (*
+        dh_params {
+          (* Pre-computed DH parameters *)
+          pkcs3_file = "/etc/pkcs11proxyd/dhparams.pem";
+          (* Run-time created DH parameters, warning: this takes a long time *)
+          (*bits = 2048;*)
+        };
+        *)
+        x509 {
+         key {
+           crt_file = "server.pem";
+           key_file = "server.key";
+         };
+         trust {
+           crt_file = "cacert.pem";
+         };
+        }
+      };
+      *)
+
+      (* LEGACY SSL support for Caml Crush <= 1.0.6 or OCamlnet 3.x *)
+      (* OpenSSL cipher syntax, one or many suites can be configured, or alias such as HIGH *)
+      cipher_suite="DHE-RSA-AES128-SHA";
+      (* Provide full certificate chain in cafile *)
+      cafile = "/usr/local/etc/tests/certs/ca.crt";
+      certfile = "/usr/local/etc/tests/certs/server.crt";
+      certkey = "/usr/local/etc/tests/certs/server.key";
+      (* Optional, allows to use DHE cipher suites, generate custom DH paramerters *)
+      dh_params = "/usr/local/etc/tests/certs/dhparams.pem";
+      (* Optional, allows to use ECDHE cipher suites *)
+      ec_curve_name = "prime256v1";
+      (* Optional, allows to use a custom certificate verification depth *)
+      verify_depth = 4;
+
+      (***************TLS support end  *************************)
+
+    };
+    workload_manager {
+      type = "dynamic";
+      max_jobs_per_thread = 1;  (* Everything else is senseless *)
+      min_free_jobs_capacity = 1;
+      max_free_jobs_capacity = 1;
+      max_threads = 100;
+    };
+  }
+}
diff --git a/src/tests/integration/pkcs11proxyd-unix-tls.conf b/src/tests/integration/pkcs11proxyd-unix-tls.conf
new file mode 100644
index 0000000..b1c1122
--- /dev/null
+++ b/src/tests/integration/pkcs11proxyd-unix-tls.conf
@@ -0,0 +1,105 @@
+netplex {
+  controller {
+    max_level = "debug";    (* Log level *)
+
+    (* configure "admin" socket directory, default "/tmp/.netplex" *)
+    (*
+    socket_directory = "/tmp/.netplex";
+    *)
+
+    logging {
+      (* type can either be "stderr", "syslog", "file", "multi_file"
+       * see http://projects.camlcity.org/projects/dl/ocamlnet-3.6/doc/html-main/Netplex_admin.html
+       *)
+      type = "stderr";      (* Log to stderr *)
+    };
+  };
+  service {
+    name = "PKCS#11 Filtering Proxy";
+    (* These parameters can be used to change UID/GID of worker processes *)
+    (*
+    user = "root";
+    group = "root";
+    *)
+
+    (* Do NOT change conn_limit, this would be a serious SECURITY ISSUE *)
+    conn_limit = 1;
+
+    protocol {
+      (* This section creates the socket *)
+      name = "rpc_pkcs11";
+
+      (* OCamlnet 4 support the following to set Unix socket permissions:*)
+      (*
+      local_chmod = "0o777";
+      *)
+
+      (* This section creates the socket *)
+      (* Socket can either be TCP or UNIX *)
+      address {
+        type = "local";
+        path = "/var/run/pkcs11proxyd.socket";
+
+      };
+    };
+    processor {
+      (* This section specifies how to process data of the socket *)
+      type = "rpc_pkcs11";
+
+      (* libnames param is used when the proxy is compiled WITHOUT filtering support *)
+      (* syntax is: libnames="<module_name>:<path_to_middleware>;<...>:<...>;"; *)
+      (*
+      libnames="softhsm:/usr/lib/softhsm/libsofthsm2.so;";
+      *)
+
+      (* filter_config is used to supply the filtering configuration when compiled in *)
+      filter_config="/build/src/tests/integration/filter.conf";
+
+      (*************** TLS support begin ***********************)
+      (* use_ssl = false to disable SSL support on server side *)
+      (* use_ssl = true to enable SSL support on server side   *)
+      use_ssl = true;
+
+      (* TLS support for Caml Crush compiled with OCamlnet 4.x *)
+      (* Uncomment to enable TLS when using OCamlnet 4.x *)
+
+      tls {
+        (* Ciphersuites, GnuTLS syntax *)
+        (* TLS 1.2, PFS-only suites, no DSS, no CAMELLIA *)
+        algorithms = "SECURE256:+SECURE128:-VERS-TLS-ALL:+VERS-TLS1.2:-RSA:-DHE-DSS:-CAMELLIA-128-CBC:-CAMELLIA-256-CBC";
+
+        (* Force peer client authentication *)
+        peer_auth = "required";
+
+        (* Uncomment to enable DHE parameters, used for PFS *)
+        (*
+        dh_params {
+          (* Pre-computed DH parameters *)
+          pkcs3_file = "/etc/pkcs11proxyd/dhparams.pem";
+          (* Run-time created DH parameters, warning: this takes a long time *)
+          (*bits = 2048;*)
+        };
+        *)
+        x509 {
+         key {
+           crt_file = "server.pem";
+           key_file = "server-key.pem";
+         };
+         trust {
+           crt_file = "ca.pem";
+         };
+        }
+      };
+
+      (***************TLS support end  *************************)
+
+    };
+    workload_manager {
+      type = "dynamic";
+      max_jobs_per_thread = 1;  (* Everything else is senseless *)
+      min_free_jobs_capacity = 1;
+      max_free_jobs_capacity = 1;
+      max_threads = 100;
+    };
+  }
+}
diff --git a/src/tests/integration/pkcs11proxyd-unix.conf b/src/tests/integration/pkcs11proxyd-unix.conf
new file mode 100644
index 0000000..ff30c91
--- /dev/null
+++ b/src/tests/integration/pkcs11proxyd-unix.conf
@@ -0,0 +1,119 @@
+netplex {
+  controller {
+    max_level = "debug";    (* Log level *)
+
+    (* configure "admin" socket directory, default "/tmp/.netplex" *)
+    (*
+    socket_directory = "/tmp/.netplex";
+    *)
+
+    logging {
+      (* type can either be "stderr", "syslog", "file", "multi_file"
+       * see http://projects.camlcity.org/projects/dl/ocamlnet-3.6/doc/html-main/Netplex_admin.html
+       *)
+      type = "stderr";      (* Log to stderr *)
+    };
+  };
+  service {
+    name = "PKCS#11 Filtering Proxy";
+    (* These parameters can be used to change UID/GID of worker processes *)
+    (*
+    user = "root";
+    group = "root";
+    *)
+
+    (* Do NOT change conn_limit, this would be a serious SECURITY ISSUE *)
+    conn_limit = 1;
+
+    protocol {
+      (* This section creates the socket *)
+      name = "rpc_pkcs11";
+
+      (* OCamlnet 4 support the following to set Unix socket permissions:*)
+      (*
+      local_chmod = "0o777";
+      *)
+
+      (* This section creates the socket *)
+      (* Socket can either be TCP or UNIX *)
+      address {
+        type = "local";
+        path = "/var/run/pkcs11proxyd.socket";
+      };
+    };
+    processor {
+      (* This section specifies how to process data of the socket *)
+      type = "rpc_pkcs11";
+
+      (* libnames param is used when the proxy is compiled WITHOUT filtering support *)
+      (* syntax is: libnames="<module_name>:<path_to_middleware>;<...>:<...>;"; *)
+      (*
+      libnames="softhsm:/usr/lib/softhsm/libsofthsm2.so;";
+      *)
+
+      (* filter_config is used to supply the filtering configuration when compiled in *)
+      filter_config="/build/src/tests/integration/filter.conf";
+
+      (*************** TLS support begin ***********************)
+      (* use_ssl = false to disable SSL support on server side *)
+      (* use_ssl = true to enable SSL support on server side   *)
+      use_ssl = false;
+
+      (* TLS support for Caml Crush compiled with OCamlnet 4.x *)
+      (* Uncomment to enable TLS when using OCamlnet 4.x *)
+      (*
+      tls {
+        (* Ciphersuites, GnuTLS syntax *)
+        (* TLS 1.2, PFS-only suites, no DSS, no CAMELLIA *)
+        algorithms = "SECURE256:+SECURE128:-VERS-TLS-ALL:+VERS-TLS1.2:-RSA:-DHE-DSS:-CAMELLIA-128-CBC:-CAMELLIA-256-CBC";
+
+        (* Force peer client authentication *)
+        peer_auth = "required";
+
+        (* Uncomment to enable DHE parameters, used for PFS *)
+        (*
+        dh_params {
+          (* Pre-computed DH parameters *)
+          pkcs3_file = "/etc/pkcs11proxyd/dhparams.pem";
+          (* Run-time created DH parameters, warning: this takes a long time *)
+          (*bits = 2048;*)
+        };
+        *)
+        x509 {
+         key {
+           crt_file = "server.pem";
+           key_file = "server.key";
+         };
+         trust {
+           crt_file = "cacert.pem";
+         };
+        }
+      };
+      *)
+
+      (* LEGACY SSL support for Caml Crush <= 1.0.6 or OCamlnet 3.x *)
+      (* OpenSSL cipher syntax, one or many suites can be configured, or alias such as HIGH *)
+      cipher_suite="DHE-RSA-AES128-SHA";
+      (* Provide full certificate chain in cafile *)
+      cafile = "/usr/local/etc/tests/certs/ca.crt";
+      certfile = "/usr/local/etc/tests/certs/server.crt";
+      certkey = "/usr/local/etc/tests/certs/server.key";
+      (* Optional, allows to use DHE cipher suites, generate custom DH paramerters *)
+      dh_params = "/usr/local/etc/tests/certs/dhparams.pem";
+      (* Optional, allows to use ECDHE cipher suites *)
+      ec_curve_name = "prime256v1";
+      (* Optional, allows to use a custom certificate verification depth *)
+      verify_depth = 4;
+
+      (***************TLS support end  *************************)
+
+    };
+    workload_manager {
+      type = "dynamic";
+      max_jobs_per_thread = 1;  (* Everything else is senseless *)
+      min_free_jobs_capacity = 1;
+      max_free_jobs_capacity = 1;
+      max_threads = 100;
+    };
+  }
+}
diff --git a/src/tests/integration/run-tests.sh b/src/tests/integration/run-tests.sh
new file mode 100755
index 0000000..92da590
--- /dev/null
+++ b/src/tests/integration/run-tests.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+pkcs11-tool --module /usr/local/lib/caml-crush/libp11clientfoo.so -t --pin 1234
\ No newline at end of file
diff --git a/src/tests/integration/wait-for-it.sh b/src/tests/integration/wait-for-it.sh
new file mode 100755
index 0000000..d990e0d
--- /dev/null
+++ b/src/tests/integration/wait-for-it.sh
@@ -0,0 +1,182 @@
+#!/usr/bin/env bash
+# Use this script to test if a given TCP host/port are available
+
+WAITFORIT_cmdname=${0##*/}
+
+echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
+
+usage()
+{
+    cat << USAGE >&2
+Usage:
+    $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args]
+    -h HOST | --host=HOST       Host or IP under test
+    -p PORT | --port=PORT       TCP port under test
+                                Alternatively, you specify the host and port as host:port
+    -s | --strict               Only execute subcommand if the test succeeds
+    -q | --quiet                Don't output any status messages
+    -t TIMEOUT | --timeout=TIMEOUT
+                                Timeout in seconds, zero for no timeout
+    -- COMMAND ARGS             Execute command with args after the test finishes
+USAGE
+    exit 1
+}
+
+wait_for()
+{
+    if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
+        echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
+    else
+        echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout"
+    fi
+    WAITFORIT_start_ts=$(date +%s)
+    while :
+    do
+        if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then
+            nc -z $WAITFORIT_HOST $WAITFORIT_PORT
+            WAITFORIT_result=$?
+        else
+            (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
+            WAITFORIT_result=$?
+        fi
+        if [[ $WAITFORIT_result -eq 0 ]]; then
+            WAITFORIT_end_ts=$(date +%s)
+            echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds"
+            break
+        fi
+        sleep 1
+    done
+    return $WAITFORIT_result
+}
+
+wait_for_wrapper()
+{
+    # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
+    if [[ $WAITFORIT_QUIET -eq 1 ]]; then
+        timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
+    else
+        timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
+    fi
+    WAITFORIT_PID=$!
+    trap "kill -INT -$WAITFORIT_PID" INT
+    wait $WAITFORIT_PID
+    WAITFORIT_RESULT=$?
+    if [[ $WAITFORIT_RESULT -ne 0 ]]; then
+        echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
+    fi
+    return $WAITFORIT_RESULT
+}
+
+# process arguments
+while [[ $# -gt 0 ]]
+do
+    case "$1" in
+        *:* )
+        WAITFORIT_hostport=(${1//:/ })
+        WAITFORIT_HOST=${WAITFORIT_hostport[0]}
+        WAITFORIT_PORT=${WAITFORIT_hostport[1]}
+        shift 1
+        ;;
+        --child)
+        WAITFORIT_CHILD=1
+        shift 1
+        ;;
+        -q | --quiet)
+        WAITFORIT_QUIET=1
+        shift 1
+        ;;
+        -s | --strict)
+        WAITFORIT_STRICT=1
+        shift 1
+        ;;
+        -h)
+        WAITFORIT_HOST="$2"
+        if [[ $WAITFORIT_HOST == "" ]]; then break; fi
+        shift 2
+        ;;
+        --host=*)
+        WAITFORIT_HOST="${1#*=}"
+        shift 1
+        ;;
+        -p)
+        WAITFORIT_PORT="$2"
+        if [[ $WAITFORIT_PORT == "" ]]; then break; fi
+        shift 2
+        ;;
+        --port=*)
+        WAITFORIT_PORT="${1#*=}"
+        shift 1
+        ;;
+        -t)
+        WAITFORIT_TIMEOUT="$2"
+        if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi
+        shift 2
+        ;;
+        --timeout=*)
+        WAITFORIT_TIMEOUT="${1#*=}"
+        shift 1
+        ;;
+        --)
+        shift
+        WAITFORIT_CLI=("$@")
+        break
+        ;;
+        --help)
+        usage
+        ;;
+        *)
+        echoerr "Unknown argument: $1"
+        usage
+        ;;
+    esac
+done
+
+if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then
+    echoerr "Error: you need to provide a host and port to test."
+    usage
+fi
+
+WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15}
+WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
+WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
+WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
+
+# Check to see if timeout is from busybox?
+WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
+WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
+
+WAITFORIT_BUSYTIMEFLAG=""
+if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
+    WAITFORIT_ISBUSY=1
+    # Check if busybox timeout uses -t flag
+    # (recent Alpine versions don't support -t anymore)
+    if timeout &>/dev/stdout | grep -q -e '-t '; then
+        WAITFORIT_BUSYTIMEFLAG="-t"
+    fi
+else
+    WAITFORIT_ISBUSY=0
+fi
+
+if [[ $WAITFORIT_CHILD -gt 0 ]]; then
+    wait_for
+    WAITFORIT_RESULT=$?
+    exit $WAITFORIT_RESULT
+else
+    if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
+        wait_for_wrapper
+        WAITFORIT_RESULT=$?
+    else
+        wait_for
+        WAITFORIT_RESULT=$?
+    fi
+fi
+
+if [[ $WAITFORIT_CLI != "" ]]; then
+    if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then
+        echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess"
+        exit $WAITFORIT_RESULT
+    fi
+    exec "${WAITFORIT_CLI[@]}"
+else
+    exit $WAITFORIT_RESULT
+fi
diff --git a/src/tests/ocaml/Makefile.in b/src/tests/ocaml/Makefile.in
index 8106cf6..e266fd8 100644
--- a/src/tests/ocaml/Makefile.in
+++ b/src/tests/ocaml/Makefile.in
@@ -8,46 +8,46 @@ build_bindings_standalone:
 	cd $(bindings_dir) && make -f Makefile.standalone && cd -
 
 p11_common:
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c p11_common.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c p11_common.ml
 
 p11_for_generic:
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c p11_for_generic.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c p11_for_generic.ml
 
 complete_test:
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c test_pkcs11.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c test_pkcs11.ml
 	ocamlfind ocamlopt -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx test_pkcs11.cmx $(LDFLAGS) -o pkcs11.opt
 
 destroy_objects:
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c destroy.ml
-	ocamlfind ocamlopt -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx destroy.cmx $(LDFLAGS) -o destroy_objects.opt
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c destroy.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx destroy.cmx $(LDFLAGS) -o destroy_objects.opt
 
 digest_test:
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c digest_test.ml
-	ocamlfind ocamlopt -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx digest_test.cmx $(LDFLAGS) -o digest_test.opt
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c digest_test.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx digest_test.cmx $(LDFLAGS) -o digest_test.opt
 
 encdec_test:
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c encdec_test.ml
-	ocamlfind ocamlopt -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx encdec_test.cmx $(LDFLAGS) -o encdec_test.opt
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c encdec_test.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx encdec_test.cmx $(LDFLAGS) -o encdec_test.opt
 
 wrap_unwrap_test:
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c wrap_unwrap.ml
-	ocamlfind ocamlopt -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx wrap_unwrap.cmx $(LDFLAGS) -o wrap_unwrap_test.opt
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c wrap_unwrap.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx wrap_unwrap.cmx $(LDFLAGS) -o wrap_unwrap_test.opt
 
 generic_scenario: build_bindings_standalone p11_common p11_for_generic
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c get_sensitive_key.ml 
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c sensitive_is_sticky.ml 
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c extractable_is_sticky.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c encrypt_and_unwrap.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c misc_scenario.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c double_unwrap.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c wrap_and_decrypt_1.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c wrap_and_decrypt_2.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c wrap_and_decrypt_3.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c wrap_and_decrypt_4.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c create_object_1.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c create_object_2.ml
-	ocamlfind ocamlopt -package "config-file" $(CFLAGS) -c generic_scenario.ml
-	ocamlfind ocamlopt -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx p11_for_generic.cmx get_sensitive_key.cmx sensitive_is_sticky.cmx extractable_is_sticky.cmx encrypt_and_unwrap.cmx misc_scenario.cmx double_unwrap.cmx wrap_and_decrypt_1.cmx wrap_and_decrypt_2.cmx wrap_and_decrypt_3.cmx wrap_and_decrypt_4.cmx create_object_1.cmx create_object_2.cmx generic_scenario.cmx $(LDFLAGS) -o generic_scenario.opt
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c get_sensitive_key.ml 
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c sensitive_is_sticky.ml 
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c extractable_is_sticky.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c encrypt_and_unwrap.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c misc_scenario.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c double_unwrap.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c wrap_and_decrypt_1.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c wrap_and_decrypt_2.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c wrap_and_decrypt_3.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c wrap_and_decrypt_4.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c create_object_1.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c create_object_2.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" $(CFLAGS) -c generic_scenario.ml
+	ocamlfind ocamlopt @ocaml_options@ -package "config-file" -linkpkg $(bindings_dir)/pkcs11_standalone.cmxa p11_common.cmx p11_for_generic.cmx get_sensitive_key.cmx sensitive_is_sticky.cmx extractable_is_sticky.cmx encrypt_and_unwrap.cmx misc_scenario.cmx double_unwrap.cmx wrap_and_decrypt_1.cmx wrap_and_decrypt_2.cmx wrap_and_decrypt_3.cmx wrap_and_decrypt_4.cmx create_object_1.cmx create_object_2.cmx generic_scenario.cmx $(LDFLAGS) -o generic_scenario.opt
 
 
 clean:
diff --git a/src/tests/ocaml/create_object_1.ml b/src/tests/ocaml/create_object_1.ml
index d366b4c..ceb6c53 100644
--- a/src/tests/ocaml/create_object_1.ml
+++ b/src/tests/ocaml/create_object_1.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/create_object_2.ml b/src/tests/ocaml/create_object_2.ml
index 7641ee6..eff4c41 100644
--- a/src/tests/ocaml/create_object_2.ml
+++ b/src/tests/ocaml/create_object_2.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/destroy.ml b/src/tests/ocaml/destroy.ml
index 0700b18..ea62727 100644
--- a/src/tests/ocaml/destroy.ml
+++ b/src/tests/ocaml/destroy.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/digest_test.ml b/src/tests/ocaml/digest_test.ml
index cb332e1..c42a92b 100644
--- a/src/tests/ocaml/digest_test.ml
+++ b/src/tests/ocaml/digest_test.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/double_unwrap.ml b/src/tests/ocaml/double_unwrap.ml
index b9ab164..43e023d 100644
--- a/src/tests/ocaml/double_unwrap.ml
+++ b/src/tests/ocaml/double_unwrap.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/encdec_test.ml b/src/tests/ocaml/encdec_test.ml
index a1d0392..7ff1756 100644
--- a/src/tests/ocaml/encdec_test.ml
+++ b/src/tests/ocaml/encdec_test.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/encrypt_and_unwrap.ml b/src/tests/ocaml/encrypt_and_unwrap.ml
index 8bba537..989ffde 100644
--- a/src/tests/ocaml/encrypt_and_unwrap.ml
+++ b/src/tests/ocaml/encrypt_and_unwrap.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/extractable_is_sticky.ml b/src/tests/ocaml/extractable_is_sticky.ml
index 32267e0..14aa408 100644
--- a/src/tests/ocaml/extractable_is_sticky.ml
+++ b/src/tests/ocaml/extractable_is_sticky.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/generic_scenario.ml b/src/tests/ocaml/generic_scenario.ml
index a29ce1d..1cf5e8d 100644
--- a/src/tests/ocaml/generic_scenario.ml
+++ b/src/tests/ocaml/generic_scenario.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/get_sensitive_key.ml b/src/tests/ocaml/get_sensitive_key.ml
index ae83836..122bb73 100644
--- a/src/tests/ocaml/get_sensitive_key.ml
+++ b/src/tests/ocaml/get_sensitive_key.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/misc_scenario.ml b/src/tests/ocaml/misc_scenario.ml
index d4b679a..c93cd32 100644
--- a/src/tests/ocaml/misc_scenario.ml
+++ b/src/tests/ocaml/misc_scenario.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/p11_common.ml b/src/tests/ocaml/p11_common.ml
index 8ffe7bb..f00a478 100644
--- a/src/tests/ocaml/p11_common.ml
+++ b/src/tests/ocaml/p11_common.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
@@ -75,7 +75,6 @@ exception C_FinalizeError
 exception C_GetInfoError
 exception C_WaitForSlotEventError
 exception C_GetSlotListError
-exception C_GetSlotListError
 exception C_GetSlotInfoError
 exception C_GetTokenInfoError
 exception C_OpenSessionError
@@ -85,13 +84,9 @@ exception C_GetSessionInfoError
 exception C_LoginError
 exception C_LogoutError
 exception C_GetMechanismListError
-exception C_GetMechanismListError
 exception C_GetMechanismInfoError
 exception C_InitTokenError
-exception C_InitTokenError
 exception C_InitPINError
-exception C_InitPINError
-exception C_SetPINError
 exception C_SetPINError
 exception C_SeedRandomError
 exception C_GenerateRandomError
@@ -129,30 +124,18 @@ exception C_VerifyUpdateError
 exception C_VerifyFinalError
 exception C_EncryptInitError
 exception C_EncryptError
-exception C_EncryptError
-exception C_EncryptUpdateError
 exception C_EncryptUpdateError
 exception C_DigestEncryptUpdateError
-exception C_DigestEncryptUpdateError
-exception C_SignEncryptUpdateError
 exception C_SignEncryptUpdateError
 exception C_EncryptFinalError
-exception C_EncryptFinalError
 exception C_DecryptInitError
-exception C_DecryptError
-exception C_DecryptError
-exception C_DecryptUpdateError
 exception C_DecryptUpdateError
 exception C_DecryptFinalError
-exception C_DecryptFinalError
-exception C_DecryptDigestUpdateError
 exception C_DecryptDigestUpdateError
 exception C_DecryptVerifyUpdateError
-exception C_DecryptVerifyUpdateError
 exception C_GetFunctionStatusError
 exception C_CancelFunctionError
 exception C_GetOperationStateError
-exception C_GetOperationStateError
 exception C_SetOperationStateError
 
 exception UnsupportedRSAKeySize
diff --git a/src/tests/ocaml/p11_for_generic.ml b/src/tests/ocaml/p11_for_generic.ml
index 61a2833..27e8d8a 100644
--- a/src/tests/ocaml/p11_for_generic.ml
+++ b/src/tests/ocaml/p11_for_generic.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/sensitive_is_sticky.ml b/src/tests/ocaml/sensitive_is_sticky.ml
index b5c7427..5fdaa47 100644
--- a/src/tests/ocaml/sensitive_is_sticky.ml
+++ b/src/tests/ocaml/sensitive_is_sticky.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/test_pkcs11.ml b/src/tests/ocaml/test_pkcs11.ml
index bb4ece9..d577faa 100644
--- a/src/tests/ocaml/test_pkcs11.ml
+++ b/src/tests/ocaml/test_pkcs11.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/wrap_and_decrypt_1.ml b/src/tests/ocaml/wrap_and_decrypt_1.ml
index 06adf71..fcd3db3 100644
--- a/src/tests/ocaml/wrap_and_decrypt_1.ml
+++ b/src/tests/ocaml/wrap_and_decrypt_1.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/wrap_and_decrypt_2.ml b/src/tests/ocaml/wrap_and_decrypt_2.ml
index 191853d..4009be4 100644
--- a/src/tests/ocaml/wrap_and_decrypt_2.ml
+++ b/src/tests/ocaml/wrap_and_decrypt_2.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/wrap_and_decrypt_3.ml b/src/tests/ocaml/wrap_and_decrypt_3.ml
index 4d6f6d7..aaddafb 100644
--- a/src/tests/ocaml/wrap_and_decrypt_3.ml
+++ b/src/tests/ocaml/wrap_and_decrypt_3.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/wrap_and_decrypt_4.ml b/src/tests/ocaml/wrap_and_decrypt_4.ml
index defe649..fa4f194 100644
--- a/src/tests/ocaml/wrap_and_decrypt_4.ml
+++ b/src/tests/ocaml/wrap_and_decrypt_4.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement
diff --git a/src/tests/ocaml/wrap_unwrap.ml b/src/tests/ocaml/wrap_unwrap.ml
index 10cd98d..f132277 100644
--- a/src/tests/ocaml/wrap_unwrap.ml
+++ b/src/tests/ocaml/wrap_unwrap.ml
@@ -1,7 +1,7 @@
 (************************* MIT License HEADER ************************************
     Copyright ANSSI (2013-2015)
-    Contributors : Ryad BENADJILA [ryad.benadjila@ssi.gouv.fr],
-    Thomas CALDERON [thomas.calderon@ssi.gouv.fr]
+    Contributors : Ryad BENADJILA [ryadbenadjila@gmail.com],
+    Thomas CALDERON [calderon.thomas@gmail.com]
     Marion DAUBIGNARD [marion.daubignard@ssi.gouv.fr]
 
     This software is a computer program whose purpose is to implement