AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/nx_secure/src/nx_secure_x509_distinguished_name_compare.c
static INT _nx_secure_x509_distinguished_name_field_compare(const UCHAR *field1, const UINT length1,
                                                            const UCHAR *field2, const UINT length2)
{
INT compare_value;

    if (length1 == length2)
    {
        /* If lengths are both 0, return equality. */
        if (length1 == 0)
        {
            compare_value = 0;
        }
        else
        {
            /* Lengths are equal and non-zero, actually compare strings. */
            compare_value = NX_SECURE_MEMCMP(field1, field2, length1);
        }
    }
    else
    {
        /* Lengths are not equal, return inequality. */
        compare_value = 1;
    }

    return(compare_value);
}
/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _nx_secure_x509_distinguished_name_field_compare    PORTABLE C      */
/*                                                           6.1          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Timothy Stapko, Microsoft Corporation                               */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function compares two X509 Distinguished Name fields given two */
/*    separate lengths to see if they are equal. Handles special cases    */
/*    where lengths are not equal and when both lengths are 0.            */
/*    Returns 0 on equality or both lengths 0, non-zero otherwise.        */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    field1                                Pointer to an X509 name field */
/*    length1                               Length of field1              */
/*    field2                                Pointer to an X509 name field */
/*    length2                               Length of field2              */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    equality                              0 if equal, else non-zero     */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    None                                                                */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    _nx_secure_x509_distinguished_name_compare                          */
/*                                          Compare distinguished name    */
/*                                                                        */
/*  RELEASE HISTORY                                                       */
/*                                                                        */
/*    DATE              NAME                      DESCRIPTION             */
/*                                                                        */
/*  05-19-2020     Timothy Stapko           Initial Version 6.0           */
/*  09-30-2020     Timothy Stapko           Modified comment(s),          */
/*                                            resulting in version 6.1    */
/*                                                                        */
/**************************************************************************/
FUNCTION                                               RELEASE

_nx_secure_x509_distinguished_name_field_compare    PORTABLE C
6.1
AUTHOR

Timothy Stapko, Microsoft Corporation

DESCRIPTION

This function compares two X509 Distinguished Name fields given two
separate lengths to see if they are equal. Handles special cases
where lengths are not equal and when both lengths are 0.
Returns 0 on equality or both lengths 0, non-zero otherwise.

INPUT

field1                                Pointer to an X509 name field
length1                               Length of field1
field2                                Pointer to an X509 name field
length2                               Length of field2

OUTPUT

equality                              0 if equal, else non-zero

CALLS

None

CALLED BY

_nx_secure_x509_distinguished_name_compare
Compare distinguished name

RELEASE HISTORY

DATE              NAME                      DESCRIPTION

05-19-2020     Timothy Stapko           Initial Version 6.0
09-30-2020     Timothy Stapko           Modified comment(s),
resulting in version 6.1
FUNCTION RELEASE _nx_secure_x509_distinguished_name_field_compare PORTABLE C 6 . 1 AUTHOR Timothy Stapko Microsoft Corporation DESCRIPTION This function compares two X509 Distinguished Name fields given two separate lengths to see if they are equal . Handles special cases where lengths are not equal and when both lengths are 0 . Returns 0 on equality or both lengths 0 non - zero otherwise . INPUT field1 Pointer to an X509 name field length1 Length of field1 field2 Pointer to an X509 name field length2 Length of field2 OUTPUT equality 0 if equal else non - zero CALLS None CALLED BY _nx_secure_x509_distinguished_name_compare Compare distinguished name RELEASE HISTORY DATE NAME DESCRIPTION 05 - 19 - 2020 Timothy Stapko Initial Version 6 . 0 09 - 30 - 2020 Timothy Stapko Modified comment ( s ) resulting in version 6 . 1
static INT _nx_secure_x509_distinguished_name_field_compare(const UCHAR *field1, const UINT length1,
                                                            const UCHAR *field2, const UINT length2)
{
INT compare_value;
    if (length1 == length2)
    {
        if (length1 == 0)
        {
            compare_value = 0;
        }
        else
        {
            compare_value = NX_SECURE_MEMCMP(field1, field2, length1);
        }
    }
    else
    {
        compare_value = 1;
    }
    return(compare_value);
}
static INT _nx_secure_x509_distinguished_name_field_compare ( const UCHAR * field1 , const UINT length1 , const UCHAR * field2 , const UINT length2 ) { INT compare_value ; if ( length1 == length2 ) { if ( length1 == 0 ) { compare_value = 0 ; } else { compare_value = NX_SECURE_MEMCMP ( field1 , field2 , length1 ) ; } } else { compare_value = 1 ; } return ( compare_value ) ; }
FUNCTION                                               RELEASE
FUNCTION RELEASE
/* If lengths are both 0, return equality. */ /* Lengths are equal and non-zero, actually compare strings. */ /* Lengths are not equal, return inequality. */