FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/src/ocsp.c
/* Returns elements of an OCSP_CERTID struct. Currently only supports
 * returning the serial number, and returns an error if user requests
 * any of name, pmd, and/or keyHash.
 * Return 1 on success, 0 on failure */
Returns elements of an OCSP_CERTID struct. Currently only supports
returning the serial number, and returns an error if user requests
any of name, pmd, and/or keyHash.
Return 1 on success, 0 on failure
Returns elements of an OCSP_CERTID struct . Currently only supports returning the serial number and returns an error if user requests any of name pmd and / or keyHash . Return 1 on success 0 on failure
int wolfSSL_OCSP_id_get0_info(WOLFSSL_ASN1_STRING **name,
  WOLFSSL_ASN1_OBJECT **pmd, WOLFSSL_ASN1_STRING **keyHash,
  WOLFSSL_ASN1_INTEGER **serial, WOLFSSL_OCSP_CERTID *cid)
{
    int i = 0;
    WOLFSSL_ASN1_INTEGER* ser;
    WOLFSSL_ENTER("wolfSSL_OCSP_id_get0_info");
    if (cid == NULL)
        return 0;
    if (serial != NULL) {
        ser = wolfSSL_ASN1_INTEGER_new();
        if (ser == NULL)
            return 0;
        if (cid->serialSz > (WOLFSSL_ASN1_INTEGER_MAX - 2)) {
            ser->data = (unsigned char*)XMALLOC(cid->serialSz + 2, NULL,
                DYNAMIC_TYPE_OPENSSL);
            if (ser->data == NULL) {
                wolfSSL_ASN1_INTEGER_free(ser);
                return 0;
            }
            ser->dataMax = cid->serialSz + 2;
            ser->isDynamic = 1;
        } else {
            ser->data    = ser->intData;
            ser->dataMax = WOLFSSL_ASN1_INTEGER_MAX;
        }
        #ifdef WOLFSSL_QT
            XMEMCPY(&ser->data[i], cid->serial, cid->serialSz);
            ser->length = cid->serialSz;
        #else
            ser->data[i++] = ASN_INTEGER;
            i += SetLength(cid->serialSz, ser->data + i);
            XMEMCPY(&ser->data[i], cid->serial, cid->serialSz);
        #endif
        cid->serialInt = ser;
        *serial = cid->serialInt;
    }
    if (name != NULL || pmd != NULL || keyHash != NULL) {
        if (name != NULL)
            *name = NULL;
        if (pmd != NULL)
            *pmd = NULL;
        if (keyHash != NULL)
            *keyHash = NULL;
        return 0;
    }
    return 1;
}
int wolfSSL_OCSP_id_get0_info ( WOLFSSL_ASN1_STRING * * name , WOLFSSL_ASN1_OBJECT * * pmd , WOLFSSL_ASN1_STRING * * keyHash , WOLFSSL_ASN1_INTEGER * * serial , WOLFSSL_OCSP_CERTID * cid ) { int i = 0 ; WOLFSSL_ASN1_INTEGER * ser ; WOLFSSL_ENTER ( " " ) ; if ( cid == NULL ) return 0 ; if ( serial != NULL ) { ser = wolfSSL_ASN1_INTEGER_new ( ) ; if ( ser == NULL ) return 0 ; if ( cid -> serialSz > ( WOLFSSL_ASN1_INTEGER_MAX - 2 ) ) { ser -> data = ( unsigned char * ) XMALLOC ( cid -> serialSz + 2 , NULL , DYNAMIC_TYPE_OPENSSL ) ; if ( ser -> data == NULL ) { wolfSSL_ASN1_INTEGER_free ( ser ) ; return 0 ; } ser -> dataMax = cid -> serialSz + 2 ; ser -> isDynamic = 1 ; } else { ser -> data = ser -> intData ; ser -> dataMax = WOLFSSL_ASN1_INTEGER_MAX ; } #ifdef WOLFSSL_QT XMEMCPY ( & ser -> data [ i ] , cid -> serial , cid -> serialSz ) ; ser -> length = cid -> serialSz ; #else ser -> data [ i ++ ] = ASN_INTEGER ; i += SetLength ( cid -> serialSz , ser -> data + i ) ; XMEMCPY ( & ser -> data [ i ] , cid -> serial , cid -> serialSz ) ; #endif cid -> serialInt = ser ; * serial = cid -> serialInt ; } if ( name != NULL || pmd != NULL || keyHash != NULL ) { if ( name != NULL ) * name = NULL ; if ( pmd != NULL ) * pmd = NULL ; if ( keyHash != NULL ) * keyHash = NULL ; return 0 ; } return 1 ; }
Returns elements of an OCSP_CERTID struct.
Returns elements of an OCSP_CERTID struct .
/* build up ASN1_INTEGER for serial */ /* allocate data buffer, +2 for type and length */ /* Use array instead of dynamic memory */ /* Serial number starts at 0 index of ser->data */ /* Not needed for Apache, return error if user is requesting */