Revision 098f27f9ef8be2a418f76896ee3c824e8709fcf7 authored by Matt Caswell on 17 October 2023, 13:55:48 UTC, committed by Tomas Mraz on 19 October 2023, 09:54:44 UTC
If the CC TX allowance is zero then we cannot send a PING frame at the moment, so do not take into account the ping deadline when calculating the tick deadline in that case. This avoids the hang found by the fuzzer mentioned in https://github.com/openssl/openssl/pull/22368#issuecomment-1765131727 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22410)
1 parent 56e3032
EVP_PKEY_DSA_paramfromdata.c
/*-
* Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/*
* Example showing how to load DSA params from raw data
* using EVP_PKEY_fromdata()
*/
#include <openssl/param_build.h>
#include <openssl/evp.h>
#include <openssl/core_names.h>
#include "dsa.inc"
int main(int argc, char **argv)
{
int ret = EXIT_FAILURE;
OSSL_LIB_CTX *libctx = NULL;
const char *propq = NULL;
EVP_PKEY_CTX *ctx = NULL;
EVP_PKEY *dsaparamkey = NULL;
OSSL_PARAM_BLD *bld = NULL;
OSSL_PARAM *params = NULL;
BIGNUM *p = NULL, *q = NULL, *g = NULL;
p = BN_bin2bn(dsa_p, sizeof(dsa_p), NULL);
q = BN_bin2bn(dsa_q, sizeof(dsa_q), NULL);
g = BN_bin2bn(dsa_g, sizeof(dsa_g), NULL);
if (p == NULL || q == NULL || g == NULL)
goto cleanup;
/* Use OSSL_PARAM_BLD if you need to handle BIGNUM Parameters */
bld = OSSL_PARAM_BLD_new();
if (bld == NULL)
goto cleanup;
if (!OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_FFC_P, p)
|| !OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_FFC_Q, q)
|| !OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_FFC_G, g))
goto cleanup;
params = OSSL_PARAM_BLD_to_param(bld);
if (params == NULL)
goto cleanup;
ctx = EVP_PKEY_CTX_new_from_name(libctx, "DSA", propq);
if (ctx == NULL) {
fprintf(stderr, "EVP_PKEY_CTX_new_from_name() failed\n");
goto cleanup;
}
if (EVP_PKEY_fromdata_init(ctx) <= 0
|| EVP_PKEY_fromdata(ctx, &dsaparamkey, EVP_PKEY_KEY_PARAMETERS, params) <= 0) {
fprintf(stderr, "EVP_PKEY_fromdata() failed\n");
goto cleanup;
}
if (!dsa_print_key(dsaparamkey, 0, libctx, propq))
goto cleanup;
ret = EXIT_SUCCESS;
cleanup:
EVP_PKEY_free(dsaparamkey);
EVP_PKEY_CTX_free(ctx);
OSSL_PARAM_free(params);
OSSL_PARAM_BLD_free(bld);
BN_free(g);
BN_free(q);
BN_free(p);
return ret;
}

Computing file changes ...