// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: proto/ukey.proto

#include "proto/ukey.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG
namespace securegcm {
constexpr Ukey2Message::Ukey2Message(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : message_data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , message_type_(0)
{}
struct Ukey2MessageDefaultTypeInternal {
  constexpr Ukey2MessageDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~Ukey2MessageDefaultTypeInternal() {}
  union {
    Ukey2Message _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Ukey2MessageDefaultTypeInternal _Ukey2Message_default_instance_;
constexpr Ukey2Alert::Ukey2Alert(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : error_message_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , type_(1)
{}
struct Ukey2AlertDefaultTypeInternal {
  constexpr Ukey2AlertDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~Ukey2AlertDefaultTypeInternal() {}
  union {
    Ukey2Alert _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Ukey2AlertDefaultTypeInternal _Ukey2Alert_default_instance_;
constexpr Ukey2ClientInit_CipherCommitment::Ukey2ClientInit_CipherCommitment(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : commitment_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , handshake_cipher_(0)
{}
struct Ukey2ClientInit_CipherCommitmentDefaultTypeInternal {
  constexpr Ukey2ClientInit_CipherCommitmentDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~Ukey2ClientInit_CipherCommitmentDefaultTypeInternal() {}
  union {
    Ukey2ClientInit_CipherCommitment _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Ukey2ClientInit_CipherCommitmentDefaultTypeInternal _Ukey2ClientInit_CipherCommitment_default_instance_;
constexpr Ukey2ClientInit::Ukey2ClientInit(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : cipher_commitments_()
  , random_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , next_protocol_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , version_(0){}
struct Ukey2ClientInitDefaultTypeInternal {
  constexpr Ukey2ClientInitDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~Ukey2ClientInitDefaultTypeInternal() {}
  union {
    Ukey2ClientInit _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Ukey2ClientInitDefaultTypeInternal _Ukey2ClientInit_default_instance_;
constexpr Ukey2ServerInit::Ukey2ServerInit(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : random_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , public_key_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , version_(0)
  , handshake_cipher_(0)
{}
struct Ukey2ServerInitDefaultTypeInternal {
  constexpr Ukey2ServerInitDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~Ukey2ServerInitDefaultTypeInternal() {}
  union {
    Ukey2ServerInit _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Ukey2ServerInitDefaultTypeInternal _Ukey2ServerInit_default_instance_;
constexpr Ukey2ClientFinished::Ukey2ClientFinished(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : public_key_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
struct Ukey2ClientFinishedDefaultTypeInternal {
  constexpr Ukey2ClientFinishedDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~Ukey2ClientFinishedDefaultTypeInternal() {}
  union {
    Ukey2ClientFinished _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Ukey2ClientFinishedDefaultTypeInternal _Ukey2ClientFinished_default_instance_;
}  // namespace securegcm
namespace securegcm {
bool Ukey2Message_Type_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
    case 2:
    case 3:
    case 4:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> Ukey2Message_Type_strings[5] = {};

static const char Ukey2Message_Type_names[] =
  "ALERT"
  "CLIENT_FINISH"
  "CLIENT_INIT"
  "SERVER_INIT"
  "UNKNOWN_DO_NOT_USE";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry Ukey2Message_Type_entries[] = {
  { {Ukey2Message_Type_names + 0, 5}, 1 },
  { {Ukey2Message_Type_names + 5, 13}, 4 },
  { {Ukey2Message_Type_names + 18, 11}, 2 },
  { {Ukey2Message_Type_names + 29, 11}, 3 },
  { {Ukey2Message_Type_names + 40, 18}, 0 },
};

static const int Ukey2Message_Type_entries_by_number[] = {
  4, // 0 -> UNKNOWN_DO_NOT_USE
  0, // 1 -> ALERT
  2, // 2 -> CLIENT_INIT
  3, // 3 -> SERVER_INIT
  1, // 4 -> CLIENT_FINISH
};

const std::string& Ukey2Message_Type_Name(
    Ukey2Message_Type value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          Ukey2Message_Type_entries,
          Ukey2Message_Type_entries_by_number,
          5, Ukey2Message_Type_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      Ukey2Message_Type_entries,
      Ukey2Message_Type_entries_by_number,
      5, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     Ukey2Message_Type_strings[idx].get();
}
bool Ukey2Message_Type_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, Ukey2Message_Type* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      Ukey2Message_Type_entries, 5, name, &int_value);
  if (success) {
    *value = static_cast<Ukey2Message_Type>(int_value);
  }
  return success;
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr Ukey2Message_Type Ukey2Message::UNKNOWN_DO_NOT_USE;
constexpr Ukey2Message_Type Ukey2Message::ALERT;
constexpr Ukey2Message_Type Ukey2Message::CLIENT_INIT;
constexpr Ukey2Message_Type Ukey2Message::SERVER_INIT;
constexpr Ukey2Message_Type Ukey2Message::CLIENT_FINISH;
constexpr Ukey2Message_Type Ukey2Message::Type_MIN;
constexpr Ukey2Message_Type Ukey2Message::Type_MAX;
constexpr int Ukey2Message::Type_ARRAYSIZE;
#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
bool Ukey2Alert_AlertType_IsValid(int value) {
  switch (value) {
    case 1:
    case 2:
    case 3:
    case 4:
    case 100:
    case 101:
    case 102:
    case 103:
    case 104:
    case 200:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> Ukey2Alert_AlertType_strings[10] = {};

static const char Ukey2Alert_AlertType_names[] =
  "BAD_HANDSHAKE_CIPHER"
  "BAD_MESSAGE"
  "BAD_MESSAGE_DATA"
  "BAD_MESSAGE_TYPE"
  "BAD_NEXT_PROTOCOL"
  "BAD_PUBLIC_KEY"
  "BAD_RANDOM"
  "BAD_VERSION"
  "INCORRECT_MESSAGE"
  "INTERNAL_ERROR";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry Ukey2Alert_AlertType_entries[] = {
  { {Ukey2Alert_AlertType_names + 0, 20}, 102 },
  { {Ukey2Alert_AlertType_names + 20, 11}, 1 },
  { {Ukey2Alert_AlertType_names + 31, 16}, 4 },
  { {Ukey2Alert_AlertType_names + 47, 16}, 2 },
  { {Ukey2Alert_AlertType_names + 63, 17}, 103 },
  { {Ukey2Alert_AlertType_names + 80, 14}, 104 },
  { {Ukey2Alert_AlertType_names + 94, 10}, 101 },
  { {Ukey2Alert_AlertType_names + 104, 11}, 100 },
  { {Ukey2Alert_AlertType_names + 115, 17}, 3 },
  { {Ukey2Alert_AlertType_names + 132, 14}, 200 },
};

static const int Ukey2Alert_AlertType_entries_by_number[] = {
  1, // 1 -> BAD_MESSAGE
  3, // 2 -> BAD_MESSAGE_TYPE
  8, // 3 -> INCORRECT_MESSAGE
  2, // 4 -> BAD_MESSAGE_DATA
  7, // 100 -> BAD_VERSION
  6, // 101 -> BAD_RANDOM
  0, // 102 -> BAD_HANDSHAKE_CIPHER
  4, // 103 -> BAD_NEXT_PROTOCOL
  5, // 104 -> BAD_PUBLIC_KEY
  9, // 200 -> INTERNAL_ERROR
};

const std::string& Ukey2Alert_AlertType_Name(
    Ukey2Alert_AlertType value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          Ukey2Alert_AlertType_entries,
          Ukey2Alert_AlertType_entries_by_number,
          10, Ukey2Alert_AlertType_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      Ukey2Alert_AlertType_entries,
      Ukey2Alert_AlertType_entries_by_number,
      10, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     Ukey2Alert_AlertType_strings[idx].get();
}
bool Ukey2Alert_AlertType_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, Ukey2Alert_AlertType* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      Ukey2Alert_AlertType_entries, 10, name, &int_value);
  if (success) {
    *value = static_cast<Ukey2Alert_AlertType>(int_value);
  }
  return success;
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_MESSAGE;
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_MESSAGE_TYPE;
constexpr Ukey2Alert_AlertType Ukey2Alert::INCORRECT_MESSAGE;
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_MESSAGE_DATA;
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_VERSION;
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_RANDOM;
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_HANDSHAKE_CIPHER;
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_NEXT_PROTOCOL;
constexpr Ukey2Alert_AlertType Ukey2Alert::BAD_PUBLIC_KEY;
constexpr Ukey2Alert_AlertType Ukey2Alert::INTERNAL_ERROR;
constexpr Ukey2Alert_AlertType Ukey2Alert::AlertType_MIN;
constexpr Ukey2Alert_AlertType Ukey2Alert::AlertType_MAX;
constexpr int Ukey2Alert::AlertType_ARRAYSIZE;
#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
bool Ukey2HandshakeCipher_IsValid(int value) {
  switch (value) {
    case 0:
    case 100:
    case 200:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> Ukey2HandshakeCipher_strings[3] = {};

static const char Ukey2HandshakeCipher_names[] =
  "CURVE25519_SHA512"
  "P256_SHA512"
  "RESERVED";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry Ukey2HandshakeCipher_entries[] = {
  { {Ukey2HandshakeCipher_names + 0, 17}, 200 },
  { {Ukey2HandshakeCipher_names + 17, 11}, 100 },
  { {Ukey2HandshakeCipher_names + 28, 8}, 0 },
};

static const int Ukey2HandshakeCipher_entries_by_number[] = {
  2, // 0 -> RESERVED
  1, // 100 -> P256_SHA512
  0, // 200 -> CURVE25519_SHA512
};

const std::string& Ukey2HandshakeCipher_Name(
    Ukey2HandshakeCipher value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          Ukey2HandshakeCipher_entries,
          Ukey2HandshakeCipher_entries_by_number,
          3, Ukey2HandshakeCipher_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      Ukey2HandshakeCipher_entries,
      Ukey2HandshakeCipher_entries_by_number,
      3, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     Ukey2HandshakeCipher_strings[idx].get();
}
bool Ukey2HandshakeCipher_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, Ukey2HandshakeCipher* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      Ukey2HandshakeCipher_entries, 3, name, &int_value);
  if (success) {
    *value = static_cast<Ukey2HandshakeCipher>(int_value);
  }
  return success;
}

// ===================================================================

class Ukey2Message::_Internal {
 public:
  using HasBits = decltype(std::declval<Ukey2Message>()._has_bits_);
  static void set_has_message_type(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_message_data(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
};

Ukey2Message::Ukey2Message(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:securegcm.Ukey2Message)
}
Ukey2Message::Ukey2Message(const Ukey2Message& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  message_data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    message_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_message_data()) {
    message_data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_message_data(), 
      GetArenaForAllocation());
  }
  message_type_ = from.message_type_;
  // @@protoc_insertion_point(copy_constructor:securegcm.Ukey2Message)
}

inline void Ukey2Message::SharedCtor() {
message_data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  message_data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
message_type_ = 0;
}

Ukey2Message::~Ukey2Message() {
  // @@protoc_insertion_point(destructor:securegcm.Ukey2Message)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void Ukey2Message::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  message_data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void Ukey2Message::ArenaDtor(void* object) {
  Ukey2Message* _this = reinterpret_cast< Ukey2Message* >(object);
  (void)_this;
}
void Ukey2Message::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Ukey2Message::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Ukey2Message::Clear() {
// @@protoc_insertion_point(message_clear_start:securegcm.Ukey2Message)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    message_data_.ClearNonDefaultToEmpty();
  }
  message_type_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Ukey2Message::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional .securegcm.Ukey2Message.Type message_type = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::securegcm::Ukey2Message_Type_IsValid(val))) {
            _internal_set_message_type(static_cast<::securegcm::Ukey2Message_Type>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      // optional bytes message_data = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_message_data();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Ukey2Message::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:securegcm.Ukey2Message)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional .securegcm.Ukey2Message.Type message_type = 1;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
      1, this->_internal_message_type(), target);
  }

  // optional bytes message_data = 2;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        2, this->_internal_message_data(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:securegcm.Ukey2Message)
  return target;
}

size_t Ukey2Message::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:securegcm.Ukey2Message)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    // optional bytes message_data = 2;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_message_data());
    }

    // optional .securegcm.Ukey2Message.Type message_type = 1;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_message_type());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Ukey2Message::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const Ukey2Message*>(
      &from));
}

void Ukey2Message::MergeFrom(const Ukey2Message& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:securegcm.Ukey2Message)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_message_data(from._internal_message_data());
    }
    if (cached_has_bits & 0x00000002u) {
      message_type_ = from.message_type_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Ukey2Message::CopyFrom(const Ukey2Message& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:securegcm.Ukey2Message)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Ukey2Message::IsInitialized() const {
  return true;
}

void Ukey2Message::InternalSwap(Ukey2Message* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &message_data_, lhs_arena,
      &other->message_data_, rhs_arena
  );
  swap(message_type_, other->message_type_);
}

std::string Ukey2Message::GetTypeName() const {
  return "securegcm.Ukey2Message";
}


// ===================================================================

class Ukey2Alert::_Internal {
 public:
  using HasBits = decltype(std::declval<Ukey2Alert>()._has_bits_);
  static void set_has_type(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_error_message(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
};

Ukey2Alert::Ukey2Alert(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:securegcm.Ukey2Alert)
}
Ukey2Alert::Ukey2Alert(const Ukey2Alert& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  error_message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    error_message_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_error_message()) {
    error_message_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error_message(), 
      GetArenaForAllocation());
  }
  type_ = from.type_;
  // @@protoc_insertion_point(copy_constructor:securegcm.Ukey2Alert)
}

inline void Ukey2Alert::SharedCtor() {
error_message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  error_message_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_ = 1;
}

Ukey2Alert::~Ukey2Alert() {
  // @@protoc_insertion_point(destructor:securegcm.Ukey2Alert)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void Ukey2Alert::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  error_message_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void Ukey2Alert::ArenaDtor(void* object) {
  Ukey2Alert* _this = reinterpret_cast< Ukey2Alert* >(object);
  (void)_this;
}
void Ukey2Alert::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Ukey2Alert::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Ukey2Alert::Clear() {
// @@protoc_insertion_point(message_clear_start:securegcm.Ukey2Alert)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      error_message_.ClearNonDefaultToEmpty();
    }
    type_ = 1;
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Ukey2Alert::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional .securegcm.Ukey2Alert.AlertType type = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::securegcm::Ukey2Alert_AlertType_IsValid(val))) {
            _internal_set_type(static_cast<::securegcm::Ukey2Alert_AlertType>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      // optional string error_message = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_error_message();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Ukey2Alert::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:securegcm.Ukey2Alert)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional .securegcm.Ukey2Alert.AlertType type = 1;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
      1, this->_internal_type(), target);
  }

  // optional string error_message = 2;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteStringMaybeAliased(
        2, this->_internal_error_message(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:securegcm.Ukey2Alert)
  return target;
}

size_t Ukey2Alert::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:securegcm.Ukey2Alert)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    // optional string error_message = 2;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_error_message());
    }

    // optional .securegcm.Ukey2Alert.AlertType type = 1;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Ukey2Alert::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const Ukey2Alert*>(
      &from));
}

