diff options
author | Adam Langley <agl@google.com> | 2014-09-05 17:04:51 -0700 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-09-18 22:38:11 +0000 |
commit | bed8ce78f001c600a143966b932f8e587c35e573 (patch) | |
tree | 543a11672b14d1425a80152f24b36243e4b6c42e | |
parent | d7c5368a0f67e8f393384170fe230bf9f598f4cb (diff) | |
download | src-bed8ce78f001c600a143966b932f8e587c35e573.tar.gz |
Add misc functions for easier porting.
Android requested that the wpa_supplicant go upstream. This change adds
some dummy functions and reinstates DSA_dup_DH in order to make the diff
smaller and easier for upstream.
Change-Id: I77ac271b8652bae5a0bbe16afde51d9096f3dfb5
Reviewed-on: https://boringssl-review.googlesource.com/1740
Reviewed-by: Adam Langley <agl@google.com>
-rw-r--r-- | crypto/bio/bio.c | 4 | ||||
-rw-r--r-- | crypto/digest/digest.c | 4 | ||||
-rw-r--r-- | crypto/dsa/dsa.c | 33 | ||||
-rw-r--r-- | crypto/pkcs8/pkcs8.c | 2 | ||||
-rw-r--r-- | include/openssl/bio.h | 4 | ||||
-rw-r--r-- | include/openssl/digest.h | 4 | ||||
-rw-r--r-- | include/openssl/dsa.h | 8 | ||||
-rw-r--r-- | include/openssl/pkcs8.h | 4 | ||||
-rw-r--r-- | include/openssl/ssl.h | 14 |
9 files changed, 70 insertions, 7 deletions
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c index a35ff65..7bd2976 100644 --- a/crypto/bio/bio.c +++ b/crypto/bio/bio.c @@ -351,6 +351,10 @@ size_t BIO_pending(const BIO *bio) { return BIO_ctrl((BIO *) bio, BIO_CTRL_PENDING, 0, NULL); } +size_t BIO_ctrl_pending(const BIO *bio) { + return BIO_pending(bio); +} + size_t BIO_wpending(const BIO *bio) { return BIO_ctrl((BIO *) bio, BIO_CTRL_WPENDING, 0, NULL); } diff --git a/crypto/digest/digest.c b/crypto/digest/digest.c index 2bfb0fa..3897c60 100644 --- a/crypto/digest/digest.c +++ b/crypto/digest/digest.c @@ -267,3 +267,7 @@ void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, uint32_t flags) { uint32_t EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, uint32_t flags) { return ctx->flags & flags; } + +int EVP_add_digest(const EVP_MD *digest) { + return 1; +} diff --git a/crypto/dsa/dsa.c b/crypto/dsa/dsa.c index 8c66ddf..25d15c0 100644 --- a/crypto/dsa/dsa.c +++ b/crypto/dsa/dsa.c @@ -60,6 +60,7 @@ #include <openssl/dsa.h> #include <openssl/asn1.h> +#include <openssl/dh.h> #include <openssl/engine.h> #include <openssl/err.h> #include <openssl/ex_data.h> @@ -332,3 +333,35 @@ int DSA_set_ex_data(DSA *d, int idx, void *arg) { void *DSA_get_ex_data(const DSA *d, int idx) { return CRYPTO_get_ex_data(&d->ex_data, idx); } + +DH *DSA_dup_DH(const DSA *r) { + DH *ret = NULL; + + if (r == NULL) { + goto err; + } + ret = DH_new(); + if (ret == NULL) { + goto err; + } + if (r->q != NULL) { + ret->priv_length = BN_num_bits(r->q); + if ((ret->q = BN_dup(r->q)) == NULL) { + goto err; + } + } + if ((r->p != NULL && (ret->p = BN_dup(r->p)) == NULL) || + (r->g != NULL && (ret->g = BN_dup(r->g)) == NULL) || + (r->pub_key != NULL && (ret->pub_key = BN_dup(r->pub_key)) == NULL) || + (r->priv_key != NULL && (ret->priv_key = BN_dup(r->priv_key)) == NULL)) { + goto err; + } + + return ret; + +err: + if (ret != NULL) { + DH_free(ret); + } + return NULL; +} diff --git a/crypto/pkcs8/pkcs8.c b/crypto/pkcs8/pkcs8.c index 04fce98..915767e 100644 --- a/crypto/pkcs8/pkcs8.c +++ b/crypto/pkcs8/pkcs8.c @@ -1015,3 +1015,5 @@ err: return ret; } + +void PKCS12_PBE_add(){}; diff --git a/include/openssl/bio.h b/include/openssl/bio.h index da0a356..547a36a 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -235,6 +235,10 @@ OPENSSL_EXPORT long BIO_callback_ctrl(BIO *bio, int cmd, bio_info_cb fp); /* BIO_pending returns the number of bytes pending to be read. */ OPENSSL_EXPORT size_t BIO_pending(const BIO *bio); +/* BIO_ctrl_pending calls |BIO_pending| and exists only for compatibility with + * OpenSSL. */ +OPENSSL_EXPORT size_t BIO_ctrl_pending(const BIO *bio); + /* BIO_wpending returns the number of bytes pending to be written. */ OPENSSL_EXPORT size_t BIO_wpending(const BIO *bio); diff --git a/include/openssl/digest.h b/include/openssl/digest.h index 291a548..6d8a165 100644 --- a/include/openssl/digest.h +++ b/include/openssl/digest.h @@ -200,6 +200,10 @@ OPENSSL_EXPORT size_t EVP_MD_block_size(const EVP_MD *md); * |in|. It returns one on success and zero on error. */ OPENSSL_EXPORT int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); +/* EVP_add_digest does nothing and returns one. It exists only for + * compatibility with OpenSSL. */ +OPENSSL_EXPORT int EVP_add_digest(const EVP_MD *digest); + /* Digest operation accessors. */ diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h index c8156fa..5e71ae2 100644 --- a/include/openssl/dsa.h +++ b/include/openssl/dsa.h @@ -291,6 +291,14 @@ OPENSSL_EXPORT int DSA_sign_setup(const DSA *dsa, BN_CTX *ctx, BIGNUM **out_kinv, BIGNUM **out_r); +/* Conversion. */ + +/* DSA_dup_DH returns a |DH| constructed from the parameters of |dsa|. This is + * sometimes needed when Diffie-Hellman parameters are stored in the form of + * DSA parameters. It returns an allocated |DH| on success or NULL on error. */ +OPENSSL_EXPORT DH *DSA_dup_DH(const DSA *dsa); + + /* ex_data functions. * * These functions are wrappers. See |ex_data.h| for details. */ diff --git a/include/openssl/pkcs8.h b/include/openssl/pkcs8.h index 6feb7f1..26f15e7 100644 --- a/include/openssl/pkcs8.h +++ b/include/openssl/pkcs8.h @@ -129,6 +129,10 @@ OPENSSL_EXPORT int PKCS12_get_key_and_certs(EVP_PKEY **out_key, STACK_OF(X509) *out_certs, CBS *in, const char *password); +/* PKCS12_PBE_add does nothing. It exists for compatibility with OpenSSL. */ +OPENSSL_EXPORT void PKCS12_PBE_add(); + + #if defined(__cplusplus) } /* extern C */ #endif diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index e52288a..1e8747e 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -522,13 +522,13 @@ struct ssl_session_st #define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|\ SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2) -/* These next two were never actually used for anything since SSLeay - * zap so we have some more flags. - */ -/* The next flag deliberately changes the ciphertest, this is a check - * for the PKCS#1 attack */ -#define SSL_OP_PKCS1_CHECK_1 0x0 -#define SSL_OP_PKCS1_CHECK_2 0x0 +/* The following flags do nothing and are included only to make it easier to + * compile code with BoringSSL. */ +#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0 +#define SSL_OP_MICROSOFT_SESS_ID_BUG 0 +#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0 +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0 +#define SSL_OP_TLS_BLOCK_PADDING_BUG 0 /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success * when just a single record has been written): */ |