Loading crypto/dh/Makefile.in +2 −2 Changes for crypto/dh/Makefile.in: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ GENERAL=Makefile LIB=$(TOP)/libcrypto.a LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \ dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_meth.c LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o \ dh_ameth.o dh_pmeth.o dh_prn.o dh_rfc5114.o dh_kdf.o dh_ameth.o dh_pmeth.o dh_prn.o dh_rfc5114.o dh_kdf.o dh_meth.o SRC= $(LIBSRC) Loading crypto/dh/build.info +1 −1 Changes for crypto/dh/build.info: 1 added line, 1 removed line. Original line number Diff line number Diff line LIBS=../../libcrypto SOURCE[../../libcrypto]=\ dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \ dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_meth.c crypto/dh/dh_locl.h +18 Changes for crypto/dh/dh_locl.h: 18 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,3 +36,21 @@ struct dh_st { ENGINE *engine; CRYPTO_RWLOCK *lock; }; struct dh_method { char *name; /* Methods here */ int (*generate_key) (DH *dh); int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh); /* Can be null */ int (*bn_mod_exp) (const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int (*init) (DH *dh); int (*finish) (DH *dh); int flags; char *app_data; /* If this is non-NULL, it will be used to generate parameters */ int (*generate_params) (DH *dh, int prime_len, int generator, BN_GENCB *cb); }; crypto/dh/dh_meth.c +158 Changes for crypto/dh/dh_meth.c: 158 added lines, 0 removed lines. Original line number Diff line number Diff line /* * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL licenses, (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://www.openssl.org/source/license.html * or in the file LICENSE in the source distribution. */ #include "dh_locl.h" #include <string.h> DH_METHOD *DH_meth_new(const char *name, int flags) { DH_METHOD *dhm = OPENSSL_zalloc(sizeof(DH_METHOD)); if (dhm != NULL) { dhm->name = OPENSSL_strdup(name); dhm->flags = flags; } return dhm; } void DH_meth_free(DH_METHOD *dhm) { if (dhm != NULL) { if (dhm->name != NULL) OPENSSL_free(dhm->name); OPENSSL_free(dhm); } } DH_METHOD *DH_meth_dup(const DH_METHOD *dhm) { DH_METHOD *ret; ret = OPENSSL_malloc(sizeof(DH_METHOD)); if (ret != NULL) { memcpy(ret, dhm, sizeof(*dhm)); ret->name = OPENSSL_strdup(dhm->name); } return ret; } const char *DH_meth_get0_name(const DH_METHOD *dhm) { return dhm->name; } int DH_meth_set1_name(DH_METHOD *dhm, const char *name) { OPENSSL_free(dhm->name); dhm->name = OPENSSL_strdup(name); return dhm->name != NULL; } int DH_meth_get_flags(DH_METHOD *dhm) { return dhm->flags; } int DH_meth_set_flags(DH_METHOD *dhm, int flags) { dhm->flags = flags; return 1; } void *DH_meth_get0_app_data(const DH_METHOD *dhm) { return dhm->app_data; } int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data) { dhm->app_data = app_data; return 1; } int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *) { return dhm->generate_key; } int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)) { dhm->generate_key = generate_key; return 1; } int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) (unsigned char *key, const BIGNUM *pub_key, DH *dh) { return dhm->compute_key; } int DH_meth_set_compute_key(DH_METHOD *dhm, int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)) { dhm->compute_key = compute_key; return 1; } int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *) { return dhm->bn_mod_exp; } int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)) { dhm->bn_mod_exp = bn_mod_exp; return 1; } int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *) { return dhm->init; } int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)) { dhm->init = init; return 1; } int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *) { return dhm->finish; } int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)) { dhm->finish = finish; return 1; } int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) (DH *, int, int, BN_GENCB *) { return dhm->generate_params; } int DH_meth_set_generate_params(DH_METHOD *dhm, int (*generate_params) (DH *, int, int, BN_GENCB *)) { dhm->generate_params = generate_params; return 1; } include/openssl/dh.h +30 −18 Changes for include/openssl/dh.h: 30 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -103,24 +103,6 @@ extern "C" { /* typedef struct dh_st DH; */ /* typedef struct dh_method DH_METHOD; */ struct dh_method { const char *name; /* Methods here */ int (*generate_key) (DH *dh); int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh); /* Can be null */ int (*bn_mod_exp) (const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int (*init) (DH *dh); int (*finish) (DH *dh); int flags; char *app_data; /* If this is non-NULL, it will be used to generate parameters */ int (*generate_params) (DH *dh, int prime_len, int generator, BN_GENCB *cb); }; DECLARE_ASN1_ITEM(DHparams) # define DH_GENERATOR_2 2 Loading Loading @@ -222,6 +204,36 @@ ENGINE *DH_get0_engine(DH *d); long DH_get_length(const DH *dh); int DH_set_length(DH *dh, long length); DH_METHOD *DH_meth_new(const char *name, int flags); void DH_meth_free(DH_METHOD *dhm); DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); const char *DH_meth_get0_name(const DH_METHOD *dhm); int DH_meth_set1_name(DH_METHOD *dhm, const char *name); int DH_meth_get_flags(DH_METHOD *dhm); int DH_meth_set_flags(DH_METHOD *dhm, int flags); void *DH_meth_get0_app_data(const DH_METHOD *dhm); int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) (unsigned char *key, const BIGNUM *pub_key, DH *dh); int DH_meth_set_compute_key(DH_METHOD *dhm, int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) (DH *, int, int, BN_GENCB *); int DH_meth_set_generate_params(DH_METHOD *dhm, int (*generate_params) (DH *, int, int, BN_GENCB *)); # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ Loading Loading
crypto/dh/Makefile.in +2 −2 Changes for crypto/dh/Makefile.in: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ GENERAL=Makefile LIB=$(TOP)/libcrypto.a LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \ dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_meth.c LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o \ dh_ameth.o dh_pmeth.o dh_prn.o dh_rfc5114.o dh_kdf.o dh_ameth.o dh_pmeth.o dh_prn.o dh_rfc5114.o dh_kdf.o dh_meth.o SRC= $(LIBSRC) Loading
crypto/dh/build.info +1 −1 Changes for crypto/dh/build.info: 1 added line, 1 removed line. Original line number Diff line number Diff line LIBS=../../libcrypto SOURCE[../../libcrypto]=\ dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \ dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_ameth.c dh_pmeth.c dh_prn.c dh_rfc5114.c dh_kdf.c dh_meth.c
crypto/dh/dh_locl.h +18 Changes for crypto/dh/dh_locl.h: 18 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,3 +36,21 @@ struct dh_st { ENGINE *engine; CRYPTO_RWLOCK *lock; }; struct dh_method { char *name; /* Methods here */ int (*generate_key) (DH *dh); int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh); /* Can be null */ int (*bn_mod_exp) (const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int (*init) (DH *dh); int (*finish) (DH *dh); int flags; char *app_data; /* If this is non-NULL, it will be used to generate parameters */ int (*generate_params) (DH *dh, int prime_len, int generator, BN_GENCB *cb); };
crypto/dh/dh_meth.c +158 Changes for crypto/dh/dh_meth.c: 158 added lines, 0 removed lines. Original line number Diff line number Diff line /* * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL licenses, (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://www.openssl.org/source/license.html * or in the file LICENSE in the source distribution. */ #include "dh_locl.h" #include <string.h> DH_METHOD *DH_meth_new(const char *name, int flags) { DH_METHOD *dhm = OPENSSL_zalloc(sizeof(DH_METHOD)); if (dhm != NULL) { dhm->name = OPENSSL_strdup(name); dhm->flags = flags; } return dhm; } void DH_meth_free(DH_METHOD *dhm) { if (dhm != NULL) { if (dhm->name != NULL) OPENSSL_free(dhm->name); OPENSSL_free(dhm); } } DH_METHOD *DH_meth_dup(const DH_METHOD *dhm) { DH_METHOD *ret; ret = OPENSSL_malloc(sizeof(DH_METHOD)); if (ret != NULL) { memcpy(ret, dhm, sizeof(*dhm)); ret->name = OPENSSL_strdup(dhm->name); } return ret; } const char *DH_meth_get0_name(const DH_METHOD *dhm) { return dhm->name; } int DH_meth_set1_name(DH_METHOD *dhm, const char *name) { OPENSSL_free(dhm->name); dhm->name = OPENSSL_strdup(name); return dhm->name != NULL; } int DH_meth_get_flags(DH_METHOD *dhm) { return dhm->flags; } int DH_meth_set_flags(DH_METHOD *dhm, int flags) { dhm->flags = flags; return 1; } void *DH_meth_get0_app_data(const DH_METHOD *dhm) { return dhm->app_data; } int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data) { dhm->app_data = app_data; return 1; } int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *) { return dhm->generate_key; } int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)) { dhm->generate_key = generate_key; return 1; } int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) (unsigned char *key, const BIGNUM *pub_key, DH *dh) { return dhm->compute_key; } int DH_meth_set_compute_key(DH_METHOD *dhm, int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)) { dhm->compute_key = compute_key; return 1; } int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *) { return dhm->bn_mod_exp; } int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)) { dhm->bn_mod_exp = bn_mod_exp; return 1; } int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *) { return dhm->init; } int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)) { dhm->init = init; return 1; } int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *) { return dhm->finish; } int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)) { dhm->finish = finish; return 1; } int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) (DH *, int, int, BN_GENCB *) { return dhm->generate_params; } int DH_meth_set_generate_params(DH_METHOD *dhm, int (*generate_params) (DH *, int, int, BN_GENCB *)) { dhm->generate_params = generate_params; return 1; }
include/openssl/dh.h +30 −18 Changes for include/openssl/dh.h: 30 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -103,24 +103,6 @@ extern "C" { /* typedef struct dh_st DH; */ /* typedef struct dh_method DH_METHOD; */ struct dh_method { const char *name; /* Methods here */ int (*generate_key) (DH *dh); int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh); /* Can be null */ int (*bn_mod_exp) (const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); int (*init) (DH *dh); int (*finish) (DH *dh); int flags; char *app_data; /* If this is non-NULL, it will be used to generate parameters */ int (*generate_params) (DH *dh, int prime_len, int generator, BN_GENCB *cb); }; DECLARE_ASN1_ITEM(DHparams) # define DH_GENERATOR_2 2 Loading Loading @@ -222,6 +204,36 @@ ENGINE *DH_get0_engine(DH *d); long DH_get_length(const DH *dh); int DH_set_length(DH *dh, long length); DH_METHOD *DH_meth_new(const char *name, int flags); void DH_meth_free(DH_METHOD *dhm); DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); const char *DH_meth_get0_name(const DH_METHOD *dhm); int DH_meth_set1_name(DH_METHOD *dhm, const char *name); int DH_meth_get_flags(DH_METHOD *dhm); int DH_meth_set_flags(DH_METHOD *dhm, int flags); void *DH_meth_get0_app_data(const DH_METHOD *dhm); int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) (unsigned char *key, const BIGNUM *pub_key, DH *dh); int DH_meth_set_compute_key(DH_METHOD *dhm, int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) (DH *, int, int, BN_GENCB *); int DH_meth_set_generate_params(DH_METHOD *dhm, int (*generate_params) (DH *, int, int, BN_GENCB *)); # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ Loading