2017-04-24 21:29:11 +01:00
|
|
|
/* Copyright (c) 2017, 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_FIPSMODULE_CAVP_TEST_UTIL_H
|
|
|
|
#define OPENSSL_HEADER_CRYPTO_FIPSMODULE_CAVP_TEST_UTIL_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <openssl/aead.h>
|
|
|
|
#include <openssl/cipher.h>
|
|
|
|
|
2017-04-29 00:45:49 +01:00
|
|
|
#include "../crypto/test/file_test.h"
|
2017-04-28 22:08:45 +01:00
|
|
|
|
2017-04-24 21:29:11 +01:00
|
|
|
|
|
|
|
std::string EncodeHex(const uint8_t *in, size_t in_len);
|
|
|
|
|
|
|
|
const EVP_CIPHER *GetCipher(const std::string &name);
|
|
|
|
|
|
|
|
bool CipherOperation(const EVP_CIPHER *cipher, std::vector<uint8_t> *out,
|
|
|
|
bool encrypt, const std::vector<uint8_t> &key,
|
|
|
|
const std::vector<uint8_t> &iv,
|
|
|
|
const std::vector<uint8_t> &in);
|
|
|
|
|
|
|
|
bool AEADEncrypt(const EVP_AEAD *aead, std::vector<uint8_t> *ct,
|
|
|
|
std::vector<uint8_t> *tag, size_t tag_len,
|
|
|
|
const std::vector<uint8_t> &key,
|
|
|
|
const std::vector<uint8_t> &pt,
|
2017-05-30 19:43:25 +01:00
|
|
|
const std::vector<uint8_t> &aad,
|
|
|
|
const std::vector<uint8_t> &iv);
|
2017-04-24 21:29:11 +01:00
|
|
|
|
2017-05-30 19:43:25 +01:00
|
|
|
bool AEADDecrypt(const EVP_AEAD *aead, std::vector<uint8_t> *pt, size_t pt_len,
|
2017-04-24 21:29:11 +01:00
|
|
|
const std::vector<uint8_t> &key,
|
2017-05-30 19:43:25 +01:00
|
|
|
const std::vector<uint8_t> &aad,
|
2017-04-24 21:29:11 +01:00
|
|
|
const std::vector<uint8_t> &ct,
|
2017-05-30 19:43:25 +01:00
|
|
|
const std::vector<uint8_t> &tag,
|
|
|
|
const std::vector<uint8_t> &iv);
|
2017-04-24 21:29:11 +01:00
|
|
|
|
2017-04-28 22:08:45 +01:00
|
|
|
bssl::UniquePtr<BIGNUM> GetBIGNUM(FileTest *t, const char *attribute);
|
|
|
|
|
2017-05-01 19:56:22 +01:00
|
|
|
int GetECGroupNIDFromInstruction(FileTest *t, const char **out_str = nullptr);
|
2017-04-28 22:08:45 +01:00
|
|
|
|
2017-04-28 22:41:28 +01:00
|
|
|
const EVP_MD *GetDigestFromInstruction(FileTest *t);
|
|
|
|
|
2017-05-30 23:37:27 +01:00
|
|
|
void EchoComment(const std::string& comment);
|
|
|
|
|
2017-05-03 22:12:39 +01:00
|
|
|
int cavp_aes_gcm_test_main(int argc, char **argv);
|
|
|
|
int cavp_aes_test_main(int argc, char **argv);
|
|
|
|
int cavp_ctr_drbg_test_main(int argc, char **argv);
|
|
|
|
int cavp_ecdsa2_keypair_test_main(int argc, char **argv);
|
|
|
|
int cavp_ecdsa2_pkv_test_main(int argc, char **argv);
|
|
|
|
int cavp_ecdsa2_siggen_test_main(int argc, char **argv);
|
|
|
|
int cavp_ecdsa2_sigver_test_main(int argc, char **argv);
|
|
|
|
int cavp_hmac_test_main(int argc, char **argv);
|
2018-01-05 17:28:00 +00:00
|
|
|
int cavp_kas_test_main(int argc, char **argv);
|
2017-05-03 22:12:39 +01:00
|
|
|
int cavp_keywrap_test_main(int argc, char **argv);
|
|
|
|
int cavp_rsa2_keygen_test_main(int argc, char **argv);
|
|
|
|
int cavp_rsa2_siggen_test_main(int argc, char **argv);
|
|
|
|
int cavp_rsa2_sigver_test_main(int argc, char **argv);
|
|
|
|
int cavp_sha_monte_test_main(int argc, char **argv);
|
|
|
|
int cavp_sha_test_main(int argc, char **argv);
|
|
|
|
int cavp_tdes_test_main(int argc, char **argv);
|
2018-01-05 21:59:09 +00:00
|
|
|
int cavp_tlskdf_test_main(int argc, char **argv);
|
2017-05-03 22:12:39 +01:00
|
|
|
|
2017-04-24 21:29:11 +01:00
|
|
|
|
|
|
|
#endif // OPENSSL_HEADER_CRYPTO_FIPSMODULE_CAVP_TEST_UTIL_H
|