qcrypto_tls_session_check_credentials(QCryptoTLSSession *session,

                                      Error **errp)

{

    if (object_dynamic_cast(OBJECT(session->creds),

                            TYPE_QCRYPTO_TLS_CREDS_ANON)) {

        return 0;

    } else if (object_dynamic_cast(OBJECT(session->creds),

                            TYPE_QCRYPTO_TLS_CREDS_X509)) {

        if (session->creds->verifyPeer) {

            return qcrypto_tls_session_check_certificate(session,

                                                         errp);

        } else {

            return 0;

        }

    } else {

        error_setg(errp, "Unexpected credential type %s",

                   object_get_typename(OBJECT(session->creds)));

        return -1;

    }

}

qcrypto_tls_session_check_credentials(QCryptoTLSSession *session,

                                      Error **errp)

{

    if (object_dynamic_cast(OBJECT(session->creds),

                            TYPE_QCRYPTO_TLS_CREDS_ANON)) {

        return 0;

    } else if (object_dynamic_cast(OBJECT(session->creds),

                            TYPE_QCRYPTO_TLS_CREDS_X509)) {

        if (session->creds->verifyPeer) {

            return qcrypto_tls_session_check_certificate(session,

                                                         errp);

        } else {

            return 0;

        }

    } else {

        error_setg(errp, "Unexpected credential type %s",

                   object_get_typename(OBJECT(session->creds)));

        return -1;

    }

}

            return qcrypto_tls_session_check_certificate(session,                                                          errp);
FUNC_0(QCryptoTLSSession *VAR_0,

                                      Error **VAR_1)

{

    if (object_dynamic_cast(OBJECT(VAR_0->creds),

                            TYPE_QCRYPTO_TLS_CREDS_ANON)) {

        return 0;

    } else if (object_dynamic_cast(OBJECT(VAR_0->creds),

                            TYPE_QCRYPTO_TLS_CREDS_X509)) {

        if (VAR_0->creds->verifyPeer) {

            return qcrypto_tls_session_check_certificate(VAR_0,

                                                         VAR_1);

        } else {

            return 0;

        }

    } else {

        error_setg(VAR_1, "Unexpected credential type %s",

                   object_get_typename(OBJECT(VAR_0->creds)));

        return -1;

    }

}

FUNC_0(QCryptoTLSSession *VAR_0,
Error **VAR_1)
{ if (object_dynamic_cast(OBJECT(VAR_0->creds),
TYPE_QCRYPTO_TLS_CREDS_ANON)) { return 0; } else if (object_dynamic_cast(OBJECT(VAR_0->creds), TYPE_QCRYPTO_TLS_CREDS_X509)) { if (VAR_0->creds->verifyPeer) { return qcrypto_tls_session_check_certificate(VAR_0,
VAR_1); } else { return 0; } } else { error_setg(VAR_1, "Unexpected credential type %s",
object_get_typename(OBJECT(VAR_0->creds))); return -1; } }