/* AUTOMATICALLY GENERATED by qapi-gen.py DO NOT MODIFY */

/*
 * Schema-defined QAPI types
 *
 * Copyright IBM, Corp. 2011
 * Copyright (c) 2013-2018 Red Hat Inc.
 *
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
 * See the COPYING.LIB file in the top-level directory.
 */

#ifndef QAPI_TYPES_CRYPTO_H
#define QAPI_TYPES_CRYPTO_H

#include "qapi/qapi-builtin-types.h"

typedef enum QCryptoTLSCredsEndpoint {
    QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT,
    QCRYPTO_TLS_CREDS_ENDPOINT_SERVER,
    QCRYPTO_TLS_CREDS_ENDPOINT__MAX,
} QCryptoTLSCredsEndpoint;

#define QCryptoTLSCredsEndpoint_str(val) \
    qapi_enum_lookup(&QCryptoTLSCredsEndpoint_lookup, (val))

extern const QEnumLookup QCryptoTLSCredsEndpoint_lookup;

typedef enum QCryptoSecretFormat {
    QCRYPTO_SECRET_FORMAT_RAW,
    QCRYPTO_SECRET_FORMAT_BASE64,
    QCRYPTO_SECRET_FORMAT__MAX,
} QCryptoSecretFormat;

#define QCryptoSecretFormat_str(val) \
    qapi_enum_lookup(&QCryptoSecretFormat_lookup, (val))

extern const QEnumLookup QCryptoSecretFormat_lookup;

typedef enum QCryptoHashAlgo {
    QCRYPTO_HASH_ALGO_MD5,
    QCRYPTO_HASH_ALGO_SHA1,
    QCRYPTO_HASH_ALGO_SHA224,
    QCRYPTO_HASH_ALGO_SHA256,
    QCRYPTO_HASH_ALGO_SHA384,
    QCRYPTO_HASH_ALGO_SHA512,
    QCRYPTO_HASH_ALGO_RIPEMD160,
    QCRYPTO_HASH_ALGO_SM3,
    QCRYPTO_HASH_ALGO__MAX,
} QCryptoHashAlgo;

#define QCryptoHashAlgo_str(val) \
    qapi_enum_lookup(&QCryptoHashAlgo_lookup, (val))

extern const QEnumLookup QCryptoHashAlgo_lookup;

typedef enum QCryptoCipherAlgo {
    QCRYPTO_CIPHER_ALGO_AES_128,
    QCRYPTO_CIPHER_ALGO_AES_192,
    QCRYPTO_CIPHER_ALGO_AES_256,
    QCRYPTO_CIPHER_ALGO_DES,
    QCRYPTO_CIPHER_ALGO_3DES,
    QCRYPTO_CIPHER_ALGO_CAST5_128,
    QCRYPTO_CIPHER_ALGO_SERPENT_128,
    QCRYPTO_CIPHER_ALGO_SERPENT_192,
    QCRYPTO_CIPHER_ALGO_SERPENT_256,
    QCRYPTO_CIPHER_ALGO_TWOFISH_128,
    QCRYPTO_CIPHER_ALGO_TWOFISH_192,
    QCRYPTO_CIPHER_ALGO_TWOFISH_256,
    QCRYPTO_CIPHER_ALGO_SM4,
    QCRYPTO_CIPHER_ALGO__MAX,
} QCryptoCipherAlgo;

#define QCryptoCipherAlgo_str(val) \
    qapi_enum_lookup(&QCryptoCipherAlgo_lookup, (val))

extern const QEnumLookup QCryptoCipherAlgo_lookup;

typedef enum QCryptoCipherMode {
    QCRYPTO_CIPHER_MODE_ECB,
    QCRYPTO_CIPHER_MODE_CBC,
    QCRYPTO_CIPHER_MODE_XTS,
    QCRYPTO_CIPHER_MODE_CTR,
    QCRYPTO_CIPHER_MODE__MAX,
} QCryptoCipherMode;

#define QCryptoCipherMode_str(val) \
    qapi_enum_lookup(&QCryptoCipherMode_lookup, (val))

extern const QEnumLookup QCryptoCipherMode_lookup;

