FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* Set Alt Names from der cert, return 0 on success */
Set Alt Names from der cert, return 0 on success
Set Alt Names from der cert return 0 on success
static int SetAltNamesFromCert(Cert* cert, const byte* der, int derSz)
{
    int ret;
#ifdef WOLFSSL_SMALL_STACK
    DecodedCert* decoded;
#else
    DecodedCert decoded[1];
#endif
    if (derSz < 0)
        return derSz;
#ifdef WOLFSSL_SMALL_STACK
    decoded = (DecodedCert*)XMALLOC(sizeof(DecodedCert), cert->heap,
                                                       DYNAMIC_TYPE_TMP_BUFFER);
    if (decoded == NULL)
        return MEMORY_E;
#endif
    InitDecodedCert(decoded, der, derSz, NULL);
    ret = ParseCertRelative(decoded, CA_TYPE, NO_VERIFY, 0);
    if (ret < 0) {
        WOLFSSL_MSG("ParseCertRelative error");
    }
    else {
        ret = SetAltNamesFromDcert(cert, decoded);
    }
    FreeDecodedCert(decoded);
#ifdef WOLFSSL_SMALL_STACK
    XFREE(decoded, cert->heap, DYNAMIC_TYPE_TMP_BUFFER);
#endif
    return ret < 0 ? ret : 0;
}
static int SetAltNamesFromCert ( Cert * cert , const byte * der , int derSz ) { int ret ; #ifdef WOLFSSL_SMALL_STACK DecodedCert * decoded ; #else DecodedCert decoded [ 1 ] ; #endif if ( derSz < 0 ) return derSz ; #ifdef WOLFSSL_SMALL_STACK decoded = ( DecodedCert * ) XMALLOC ( sizeof ( DecodedCert ) , cert -> heap , DYNAMIC_TYPE_TMP_BUFFER ) ; if ( decoded == NULL ) return MEMORY_E ; #endif InitDecodedCert ( decoded , der , derSz , NULL ) ; ret = ParseCertRelative ( decoded , CA_TYPE , NO_VERIFY , 0 ) ; if ( ret < 0 ) { WOLFSSL_MSG ( " " ) ; } else { ret = SetAltNamesFromDcert ( cert , decoded ) ; } FreeDecodedCert ( decoded ) ; #ifdef WOLFSSL_SMALL_STACK XFREE ( decoded , cert -> heap , DYNAMIC_TYPE_TMP_BUFFER ) ; #endif return ret < 0 ? ret : 0 ; }
Set Alt Names from der cert, return 0 on success
Set Alt Names from der cert return 0 on success