FreeRDP
libfreerdp/crypto/crypto.c File Reference
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/crypto.h>
#include <freerdp/log.h>
#include <freerdp/crypto/crypto.h>

Macros

#define TAG   FREERDP_TAG("crypto")
 
#define GEN_ALL   (-1)
 

Typedefs

typedef int(* general_name_mapper_pr) (GENERAL_NAME *name, void *data, int index, int count)
 

Functions

CryptoCert crypto_cert_read (const BYTE *data, UINT32 length)
 
CryptoCert crypto_cert_pem_read (const char *data)
 
void crypto_cert_free (CryptoCert cert)
 
BOOL crypto_cert_get_public_key (CryptoCert cert, BYTE **PublicKey, DWORD *PublicKeyLength)
 
static SSIZE_T crypto_rsa_common (const BYTE *input, size_t length, UINT32 key_length, const BYTE *modulus, const BYTE *exponent, size_t exponent_size, BYTE *output)
 
static int crypto_rsa_public (const BYTE *input, size_t length, size_t key_length, const BYTE *modulus, const BYTE *exponent, BYTE *output)
 
static int crypto_rsa_private (const BYTE *input, size_t length, size_t key_length, const BYTE *modulus, const BYTE *private_exponent, BYTE *output)
 
SSIZE_T crypto_rsa_public_encrypt (const BYTE *input, size_t length, size_t key_length, const BYTE *modulus, const BYTE *exponent, BYTE *output)
 
SSIZE_T crypto_rsa_public_decrypt (const BYTE *input, size_t length, size_t key_length, const BYTE *modulus, const BYTE *exponent, BYTE *output)
 
SSIZE_T crypto_rsa_private_encrypt (const BYTE *input, size_t length, size_t key_length, const BYTE *modulus, const BYTE *private_exponent, BYTE *output)
 
SSIZE_T crypto_rsa_private_decrypt (const BYTE *input, size_t length, size_t key_length, const BYTE *modulus, const BYTE *private_exponent, BYTE *output)
 
void crypto_reverse (BYTE *data, size_t length)
 
char * crypto_cert_fingerprint (X509 *xcert)
 
BYTEcrypto_cert_hash (X509 *xcert, const char *hash, UINT32 *length)
 
char * crypto_cert_fingerprint_by_hash (X509 *xcert, const char *hash)
 
char * crypto_cert_fingerprint_by_hash_ex (X509 *xcert, const char *hash, BOOL separator)
 
static char * crypto_print_name (X509_NAME *name)
 
char * crypto_cert_subject (X509 *xcert)
 
char * crypto_cert_subject_common_name (X509 *xcert, int *length)
 
static const char * general_name_type_label (int general_name_type)
 
static void map_subject_alt_name (X509 *x509, int general_name_type, general_name_mapper_pr mapper, void *data)
 
static void string_list_initialize (string_list *list)
 
static void string_list_allocate (string_list *list, int allocate_count)
 
static void string_list_free (string_list *list)
 
static int extract_string (GENERAL_NAME *name, void *data, int index, int count)
 
static void object_list_initialize (object_list *list)
 
static void object_list_allocate (object_list *list, int allocate_count)
 
static char * object_string (ASN1_TYPE *object)
 
static void object_list_free (object_list *list)
 
static int extract_othername_object_as_string (GENERAL_NAME *name, void *data, int index, int count)
 
char * crypto_cert_get_email (X509 *x509)
 
char * crypto_cert_get_upn (X509 *x509)
 
void crypto_cert_subject_alt_name_free (int count, int *lengths, char **alt_names)
 
void crypto_cert_dns_names_free (int count, int *lengths, char **dns_names)
 
char ** crypto_cert_subject_alt_name (X509 *xcert, int *count, int **lengths)
 
char ** crypto_cert_get_dns_names (X509 *x509, int *count, int **lengths)
 
char * crypto_cert_issuer (X509 *xcert)
 
static int verify_cb (int ok, X509_STORE_CTX *csc)
 
BOOL x509_verify_certificate (CryptoCert cert, const char *certificate_store_path)
 
rdpCertificateData * crypto_get_certificate_data (X509 *xcert, const char *hostname, UINT16 port)
 
void crypto_cert_print_info (X509 *xcert)
 
BYTEcrypto_cert_pem (X509 *xcert, STACK_OF(X509) *chain, size_t *plength)
 
X509 * crypto_cert_from_pem (const char *data, size_t len, BOOL fromFile)
 

Variables

static const char * general_name_type_labels []
 

Macro Definition Documentation

◆ GEN_ALL

#define GEN_ALL   (-1)

◆ TAG

#define TAG   FREERDP_TAG("crypto")

FreeRDP: A Remote Desktop Protocol Implementation Cryptographic Abstraction Layer

Copyright 2011-2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Typedef Documentation

◆ general_name_mapper_pr

typedef int(* general_name_mapper_pr) (GENERAL_NAME *name, void *data, int index, int count)

Function Documentation

◆ crypto_cert_dns_names_free()

void crypto_cert_dns_names_free ( int  count,
int *  lengths,
char **  dns_names 
)
Here is the caller graph for this function:

◆ crypto_cert_fingerprint()

char* crypto_cert_fingerprint ( X509 *  xcert)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_fingerprint_by_hash()