typedef enum QCryptoIVGenAlgo {
    QCRYPTO_IV_GEN_ALGO_PLAIN,
    QCRYPTO_IV_GEN_ALGO_PLAIN64,
    QCRYPTO_IV_GEN_ALGO_ESSIV,
    QCRYPTO_IV_GEN_ALGO__MAX,
} QCryptoIVGenAlgo;

#define QCryptoIVGenAlgo_str(val) \
    qapi_enum_lookup(&QCryptoIVGenAlgo_lookup, (val))

extern const QEnumLookup QCryptoIVGenAlgo_lookup;

typedef enum QCryptoBlockFormat {
    QCRYPTO_BLOCK_FORMAT_QCOW,
    QCRYPTO_BLOCK_FORMAT_LUKS,
    QCRYPTO_BLOCK_FORMAT__MAX,
} QCryptoBlockFormat;

#define QCryptoBlockFormat_str(val) \
    qapi_enum_lookup(&QCryptoBlockFormat_lookup, (val))

extern const QEnumLookup QCryptoBlockFormat_lookup;

typedef struct QCryptoBlockOptionsBase QCryptoBlockOptionsBase;

typedef struct QCryptoBlockOptionsQCow QCryptoBlockOptionsQCow;

typedef struct QCryptoBlockOptionsLUKS QCryptoBlockOptionsLUKS;

typedef struct QCryptoBlockCreateOptionsLUKS QCryptoBlockCreateOptionsLUKS;

typedef struct QCryptoBlockOpenOptions QCryptoBlockOpenOptions;

typedef struct QCryptoBlockCreateOptions QCryptoBlockCreateOptions;

typedef struct QCryptoBlockInfoBase QCryptoBlockInfoBase;

typedef struct QCryptoBlockInfoLUKSSlot QCryptoBlockInfoLUKSSlot;

typedef struct QCryptoBlockInfoLUKSSlotList QCryptoBlockInfoLUKSSlotList;

typedef struct QCryptoBlockInfoLUKS QCryptoBlockInfoLUKS;

typedef struct QCryptoBlockInfo QCryptoBlockInfo;

typedef enum QCryptoBlockLUKSKeyslotState {
    QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE_ACTIVE,
    QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE_INACTIVE,
    QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE__MAX,
} QCryptoBlockLUKSKeyslotState;

#define QCryptoBlockLUKSKeyslotState_str(val) \
    qapi_enum_lookup(&QCryptoBlockLUKSKeyslotState_lookup, (val))

extern const QEnumLookup QCryptoBlockLUKSKeyslotState_lookup;

typedef struct QCryptoBlockAmendOptionsLUKS QCryptoBlockAmendOptionsLUKS;

typedef struct QCryptoBlockAmendOptions QCryptoBlockAmendOptions;

typedef struct SecretCommonProperties SecretCommonProperties;

typedef struct SecretProperties SecretProperties;

#if defined(CONFIG_SECRET_KEYRING)
typedef struct SecretKeyringProperties SecretKeyringProperties;
#endif /* defined(CONFIG_SECRET_KEYRING) */

typedef struct TlsCredsProperties TlsCredsProperties;

typedef struct TlsCredsAnonProperties TlsCredsAnonProperties;

typedef struct TlsCredsPskProperties TlsCredsPskProperties;

typedef struct TlsCredsX509Properties TlsCredsX509Properties;

typedef enum QCryptoAkCipherAlgo {
    QCRYPTO_AK_CIPHER_ALGO_RSA,
    QCRYPTO_AK_CIPHER_ALGO__MAX,
} QCryptoAkCipherAlgo;

#define QCryptoAkCipherAlgo_str(val) \
    qapi_enum_lookup(&QCryptoAkCipherAlgo_lookup, (val))

extern const QEnumLookup QCryptoAkCipherAlgo_lookup;

typedef enum QCryptoAkCipherKeyType {
    QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC,
    QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE,
    QCRYPTO_AK_CIPHER_KEY_TYPE__MAX,
} QCryptoAkCipherKeyType;

#define QCryptoAkCipherKeyType_str(val) \
    qapi_enum_lookup(&QCryptoAkCipherKeyType_lookup, (val))

extern const QEnumLookup QCryptoAkCipherKeyType_lookup;

