The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions | Variables
utils.c File Reference

TLS utility functions. More...

#include "utils.h"
#include <openssl/ssl.h>
+ Include dependency graph for utils.c:

Go to the source code of this file.

Functions

int fr_tls_utils_asn1time_to_epoch (time_t *out, ASN1_TIME const *asn1)
 Convert OpenSSL's ASN1_TIME to an epoch time. More...
 
int fr_tls_utils_keyblock_size_get (request_t *request, SSL *ssl)
 Returns the OpenSSL keyblock size. More...
 
char const * fr_tls_utils_x509_pkey_type (X509 *cert)
 Returns a friendly identifier for the public key type of a certificate. More...
 

Variables

static fr_table_num_sorted_t const pkey_types []
 PKEY types (friendly names) More...
 
static size_t pkey_types_len = NUM_ELEMENTS(pkey_types)
 

Detailed Description

TLS utility functions.

Id
1f447f7748c1a1f176d4c62737e1ca9800a3b31e

Definition in file utils.c.

Function Documentation

◆ 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]outWhere to write the time_t.
[in]asn1The 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.

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]requestThe current request.
[in]sslThe current SSL session.
Returns
  • -1 problem with the session.
  • >=0 length of the block.

Definition at line 80 of file utils.c.

+ Here is the caller graph for this function:

◆ 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]certThe X509 cert to return the type of.
Returns
the type string.

Definition at line 45 of file utils.c.

Variable Documentation

◆ pkey_types

fr_table_num_sorted_t const pkey_types[]
static
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.
Definition: build.h:207

PKEY types (friendly names)

Definition at line 32 of file utils.c.

◆ pkey_types_len

size_t pkey_types_len = NUM_ELEMENTS(pkey_types)
static

Definition at line 38 of file utils.c.