Add ECDSA and RSA verify Wycheproof drivers.
Along the way, add some utility functions for getting common things
(curves, hashes, etc.) in the names Wycheproof uses.
Change-Id: I09c11ea2970cf2c8a11a8c2a861d85396efda125
Reviewed-on: https://boringssl-review.googlesource.com/27786
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/test/wycheproof_util.h b/crypto/test/wycheproof_util.h
new file mode 100644
index 0000000..cf50b8e
--- /dev/null
+++ b/crypto/test/wycheproof_util.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2018, Google Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
+#ifndef OPENSSL_HEADER_CRYPTO_TEST_WYCHEPROOF_UTIL_H
+#define OPENSSL_HEADER_CRYPTO_TEST_WYCHEPROOF_UTIL_H
+
+#include <openssl/base.h>
+
+
+// This header contains convenience functions for Wycheproof tests.
+
+class FileTest;
+
+enum class WycheproofResult {
+ kValid,
+ kInvalid,
+ kAcceptable,
+};
+
+// GetWycheproofResult sets |*out| to the parsed "result" key of |t|.
+bool GetWycheproofResult(FileTest *t, WycheproofResult *out);
+
+// GetWycheproofDigest returns a digest function using the Wycheproof name, or
+// nullptr on error.
+const EVP_MD *GetWycheproofDigest(FileTest *t, const char *key,
+ bool instruction);
+
+// GetWycheproofCurve returns a curve using the Wycheproof name, or nullptr on
+// error.
+bssl::UniquePtr<EC_GROUP> GetWycheproofCurve(FileTest *t, const char *key,
+ bool instruction);
+
+
+#endif // OPENSSL_HEADER_CRYPTO_TEST_WYCHEPROOF_UTIL_H