typedef enum QCryptoRSAPaddingAlgo {
    QCRYPTO_RSA_PADDING_ALGO_RAW,
    QCRYPTO_RSA_PADDING_ALGO_PKCS1,
    QCRYPTO_RSA_PADDING_ALGO__MAX,
} QCryptoRSAPaddingAlgo;

#define QCryptoRSAPaddingAlgo_str(val) \
    qapi_enum_lookup(&QCryptoRSAPaddingAlgo_lookup, (val))

extern const QEnumLookup QCryptoRSAPaddingAlgo_lookup;

typedef struct QCryptoAkCipherOptionsRSA QCryptoAkCipherOptionsRSA;

typedef struct q_obj_QCryptoAkCipherOptions_base q_obj_QCryptoAkCipherOptions_base;

typedef struct QCryptoAkCipherOptions QCryptoAkCipherOptions;

struct QCryptoBlockOptionsBase {
    QCryptoBlockFormat format;
};

void qapi_free_QCryptoBlockOptionsBase(QCryptoBlockOptionsBase *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockOptionsBase, qapi_free_QCryptoBlockOptionsBase)

struct QCryptoBlockOptionsQCow {
    char *key_secret;
};

void qapi_free_QCryptoBlockOptionsQCow(QCryptoBlockOptionsQCow *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockOptionsQCow, qapi_free_QCryptoBlockOptionsQCow)

struct QCryptoBlockOptionsLUKS {
    char *key_secret;
};

void qapi_free_QCryptoBlockOptionsLUKS(QCryptoBlockOptionsLUKS *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockOptionsLUKS, qapi_free_QCryptoBlockOptionsLUKS)

struct QCryptoBlockCreateOptionsLUKS {
    /* Members inherited from QCryptoBlockOptionsLUKS: */
    char *key_secret;
    /* Own members: */
    bool has_cipher_alg;
    QCryptoCipherAlgo cipher_alg;
    bool has_cipher_mode;
    QCryptoCipherMode cipher_mode;
    bool has_ivgen_alg;
    QCryptoIVGenAlgo ivgen_alg;
    bool has_ivgen_hash_alg;
    QCryptoHashAlgo ivgen_hash_alg;
    bool has_hash_alg;
    QCryptoHashAlgo hash_alg;
    bool has_iter_time;
    int64_t iter_time;
};

static inline QCryptoBlockOptionsLUKS *qapi_QCryptoBlockCreateOptionsLUKS_base(const QCryptoBlockCreateOptionsLUKS *obj)
{
    return (QCryptoBlockOptionsLUKS *)obj;
}

void qapi_free_QCryptoBlockCreateOptionsLUKS(QCryptoBlockCreateOptionsLUKS *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockCreateOptionsLUKS, qapi_free_QCryptoBlockCreateOptionsLUKS)

struct QCryptoBlockOpenOptions {
    /* Members inherited from QCryptoBlockOptionsBase: */
    QCryptoBlockFormat format;
    /* Own members: */
    union { /* union tag is @format */
        QCryptoBlockOptionsQCow qcow;
        QCryptoBlockOptionsLUKS luks;
    } u;
};

static inline QCryptoBlockOptionsBase *qapi_QCryptoBlockOpenOptions_base(const QCryptoBlockOpenOptions *obj)
{
    return (QCryptoBlockOptionsBase *)obj;
}

void qapi_free_QCryptoBlockOpenOptions(QCryptoBlockOpenOptions *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockOpenOptions, qapi_free_QCryptoBlockOpenOptions)

struct QCryptoBlockCreateOptions {
    /* Members inherited from QCryptoBlockOptionsBase: */
    QCryptoBlockFormat format;
    /* Own members: */
    union { /* union tag is @format */
        QCryptoBlockOptionsQCow qcow;
        QCryptoBlockCreateOptionsLUKS luks;
    } u;
};

static inline QCryptoBlockOptionsBase *qapi_QCryptoBlockCreateOptions_base(const QCryptoBlockCreateOptions *obj)
{
    return (QCryptoBlockOptionsBase *)obj;
}

void qapi_free_QCryptoBlockCreateOptions(QCryptoBlockCreateOptions *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockCreateOptions, qapi_free_QCryptoBlockCreateOptions)

