boringssl/fipsoracle/cavp_test_util.h
Adam Langley 58e449904e Move crypto/fipsoracle/ to the top-level.
This works better with util/generate_build_files.py.

Change-Id: Icb55dc74e0a004aca3e09978640455b66f0473ff
Reviewed-on: https://boringssl-review.googlesource.com/15648
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
2017-04-28 23:55:42 +00:00

57 lines
2.2 KiB
C++

/* 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>
#include "../crypto/test/file_test.h"
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,
const std::vector<uint8_t> &aad, std::vector<uint8_t> *iv);
bool AEADDecrypt(const EVP_AEAD *aead, std::vector<uint8_t> *pt,
std::vector<uint8_t> *aad, size_t pt_len, size_t aad_len,
const std::vector<uint8_t> &key,
const std::vector<uint8_t> &ct,
const std::vector<uint8_t> &tag, std::vector<uint8_t> &iv);
bssl::UniquePtr<BIGNUM> GetBIGNUM(FileTest *t, const char *attribute);
int GetECGroupNIDFromInstruction(FileTest *t);
const EVP_MD *GetDigestFromInstruction(FileTest *t);
#endif // OPENSSL_HEADER_CRYPTO_FIPSMODULE_CAVP_TEST_UTIL_H