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