1# -*- mode: perl; -*-
2# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (the "License").  You may not use
5# this file except in compliance with the License.  You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9
10## Test DTLS CertStatus messages
11
12use strict;
13use warnings;
14
15package ssltests;
16use OpenSSL::Test::Utils;
17
18our $fips_mode;
19
20our @tests = ();
21
22our @tests_standard = (
23    {
24        name => "certstatus-good",
25        server => {
26            "CipherString" => "DEFAULT:\@SECLEVEL=0",
27            extra => {
28                "CertStatus" => "GoodResponse"
29            },
30        },
31        client => {
32            "CipherString" => "DEFAULT:\@SECLEVEL=0",
33        },
34        test => {
35            "Method" => "DTLS",
36            "ExpectedResult" => "Success"
37        }
38    },
39    {
40        name => "certstatus-bad",
41        server => {
42            "CipherString" => "DEFAULT:\@SECLEVEL=0",
43            extra => {
44                "CertStatus" => "BadResponse",
45            },
46        },
47        client => {
48            "CipherString" => "DEFAULT:\@SECLEVEL=0",
49        },
50        test => {
51            "Method" => "DTLS",
52            "ExpectedResult" => "ClientFail"
53        }
54    }
55);
56
57our @tests_sctp = (
58    {
59        name => "certstatus-good",
60        server => {
61            "CipherString" => "DEFAULT:\@SECLEVEL=0",
62            extra => {
63                "CertStatus" => "GoodResponse",
64            },
65        },
66        client => {
67            "CipherString" => "DEFAULT:\@SECLEVEL=0",
68        },
69        test => {
70            "Method" => "DTLS",
71            "UseSCTP" => "Yes",
72            "ExpectedResult" => "Success"
73        }
74    },
75    {
76        name => "certstatus-bad",
77        server => {
78            "CipherString" => "DEFAULT:\@SECLEVEL=0",
79            extra => {
80                "CertStatus" => "BadResponse",
81            },
82        },
83        client => {
84            "CipherString" => "DEFAULT:\@SECLEVEL=0",
85        },
86        test => {
87            "Method" => "DTLS",
88            "UseSCTP" => "Yes",
89            "ExpectedResult" => "ClientFail"
90        }
91    },
92);
93
94if  (!$fips_mode || !disabled("dtls1_2")) {
95    push @tests, @tests_standard;
96    push @tests, @tests_sctp unless disabled("sctp") || disabled("sock");
97}
98