Skip to content

Commit

Permalink
[#197] Removed commented code and references to GCM-SIV in wolfssl
Browse files Browse the repository at this point in the history
  • Loading branch information
Donnie-Ice committed Aug 2, 2024
1 parent 483eca8 commit efcf356
Showing 1 changed file with 0 additions and 89 deletions.
89 changes: 0 additions & 89 deletions src/crypto/wolfssl/cryptography_interface_wolfssl.template.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,19 +422,6 @@ static int32_t cryptography_encrypt(uint8_t* data_out, size_t len_data_out,
}
break;

// TODO: Confirm same process as above for SIV
// case CRYPTO_CIPHER_AES256_GCM_SIV:
// status = wc_AesGcmSetKey(&enc, key, len_key);
// if (status == 0)
// {
// //status = wc_AesGcmEncrypt(&enc, data_out, data_in, len_data_in, iv, iv_len, NULL, 16, NULL, 0);
// status = wc_AesSivEncrypt(key, len_key, NULL, 0, )
// if (status == -180)
// { // Special error case as Wolf will not accept a zero value for MAC size
// status = CRYPTO_LIB_SUCCESS;
// }
// }
// break;

case CRYPTO_CIPHER_AES256_CBC:
status = wc_AesSetKey(&enc, key, len_key, iv, AES_ENCRYPTION);
Expand Down Expand Up @@ -528,30 +515,6 @@ static int32_t cryptography_aead_encrypt(uint8_t* data_out, size_t len_data_out,
}
break;

// TODO: Confirm same process will be used
// case CRYPTO_CIPHER_AES256_GCM_SIV:
// status = wc_AesGcmSetKey(&enc, key, len_key);
// if (status == 0)
// {
// if ((encrypt_bool == CRYPTO_TRUE) && (authenticate_bool == CRYPTO_TRUE))
// {
// status = wc_AesGcmEncrypt(&enc, data_out, data_in, len_data_in, iv, iv_len, mac, mac_size, aad, aad_len);
// }
// else if (encrypt_bool == CRYPTO_TRUE)
// {
// status = wc_AesGcmEncrypt(&enc, data_out, data_in, len_data_in, iv, iv_len, mac, 16, aad, aad_len);
// if (status == -180)
// { // Special error case as Wolf will not accept a zero value for MAC size
// status = CRYPTO_LIB_SUCCESS;
// }
// }
// else if (authenticate_bool == CRYPTO_TRUE)
// {
// status = wc_AesGcmEncrypt(&enc, data_out, data_in, 0, iv, iv_len, mac, mac_size, aad, aad_len);
// }
// }
// break;

case CRYPTO_CIPHER_AES256_CCM:
status = CRYPTO_LIB_ERR_UNSUPPORTED_ACS;
break;
Expand Down Expand Up @@ -611,18 +574,6 @@ static int32_t cryptography_decrypt(uint8_t* data_out, size_t len_data_out,
}
break;

// case CRYPTO_CIPHER_AES256_GCM_SIV:
// status = wc_AesGcmSetKey(&dec, key, len_key);
// if (status == 0)
// {
// status = wc_AesGcmDecrypt(&dec, data_out, data_in, len_data_in, iv, iv_len, calc_mac, 16, NULL, 0);
// if (status == -180)
// { // Special error case as Wolf will not accept a zero value for MAC size
// status = CRYPTO_LIB_SUCCESS;
// }
// }
// break;

case CRYPTO_CIPHER_AES256_CBC:
status = wc_AesSetKey(&dec, key, len_key, iv, AES_DECRYPTION);
if (status == 0)
Expand Down Expand Up @@ -709,43 +660,6 @@ static int32_t cryptography_aead_decrypt(uint8_t* data_out, size_t len_data_out,
}
break;

// case CRYPTO_CIPHER_AES256_GCM_SIV:
// status = wc_AesGcmSetKey(&dec, key, len_key);
// if (status == 0)
// {
// if ((decrypt_bool == CRYPTO_TRUE) && (authenticate_bool == CRYPTO_TRUE))
// {
// // Added for now while assessing unit tests and requirements
// if (mac_size > 0)
// {
// status = wc_AesGcmDecrypt(&dec, data_out, data_in, len_data_in, iv, iv_len, mac, mac_size, aad, aad_len);
// }
// else
// {
// status = wc_AesGcmDecrypt(&dec, data_out, data_in, len_data_in, iv, iv_len, mac, 16, aad, aad_len);
// if (status == -180)
// { // Special error case as Wolf will not accept a zero value for MAC size
// status = CRYPTO_LIB_SUCCESS;
// }
// }
// }
// else if (decrypt_bool == CRYPTO_TRUE)
// {
// status = wc_AesGcmDecrypt(&dec, data_out, data_in, len_data_in, iv, iv_len, mac, 16, aad, aad_len);
// if (status == -180)
// { // Special error case as Wolf will not accept a zero value for MAC size
// status = CRYPTO_LIB_SUCCESS;
// }
// }
// else if (authenticate_bool == CRYPTO_TRUE)
// {
// status = wc_AesGcmDecrypt(&dec, data_out, data_in, len_data_in, iv, iv_len, mac, mac_size, aad, aad_len);
// // If authentication only, don't decrypt the data. Just pass the data PDU through.
// memcpy(data_out, data_in, len_data_in);
// }
// }
// break;

case CRYPTO_CIPHER_AES256_CCM:
status = CRYPTO_LIB_ERR_UNSUPPORTED_ECS;
break;
Expand Down Expand Up @@ -809,9 +723,6 @@ int32_t cryptography_get_ecs_algo(int8_t algo_enum)
case CRYPTO_CIPHER_AES256_GCM:
algo = CRYPTO_CIPHER_AES256_GCM;
break;
case CRYPTO_CIPHER_AES256_GCM_SIV:
algo = CRYPTO_CIPHER_AES256_GCM_SIV;
break;
case CRYPTO_CIPHER_AES256_CBC:
algo = CRYPTO_CIPHER_AES256_CBC;
break;
Expand Down

0 comments on commit efcf356

Please sign in to comment.