[MONGOCRYPT-347] Separate KMS provider specific fields in kms_request_t Created: 16/Oct/21  Updated: 25/Oct/22

Status: Backlog
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: techdebt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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;
   }


Generated at Thu Feb 08 09:08:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.