#include "anonymous_tokens/cpp/crypto/crypto_utils.h"
#include <stddef.h>
#include <stdint.h>
#include <cstdint>
#include <iterator>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "anonymous_tokens/cpp/crypto/constants.h"
#include "anonymous_tokens/cpp/shared/status_utils.h"
#include <openssl/base.h>
#include <openssl/bytestring.h>
#include <openssl/digest.h>
#include <openssl/err.h>
#include <openssl/hkdf.h>
#include <openssl/mem.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
namespace anonymous_tokens {
namespace internal {
constexpr uint32_t kBoringSSLRSASqrtTwo[] = …;
absl::StatusOr<bssl::UniquePtr<BIGNUM>> PublicMetadataHashWithHKDF(
absl::string_view public_metadata, absl::string_view rsa_modulus_str,
size_t out_len_bytes) { … }
}
namespace {
absl::StatusOr<std::string> MarshalRsaPublicKey(const RSA* rsa) { … }
}
absl::StatusOr<BnCtxPtr> GetAndStartBigNumCtx() { … }
absl::StatusOr<bssl::UniquePtr<BIGNUM>> NewBigNum() { … }
absl::StatusOr<std::string> BignumToString(const BIGNUM& big_num,
const size_t output_len) { … }
absl::StatusOr<bssl::UniquePtr<BIGNUM>> StringToBignum(
const absl::string_view input_str) { … }
std::string GetSslErrors() { … }
std::string MaskMessageConcat(absl::string_view mask,
absl::string_view message) { … }
std::string EncodeMessagePublicMetadata(absl::string_view message,
absl::string_view public_metadata) { … }
absl::StatusOr<bssl::UniquePtr<BIGNUM>> GetRsaSqrtTwo(int x) { … }
absl::StatusOr<bssl::UniquePtr<BIGNUM>> ComputePowerOfTwo(int x) { … }
absl::StatusOr<std::string> ComputeHash(absl::string_view input,
const EVP_MD& hasher) { … }
absl::StatusOr<bssl::UniquePtr<RSA>> CreatePrivateKeyRSA(
const absl::string_view rsa_modulus,
const absl::string_view public_exponent,
const absl::string_view private_exponent, const absl::string_view p,
const absl::string_view q, const absl::string_view dp,
const absl::string_view dq, const absl::string_view crt) { … }
absl::StatusOr<bssl::UniquePtr<RSA>> CreatePublicKeyRSA(
const absl::string_view rsa_modulus,
const absl::string_view public_exponent) { … }
absl::StatusOr<bssl::UniquePtr<RSA>> CreatePublicKeyRSAWithPublicMetadata(
const BIGNUM& rsa_modulus, const BIGNUM& public_exponent,
absl::string_view public_metadata, const bool use_rsa_public_exponent) { … }
absl::StatusOr<bssl::UniquePtr<RSA>> CreatePublicKeyRSAWithPublicMetadata(
const absl::string_view rsa_modulus,
const absl::string_view public_exponent,
const absl::string_view public_metadata,
const bool use_rsa_public_exponent) { … }
absl::StatusOr<bssl::UniquePtr<BIGNUM>> ComputeCarmichaelLcm(
const BIGNUM& phi_p, const BIGNUM& phi_q, BN_CTX& bn_ctx) { … }
absl::StatusOr<bssl::UniquePtr<BIGNUM>> ComputeExponentWithPublicMetadata(
const BIGNUM& n, absl::string_view public_metadata) { … }
absl::StatusOr<bssl::UniquePtr<BIGNUM>>
ComputeExponentWithPublicMetadataAndPublicExponent(
const BIGNUM& n, const BIGNUM& e, absl::string_view public_metadata) { … }
absl::Status RsaBlindSignatureVerify(const int salt_length,
const EVP_MD* sig_hash,
const EVP_MD* mgf1_hash,
const absl::string_view signature,
const absl::string_view message,
RSA* rsa_public_key) { … }
absl::StatusOr<std::string> RsaSsaPssPublicKeyToDerEncoding(const RSA* rsa) { … }
absl::StatusOr<bool> PrivacyPassTruncatedTokenKeyIdCollision(
const RSA* public_key, const RSA* other_public_key) { … }
}