struct QCryptoBlockInfoBase {
    QCryptoBlockFormat format;
};

void qapi_free_QCryptoBlockInfoBase(QCryptoBlockInfoBase *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockInfoBase, qapi_free_QCryptoBlockInfoBase)

struct QCryptoBlockInfoLUKSSlot {
    bool active;
    bool has_iters;
    int64_t iters;
    bool has_stripes;
    int64_t stripes;
    int64_t key_offset;
};

void qapi_free_QCryptoBlockInfoLUKSSlot(QCryptoBlockInfoLUKSSlot *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockInfoLUKSSlot, qapi_free_QCryptoBlockInfoLUKSSlot)

struct QCryptoBlockInfoLUKSSlotList {
    QCryptoBlockInfoLUKSSlotList *next;
    QCryptoBlockInfoLUKSSlot *value;
};

void qapi_free_QCryptoBlockInfoLUKSSlotList(QCryptoBlockInfoLUKSSlotList *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockInfoLUKSSlotList, qapi_free_QCryptoBlockInfoLUKSSlotList)

struct QCryptoBlockInfoLUKS {
    QCryptoCipherAlgo cipher_alg;
    QCryptoCipherMode cipher_mode;
    QCryptoIVGenAlgo ivgen_alg;
    bool has_ivgen_hash_alg;
    QCryptoHashAlgo ivgen_hash_alg;
    QCryptoHashAlgo hash_alg;
    bool detached_header;
    int64_t payload_offset;
    int64_t master_key_iters;
    char *uuid;
    QCryptoBlockInfoLUKSSlotList *slots;
};

void qapi_free_QCryptoBlockInfoLUKS(QCryptoBlockInfoLUKS *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockInfoLUKS, qapi_free_QCryptoBlockInfoLUKS)

struct QCryptoBlockInfo {
    /* Members inherited from QCryptoBlockInfoBase: */
    QCryptoBlockFormat format;
    /* Own members: */
    union { /* union tag is @format */
        QCryptoBlockInfoLUKS luks;
    } u;
};

static inline QCryptoBlockInfoBase *qapi_QCryptoBlockInfo_base(const QCryptoBlockInfo *obj)
{
    return (QCryptoBlockInfoBase *)obj;
}

void qapi_free_QCryptoBlockInfo(QCryptoBlockInfo *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockInfo, qapi_free_QCryptoBlockInfo)

struct QCryptoBlockAmendOptionsLUKS {
    QCryptoBlockLUKSKeyslotState state;
    char *new_secret;
    char *old_secret;
    bool has_keyslot;
    int64_t keyslot;
    bool has_iter_time;
    int64_t iter_time;
    char *secret;
};

void qapi_free_QCryptoBlockAmendOptionsLUKS(QCryptoBlockAmendOptionsLUKS *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockAmendOptionsLUKS, qapi_free_QCryptoBlockAmendOptionsLUKS)

struct QCryptoBlockAmendOptions {
    /* Members inherited from QCryptoBlockOptionsBase: */
    QCryptoBlockFormat format;
    /* Own members: */
    union { /* union tag is @format */
        QCryptoBlockAmendOptionsLUKS luks;
    } u;
};

static inline QCryptoBlockOptionsBase *qapi_QCryptoBlockAmendOptions_base(const QCryptoBlockAmendOptions *obj)
{
    return (QCryptoBlockOptionsBase *)obj;
}

void qapi_free_QCryptoBlockAmendOptions(QCryptoBlockAmendOptions *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockAmendOptions, qapi_free_QCryptoBlockAmendOptions)

struct SecretCommonProperties {
    bool has_format;
    QCryptoSecretFormat format;
    char *keyid;
    char *iv;
};

void qapi_free_SecretCommonProperties(SecretCommonProperties *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SecretCommonProperties, qapi_free_SecretCommonProperties)

struct SecretProperties {
    /* Members inherited from SecretCommonProperties: */
    bool has_format;
    QCryptoSecretFormat format;
    char *keyid;
    char *iv;
    /* Own members: */
    char *data;
    char *file;
};

static inline SecretCommonProperties *qapi_SecretProperties_base(const SecretProperties *obj)
{
    return (SecretCommonProperties *)obj;
}

