Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / crypto / tlscredspsk.h
blobbcd07dc4f620aa98f22805bff195598ab533e3f1
1 /*
2 * QEMU crypto TLS Pre-Shared Key (PSK) support
4 * Copyright (c) 2018 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QCRYPTO_TLSCREDSPSK_H
22 #define QCRYPTO_TLSCREDSPSK_H
24 #include "crypto/tlscreds.h"
25 #include "qom/object.h"
27 #define TYPE_QCRYPTO_TLS_CREDS_PSK "tls-creds-psk"
28 typedef struct QCryptoTLSCredsPSK QCryptoTLSCredsPSK;
29 DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsPSK, QCRYPTO_TLS_CREDS_PSK,
30 TYPE_QCRYPTO_TLS_CREDS_PSK)
32 typedef struct QCryptoTLSCredsPSKClass QCryptoTLSCredsPSKClass;
34 #define QCRYPTO_TLS_CREDS_PSKFILE "keys.psk"
36 /**
37 * QCryptoTLSCredsPSK:
39 * The QCryptoTLSCredsPSK object provides a representation
40 * of the Pre-Shared Key credential used to perform a TLS handshake.
42 * This is a user creatable object, which can be instantiated
43 * via object_new_propv():
45 * <example>
46 * <title>Creating TLS-PSK credential objects in code</title>
47 * <programlisting>
48 * Object *obj;
49 * Error *err = NULL;
50 * obj = object_new_propv(TYPE_QCRYPTO_TLS_CREDS_PSK,
51 * "tlscreds0",
52 * &err,
53 * "dir", "/path/to/dir",
54 * "endpoint", "client",
55 * NULL);
56 * </programlisting>
57 * </example>
59 * Or via QMP:
61 * <example>
62 * <title>Creating TLS-PSK credential objects via QMP</title>
63 * <programlisting>
64 * {
65 * "execute": "object-add", "arguments": {
66 * "id": "tlscreds0",
67 * "qom-type": "tls-creds-psk",
68 * "props": {
69 * "dir": "/path/to/dir",
70 * "endpoint": "client"
71 * }
72 * }
73 * }
74 * </programlisting>
75 * </example>
77 * Or via the CLI:
79 * <example>
80 * <title>Creating TLS-PSK credential objects via CLI</title>
81 * <programlisting>
82 * qemu-system-x86_64 --object tls-creds-psk,id=tlscreds0,\
83 * endpoint=client,dir=/path/to/dir[,username=qemu]
84 * </programlisting>
85 * </example>
87 * The PSK file can be created and managed using psktool.
90 struct QCryptoTLSCredsPSKClass {
91 QCryptoTLSCredsClass parent_class;
95 #endif /* QCRYPTO_TLSCREDSPSK_H */