VirtualBox

Ignore:
Timestamp:
Sep 4, 2024 11:32:47 AM (6 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164679
Message:

openssl-3.1.7: Applied and adjusted our OpenSSL changes to 3.1.7. bugref:10757

Location:
trunk/src/libs/openssl-3.1.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/openssl-3.1.7

    • Property svn:mergeinfo
      •  

        old new  
        2525/vendor/openssl/3.0.3:151497-151729
        2626/vendor/openssl/3.0.7:154371
         27/vendor/openssl/3.1.7:164675-164677
  • trunk/src/libs/openssl-3.1.7/crypto/dsa/dsa_check.c

    r104078 r105945  
    11/*
    2  * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    2020#include "crypto/dsa.h"
    2121
     22static int dsa_precheck_params(const DSA *dsa, int *ret)
     23{
     24    if (dsa->params.p == NULL || dsa->params.q == NULL) {
     25        ERR_raise(ERR_LIB_DSA, DSA_R_BAD_FFC_PARAMETERS);
     26        *ret = FFC_CHECK_INVALID_PQ;
     27        return 0;
     28    }
     29
     30    if (BN_num_bits(dsa->params.p) > OPENSSL_DSA_MAX_MODULUS_BITS) {
     31        ERR_raise(ERR_LIB_DSA, DSA_R_MODULUS_TOO_LARGE);
     32        *ret = FFC_CHECK_INVALID_PQ;
     33        return 0;
     34    }
     35
     36    if (BN_num_bits(dsa->params.q) >= BN_num_bits(dsa->params.p)) {
     37        ERR_raise(ERR_LIB_DSA, DSA_R_BAD_Q_VALUE);
     38        *ret = FFC_CHECK_INVALID_PQ;
     39        return 0;
     40    }
     41
     42    return 1;
     43}
     44
    2245int ossl_dsa_check_params(const DSA *dsa, int checktype, int *ret)
    2346{
     47    if (!dsa_precheck_params(dsa, ret))
     48        return 0;
     49
    2450    if (checktype == OSSL_KEYMGMT_VALIDATE_QUICK_CHECK)
    2551        return ossl_ffc_params_simple_validate(dsa->libctx, &dsa->params,
     
    4066int ossl_dsa_check_pub_key(const DSA *dsa, const BIGNUM *pub_key, int *ret)
    4167{
     68    if (!dsa_precheck_params(dsa, ret))
     69        return 0;
     70
    4271    return ossl_ffc_validate_public_key(&dsa->params, pub_key, ret)
    4372           && *ret == 0;
     
    5180int ossl_dsa_check_pub_key_partial(const DSA *dsa, const BIGNUM *pub_key, int *ret)
    5281{
     82    if (!dsa_precheck_params(dsa, ret))
     83        return 0;
     84
    5385    return ossl_ffc_validate_public_key_partial(&dsa->params, pub_key, ret)
    5486           && *ret == 0;
     
    5991    *ret = 0;
    6092
    61     return (dsa->params.q != NULL
    62             && ossl_ffc_validate_private_key(dsa->params.q, priv_key, ret));
     93    if (!dsa_precheck_params(dsa, ret))
     94        return 0;
     95
     96    return ossl_ffc_validate_private_key(dsa->params.q, priv_key, ret);
    6397}
    6498
     
    73107    BIGNUM *pub_key = NULL;
    74108
    75     if (dsa->params.p == NULL
    76         || dsa->params.g == NULL
     109    if (!dsa_precheck_params(dsa, &ret))
     110        return 0;
     111
     112    if (dsa->params.g == NULL
    77113        || dsa->priv_key == NULL
    78114        || dsa->pub_key == NULL)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette