forked from SUNET/pkcs11-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gck-rpc-tls-psk.h
36 lines (27 loc) · 962 Bytes
/
gck-rpc-tls-psk.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
#ifndef GCKRPC_TLS_PSK_H_
#define GCKRPC_TLS_PSK_H_
#include "openssl/bio.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
#if OPENSSL_VERSION_NUMBER < 0x10000000
# error "OpenSSL version >= 1.0.0 required"
#endif
enum gck_rpc_tls_psk_caller {
GCK_RPC_TLS_PSK_CLIENT,
GCK_RPC_TLS_PSK_SERVER
};
typedef struct {
int initialized;
SSL_CTX *ssl_ctx;
BIO *bio;
SSL *ssl;
enum gck_rpc_tls_psk_caller type;
} GckRpcTlsPskState;
int gck_rpc_init_tls_psk(GckRpcTlsPskState *state, const char *key_filename,
const char *identity, enum gck_rpc_tls_psk_caller caller);
int gck_rpc_start_tls(GckRpcTlsPskState *state, int sock);
int gck_rpc_tls_write_all(GckRpcTlsPskState *state, void *data, unsigned int len);
int gck_rpc_tls_read_all(GckRpcTlsPskState *state, void *data, unsigned int len);
void gck_rpc_close_tls(GckRpcTlsPskState *state);
#endif /* GCKRPC_TLS_PSK_H_ */