void Ukey2Alert::MergeFrom(const Ukey2Alert& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:securegcm.Ukey2Alert)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_error_message(from._internal_error_message());
    }
    if (cached_has_bits & 0x00000002u) {
      type_ = from.type_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Ukey2Alert::CopyFrom(const Ukey2Alert& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:securegcm.Ukey2Alert)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Ukey2Alert::IsInitialized() const {
  return true;
}

void Ukey2Alert::InternalSwap(Ukey2Alert* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &error_message_, lhs_arena,
      &other->error_message_, rhs_arena
  );
  swap(type_, other->type_);
}

std::string Ukey2Alert::GetTypeName() const {
  return "securegcm.Ukey2Alert";
}


// ===================================================================

class Ukey2ClientInit_CipherCommitment::_Internal {
 public:
  using HasBits = decltype(std::declval<Ukey2ClientInit_CipherCommitment>()._has_bits_);
  static void set_has_handshake_cipher(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_commitment(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
};

Ukey2ClientInit_CipherCommitment::Ukey2ClientInit_CipherCommitment(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:securegcm.Ukey2ClientInit.CipherCommitment)
}
Ukey2ClientInit_CipherCommitment::Ukey2ClientInit_CipherCommitment(const Ukey2ClientInit_CipherCommitment& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  commitment_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    commitment_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_commitment()) {
    commitment_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_commitment(), 
      GetArenaForAllocation());
  }
  handshake_cipher_ = from.handshake_cipher_;
  // @@protoc_insertion_point(copy_constructor:securegcm.Ukey2ClientInit.CipherCommitment)
}

