summaryrefslogtreecommitdiff
path: root/src/openvpn/pkcs11.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvpn/pkcs11.c')
-rw-r--r--src/openvpn/pkcs11.c73
1 files changed, 26 insertions, 47 deletions
diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
index 6041828..6858846 100644
--- a/src/openvpn/pkcs11.c
+++ b/src/openvpn/pkcs11.c
@@ -16,9 +16,10 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
@@ -44,24 +45,21 @@
static
time_t
-__mytime(void)
-{
+__mytime(void) {
return openvpn_time(NULL);
}
#if !defined(_WIN32)
static
int
-__mygettimeofday(struct timeval *tv)
-{
+__mygettimeofday(struct timeval *tv) {
return gettimeofday(tv, NULL);
}
#endif
static
void
-__mysleep(const unsigned long usec)
-{
+__mysleep(const unsigned long usec) {
#if defined(_WIN32)
Sleep(usec/1000);
#else
@@ -86,12 +84,10 @@ static
unsigned
_pkcs11_msg_pkcs112openvpn(
const unsigned flags
- )
-{
+ ) {
unsigned openvpn_flags;
- switch (flags)
- {
+ switch (flags) {
case PKCS11H_LOG_DEBUG2:
openvpn_flags = D_PKCS11_DEBUG;
break;
@@ -128,8 +124,7 @@ static
unsigned
_pkcs11_msg_openvpn2pkcs11(
const unsigned flags
- )
-{
+ ) {
unsigned pkcs11_flags;
if ((flags & D_PKCS11_DEBUG) != 0)
@@ -171,8 +166,7 @@ _pkcs11_openvpn_log(
unsigned flags,
const char *const szFormat,
va_list args
- )
-{
+ ) {
char Buffer[10*1024];
(void)global_data;
@@ -190,8 +184,7 @@ _pkcs11_openvpn_token_prompt(
void *const user_data,
const pkcs11h_token_id_t token,
const unsigned retry
- )
-{
+ ) {
struct user_pass token_resp;
(void)global_data;
@@ -236,8 +229,7 @@ _pkcs11_openvpn_pin_prompt(
const unsigned retry,
char *const pin,
const size_t pin_max
- )
-{
+ ) {
struct user_pass token_pass;
char prompt[1024];
@@ -283,8 +275,7 @@ bool
pkcs11_initialize(
const bool protected_auth,
const int nPINCachePeriod
- )
-{
+ ) {
CK_RV rv = CKR_FUNCTION_FAILED;
dmsg(
@@ -356,8 +347,7 @@ cleanup:
}
void
-pkcs11_terminate()
-{
+pkcs11_terminate() {
dmsg(
D_PKCS11_DEBUG,
"PKCS#11: pkcs11_terminate - entered"
@@ -377,8 +367,7 @@ pkcs11_addProvider(
const bool protected_auth,
const unsigned private_mode,
const bool cert_private
- )
-{
+ ) {
CK_RV rv = CKR_OK;
ASSERT(provider!=NULL);
@@ -422,14 +411,12 @@ pkcs11_addProvider(
}
int
-pkcs11_logout()
-{
+pkcs11_logout() {
return pkcs11h_logout() == CKR_OK;
}
int
-pkcs11_management_id_count()
-{
+pkcs11_management_id_count() {
pkcs11h_certificate_id_list_t id_list = NULL;
pkcs11h_certificate_id_list_t t = NULL;
CK_RV rv = CKR_OK;
@@ -454,8 +441,7 @@ pkcs11_management_id_count()
goto cleanup;
}
- for (count = 0, t = id_list; t != NULL; t = t->next)
- {
+ for (count = 0, t = id_list; t != NULL; t = t->next) {
count++;
}
@@ -481,8 +467,7 @@ pkcs11_management_id_get(
const int index,
char **id,
char **base64
- )
-{
+ ) {
pkcs11h_certificate_id_list_t id_list = NULL;
pkcs11h_certificate_id_list_t entry = NULL;
#if 0 /* certificate_id seems to be unused -- JY */
@@ -526,8 +511,7 @@ pkcs11_management_id_get(
entry = id_list;
count = 0;
- while (entry != NULL && count != index)
- {
+ while (entry != NULL && count != index) {
count++;
entry = entry->next;
}
@@ -669,8 +653,7 @@ tls_ctx_use_pkcs11(
struct tls_root_ctx *const ssl_ctx,
bool pkcs11_id_management,
const char *const pkcs11_id
- )
-{
+ ) {
pkcs11h_certificate_id_t certificate_id = NULL;
pkcs11h_certificate_t certificate = NULL;
CK_RV rv = CKR_OK;
@@ -801,8 +784,7 @@ _pkcs11_openvpn_show_pkcs11_ids_pin_prompt(
const unsigned retry,
char *const pin,
const size_t pin_max
- )
-{
+ ) {
struct gc_arena gc = gc_new();
struct buffer pass_prompt = alloc_buf_gc(128, &gc);
@@ -835,8 +817,7 @@ void
show_pkcs11_ids(
const char *const provider,
bool cert_private
- )
-{
+ ) {
struct gc_arena gc = gc_new();
pkcs11h_certificate_id_list_t user_certificates = NULL;
pkcs11h_certificate_id_list_t current = NULL;
@@ -907,8 +888,7 @@ show_pkcs11_ids(
"--pkcs11-id option please remember to use single quote mark.\n"
)
);
- for (current = user_certificates; current != NULL; current = current->next)
- {
+ for (current = user_certificates; current != NULL; current = current->next) {
pkcs11h_certificate_t certificate = NULL;
char *dn = NULL;
char serial[1024] = {0};
@@ -1026,8 +1006,7 @@ cleanup:
#else /* if defined(ENABLE_PKCS11) */
#ifdef _MSC_VER /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
static void
-dummy(void)
-{
+dummy(void) {
}
#endif
#endif /* ENABLE_PKCS11 */