Remove more openssl code.
diff --git a/src/mbedtls.c b/src/mbedtls.c
index 85144ab..d1f7fb9 100644
--- a/src/mbedtls.c
+++ b/src/mbedtls.c
@@ -390,127 +390,10 @@
mbedtls_gcm_free(&ctx);
return false;
}
-
#endif
-#if 0
-// We are doing CBC-MAC not CMAC at this time
-bool AES_CMAC_Validate(COSE_MacMessage * pcose, int KeySize, int TagSize, const
-byte * pbAuthData, int cbAuthData, cose_errback * perr)
-{
- CMAC_CTX * pctx = NULL;
- const EVP_CIPHER * pcipher = NULL;
- byte * rgbOut = NULL;
- size_t cbOut;
- bool f = false;
- unsigned int i;
-#ifdef USE_CBOR_CONTEXT
- cn_cbor_context * context = &pcose->m_message.m_allocContext;
-#endif
-
- pctx = CMAC_CTX_new();
-
-
- switch (KeySize) {
- case 128: pcipher = EVP_aes_128_cbc(); break;
- case 256: pcipher = EVP_aes_256_cbc(); break;
- default: FAIL_CONDITION(COSE_ERR_INVALID_PARAMETER); break;
- }
-
- rgbOut = COSE_CALLOC(128/8, 1, context);
- CHECK_CONDITION(rgbOut != NULL, COSE_ERR_OUT_OF_MEMORY);
-
- CHECK_CONDITION(CMAC_Init(pctx, pcose->pbKey, pcose->cbKey, pcipher, NULL )
-== 1, COSE_ERR_CRYPTO_FAIL); CHECK_CONDITION(CMAC_Update(pctx, pbAuthData,
-cbAuthData), COSE_ERR_CRYPTO_FAIL); CHECK_CONDITION(CMAC_Final(pctx, rgbOut,
-&cbOut), COSE_ERR_CRYPTO_FAIL);
-
- cn_cbor * cn = _COSE_arrayget_int(&pcose->m_message, INDEX_MAC_TAG);
- CHECK_CONDITION(cn != NULL, COSE_ERR_CBOR);
-
- for (i = 0; i < (unsigned int)TagSize / 8; i++) f |= (cn->v.bytes[i] !=
-rgbOut[i]);
-
- COSE_FREE(rgbOut, context);
- CMAC_CTX_cleanup(pctx);
- CMAC_CTX_free(pctx);
- return !f;
-
-errorReturn:
- COSE_FREE(rgbOut, context);
- CMAC_CTX_cleanup(pctx);
- CMAC_CTX_free(pctx);
- return false;
-
-}
-#endif
-
-#ifdef USE_HKDF_AES
-bool HKDF_AES_Expand(COSE * pcose, size_t cbitKey, const byte * pbPRK, size_t
-cbPRK, const byte * pbInfo, size_t cbInfo, byte * pbOutput, size_t cbOutput,
-cose_errback * perr)
-{
- const EVP_CIPHER * pcipher = NULL;
- EVP_CIPHER_CTX ctx;
- int cbOut;
- byte rgbIV[16] = { 0 };
- byte bCount = 1;
- size_t ib;
- byte rgbDigest[128 / 8];
- int cbDigest = 0;
- byte rgbOut[16];
-
- EVP_CIPHER_CTX_init(&ctx);
-
- switch (cbitKey) {
- case 128:
- pcipher = EVP_aes_128_cbc();
- break;
-
- case 256:
- pcipher = EVP_aes_256_cbc();
- break;
-
- default:
- FAIL_CONDITION(COSE_ERR_INVALID_PARAMETER);
- }
- CHECK_CONDITION(cbPRK == cbitKey / 8, COSE_ERR_INVALID_PARAMETER);
-
- // Setup and run the OpenSSL code
-
-
- for (ib = 0; ib < cbOutput; ib += 16, bCount += 1) {
- size_t ib2;
-
- CHECK_CONDITION(EVP_EncryptInit_ex(&ctx, pcipher, NULL, pbPRK, rgbIV),
-COSE_ERR_CRYPTO_FAIL);
-
- CHECK_CONDITION(EVP_EncryptUpdate(&ctx, rgbOut, &cbOut, rgbDigest,
-cbDigest), COSE_ERR_CRYPTO_FAIL); for (ib2 = 0; ib2 < cbInfo; ib2+=16) {
- CHECK_CONDITION(EVP_EncryptUpdate(&ctx, rgbOut, &cbOut, pbInfo+ib2,
-(int) MIN(16, cbInfo-ib2)), COSE_ERR_CRYPTO_FAIL);
- }
- CHECK_CONDITION(EVP_EncryptUpdate(&ctx, rgbOut, &cbOut, &bCount, 1),
-COSE_ERR_CRYPTO_FAIL); if ((cbInfo + 1) % 16 != 0) {
- CHECK_CONDITION(EVP_EncryptUpdate(&ctx, rgbOut, &cbOut, rgbIV, (int)
-16-(cbInfo+1)%16), COSE_ERR_CRYPTO_FAIL);
- }
- memcpy(rgbDigest, rgbOut, cbOut);
- cbDigest = cbOut;
- memcpy(pbOutput + ib, rgbDigest, MIN(16, cbOutput - ib));
- }
-
- EVP_CIPHER_CTX_cleanup(&ctx);
- return true;
-
-errorReturn:
- EVP_CIPHER_CTX_cleanup(&ctx);
- return false;
-}
-#endif
-
#if defined(USE_HKDF_SHA2)
bool HKDF_Extract(COSE *pcose,
const byte *pbKey,