inline void Ukey2ClientInit_CipherCommitment::SharedCtor() {
commitment_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  commitment_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
handshake_cipher_ = 0;
}

Ukey2ClientInit_CipherCommitment::~Ukey2ClientInit_CipherCommitment() {
  // @@protoc_insertion_point(destructor:securegcm.Ukey2ClientInit.CipherCommitment)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void Ukey2ClientInit_CipherCommitment::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  commitment_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void Ukey2ClientInit_CipherCommitment::ArenaDtor(void* object) {
  Ukey2ClientInit_CipherCommitment* _this = reinterpret_cast< Ukey2ClientInit_CipherCommitment* >(object);
  (void)_this;
}
void Ukey2ClientInit_CipherCommitment::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Ukey2ClientInit_CipherCommitment::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Ukey2ClientInit_CipherCommitment::Clear() {
// @@protoc_insertion_point(message_clear_start:securegcm.Ukey2ClientInit.CipherCommitment)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    commitment_.ClearNonDefaultToEmpty();
  }
  handshake_cipher_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Ukey2ClientInit_CipherCommitment::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::securegcm::Ukey2HandshakeCipher_IsValid(val))) {
            _internal_set_handshake_cipher(static_cast<::securegcm::Ukey2HandshakeCipher>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      // optional bytes commitment = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_commitment();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Ukey2ClientInit_CipherCommitment::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:securegcm.Ukey2ClientInit.CipherCommitment)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 1;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
      1, this->_internal_handshake_cipher(), target);
  }

  // optional bytes commitment = 2;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        2, this->_internal_commitment(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:securegcm.Ukey2ClientInit.CipherCommitment)
  return target;
}

