FreeRDP
per.c File Reference
#include <winpr/assert.h>
#include <winpr/print.h>
#include <freerdp/config.h>
#include <freerdp/crypto/per.h>
#include <freerdp/log.h>

Macros

#define TAG   FREERDP_TAG("crypto.per")
 

Functions

BOOL per_read_length (wStream *s, UINT16 *length)
 
BOOL per_write_length (wStream *s, UINT16 length)
 
BOOL per_read_choice (wStream *s, BYTE *choice)
 
BOOL per_write_choice (wStream *s, BYTE choice)
 
BOOL per_read_selection (wStream *s, BYTE *selection)
 
BOOL per_write_selection (wStream *s, BYTE selection)
 
BOOL per_read_number_of_sets (wStream *s, BYTE *number)
 
BOOL per_write_number_of_sets (wStream *s, BYTE number)
 
BOOL per_read_padding (wStream *s, UINT16 length)
 
BOOL per_write_padding (wStream *s, UINT16 length)
 
BOOL per_read_integer (wStream *s, UINT32 *integer)
 
BOOL per_write_integer (wStream *s, UINT32 integer)
 
BOOL per_read_integer16 (wStream *s, UINT16 *integer, UINT16 min)
 
BOOL per_write_integer16 (wStream *s, UINT16 integer, UINT16 min)
 
BOOL per_read_enumerated (wStream *s, BYTE *enumerated, BYTE count)
 
BOOL per_write_enumerated (wStream *s, BYTE enumerated, BYTE count)
 
static BOOL per_check_oid_and_log_mismatch (const BYTE *got, const BYTE *expect, size_t length)
 
BOOL per_read_object_identifier (wStream *s, const BYTE oid[6])
 
BOOL per_write_object_identifier (wStream *s, const BYTE oid[6])
 
static void per_write_string (wStream *s, BYTE *str, int length)
 
BOOL per_read_octet_string (wStream *s, const BYTE *oct_str, UINT16 length, UINT16 min)
 
BOOL per_write_octet_string (wStream *s, const BYTE *oct_str, UINT16 length, UINT16 min)
 
BOOL per_read_numeric_string (wStream *s, UINT16 min)
 
BOOL per_write_numeric_string (wStream *s, const BYTE *num_str, UINT16 length, UINT16 min)
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("crypto.per")

FreeRDP: A Remote Desktop Protocol Implementation ASN.1 Packed Encoding Rules (BER)

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.

Function Documentation

◆ per_check_oid_and_log_mismatch()