void qapi_free_SecretProperties(SecretProperties *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SecretProperties, qapi_free_SecretProperties)

#if defined(CONFIG_SECRET_KEYRING)
struct SecretKeyringProperties {
    /* Members inherited from SecretCommonProperties: */
    bool has_format;
    QCryptoSecretFormat format;
    char *keyid;
    char *iv;
    /* Own members: */
    int32_t serial;
};
#endif /* defined(CONFIG_SECRET_KEYRING) */

#if defined(CONFIG_SECRET_KEYRING)
static inline SecretCommonProperties *qapi_SecretKeyringProperties_base(const SecretKeyringProperties *obj)
{
    return (SecretCommonProperties *)obj;
}

void qapi_free_SecretKeyringProperties(SecretKeyringProperties *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(SecretKeyringProperties, qapi_free_SecretKeyringProperties)
#endif /* defined(CONFIG_SECRET_KEYRING) */

struct TlsCredsProperties {
    bool has_verify_peer;
    bool verify_peer;
    char *dir;
    bool has_endpoint;
    QCryptoTLSCredsEndpoint endpoint;
    char *priority;
};

void qapi_free_TlsCredsProperties(TlsCredsProperties *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(TlsCredsProperties, qapi_free_TlsCredsProperties)

struct TlsCredsAnonProperties {
    /* Members inherited from TlsCredsProperties: */
    bool has_verify_peer;
    bool verify_peer;
    char *dir;
    bool has_endpoint;
    QCryptoTLSCredsEndpoint endpoint;
    char *priority;
    /* Own members: */
};

static inline TlsCredsProperties *qapi_TlsCredsAnonProperties_base(const TlsCredsAnonProperties *obj)
{
    return (TlsCredsProperties *)obj;
}

void qapi_free_TlsCredsAnonProperties(TlsCredsAnonProperties *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(TlsCredsAnonProperties, qapi_free_TlsCredsAnonProperties)

struct TlsCredsPskProperties {
    /* Members inherited from TlsCredsProperties: */
    bool has_verify_peer;
    bool verify_peer;
    char *dir;
    bool has_endpoint;
    QCryptoTLSCredsEndpoint endpoint;
    char *priority;
    /* Own members: */
    char *username;
};

static inline TlsCredsProperties *qapi_TlsCredsPskProperties_base(const TlsCredsPskProperties *obj)
{
    return (TlsCredsProperties *)obj;
}

void qapi_free_TlsCredsPskProperties(TlsCredsPskProperties *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(TlsCredsPskProperties, qapi_free_TlsCredsPskProperties)

struct TlsCredsX509Properties {
    /* Members inherited from TlsCredsProperties: */
    bool has_verify_peer;
    bool verify_peer;
    char *dir;
    bool has_endpoint;
    QCryptoTLSCredsEndpoint endpoint;
    char *priority;
    /* Own members: */
    bool has_sanity_check;
    bool sanity_check;
    char *passwordid;
};

static inline TlsCredsProperties *qapi_TlsCredsX509Properties_base(const TlsCredsX509Properties *obj)
{
    return (TlsCredsProperties *)obj;
}

void qapi_free_TlsCredsX509Properties(TlsCredsX509Properties *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(TlsCredsX509Properties, qapi_free_TlsCredsX509Properties)

struct QCryptoAkCipherOptionsRSA {
    QCryptoHashAlgo hash_alg;
    QCryptoRSAPaddingAlgo padding_alg;
};

void qapi_free_QCryptoAkCipherOptionsRSA(QCryptoAkCipherOptionsRSA *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoAkCipherOptionsRSA, qapi_free_QCryptoAkCipherOptionsRSA)

struct q_obj_QCryptoAkCipherOptions_base {
    QCryptoAkCipherAlgo alg;
};

struct QCryptoAkCipherOptions {
    QCryptoAkCipherAlgo alg;
    union { /* union tag is @alg */
        QCryptoAkCipherOptionsRSA rsa;
    } u;
};

void qapi_free_QCryptoAkCipherOptions(QCryptoAkCipherOptions *obj);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoAkCipherOptions, qapi_free_QCryptoAkCipherOptions)

#endif /* QAPI_TYPES_CRYPTO_H */