size_t Ukey2ClientInit_CipherCommitment::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:securegcm.Ukey2ClientInit.CipherCommitment)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    // optional bytes commitment = 2;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_commitment());
    }

    // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 1;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_handshake_cipher());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Ukey2ClientInit_CipherCommitment::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const Ukey2ClientInit_CipherCommitment*>(
      &from));
}

void Ukey2ClientInit_CipherCommitment::MergeFrom(const Ukey2ClientInit_CipherCommitment& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:securegcm.Ukey2ClientInit.CipherCommitment)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_commitment(from._internal_commitment());
    }
    if (cached_has_bits & 0x00000002u) {
      handshake_cipher_ = from.handshake_cipher_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Ukey2ClientInit_CipherCommitment::CopyFrom(const Ukey2ClientInit_CipherCommitment& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:securegcm.Ukey2ClientInit.CipherCommitment)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Ukey2ClientInit_CipherCommitment::IsInitialized() const {
  return true;
}

void Ukey2ClientInit_CipherCommitment::InternalSwap(Ukey2ClientInit_CipherCommitment* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &commitment_, lhs_arena,
      &other->commitment_, rhs_arena
  );
  swap(handshake_cipher_, other->handshake_cipher_);
}

std::string Ukey2ClientInit_CipherCommitment::GetTypeName() const {
  return "securegcm.Ukey2ClientInit.CipherCommitment";
}


