Module Name: src
Committed By: christos
Date: Mon Feb 5 00:11:33 UTC 2018
Modified Files:
src/crypto/external/bsd/openssl.old/dist/crypto/dh: dh.h
src/crypto/external/bsd/openssl.old/dist/crypto/dsa: dsa.h
src/crypto/external/bsd/openssl.old/dist/crypto/ecdsa: ecdsa.h
src/crypto/external/bsd/openssl.old/dist/crypto/evp: evp.h
src/crypto/external/bsd/openssl.old/dist/crypto/rsa: rsa.h
Log Message:
add enough of the 1.1 API to compile openssh
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h
diff -u src/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h:1.1.1.1 src/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h:1.2
--- src/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h:1.1.1.1 Sat Feb 3 17:43:43 2018
+++ src/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h Sun Feb 4 19:11:33 2018
@@ -387,6 +387,45 @@ void ERR_load_DH_strings(void);
# define DH_R_PEER_KEY_ERROR 113
# define DH_R_SHARED_INFO_ERROR 114
+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 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;
+}
+
#ifdef __cplusplus
}
#endif
Index: src/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h
diff -u src/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h:1.1.1.1 src/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h:1.2
--- src/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h:1.1.1.1 Sat Feb 3 17:43:43 2018
+++ src/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h Sun Feb 4 19:11:33 2018
@@ -326,6 +326,82 @@ void ERR_load_DSA_strings(void);
# define DSA_R_PARAMETER_ENCODING_ERROR 105
# define DSA_R_Q_NOT_PRIME 113
+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;
+}
+
+
#ifdef __cplusplus
}
#endif
Index: src/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h
diff -u src/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h:1.1.1.1 src/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h:1.2
--- src/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h:1.1.1.1 Sat Feb 3 17:43:44 2018
+++ src/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h Sun Feb 4 19:11:33 2018
@@ -329,6 +329,28 @@ void ERR_load_ECDSA_strings(void);
# define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104
# define ECDSA_R_SIGNATURE_MALLOC_FAILED 105
+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;
+}
#ifdef __cplusplus
}
#endif
Index: src/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h
diff -u src/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h:1.1.1.1 src/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h:1.2
--- src/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h:1.1.1.1 Sat Feb 3 17:43:44 2018
+++ src/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h Sun Feb 4 19:11:33 2018
@@ -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,31 @@ void ERR_load_EVP_strings(void);
# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
# define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
+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;
+}
+
+
# ifdef __cplusplus
}
# endif
Index: src/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h
diff -u src/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h:1.1.1.1 src/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h:1.2
--- src/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h:1.1.1.1 Sat Feb 3 17:43:46 2018
+++ src/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h Sun Feb 4 19:11:33 2018
@@ -658,6 +658,181 @@ void ERR_load_RSA_strings(void);
# define RSA_R_VALUE_MISSING 147
# define RSA_R_WRONG_SIGNATURE_LENGTH 119
+#include <string.h>
+
+static inline RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth)
+{
+ RSA_METHOD *ret = malloc(sizeof(*meth));
+ if (ret == NULL)
+ return NULL;
+ memcpy(ret, meth, sizeof(*meth));
+ ret->name = strdup(meth->name);
+ if (ret->name == NULL) {
+ free(ret);
+ return NULL;
+ }
+ return ret;
+}
+
+static inline int RSA_meth_set1_name(RSA_METHOD *meth, const char *name)
+{
+ char *nname = strdup(name);
+ if (nname == NULL)
+ return 0;
+ free(__UNCONST(meth->name));
+ meth->name = nname;
+ return 1;
+}
+
+static inline int RSA_meth_set_priv_enc(RSA_METHOD *meth,
+ int (*priv_enc) (int flen, const unsigned char *from,
+ unsigned char *to, RSA *rsa, int padding))
+{
+ meth->rsa_priv_enc = priv_enc;
+ return 1;
+}
+
+static inline int RSA_meth_set_pub_dec(RSA_METHOD *meth,
+ int (*pub_dec) (int flen, const unsigned char *from,
+ unsigned char *to, RSA *rsa, int padding))
+{
+ meth->rsa_pub_dec = pub_dec;
+ return 1;
+}
+
+static inline int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(
+ int flen, const unsigned char *from, unsigned char *to, RSA *rsa,
+ int padding)
+{
+ return meth->rsa_priv_enc;
+}
+
+static inline int RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec)(
+ int flen, const unsigned char *from, unsigned char *to, RSA *rsa,
+ int padding))
+{
+ meth->rsa_priv_dec = priv_dec;
+ return 1;
+}
+
+static inline int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa)
+{
+ return meth->finish;
+}
+
+static inline int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa))
+{
+ meth->finish = finish;
+ return 1;
+}
+
+static inline RSA_METHOD *RSA_meth_new(const char *name, int flags)
+{
+ RSA_METHOD *meth = calloc(1, sizeof(*meth));
+
+ if (meth == NULL)
+ return NULL;
+
+ meth->flags = flags;
+ meth->name = OPENSSL_strdup(name);
+ if (meth->name != NULL)
+ return meth;
+ free(meth);
+ return NULL;
+}
+
+static inline int RSA_meth_get_flags(RSA_METHOD *meth)
+{
+ return meth->flags;
+}
+
+static inline void RSA_get0_key(const RSA *r,
+ const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
+{
+ if (n)
+ *n = r->n;
+ if (e)
+ *e = r->e;
+ if (d)
+ *d = r->d;
+}
+
+static inline int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
+{
+ if (n) {
+ BN_free(r->n);
+ r->n = n;
+ }
+ if (e) {
+ BN_free(r->e);
+ r->e = e;
+ }
+ if (d) {
+ BN_free(r->d);
+ r->d = d;
+ }
+ return 1;
+}
+
+static inline void RSA_get0_factors(const RSA *r, const BIGNUM **p,
+ const BIGNUM **q)
+{
+ if (p)
+ *p = r->p;
+ if (q)
+ *q = r->q;
+}
+
+static inline int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
+{
+ if (p) {
+ BN_free(r->p);
+ r->p = p;
+ }
+ if (q) {
+ BN_free(r->q);
+ r->q = q;
+ }
+
+ return 1;
+}
+
+static inline int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1,
+ BIGNUM *iqmp)
+{
+ if (dmp1) {
+ BN_free(r->dmp1);
+ r->dmp1 = dmp1;
+ }
+ if (dmq1) {
+ BN_free(r->dmq1);
+ r->dmq1 = dmq1;
+ }
+ if (iqmp) {
+ BN_free(r->iqmp);
+ r->iqmp = iqmp;
+ }
+ return 1;
+}
+
+static inline int RSA_bits(const RSA *r)
+{
+ return BN_num_bits(r->n);
+}
+
+
+static inline void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1,
+ const BIGNUM **dmq1, const BIGNUM **iqmp)
+{
+ if (dmp1)
+ *dmp1 = r->dmp1;
+ if (dmq1)
+ *dmq1 = r->dmq1;
+ if (iqmp)
+ *iqmp = r->iqmp;
+}
+
+
#ifdef __cplusplus
}
#endif