// Copyright 2017 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package chaps;

// Proto for CK_MECHANISM_INFO.
// https://www.cryptsoft.com/pkcs11doc/v220/structCK__MECHANISM__INFO.html
message MechanismInfo {
  // Next ID to use: 4

  optional uint64 min_key_size = 1;
  optional uint64 max_key_size = 2;
  optional uint64 flags = 3;
}

// Proto for CK_SESSION_INFO.
// https://www.cryptsoft.com/pkcs11doc/v220/structCK__SESSION__INFO.html
message SessionInfo {
  // Next ID to use: 5

  optional uint64 slot_id = 1;
  optional uint64 state = 2;
  optional uint64 flags = 3;
  optional uint64 device_error = 4;
}

// Proto for CK_VERSION.
// https://www.cryptsoft.com/pkcs11doc/v220/structCK__VERSION.html
message Version {
  // Next ID to use: 3

  optional uint32 major = 1;
  optional uint32 minor = 2;
}

// Proto for CK_SLOT_INFO.
// https://www.cryptsoft.com/pkcs11doc/v220/structCK__SLOT__INFO.html
message SlotInfo {
  // Next ID to use: 6

  optional bytes slot_description = 1;
  optional bytes manufacturer_id = 2;
  optional uint64 flags = 3;
  optional Version hardware_version = 4;
  optional Version firmware_version = 5;
}

// Proto for CK_TOKEN_INFO.
// https://www.cryptsoft.com/pkcs11doc/v220/structCK__TOKEN__INFO.html
message TokenInfo {
  // Next ID to use: 18

  optional bytes label = 1;
  optional bytes manufacturer_id = 2;
  optional bytes model = 3;
  optional bytes serial_number = 4;
  optional uint64 flags = 5;
  optional uint64 max_session_count = 6;
  optional uint64 session_count = 7;
  optional uint64 max_session_count_rw = 8;
  optional uint64 session_count_rw = 9;
  optional uint64 max_pin_len = 10;
  optional uint64 min_pin_len = 11;
  optional uint64 total_public_memory = 12;
  optional uint64 free_public_memory = 13;
  optional uint64 total_private_memory = 14;
  optional uint64 free_private_memory = 15;
  optional Version hardware_version = 16;
  optional Version firmware_version = 17;
}
