Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/crypto/external/bsd/openssl/dist/crypto Apply patch, requ...
details: https://anonhg.NetBSD.org/src/rev/a7458ebeff0c
branches: netbsd-8
changeset: 435079:a7458ebeff0c
user: martin <martin%NetBSD.org@localhost>
date: Sat Jun 23 10:52:30 2018 +0000
description:
Apply patch, requested by christos in ticket #891:
Provide future compatibility API when OPENSSL_API_COMPAT is
defined to >= 0x10100000L.
diffstat:
crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h | 8 +
crypto/external/bsd/openssl/dist/crypto/dh/dh.h | 63 +++++
crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h | 83 ++++++
crypto/external/bsd/openssl/dist/crypto/ecdsa/ecdsa.h | 27 ++
crypto/external/bsd/openssl/dist/crypto/evp/evp.h | 32 ++
crypto/external/bsd/openssl/dist/crypto/hmac/hmac.h | 26 ++
crypto/external/bsd/openssl/dist/crypto/rsa/rsa.h | 197 ++++++++++++++++
crypto/external/bsd/openssl/dist/crypto/x509v3/x509v3.h | 9 +
8 files changed, 445 insertions(+), 0 deletions(-)
diffs (truncated from 532 to 300 lines):
diff -r 0e39aa8f5be9 -r a7458ebeff0c crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h
--- a/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h Fri Jun 22 18:06:22 2018 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h Sat Jun 23 10:52:30 2018 +0000
@@ -1414,6 +1414,14 @@
# define ASN1_R_WRONG_TAG 168
# define ASN1_R_WRONG_TYPE 169
+#if OPENSSL_API_COMPAT >= 0x10100000L
+static inline const unsigned char *
+ASN1_STRING_get0_data(const ASN1_STRING *x)
+{
+ return ASN1_STRING_data(__UNCONST(x));
+}
+#endif
+
#ifdef __cplusplus
}
#endif
diff -r 0e39aa8f5be9 -r a7458ebeff0c crypto/external/bsd/openssl/dist/crypto/dh/dh.h
--- a/crypto/external/bsd/openssl/dist/crypto/dh/dh.h Fri Jun 22 18:06:22 2018 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/dh/dh.h Sat Jun 23 10:52:30 2018 +0000
@@ -387,6 +387,69 @@
# define DH_R_PEER_KEY_ERROR 113
# define DH_R_SHARED_INFO_ERROR 114
+#if OPENSSL_API_COMPAT >= 0x10100000L
+static inline void
+DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
+{
+ if (pub_key)
+ *pub_key = dh->pub_key;
+ if (priv_key)
+ *priv_key = dh->priv_key;
+}
+
+static inline int
+DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
+{
+ if (pub_key) {
+ BN_free(dh->pub_key);
+ dh->pub_key = pub_key;
+ }
+ if (priv_key) {
+ BN_free(dh->priv_key);
+ dh->priv_key = priv_key;
+ }
+ return 1;
+}
+
+static inline void
+DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
+ const BIGNUM **g)
+{
+ if (p)
+ *p = dh->p;
+ if (q)
+ *q = dh->q;
+ if (g)
+ *g = dh->g;
+}
+
+static inline int
+DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
+{
+ if (p)
+ dh->p = p;
+ if (q)
+ dh->q = q;
+ if (g)
+ dh->g = g;
+ return 1;
+}
+
+static inline void
+DH_set_length(DH *dh, long length)
+{
+ dh->length = length;
+}
+
+static inline const char *
+DH_meth_get0_name(const DH_METHOD *meth)
+{
+ return meth->name;
+}
+
+
+#endif
+
#ifdef __cplusplus
}
#endif
diff -r 0e39aa8f5be9 -r a7458ebeff0c crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h
--- a/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h Fri Jun 22 18:06:22 2018 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h Sat Jun 23 10:52:30 2018 +0000
@@ -326,6 +326,89 @@
# define DSA_R_PARAMETER_ENCODING_ERROR 105
# define DSA_R_Q_NOT_PRIME 113
+#if OPENSSL_API_COMPAT >= 0x10100000L
+static inline void
+DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **r, const BIGNUM **s)
+{
+ if (r)
+ *r = sig->r;
+ if (s)
+ *s = sig->s;
+}
+
+static inline int
+DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
+{
+ if (r) {
+ BN_free(r);
+ sig->r = r;
+ }
+ if (s) {
+ BN_free(s);
+ sig->s = s;
+ }
+ return 1;
+}
+
+static inline void DSA_get0_pqg(const DSA *d, const BIGNUM **p,
+ const BIGNUM **q, const BIGNUM **g)
+{
+ if (p)
+ *p = d->p;
+ if (q)
+ *q = d->q;
+ if (g)
+ *g = d->g;
+}
+
+
+static inline int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
+{
+ if (p) {
+ BN_free(d->p);
+ d->p = p;
+ }
+ if (q) {
+ BN_free(d->q);
+ d->q = q;
+ }
+ if (g) {
+ BN_free(d->g);
+ d->g = g;
+ }
+ return 1;
+}
+
+static inline void DSA_get0_key(const DSA *d, const BIGNUM **pub_key,
+ const BIGNUM **priv_key)
+{
+ if (pub_key)
+ *pub_key = d->pub_key;
+ if (priv_key)
+ *priv_key = d->priv_key;
+}
+
+static inline int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
+{
+ if (pub_key) {
+ BN_free(d->pub_key);
+ d->pub_key = pub_key;
+ }
+ if (priv_key) {
+ BN_free(d->priv_key);
+ d->priv_key = priv_key;
+ }
+
+ return 1;
+}
+
+static inline int DSA_bits(const DSA *d)
+{
+ return BN_num_bits(d->p);
+}
+#endif
+
+
#ifdef __cplusplus
}
#endif
diff -r 0e39aa8f5be9 -r a7458ebeff0c crypto/external/bsd/openssl/dist/crypto/ecdsa/ecdsa.h
--- a/crypto/external/bsd/openssl/dist/crypto/ecdsa/ecdsa.h Fri Jun 22 18:06:22 2018 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/ecdsa/ecdsa.h Sat Jun 23 10:52:30 2018 +0000
@@ -329,6 +329,33 @@
# define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104
# define ECDSA_R_SIGNATURE_MALLOC_FAILED 105
+#if OPENSSL_API_COMPAT >= 0x10100000L
+
+static inline void
+ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **r, const BIGNUM **s)
+{
+ if (r)
+ *r = sig->r;
+ if (s)
+ *s = sig->s;
+}
+
+static inline int
+ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
+{
+ if (r) {
+ BN_free(sig->r);
+ sig->r = r;
+ }
+ if (s) {
+ BN_free(sig->s);
+ sig->s = s;
+ }
+ return 1;
+}
+
+#endif
+
#ifdef __cplusplus
}
#endif
diff -r 0e39aa8f5be9 -r a7458ebeff0c crypto/external/bsd/openssl/dist/crypto/evp/evp.h
--- a/crypto/external/bsd/openssl/dist/crypto/evp/evp.h Fri Jun 22 18:06:22 2018 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/evp/evp.h Sat Jun 23 10:52:30 2018 +0000
@@ -122,6 +122,9 @@
extern "C" {
#endif
+#define EVP_CIPHER_CTX_iv_noconst(ctx) ((ctx)->iv)
+#define EVP_CIPHER_CTX_iv(ctx) ((ctx)->iv)
+
/*
* Type needs to be a bit field Sub-type needs to be for variations on the
* method, as in, can it do arbitrary encryption....
@@ -1530,6 +1533,35 @@
# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
# define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
+#if OPENSSL_API_COMPAT >= 0x10100000L
+
+static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
+{
+ EVP_MD_CTX *ctx = malloc(sizeof(*ctx));
+ if (ctx == NULL)
+ return NULL;
+ EVP_MD_CTX_init(ctx);
+ return ctx;
+}
+
+static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
+{
+ if (ctx == NULL)
+ return;
+ EVP_MD_CTX_cleanup(ctx);
+ free(ctx);
+}
+
+static inline RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
+{
+ if (pkey->type != EVP_PKEY_RSA)
+ return NULL;
+ return pkey->pkey.rsa;
+}
+
+#endif
+
+
# ifdef __cplusplus
}
# endif
diff -r 0e39aa8f5be9 -r a7458ebeff0c crypto/external/bsd/openssl/dist/crypto/hmac/hmac.h
--- a/crypto/external/bsd/openssl/dist/crypto/hmac/hmac.h Fri Jun 22 18:06:22 2018 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/hmac/hmac.h Sat Jun 23 10:52:30 2018 +0000
@@ -102,6 +102,32 @@
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
+#if OPENSSL_API_COMPAT >= 0x10100000L
+static inline HMAC_CTX *HMAC_CTX_new(void)
+{
+ HMAC_CTX *ctx = calloc(1, sizeof(*ctx));
+ if (ctx == NULL)
+ return NULL;
+ HMAC_CTX_init(ctx);
+ return ctx;
+}
+
+static inline void HMAC_CTX_free(HMAC_CTX *ctx)
+{
+ if (ctx == NULL)
+ return;
+ HMAC_CTX_cleanup(ctx);
+ free(ctx);
+}
+
+static inline void HMAC_CTX_reset(HMAC_CTX *ctx)
+{
+ HMAC_CTX_cleanup(ctx);
+ HMAC_CTX_init(ctx);
+}
Home |
Main Index |
Thread Index |
Old Index