wycheproof_util.h
Go to the documentation of this file.
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 #include <string>
21 #include <vector>
22 
23 
24 // This header contains convenience functions for Wycheproof tests.
25 
26 class FileTest;
27 
28 enum class WycheproofRawResult {
29  kValid,
30  kInvalid,
32 };
33 
36  std::vector<std::string> flags;
37 
38  // IsValid returns true if the Wycheproof test should be considered valid. A
39  // test result of "acceptable" is treated as valid if all flags are included
40  // in |acceptable_flags| and invalid otherwise.
41  bool IsValid(const std::vector<std::string> &acceptable_flags = {}) const;
42 };
43 
44 // GetWycheproofResult sets |*out| to the parsed "result" and "flags" keys of |t|.
46 
47 // GetWycheproofDigest returns a digest function using the Wycheproof name, or
48 // nullptr on error.
49 const EVP_MD *GetWycheproofDigest(FileTest *t, const char *key,
50  bool instruction);
51 
52 // GetWycheproofCurve returns a curve using the Wycheproof name, or nullptr on
53 // error.
54 bssl::UniquePtr<EC_GROUP> GetWycheproofCurve(FileTest *t, const char *key,
55  bool instruction);
56 
57 // GetWycheproofBIGNUM returns a BIGNUM in the Wycheproof format, or nullptr on
58 // error.
59 bssl::UniquePtr<BIGNUM> GetWycheproofBIGNUM(FileTest *t, const char *key,
60  bool instruction);
61 
62 
63 #endif // OPENSSL_HEADER_CRYPTO_TEST_WYCHEPROOF_UTIL_H
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
env_md_st
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h:67
WycheproofResult
Definition: wycheproof_util.h:34
WycheproofResult::raw_result
WycheproofRawResult raw_result
Definition: wycheproof_util.h:35
WycheproofRawResult::kAcceptable
@ kAcceptable
base.h
GetWycheproofDigest
const EVP_MD * GetWycheproofDigest(FileTest *t, const char *key, bool instruction)
Definition: wycheproof_util.cc:81
GetWycheproofBIGNUM
bssl::UniquePtr< BIGNUM > GetWycheproofBIGNUM(FileTest *t, const char *key, bool instruction)
Definition: wycheproof_util.cc:132
FileTest
Definition: file_test.h:90
WycheproofResult::IsValid
bool IsValid(const std::vector< std::string > &acceptable_flags={}) const
Definition: wycheproof_util.cc:29
GetWycheproofResult
bool GetWycheproofResult(FileTest *t, WycheproofResult *out)
Definition: wycheproof_util.cc:49
key
const char * key
Definition: hpack_parser_table.cc:164
WycheproofResult::flags
std::vector< std::string > flags
Definition: wycheproof_util.h:36
WycheproofRawResult::kValid
@ kValid
WycheproofRawResult
WycheproofRawResult
Definition: wycheproof_util.h:28
GetWycheproofCurve
bssl::UniquePtr< EC_GROUP > GetWycheproofCurve(FileTest *t, const char *key, bool instruction)
Definition: wycheproof_util.cc:108
WycheproofRawResult::kInvalid
@ kInvalid


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:53