Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-347

Separate KMS provider specific fields in kms_request_t

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None

    Description

      Background & Motivation

      kms_response_t represents a generic KMS message response, which may be from AWS, Azure, GCP, or KMIP. Not all fields in the kms_response_t struct apply to all KMS providers. A clearer separation of fields by KMS provider may help clarify and help with maintainability.

      Scope
      Separate KMS provider specific fields in kms_response_t and clarify which fields apply to which KMS provider. Here is a proposed solution with a union:

      struct _kms_response_t {
         char error[512];
         bool failed;
         kms_request_provider_t provider;
       
         union {
            struct {
               int status;
               kms_kv_list_t *headers;
               kms_request_str_t *body;
            } aws;
            struct {
               int status;
               kms_kv_list_t *headers;
               kms_request_str_t *body;
            } gcp;
            struct {
               int status;
               kms_kv_list_t *headers;
               kms_request_str_t *body;
            } azure;
            struct {
               uint8_t *data;
               uint32_t len;
            } kmip;
         }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: