summaryrefslogtreecommitdiff
path: root/src/regress/lib/libssl/ssl/ssltest.c
diff options
context:
space:
mode:
authortb <>2021-11-21 21:40:45 +0000
committertb <>2021-11-21 21:40:45 +0000
commitaa176fce509d4a6467d55429aaa3ea0256ad6eda (patch)
tree265b5f8ab120e5721a0b5104dd3e2516eedcdd8a /src/regress/lib/libssl/ssl/ssltest.c
parent531adb9e89fcce417b0bb144eac2484fa61752c5 (diff)
downloadopenbsd-aa176fce509d4a6467d55429aaa3ea0256ad6eda.tar.gz
openbsd-aa176fce509d4a6467d55429aaa3ea0256ad6eda.tar.bz2
openbsd-aa176fce509d4a6467d55429aaa3ea0256ad6eda.zip
Prepare ssltest for opaque DH
Diffstat (limited to 'src/regress/lib/libssl/ssl/ssltest.c')
-rw-r--r--src/regress/lib/libssl/ssl/ssltest.c57
1 files changed, 39 insertions, 18 deletions
diff --git a/src/regress/lib/libssl/ssl/ssltest.c b/src/regress/lib/libssl/ssl/ssltest.c
index b1618de4a6..32253844b2 100644
--- a/src/regress/lib/libssl/ssl/ssltest.c
+++ b/src/regress/lib/libssl/ssl/ssltest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssltest.c,v 1.32 2021/11/18 16:45:28 tb Exp $ */ 1/* $OpenBSD: ssltest.c,v 1.33 2021/11/21 21:40:45 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1868,16 +1868,26 @@ get_dh1024()
1868 0x02, 1868 0x02,
1869 }; 1869 };
1870 DH *dh; 1870 DH *dh;
1871 BIGNUM *dh_p = NULL, *dh_g = NULL;
1871 1872
1872 if ((dh = DH_new()) == NULL) 1873 if ((dh = DH_new()) == NULL)
1873 return (NULL); 1874 return NULL;
1874 dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); 1875
1875 dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); 1876 dh_p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
1876 if ((dh->p == NULL) || (dh->g == NULL)) { 1877 dh_g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
1877 DH_free(dh); 1878 if (dh_p == NULL || dh_g == NULL)
1878 return (NULL); 1879 goto err;
1879 } 1880
1880 return (dh); 1881 if (!DH_set0_pqg(dh, dh_p, NULL, dh_g))
1882 goto err;
1883
1884 return dh;
1885
1886 err:
1887 BN_free(dh_p);
1888 BN_free(dh_g);
1889 DH_free(dh);
1890 return NULL;
1881} 1891}
1882 1892
1883static DH * 1893static DH *
@@ -1910,15 +1920,26 @@ get_dh1024dsa()
1910 0x07, 0xE7, 0x68, 0x1A, 0x82, 0x5D, 0x32, 0xA2, 1920 0x07, 0xE7, 0x68, 0x1A, 0x82, 0x5D, 0x32, 0xA2,
1911 }; 1921 };
1912 DH *dh; 1922 DH *dh;
1923 BIGNUM *dh_p = NULL, *dh_g = NULL;
1913 1924
1914 if ((dh = DH_new()) == NULL) 1925 if ((dh = DH_new()) == NULL)
1915 return (NULL); 1926 return NULL;
1916 dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); 1927
1917 dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); 1928 dh_p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
1918 if ((dh->p == NULL) || (dh->g == NULL)) { 1929 dh_g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
1919 DH_free(dh); 1930 if (dh_p == NULL || dh_g == NULL)
1920 return (NULL); 1931 goto err;
1921 } 1932
1922 dh->length = 160; 1933 if (!DH_set0_pqg(dh, dh_p, NULL, dh_g))
1923 return (dh); 1934 goto err;
1935
1936 DH_set_length(dh, 160);
1937
1938 return dh;
1939
1940 err:
1941 BN_free(dh_p);
1942 BN_free(dh_g);
1943 DH_free(dh);
1944 return NULL;
1924} 1945}