// ===================================================================

class Ukey2ClientInit::_Internal {
 public:
  using HasBits = decltype(std::declval<Ukey2ClientInit>()._has_bits_);
  static void set_has_version(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_random(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_next_protocol(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
};

Ukey2ClientInit::Ukey2ClientInit(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned),
  cipher_commitments_(arena) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:securegcm.Ukey2ClientInit)
}
Ukey2ClientInit::Ukey2ClientInit(const Ukey2ClientInit& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_),
      cipher_commitments_(from.cipher_commitments_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  random_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    random_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_random()) {
    random_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_random(), 
      GetArenaForAllocation());
  }
  next_protocol_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    next_protocol_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_next_protocol()) {
    next_protocol_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_next_protocol(), 
      GetArenaForAllocation());
  }
  version_ = from.version_;
  // @@protoc_insertion_point(copy_constructor:securegcm.Ukey2ClientInit)
}

inline void Ukey2ClientInit::SharedCtor() {
random_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  random_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
next_protocol_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  next_protocol_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_ = 0;
}

Ukey2ClientInit::~Ukey2ClientInit() {
  // @@protoc_insertion_point(destructor:securegcm.Ukey2ClientInit)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void Ukey2ClientInit::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  random_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  next_protocol_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void Ukey2ClientInit::ArenaDtor(void* object) {
  Ukey2ClientInit* _this = reinterpret_cast< Ukey2ClientInit* >(object);
  (void)_this;
}
void Ukey2ClientInit::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Ukey2ClientInit::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Ukey2ClientInit::Clear() {
// @@protoc_insertion_point(message_clear_start:securegcm.Ukey2ClientInit)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cipher_commitments_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      random_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      next_protocol_.ClearNonDefaultToEmpty();
    }
  }
  version_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Ukey2ClientInit::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional int32 version = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          _Internal::set_has_version(&has_bits);
          version_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bytes random = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_random();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated .securegcm.Ukey2ClientInit.CipherCommitment cipher_commitments = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_cipher_commitments(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
        } else
          goto handle_unusual;
        continue;
      // optional string next_protocol = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          auto str = _internal_mutable_next_protocol();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Ukey2ClientInit::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:securegcm.Ukey2ClientInit)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 version = 1;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_version(), target);
  }

  // optional bytes random = 2;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        2, this->_internal_random(), target);
  }

  // repeated .securegcm.Ukey2ClientInit.CipherCommitment cipher_commitments = 3;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_cipher_commitments_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(3, this->_internal_cipher_commitments(i), target, stream);
  }

  // optional string next_protocol = 4;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteStringMaybeAliased(
        4, this->_internal_next_protocol(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:securegcm.Ukey2ClientInit)
  return target;
}

