Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssl.old/dist/crypto add enough of th...



details:   https://anonhg.NetBSD.org/src/rev/1913cccb6a1f
branches:  trunk
changeset: 829518:1913cccb6a1f
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Feb 05 00:11:33 2018 +0000

description:
add enough of the 1.1 API to compile openssh

diffstat:

 crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h       |   39 +++
 crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h     |   76 ++++++
 crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h |   22 +
 crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h     |   28 ++
 crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h     |  175 ++++++++++++++
 5 files changed, 340 insertions(+), 0 deletions(-)

diffs (truncated from 397 to 300 lines):

diff -r 71d6f0c1f890 -r 1913cccb6a1f crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h
--- a/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h       Sun Feb 04 21:52:16 2018 +0000
+++ b/crypto/external/bsd/openssl.old/dist/crypto/dh/dh.h       Mon Feb 05 00:11:33 2018 +0000
@@ -387,6 +387,45 @@
 # 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
diff -r 71d6f0c1f890 -r 1913cccb6a1f crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h
--- a/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h     Sun Feb 04 21:52:16 2018 +0000
+++ b/crypto/external/bsd/openssl.old/dist/crypto/dsa/dsa.h     Mon Feb 05 00:11:33 2018 +0000
@@ -326,6 +326,82 @@
 # 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
diff -r 71d6f0c1f890 -r 1913cccb6a1f crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h
--- a/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h Sun Feb 04 21:52:16 2018 +0000
+++ b/crypto/external/bsd/openssl.old/dist/crypto/ecdsa/ecdsa.h Mon Feb 05 00:11:33 2018 +0000
@@ -329,6 +329,28 @@
 # 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
diff -r 71d6f0c1f890 -r 1913cccb6a1f crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h
--- a/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h     Sun Feb 04 21:52:16 2018 +0000
+++ b/crypto/external/bsd/openssl.old/dist/crypto/evp/evp.h     Mon Feb 05 00:11:33 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,31 @@
 # 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
diff -r 71d6f0c1f890 -r 1913cccb6a1f crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h
--- a/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h     Sun Feb 04 21:52:16 2018 +0000
+++ b/crypto/external/bsd/openssl.old/dist/crypto/rsa/rsa.h     Mon Feb 05 00:11:33 2018 +0000
@@ -658,6 +658,181 @@
 # 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;



Home | Main Index | Thread Index | Old Index