Latest update (add quic)
This commit is contained in:
+14
-14
@@ -99,7 +99,7 @@ __owur static ossl_inline int siv128_do_s2v_p(SIV128_CONTEXT *ctx, SIV_BLOCK *ou
|
||||
EVP_MAC_CTX *mac_ctx;
|
||||
int ret = 0;
|
||||
|
||||
mac_ctx = EVP_MAC_CTX_dup(ctx->mac_ctx_init);
|
||||
mac_ctx = EVP_MAC_dup_ctx(ctx->mac_ctx_init);
|
||||
if (mac_ctx == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -126,7 +126,7 @@ __owur static ossl_inline int siv128_do_s2v_p(SIV128_CONTEXT *ctx, SIV_BLOCK *ou
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
EVP_MAC_CTX_free(mac_ctx);
|
||||
EVP_MAC_free_ctx(mac_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -187,20 +187,20 @@ int CRYPTO_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen,
|
||||
/* TODO(3.0) library context */
|
||||
|| (ctx->mac =
|
||||
EVP_MAC_fetch(NULL, OSSL_MAC_NAME_CMAC, NULL)) == NULL
|
||||
|| (ctx->mac_ctx_init = EVP_MAC_CTX_new(ctx->mac)) == NULL
|
||||
|| !EVP_MAC_CTX_set_params(ctx->mac_ctx_init, params)
|
||||
|| (ctx->mac_ctx_init = EVP_MAC_new_ctx(ctx->mac)) == NULL
|
||||
|| !EVP_MAC_set_ctx_params(ctx->mac_ctx_init, params)
|
||||
|| !EVP_EncryptInit_ex(ctx->cipher_ctx, ctr, NULL, key + klen, NULL)
|
||||
|| (mac_ctx = EVP_MAC_CTX_dup(ctx->mac_ctx_init)) == NULL
|
||||
|| (mac_ctx = EVP_MAC_dup_ctx(ctx->mac_ctx_init)) == NULL
|
||||
|| !EVP_MAC_update(mac_ctx, zero, sizeof(zero))
|
||||
|| !EVP_MAC_final(mac_ctx, ctx->d.byte, &out_len,
|
||||
sizeof(ctx->d.byte))) {
|
||||
EVP_CIPHER_CTX_free(ctx->cipher_ctx);
|
||||
EVP_MAC_CTX_free(ctx->mac_ctx_init);
|
||||
EVP_MAC_CTX_free(mac_ctx);
|
||||
EVP_MAC_free_ctx(ctx->mac_ctx_init);
|
||||
EVP_MAC_free_ctx(mac_ctx);
|
||||
EVP_MAC_free(ctx->mac);
|
||||
return 0;
|
||||
}
|
||||
EVP_MAC_CTX_free(mac_ctx);
|
||||
EVP_MAC_free_ctx(mac_ctx);
|
||||
|
||||
ctx->final_ret = -1;
|
||||
ctx->crypto_ok = 1;
|
||||
@@ -216,8 +216,8 @@ int CRYPTO_siv128_copy_ctx(SIV128_CONTEXT *dest, SIV128_CONTEXT *src)
|
||||
memcpy(&dest->d, &src->d, sizeof(src->d));
|
||||
if (!EVP_CIPHER_CTX_copy(dest->cipher_ctx, src->cipher_ctx))
|
||||
return 0;
|
||||
EVP_MAC_CTX_free(dest->mac_ctx_init);
|
||||
dest->mac_ctx_init = EVP_MAC_CTX_dup(src->mac_ctx_init);
|
||||
EVP_MAC_free_ctx(dest->mac_ctx_init);
|
||||
dest->mac_ctx_init = EVP_MAC_dup_ctx(src->mac_ctx_init);
|
||||
if (dest->mac_ctx_init == NULL)
|
||||
return 0;
|
||||
return 1;
|
||||
@@ -237,15 +237,15 @@ int CRYPTO_siv128_aad(SIV128_CONTEXT *ctx, const unsigned char *aad,
|
||||
|
||||
siv128_dbl(&ctx->d);
|
||||
|
||||
if ((mac_ctx = EVP_MAC_CTX_dup(ctx->mac_ctx_init)) == NULL
|
||||
if ((mac_ctx = EVP_MAC_dup_ctx(ctx->mac_ctx_init)) == NULL
|
||||
|| !EVP_MAC_update(mac_ctx, aad, len)
|
||||
|| !EVP_MAC_final(mac_ctx, mac_out.byte, &out_len,
|
||||
sizeof(mac_out.byte))
|
||||
|| out_len != SIV_LEN) {
|
||||
EVP_MAC_CTX_free(mac_ctx);
|
||||
EVP_MAC_free_ctx(mac_ctx);
|
||||
return 0;
|
||||
}
|
||||
EVP_MAC_CTX_free(mac_ctx);
|
||||
EVP_MAC_free_ctx(mac_ctx);
|
||||
|
||||
siv128_xorblock(&ctx->d, &mac_out);
|
||||
|
||||
@@ -357,7 +357,7 @@ int CRYPTO_siv128_cleanup(SIV128_CONTEXT *ctx)
|
||||
if (ctx != NULL) {
|
||||
EVP_CIPHER_CTX_free(ctx->cipher_ctx);
|
||||
ctx->cipher_ctx = NULL;
|
||||
EVP_MAC_CTX_free(ctx->mac_ctx_init);
|
||||
EVP_MAC_free_ctx(ctx->mac_ctx_init);
|
||||
ctx->mac_ctx_init = NULL;
|
||||
EVP_MAC_free(ctx->mac);
|
||||
ctx->mac = NULL;
|
||||
|
||||
Reference in New Issue
Block a user