size_t Ukey2ClientInit::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:securegcm.Ukey2ClientInit)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated .securegcm.Ukey2ClientInit.CipherCommitment cipher_commitments = 3;
  total_size += 1UL * this->_internal_cipher_commitments_size();
  for (const auto& msg : this->cipher_commitments_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    // optional bytes random = 2;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_random());
    }

    // optional string next_protocol = 4;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_next_protocol());
    }

    // optional int32 version = 1;
    if (cached_has_bits & 0x00000004u) {
      total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_version());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Ukey2ClientInit::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const Ukey2ClientInit*>(
      &from));
}

void Ukey2ClientInit::MergeFrom(const Ukey2ClientInit& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:securegcm.Ukey2ClientInit)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cipher_commitments_.MergeFrom(from.cipher_commitments_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_random(from._internal_random());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_next_protocol(from._internal_next_protocol());
    }
    if (cached_has_bits & 0x00000004u) {
      version_ = from.version_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Ukey2ClientInit::CopyFrom(const Ukey2ClientInit& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:securegcm.Ukey2ClientInit)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Ukey2ClientInit::IsInitialized() const {
  return true;
}

void Ukey2ClientInit::InternalSwap(Ukey2ClientInit* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  cipher_commitments_.InternalSwap(&other->cipher_commitments_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &random_, lhs_arena,
      &other->random_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &next_protocol_, lhs_arena,
      &other->next_protocol_, rhs_arena
  );
  swap(version_, other->version_);
}

std::string Ukey2ClientInit::GetTypeName() const {
  return "securegcm.Ukey2ClientInit";
}


// ===================================================================

class Ukey2ServerInit::_Internal {
 public:
  using HasBits = decltype(std::declval<Ukey2ServerInit>()._has_bits_);
  static void set_has_version(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_random(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_handshake_cipher(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static void set_has_public_key(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
};

Ukey2ServerInit::Ukey2ServerInit(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:securegcm.Ukey2ServerInit)
}
Ukey2ServerInit::Ukey2ServerInit(const Ukey2ServerInit& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  random_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    random_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_random()) {
    random_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_random(), 
      GetArenaForAllocation());
  }
  public_key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    public_key_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_public_key()) {
    public_key_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_public_key(), 
      GetArenaForAllocation());
  }
  ::memcpy(&version_, &from.version_,
    static_cast<size_t>(reinterpret_cast<char*>(&handshake_cipher_) -
    reinterpret_cast<char*>(&version_)) + sizeof(handshake_cipher_));
  // @@protoc_insertion_point(copy_constructor:securegcm.Ukey2ServerInit)
}

