Loading apps/dhparam.c +23 −13 Original line number Diff line number Diff line Loading @@ -384,40 +384,50 @@ int dhparam_main(int argc, char **argv) if (C) { unsigned char *data; int len, bits; BIGNUM *pbn, *gbn; len = BN_num_bytes(dh->p); bits = BN_num_bits(dh->p); len = DH_size(dh); bits = DH_bits(dh); DH_get0_pqg(dh, &pbn, NULL, &gbn); data = app_malloc(len, "print a BN"); BIO_printf(out, "#ifndef HEADER_DH_H\n" "# include <openssl/dh.h>\n" "#endif\n" "\n"); BIO_printf(out, "DH *get_dh%d()\n{\n", bits); print_bignum_var(out, dh->p, "dhp", bits, data); print_bignum_var(out, dh->g, "dhg", bits, data); BIO_printf(out, " DH *dh = DN_new();\n" print_bignum_var(out, pbn, "dhp", bits, data); print_bignum_var(out, gbn, "dhg", bits, data); BIO_printf(out, " DH *dh = DH_new();\n" " BIGNUM *dhp_bn, *dhg_bn;\n" "\n" " if (dh == NULL)\n" " return NULL;\n"); BIO_printf(out, " dh->p = BN_bin2bn(dhp_%d, sizeof (dhp_%d), NULL);\n", BIO_printf(out, " dhp_bn = BN_bin2bn(dhp_%d, sizeof (dhp_%d), NULL);\n", bits, bits); BIO_printf(out, " dh->g = BN_bin2bn(dhg_%d, sizeof (dhg_%d), NULL);\n", BIO_printf(out, " dhg_bn = BN_bin2bn(dhg_%d, sizeof (dhg_%d), NULL);\n", bits, bits); BIO_printf(out, " if (!dh->p || !dh->g) {\n" BIO_printf(out, " if (dhp_bn == NULL || dhg_bn == NULL\n" " || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {\n" " DH_free(dh);\n" " BN_free(dhp_bn);\n" " BN_free(dhg_bn);\n" " return NULL;\n" " }\n"); if (dh->length) if (DH_get_length(dh) > 0) BIO_printf(out, " dh->length = %ld;\n", dh->length); " if (!DH_set_length(dh, %ld)) {\n" " DH_free(dh);\n" " }\n", DH_get_length(dh)); BIO_printf(out, " return dh;\n}\n"); OPENSSL_free(data); } if (!noout) { BIGNUM *q; DH_get0_pqg(dh, NULL, &q, NULL); if (outformat == FORMAT_ASN1) i = i2d_DHparams_bio(out, dh); else if (dh->q) else if (q != NULL) i = PEM_write_bio_DHxparams(out, dh); else i = PEM_write_bio_DHparams(out, dh); Loading apps/s_cb.c +1 −1 Original line number Diff line number Diff line Loading @@ -1371,7 +1371,7 @@ static int security_callback_debug(const SSL *s, const SSL_CTX *ctx, case SSL_SECOP_OTHER_DH: { DH *dh = other; BIO_printf(sdb->out, "%d", BN_num_bits(dh->p)); BIO_printf(sdb->out, "%d", DH_bits(dh)); break; } #endif Loading crypto/dh/dh_ameth.c +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ #include "internal/cryptlib.h" #include <openssl/x509.h> #include <openssl/asn1.h> #include <openssl/dh.h> #include "dh_locl.h" #include <openssl/bn.h> #include "internal/asn1_int.h" #include "internal/evp_int.h" Loading crypto/dh/dh_asn1.c +1 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/dh.h> #include "dh_locl.h" #include <openssl/objects.h> #include <openssl/asn1t.h> Loading crypto/dh/dh_check.c +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/dh.h> #include "dh_locl.h" /*- * Check that p is a safe prime and Loading Loading
apps/dhparam.c +23 −13 Original line number Diff line number Diff line Loading @@ -384,40 +384,50 @@ int dhparam_main(int argc, char **argv) if (C) { unsigned char *data; int len, bits; BIGNUM *pbn, *gbn; len = BN_num_bytes(dh->p); bits = BN_num_bits(dh->p); len = DH_size(dh); bits = DH_bits(dh); DH_get0_pqg(dh, &pbn, NULL, &gbn); data = app_malloc(len, "print a BN"); BIO_printf(out, "#ifndef HEADER_DH_H\n" "# include <openssl/dh.h>\n" "#endif\n" "\n"); BIO_printf(out, "DH *get_dh%d()\n{\n", bits); print_bignum_var(out, dh->p, "dhp", bits, data); print_bignum_var(out, dh->g, "dhg", bits, data); BIO_printf(out, " DH *dh = DN_new();\n" print_bignum_var(out, pbn, "dhp", bits, data); print_bignum_var(out, gbn, "dhg", bits, data); BIO_printf(out, " DH *dh = DH_new();\n" " BIGNUM *dhp_bn, *dhg_bn;\n" "\n" " if (dh == NULL)\n" " return NULL;\n"); BIO_printf(out, " dh->p = BN_bin2bn(dhp_%d, sizeof (dhp_%d), NULL);\n", BIO_printf(out, " dhp_bn = BN_bin2bn(dhp_%d, sizeof (dhp_%d), NULL);\n", bits, bits); BIO_printf(out, " dh->g = BN_bin2bn(dhg_%d, sizeof (dhg_%d), NULL);\n", BIO_printf(out, " dhg_bn = BN_bin2bn(dhg_%d, sizeof (dhg_%d), NULL);\n", bits, bits); BIO_printf(out, " if (!dh->p || !dh->g) {\n" BIO_printf(out, " if (dhp_bn == NULL || dhg_bn == NULL\n" " || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {\n" " DH_free(dh);\n" " BN_free(dhp_bn);\n" " BN_free(dhg_bn);\n" " return NULL;\n" " }\n"); if (dh->length) if (DH_get_length(dh) > 0) BIO_printf(out, " dh->length = %ld;\n", dh->length); " if (!DH_set_length(dh, %ld)) {\n" " DH_free(dh);\n" " }\n", DH_get_length(dh)); BIO_printf(out, " return dh;\n}\n"); OPENSSL_free(data); } if (!noout) { BIGNUM *q; DH_get0_pqg(dh, NULL, &q, NULL); if (outformat == FORMAT_ASN1) i = i2d_DHparams_bio(out, dh); else if (dh->q) else if (q != NULL) i = PEM_write_bio_DHxparams(out, dh); else i = PEM_write_bio_DHparams(out, dh); Loading
apps/s_cb.c +1 −1 Original line number Diff line number Diff line Loading @@ -1371,7 +1371,7 @@ static int security_callback_debug(const SSL *s, const SSL_CTX *ctx, case SSL_SECOP_OTHER_DH: { DH *dh = other; BIO_printf(sdb->out, "%d", BN_num_bits(dh->p)); BIO_printf(sdb->out, "%d", DH_bits(dh)); break; } #endif Loading
crypto/dh/dh_ameth.c +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ #include "internal/cryptlib.h" #include <openssl/x509.h> #include <openssl/asn1.h> #include <openssl/dh.h> #include "dh_locl.h" #include <openssl/bn.h> #include "internal/asn1_int.h" #include "internal/evp_int.h" Loading
crypto/dh/dh_asn1.c +1 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/dh.h> #include "dh_locl.h" #include <openssl/objects.h> #include <openssl/asn1t.h> Loading
crypto/dh/dh_check.c +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ #include <stdio.h> #include "internal/cryptlib.h" #include <openssl/bn.h> #include <openssl/dh.h> #include "dh_locl.h" /*- * Check that p is a safe prime and Loading