• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2018, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #ifndef OPENSSL_HEADER_CRYPTO_TEST_WYCHEPROOF_UTIL_H
16 #define OPENSSL_HEADER_CRYPTO_TEST_WYCHEPROOF_UTIL_H
17 
18 #include <openssl/base.h>
19 
20 
21 // This header contains convenience functions for Wycheproof tests.
22 
23 class FileTest;
24 
25 enum class WycheproofResult {
26   kValid,
27   kInvalid,
28   kAcceptable,
29 };
30 
31 // GetWycheproofResult sets |*out| to the parsed "result" key of |t|.
32 bool GetWycheproofResult(FileTest *t, WycheproofResult *out);
33 
34 // GetWycheproofDigest returns a digest function using the Wycheproof name, or
35 // nullptr on error.
36 const EVP_MD *GetWycheproofDigest(FileTest *t, const char *key,
37                                   bool instruction);
38 
39 // GetWycheproofCurve returns a curve using the Wycheproof name, or nullptr on
40 // error.
41 bssl::UniquePtr<EC_GROUP> GetWycheproofCurve(FileTest *t, const char *key,
42                                              bool instruction);
43 
44 // GetWycheproofBIGNUM returns a BIGNUM in the Wycheproof format, or nullptr on
45 // error.
46 bssl::UniquePtr<BIGNUM> GetWycheproofBIGNUM(FileTest *t, const char *key,
47                                             bool instruction);
48 
49 
50 #endif  // OPENSSL_HEADER_CRYPTO_TEST_WYCHEPROOF_UTIL_H
51