inline void Ukey2ServerInit::SharedCtor() {
random_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  random_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
public_key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  public_key_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&version_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&handshake_cipher_) -
    reinterpret_cast<char*>(&version_)) + sizeof(handshake_cipher_));
}

Ukey2ServerInit::~Ukey2ServerInit() {
  // @@protoc_insertion_point(destructor:securegcm.Ukey2ServerInit)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void Ukey2ServerInit::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  random_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  public_key_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void Ukey2ServerInit::ArenaDtor(void* object) {
  Ukey2ServerInit* _this = reinterpret_cast< Ukey2ServerInit* >(object);
  (void)_this;
}
void Ukey2ServerInit::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Ukey2ServerInit::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Ukey2ServerInit::Clear() {
// @@protoc_insertion_point(message_clear_start:securegcm.Ukey2ServerInit)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      random_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      public_key_.ClearNonDefaultToEmpty();
    }
  }
  if (cached_has_bits & 0x0000000cu) {
    ::memset(&version_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&handshake_cipher_) -
        reinterpret_cast<char*>(&version_)) + sizeof(handshake_cipher_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Ukey2ServerInit::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional int32 version = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          _Internal::set_has_version(&has_bits);
          version_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bytes random = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_random();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::securegcm::Ukey2HandshakeCipher_IsValid(val))) {
            _internal_set_handshake_cipher(static_cast<::securegcm::Ukey2HandshakeCipher>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      // optional bytes public_key = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          auto str = _internal_mutable_public_key();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Ukey2ServerInit::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:securegcm.Ukey2ServerInit)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 version = 1;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_version(), target);
  }

  // optional bytes random = 2;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        2, this->_internal_random(), target);
  }

  // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 3;
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
      3, this->_internal_handshake_cipher(), target);
  }

  // optional bytes public_key = 4;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteBytesMaybeAliased(
        4, this->_internal_public_key(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:securegcm.Ukey2ServerInit)
  return target;
}

size_t Ukey2ServerInit::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:securegcm.Ukey2ServerInit)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    // optional bytes random = 2;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_random());
    }

    // optional bytes public_key = 4;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_public_key());
    }

    // optional int32 version = 1;
    if (cached_has_bits & 0x00000004u) {
      total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_version());
    }

    // optional .securegcm.Ukey2HandshakeCipher handshake_cipher = 3;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_handshake_cipher());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Ukey2ServerInit::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const Ukey2ServerInit*>(
      &from));
}

void Ukey2ServerInit::MergeFrom(const Ukey2ServerInit& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:securegcm.Ukey2ServerInit)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_random(from._internal_random());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_public_key(from._internal_public_key());
    }
    if (cached_has_bits & 0x00000004u) {
      version_ = from.version_;
    }
    if (cached_has_bits & 0x00000008u) {
      handshake_cipher_ = from.handshake_cipher_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Ukey2ServerInit::CopyFrom(const Ukey2ServerInit& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:securegcm.Ukey2ServerInit)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Ukey2ServerInit::IsInitialized() const {
  return true;
}

void Ukey2ServerInit::InternalSwap(Ukey2ServerInit* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &random_, lhs_arena,
      &other->random_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &public_key_, lhs_arena,
      &other->public_key_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(Ukey2ServerInit, handshake_cipher_)
      + sizeof(Ukey2ServerInit::handshake_cipher_)
      - PROTOBUF_FIELD_OFFSET(Ukey2ServerInit, version_)>(
          reinterpret_cast<char*>(&version_),
          reinterpret_cast<char*>(&other->version_));
}

std::string Ukey2ServerInit::GetTypeName() const {
  return "securegcm.Ukey2ServerInit";
}


// ===================================================================

class Ukey2ClientFinished::_Internal {
 public:
  using HasBits = decltype(std::declval<Ukey2ClientFinished>()._has_bits_);
  static void set_has_public_key(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
};

Ukey2ClientFinished::Ukey2ClientFinished(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:securegcm.Ukey2ClientFinished)
}
Ukey2ClientFinished::Ukey2ClientFinished(const Ukey2ClientFinished& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  public_key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    public_key_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_public_key()) {
    public_key_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_public_key(), 
      GetArenaForAllocation());
  }
  // @@protoc_insertion_point(copy_constructor:securegcm.Ukey2ClientFinished)
}