static BOOL per_check_oid_and_log_mismatch ( const BYTE got,
const BYTE expect,
size_t  length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_read_choice()

BOOL per_read_choice ( wStream s,
BYTE choice 
)

Read PER choice.

Parameters
sstream
choicechoice
Returns
TRUE for success, FALSE otherwise.
Here is the caller graph for this function:

◆ per_read_enumerated()

BOOL per_read_enumerated ( wStream s,
BYTE enumerated,
BYTE  count 
)

Read PER ENUMERATED.

Parameters
sThe stream to read from
enumeratedenumerated result variable, must not be NULL
countenumeration count
Returns
TRUE for success, FALSE otherwise
Here is the caller graph for this function:

◆ per_read_integer()

BOOL per_read_integer ( wStream s,
UINT32 *  integer 
)

Read PER INTEGER.

Parameters
sstream
integerinteger
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_read_integer16()

BOOL per_read_integer16 ( wStream s,
UINT16 integer,
UINT16  min 
)

Read PER INTEGER (UINT16).

Parameters
sThe stream to read from
integerThe integer result variable pointer, must not be NULL
minminimum value
Returns
TRUE for success, FALSE otherwise
Here is the caller graph for this function:

◆ per_read_length()

BOOL per_read_length ( wStream s,
UINT16 length 
)

Read PER length.

Parameters
sstream to read from
lengthA pointer to return the length read, must not be NULL
Returns
TRUE for success, FALSE otherwise.
Here is the caller graph for this function:

◆ per_read_number_of_sets()

BOOL per_read_number_of_sets ( wStream s,
BYTE number 
)

Read PER number of sets.

Parameters
sstream
numbernumber of sets
Returns
TRUE for success, FALSE otherwise.
Here is the caller graph for this function:

◆ per_read_numeric_string()

BOOL per_read_numeric_string ( wStream s,
UINT16  min 
)

Read PER NumericString.

Parameters
sstream
minminimum string length
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_read_object_identifier()

BOOL per_read_object_identifier ( wStream s,
const BYTE  oid[6] 
)

Read PER OBJECT_IDENTIFIER (OID).

Parameters
sThe stream to read from
oidobject identifier (OID)
Warning
It works correctly only for limited set of OIDs.
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_read_octet_string()

BOOL per_read_octet_string ( wStream s,
const BYTE oct_str,
UINT16  length,
UINT16  min 
)

Read PER OCTET_STRING.

Parameters
sThe stream to read from
oct_stroctet string
lengthstring length
minminimum length
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_read_padding()

BOOL per_read_padding ( wStream s,
UINT16  length 
)

Read PER padding with zeros.

Parameters
sA stream to read from
lengththe data to write
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_read_selection()

BOOL per_read_selection ( wStream s,
BYTE selection 
)

Read PER selection.

Parameters
sstream
selectionselection
Returns
TRUE for success, FALSE otherwise.
Here is the caller graph for this function:

◆ per_write_choice()

BOOL per_write_choice ( wStream s,
BYTE  choice 
)

Write PER CHOICE.

Parameters
sstream
choiceindex of chosen field
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_enumerated()

BOOL per_write_enumerated ( wStream s,
BYTE  enumerated,
BYTE  count 
)

Write PER ENUMERATED.

Parameters
sThe stream to write to
enumeratedenumerated
countenumeration count
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_integer()

BOOL per_write_integer ( wStream s,
UINT32  integer 
)

Write PER INTEGER.

Parameters
sstream
integerinteger
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_integer16()

BOOL per_write_integer16 ( wStream s,
UINT16  integer,
UINT16  min 
)

Write PER INTEGER (UINT16).

Parameters
sstream
integerinteger
minminimum value
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_length()

BOOL per_write_length ( wStream s,
UINT16  length 
)

Write PER length.

Parameters
sstream
lengthlength
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_number_of_sets()

BOOL per_write_number_of_sets ( wStream s,
BYTE  number 
)

Write PER number of sets for SET OF.

Parameters
sstream
numbernumber of sets
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_numeric_string()

BOOL per_write_numeric_string ( wStream s,
const BYTE num_str,
UINT16  length,
UINT16  min 
)

Write PER NumericString.

Parameters
sstream
num_strnumeric string
lengthstring length
minminimum string length
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_object_identifier()

BOOL per_write_object_identifier ( wStream s,
const BYTE  oid[6] 
)

Write PER OBJECT_IDENTIFIER (OID)

Parameters
sstream
oidobject identifier (oid)
Warning
It works correctly only for limited set of OIDs.
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_octet_string()

BOOL per_write_octet_string ( wStream s,
const BYTE oct_str,
UINT16  length,
UINT16  min 
)

Write PER OCTET_STRING

Parameters
sstream
oct_stroctet string
lengthstring length
minminimum string length
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_padding()

BOOL per_write_padding ( wStream s,
UINT16  length 
)

Write PER padding with zeros.

Parameters
sA stream to write to
lengththe data to write
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_selection()

BOOL per_write_selection ( wStream s,
BYTE  selection 
)

Write PER selection for OPTIONAL fields.

Parameters
sstream
selectionbit map of selected fields
Returns
TRUE for success, FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ per_write_string()

static void per_write_string ( wStream s,
BYTE str,
int  length 
)
static

Write PER string.

Parameters
sstream
strstring
lengthstring length
Here is the call graph for this function: