TLS utility functions.
More...
#include "utils.h"
#include <openssl/ssl.h>
Go to the source code of this file.
TLS utility functions.
- Id
- 2b3eebd4e0bbeb0f2a97b9b4e9976accc6d9dd64
- Copyright
- 2018 The FreeRADIUS server project
Definition in file utils.c.
◆ fr_tls_utils_asn1time_to_epoch()
int fr_tls_utils_asn1time_to_epoch |
( |
time_t * |
out, |
|
|
ASN1_TIME const * |
asn1 |
|
) |
| |
Convert OpenSSL's ASN1_TIME to an epoch time.
- Parameters
-
[out] | out | Where to write the time_t. |
[in] | asn1 | The ASN1_TIME to convert. |
- Returns
- 0 success.
- -1 on failure.
Definition at line 115 of file utils.c.
◆ fr_tls_utils_keyblock_size_get()
int fr_tls_utils_keyblock_size_get |
( |
request_t * |
request, |
|
|
SSL * |
ssl |
|
) |
| |
Returns the OpenSSL keyblock size.
- Copyright
- (c) 2002-2016, Jouni Malinen (j@w1..nosp@m.fi) and contributors All Rights Reserved.
These programs are licensed under the BSD license (the one with advertisement clause removed).
this function shamelessly stolen from from hostap:src/crypto/tls_openssl.c:openssl_get_keyblock_size()
- Parameters
-
[in] | request | The current request. |
[in] | ssl | The current SSL session. |
- Returns
- -1 problem with the session.
- >=0 length of the block.
Definition at line 80 of file utils.c.
◆ fr_tls_utils_x509_pkey_type()
char const* fr_tls_utils_x509_pkey_type |
( |
X509 * |
cert | ) |
|
Returns a friendly identifier for the public key type of a certificate.
- Parameters
-
[in] | cert | The X509 cert to return the type of. |
- Returns
- the type string.
Definition at line 45 of file utils.c.
◆ fr_utils_get_private_key_password()
int fr_utils_get_private_key_password |
( |
char * |
buf, |
|
|
int |
size, |
|
|
UNUSED int |
rwflag, |
|
|
void * |
u |
|
) |
| |
Return the static private key password we have configured.
- Note
- This is used as a callback to OpenSSL's PEM_read_PrivateKey function.
- Parameters
-
[out] | buf | Where to write the password to. |
[in] | size | The length of buf. |
[in] | rwflag |
- 0 if password used for decryption.
- 1 if password used for encryption.
|
[in] | u | The static password. |
- Returns
- 0 on error.
- >0 on success (the length of the password).
Definition at line 190 of file utils.c.
◆ pkey_types
Initial value:= {
{
L(
"DH"), EVP_PKEY_DH },
{
L(
"DSA"), EVP_PKEY_DSA },
{
L(
"EC"), EVP_PKEY_EC },
{
L(
"RSA"), EVP_PKEY_RSA }
}
#define L(_str)
Helper for initialising arrays of string literals.
PKEY types (friendly names)
Definition at line 32 of file utils.c.
◆ pkey_types_len