inline void Ukey2ClientFinished::SharedCtor() {
public_key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  public_key_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

Ukey2ClientFinished::~Ukey2ClientFinished() {
  // @@protoc_insertion_point(destructor:securegcm.Ukey2ClientFinished)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void Ukey2ClientFinished::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  public_key_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void Ukey2ClientFinished::ArenaDtor(void* object) {
  Ukey2ClientFinished* _this = reinterpret_cast< Ukey2ClientFinished* >(object);
  (void)_this;
}
void Ukey2ClientFinished::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Ukey2ClientFinished::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Ukey2ClientFinished::Clear() {
// @@protoc_insertion_point(message_clear_start:securegcm.Ukey2ClientFinished)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    public_key_.ClearNonDefaultToEmpty();
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Ukey2ClientFinished::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional bytes public_key = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_public_key();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Ukey2ClientFinished::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:securegcm.Ukey2ClientFinished)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional bytes public_key = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        1, this->_internal_public_key(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:securegcm.Ukey2ClientFinished)
  return target;
}

size_t Ukey2ClientFinished::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:securegcm.Ukey2ClientFinished)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // optional bytes public_key = 1;
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
        this->_internal_public_key());
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Ukey2ClientFinished::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const Ukey2ClientFinished*>(
      &from));
}

void Ukey2ClientFinished::MergeFrom(const Ukey2ClientFinished& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:securegcm.Ukey2ClientFinished)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (from._internal_has_public_key()) {
    _internal_set_public_key(from._internal_public_key());
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Ukey2ClientFinished::CopyFrom(const Ukey2ClientFinished& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:securegcm.Ukey2ClientFinished)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Ukey2ClientFinished::IsInitialized() const {
  return true;
}

void Ukey2ClientFinished::InternalSwap(Ukey2ClientFinished* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
      &public_key_, lhs_arena,
      &other->public_key_, rhs_arena
  );
}

std::string Ukey2ClientFinished::GetTypeName() const {
  return "securegcm.Ukey2ClientFinished";
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace securegcm
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::securegcm::Ukey2Message* Arena::CreateMaybeMessage< ::securegcm::Ukey2Message >(Arena* arena) {
  return Arena::CreateMessageInternal< ::securegcm::Ukey2Message >(arena);
}
template<> PROTOBUF_NOINLINE ::securegcm::Ukey2Alert* Arena::CreateMaybeMessage< ::securegcm::Ukey2Alert >(Arena* arena) {
  return Arena::CreateMessageInternal< ::securegcm::Ukey2Alert >(arena);
}
template<> PROTOBUF_NOINLINE ::securegcm::Ukey2ClientInit_CipherCommitment* Arena::CreateMaybeMessage< ::securegcm::Ukey2ClientInit_CipherCommitment >(Arena* arena) {
  return Arena::CreateMessageInternal< ::securegcm::Ukey2ClientInit_CipherCommitment >(arena);
}
template<> PROTOBUF_NOINLINE ::securegcm::Ukey2ClientInit* Arena::CreateMaybeMessage< ::securegcm::Ukey2ClientInit >(Arena* arena) {
  return Arena::CreateMessageInternal< ::securegcm::Ukey2ClientInit >(arena);
}
template<> PROTOBUF_NOINLINE ::securegcm::Ukey2ServerInit* Arena::CreateMaybeMessage< ::securegcm::Ukey2ServerInit >(Arena* arena) {
  return Arena::CreateMessageInternal< ::securegcm::Ukey2ServerInit >(arena);
}
template<> PROTOBUF_NOINLINE ::securegcm::Ukey2ClientFinished* Arena::CreateMaybeMessage< ::securegcm::Ukey2ClientFinished >(Arena* arena) {
  return Arena::CreateMessageInternal< ::securegcm::Ukey2ClientFinished >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
