1da668aa1SThomas Huth /* 2da668aa1SThomas Huth * Copyright (C) 2015-2018 Red Hat, Inc. 3da668aa1SThomas Huth * 4da668aa1SThomas Huth * This library is free software; you can redistribute it and/or 5da668aa1SThomas Huth * modify it under the terms of the GNU Lesser General Public 6da668aa1SThomas Huth * License as published by the Free Software Foundation; either 7da668aa1SThomas Huth * version 2.1 of the License, or (at your option) any later version. 8da668aa1SThomas Huth * 9da668aa1SThomas Huth * This library is distributed in the hope that it will be useful, 10da668aa1SThomas Huth * but WITHOUT ANY WARRANTY; without even the implied warranty of 11da668aa1SThomas Huth * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12da668aa1SThomas Huth * Lesser General Public License for more details. 13da668aa1SThomas Huth * 14da668aa1SThomas Huth * You should have received a copy of the GNU Lesser General Public 15da668aa1SThomas Huth * License along with this library. If not, see 16da668aa1SThomas Huth * <http://www.gnu.org/licenses/>. 17da668aa1SThomas Huth * 18da668aa1SThomas Huth * Author: Richard W.M. Jones <rjones@redhat.com> 19da668aa1SThomas Huth */ 20da668aa1SThomas Huth 21da668aa1SThomas Huth #include "qemu/osdep.h" 22da668aa1SThomas Huth 23da668aa1SThomas Huth #include "crypto-tls-x509-helpers.h" 24da668aa1SThomas Huth #include "crypto-tls-psk-helpers.h" 25da668aa1SThomas Huth #include "qemu/sockets.h" 26da668aa1SThomas Huth 27da668aa1SThomas Huth void test_tls_psk_init(const char *pskfile) 28da668aa1SThomas Huth { 29da668aa1SThomas Huth FILE *fp; 30da668aa1SThomas Huth 31da668aa1SThomas Huth fp = fopen(pskfile, "w"); 32da668aa1SThomas Huth if (fp == NULL) { 33*a17ec44dSDaniel P. Berrangé g_critical("Failed to create pskfile %s: %s", pskfile, strerror(errno)); 34da668aa1SThomas Huth abort(); 35da668aa1SThomas Huth } 36da668aa1SThomas Huth /* Don't do this in real applications! Use psktool. */ 37da668aa1SThomas Huth fprintf(fp, "qemu:009d5638c40fde0c\n"); 38da668aa1SThomas Huth fclose(fp); 39da668aa1SThomas Huth } 40da668aa1SThomas Huth 41da668aa1SThomas Huth void test_tls_psk_cleanup(const char *pskfile) 42da668aa1SThomas Huth { 43da668aa1SThomas Huth unlink(pskfile); 44da668aa1SThomas Huth } 45