Add some compatibility symbols

Change-Id: Ia07aa88be217a73846b0dc12f360cd1aaafcfaba
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69168
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin
2024-09-17 17:41:14 +00:00
committed by Boringssl LUCI CQ
parent 8237469f52
commit 2467c70bd3
14 changed files with 93 additions and 13 deletions
+1
View File
@@ -301,6 +301,7 @@
"crypto/refcount.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_extra.c",
"crypto/rsa_extra/rsa_print.c",
"crypto/sha/sha1.c",
"crypto/sha/sha256.c",
-2
View File
@@ -42,8 +42,6 @@ struct dsa_st {
CRYPTO_EX_DATA ex_data;
};
#define OPENSSL_DSA_MAX_MODULUS_BITS 10000
// dsa_check_key performs cheap self-checks on |dsa|, and ensures it is within
// DoS bounds. It returns one on success and zero on error.
int dsa_check_key(const DSA *dsa);
+35
View File
@@ -478,6 +478,41 @@ int i2d_ECPrivateKey(const EC_KEY *key, uint8_t **outp) {
return CBB_finish_i2d(&cbb, outp);
}
EC_GROUP *d2i_ECPKParameters(EC_GROUP **out, const uint8_t **inp, long len) {
if (len < 0) {
return NULL;
}
CBS cbs;
CBS_init(&cbs, *inp, (size_t)len);
EC_GROUP *ret = EC_KEY_parse_parameters(&cbs);
if (ret == NULL) {
return NULL;
}
if (out != NULL) {
EC_GROUP_free(*out);
*out = ret;
}
*inp = CBS_data(&cbs);
return ret;
}
int i2d_ECPKParameters(const EC_GROUP *group, uint8_t **outp) {
if (group == NULL) {
OPENSSL_PUT_ERROR(EC, ERR_R_PASSED_NULL_PARAMETER);
return -1;
}
CBB cbb;
if (!CBB_init(&cbb, 0) || //
!EC_KEY_marshal_curve_name(&cbb, group)) {
CBB_cleanup(&cbb);
return -1;
}
return CBB_finish_i2d(&cbb, outp);
}
EC_KEY *d2i_ECParameters(EC_KEY **out_key, const uint8_t **inp, long len) {
if (len < 0) {
return NULL;
-2
View File
@@ -26,8 +26,6 @@ extern "C" {
#endif
#define OPENSSL_DH_MAX_MODULUS_BITS 10000
struct dh_st {
BIGNUM *p;
BIGNUM *g;
+1 -3
View File
@@ -79,10 +79,8 @@ int rsa_check_public_key(const RSA *rsa) {
return 0;
}
// TODO(davidben): 16384-bit RSA is huge. Can we bring this down to a limit of
// 8192-bit?
unsigned n_bits = BN_num_bits(rsa->n);
if (n_bits > 16 * 1024) {
if (n_bits > OPENSSL_RSA_MAX_MODULUS_BITS) {
OPENSSL_PUT_ERROR(RSA, RSA_R_MODULUS_TOO_LARGE);
return 0;
}
+17
View File
@@ -0,0 +1,17 @@
/* Copyright (c) 2024, Google Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#include <openssl/rsa.h>
void RSA_blinding_off(RSA *rsa) {}
+1
View File
@@ -396,6 +396,7 @@ crypto_sources = [
"crypto/refcount.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_extra.c",
"crypto/rsa_extra/rsa_print.c",
"crypto/sha/sha1.c",
"crypto/sha/sha256.c",
+1
View File
@@ -410,6 +410,7 @@ set(
crypto/refcount.c
crypto/rsa_extra/rsa_asn1.c
crypto/rsa_extra/rsa_crypt.c
crypto/rsa_extra/rsa_extra.c
crypto/rsa_extra/rsa_print.c
crypto/sha/sha1.c
crypto/sha/sha256.c
+1
View File
@@ -396,6 +396,7 @@ crypto_sources = [
"crypto/refcount.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_extra.c",
"crypto/rsa_extra/rsa_print.c",
"crypto/sha/sha1.c",
"crypto/sha/sha256.c",
+1
View File
@@ -380,6 +380,7 @@
"crypto/refcount.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_extra.c",
"crypto/rsa_extra/rsa_print.c",
"crypto/sha/sha1.c",
"crypto/sha/sha256.c",
+4
View File
@@ -96,6 +96,10 @@ OPENSSL_EXPORT int DH_up_ref(DH *dh);
// Properties.
// OPENSSL_DH_MAX_MODULUS_BITS is the maximum supported Diffie-Hellman group
// modulus, in bits.
#define OPENSSL_DH_MAX_MODULUS_BITS 10000
// DH_bits returns the size of |dh|'s group modulus, in bits.
OPENSSL_EXPORT unsigned DH_bits(const DH *dh);
+4
View File
@@ -99,6 +99,10 @@ OPENSSL_EXPORT int DSA_up_ref(DSA *dsa);
// Properties.
// OPENSSL_DSA_MAX_MODULUS_BITS is the maximum supported DSA group modulus, in
// bits.
#define OPENSSL_DSA_MAX_MODULUS_BITS 10000
// DSA_bits returns the size of |dsa|'s group modulus, in bits.
OPENSSL_EXPORT unsigned DSA_bits(const DSA *dsa);
+17 -1
View File
@@ -351,8 +351,24 @@ OPENSSL_EXPORT EC_KEY *d2i_ECPrivateKey(EC_KEY **out_key, const uint8_t **inp,
// Use |EC_KEY_marshal_private_key| instead.
OPENSSL_EXPORT int i2d_ECPrivateKey(const EC_KEY *key, uint8_t **outp);
// d2i_ECPKParameters parses a DER-encoded ECParameters structure (RFC 5480)
// from |len| bytes at |*inp|, as described in |d2i_SAMPLE|. For legacy reasons,
// it recognizes the specifiedCurve form, but only for curves that are already
// supported as named curves.
//
// Use |EC_KEY_parse_parameters| or |EC_KEY_parse_curve_name| instead.
OPENSSL_EXPORT EC_GROUP *d2i_ECPKParameters(EC_GROUP **out, const uint8_t **inp,
long len);
// i2d_ECPKParameters marshals |group| as a DER-encoded ECParameters structure
// (RFC 5480), as described in |i2d_SAMPLE|.
//
// Use |EC_KEY_marshal_curve_name| instead.
OPENSSL_EXPORT int i2d_ECPKParameters(const EC_GROUP *group, uint8_t **outp);
// d2i_ECParameters parses a DER-encoded ECParameters structure (RFC 5480) from
// |len| bytes at |*inp|, as described in |d2i_SAMPLE|.
// |len| bytes at |*inp|, as described in |d2i_SAMPLE|. It returns the result as
// an |EC_KEY| with parameters, but no key, configured.
//
// Use |EC_KEY_parse_parameters| or |EC_KEY_parse_curve_name| instead.
OPENSSL_EXPORT EC_KEY *d2i_ECParameters(EC_KEY **out_key, const uint8_t **inp,
+10 -5
View File
@@ -111,6 +111,11 @@ OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
// Properties.
// OPENSSL_RSA_MAX_MODULUS_BITS is the maximum supported RSA modulus, in bits.
//
// TODO(davidben): Reduce this to 8192.
#define OPENSSL_RSA_MAX_MODULUS_BITS 16384
// RSA_bits returns the size of |rsa|, in bits.
OPENSSL_EXPORT unsigned RSA_bits(const RSA *rsa);
@@ -670,11 +675,8 @@ OPENSSL_EXPORT void *RSA_get_ex_data(const RSA *rsa, int idx);
#define RSA_FLAG_OPAQUE 1
// RSA_FLAG_NO_BLINDING disables blinding of private operations, which is a
// dangerous thing to do. It is deprecated and should not be used. It will
// be ignored whenever possible.
//
// This flag must be used if a key without the public exponent |e| is used for
// private key operations; avoid using such keys whenever possible.
// dangerous thing to do. This flag is set internally as part of self-tests but
// is otherwise impossible to set externally.
#define RSA_FLAG_NO_BLINDING 8
// RSA_FLAG_EXT_PKEY is deprecated and ignored.
@@ -712,6 +714,9 @@ OPENSSL_EXPORT int RSA_test_flags(const RSA *rsa, int flags);
// RSA_blinding_on returns one.
OPENSSL_EXPORT int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
// RSA_blinding_off does nothing.
OPENSSL_EXPORT void RSA_blinding_off(RSA *rsa);
// RSA_generate_key behaves like |RSA_generate_key_ex|, which is what you
// should use instead. It returns NULL on error, or a newly-allocated |RSA| on
// success. This function is provided for compatibility only. The |callback|