char* crypto_cert_fingerprint_by_hash ( X509 *  xcert,
const char *  hash 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_fingerprint_by_hash_ex()

char* crypto_cert_fingerprint_by_hash_ex ( X509 *  xcert,
const char *  hash,
BOOL  separator 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_free()

void crypto_cert_free ( CryptoCert  cert)
Here is the caller graph for this function:

◆ crypto_cert_from_pem()

X509* crypto_cert_from_pem ( const char *  data,
size_t  len,
BOOL  fromFile 
)
Here is the caller graph for this function:

◆ crypto_cert_get_dns_names()

char** crypto_cert_get_dns_names ( X509 *  x509,
int *  count,
int **  lengths 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_get_email()

char* crypto_cert_get_email ( X509 *  x509)
Here is the call graph for this function:

◆ crypto_cert_get_public_key()

BOOL crypto_cert_get_public_key ( CryptoCert  cert,
BYTE **  PublicKey,
DWORD *  PublicKeyLength 
)
Here is the caller graph for this function:

◆ crypto_cert_get_upn()

char* crypto_cert_get_upn ( X509 *  x509)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_hash()

BYTE* crypto_cert_hash ( X509 *  xcert,
const char *  hash,
UINT32 *  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_issuer()

char* crypto_cert_issuer ( X509 *  xcert)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_pem()

BYTE* crypto_cert_pem ( X509 *  xcert,
STACK_OF(X509) *  chain,
size_t *  plength 
)

Don't manage certificates internally, leave it up entirely to the external client implementation

Here is the caller graph for this function:

◆ crypto_cert_pem_read()

CryptoCert crypto_cert_pem_read ( const char *  data)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_print_info()

void crypto_cert_print_info ( X509 *  xcert)
Here is the call graph for this function:

◆ crypto_cert_read()

CryptoCert crypto_cert_read ( const BYTE data,
UINT32  length 
)
Here is the caller graph for this function:

◆ crypto_cert_subject()

char* crypto_cert_subject ( X509 *  xcert)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_cert_subject_alt_name()

char** crypto_cert_subject_alt_name ( X509 *  xcert,
int *  count,
int **  lengths 
)
Here is the call graph for this function:

◆ crypto_cert_subject_alt_name_free()

void crypto_cert_subject_alt_name_free ( int  count,
int *  lengths,
char **  alt_names 
)
Here is the call graph for this function:

◆ crypto_cert_subject_common_name()

char* crypto_cert_subject_common_name ( X509 *  xcert,
int *  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_get_certificate_data()

rdpCertificateData* crypto_get_certificate_data ( X509 *  xcert,
const char *  hostname,
UINT16  port 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_print_name()

static char* crypto_print_name ( X509_NAME *  name)
static
Here is the caller graph for this function:

◆ crypto_reverse()

void crypto_reverse ( BYTE data,
size_t  length 
)
Here is the caller graph for this function:

◆ crypto_rsa_common()

static SSIZE_T crypto_rsa_common ( const BYTE input,
size_t  length,
UINT32  key_length,
const BYTE modulus,
const BYTE exponent,
size_t  exponent_size,
BYTE output 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_rsa_private()

static int crypto_rsa_private ( const BYTE input,
size_t  length,
size_t  key_length,
const BYTE modulus,
const BYTE private_exponent,
BYTE output 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_rsa_private_decrypt()

SSIZE_T crypto_rsa_private_decrypt ( const BYTE input,
size_t  length,
size_t  key_length,
const BYTE modulus,
const BYTE private_exponent,
BYTE output 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_rsa_private_encrypt()

SSIZE_T crypto_rsa_private_encrypt ( const BYTE input,
size_t  length,
size_t  key_length,
const BYTE modulus,
const BYTE private_exponent,
BYTE output 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_rsa_public()

static int crypto_rsa_public ( const BYTE input,
size_t  length,
size_t  key_length,
const BYTE modulus,
const BYTE exponent,
BYTE output 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_rsa_public_decrypt()

SSIZE_T crypto_rsa_public_decrypt ( const BYTE input,
size_t  length,
size_t  key_length,
const BYTE modulus,
const BYTE exponent,
BYTE output 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_rsa_public_encrypt()

SSIZE_T crypto_rsa_public_encrypt ( const BYTE input,
size_t  length,
size_t  key_length,
const BYTE modulus,
const BYTE exponent,
BYTE output 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_othername_object_as_string()

static int extract_othername_object_as_string ( GENERAL_NAME *  name,
void *  data,
int  index,
int  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_string()

static int extract_string ( GENERAL_NAME *  name,
void *  data,
int  index,
int  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ general_name_type_label()

static const char* general_name_type_label ( int  general_name_type)
static
Here is the caller graph for this function:

◆ map_subject_alt_name()

static void map_subject_alt_name ( X509 *  x509,
int  general_name_type,
general_name_mapper_pr  mapper,
void *  data 
)
static
Here is the caller graph for this function:

◆ object_list_allocate()

static void object_list_allocate ( object_list *  list,
int  allocate_count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ object_list_free()

static void object_list_free ( object_list *  list)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ object_list_initialize()

static void object_list_initialize ( object_list *  list)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ object_string()

static char* object_string ( ASN1_TYPE *  object)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_list_allocate()

static void string_list_allocate ( string_list *  list,
int  allocate_count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_list_free()

static void string_list_free ( string_list *  list)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_list_initialize()

static void string_list_initialize ( string_list *  list)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verify_cb()

static int verify_cb ( int  ok,
X509_STORE_CTX *  csc 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_verify_certificate()

BOOL x509_verify_certificate ( CryptoCert  cert,
const char *  certificate_store_path 
)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ general_name_type_labels

const char* general_name_type_labels[]
static
Initial value:
= { "OTHERNAME", "EMAIL ", "DNS ",
"X400 ", "DIRNAME ", "EDIPARTY ",
"URI ", "IPADD ", "RID " }