#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include "base/containers/span.h"
#include "components/webcrypto/algorithm_implementation.h"
#include "components/webcrypto/algorithms/ec.h"
#include "components/webcrypto/algorithms/util.h"
#include "components/webcrypto/blink_key_handle.h"
#include "components/webcrypto/generate_key_result.h"
#include "components/webcrypto/status.h"
#include "crypto/openssl_util.h"
#include "crypto/secure_util.h"
#include "third_party/blink/public/platform/web_crypto_algorithm_params.h"
#include "third_party/blink/public/platform/web_crypto_key.h"
#include "third_party/blink/public/platform/web_crypto_key_algorithm.h"
#include "third_party/boringssl/src/include/openssl/bn.h"
#include "third_party/boringssl/src/include/openssl/digest.h"
#include "third_party/boringssl/src/include/openssl/ec.h"
#include "third_party/boringssl/src/include/openssl/ec_key.h"
#include "third_party/boringssl/src/include/openssl/ecdsa.h"
#include "third_party/boringssl/src/include/openssl/evp.h"
#include "third_party/boringssl/src/include/openssl/mem.h"
namespace webcrypto {
namespace {
Status GetPKeyAndDigest(const blink::WebCryptoAlgorithm& algorithm,
const blink::WebCryptoKey& key,
EVP_PKEY** pkey,
const EVP_MD** digest) { … }
Status GetEcGroupOrderSize(EVP_PKEY* pkey, size_t* order_size_bytes) { … }
Status ConvertDerSignatureToWebCryptoSignature(
EVP_PKEY* key,
std::vector<uint8_t>* signature) { … }
Status ConvertWebCryptoSignatureToDerSignature(
EVP_PKEY* key,
base::span<const uint8_t> signature,
std::vector<uint8_t>* der_signature,
bool* incorrect_length) { … }
class EcdsaImplementation : public EcAlgorithm { … };
}
std::unique_ptr<AlgorithmImplementation> CreateEcdsaImplementation() { … }
}