]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/ecdhtest.c
ecdhtest.c: move co-factor ECDH KATs to evptests
[thirdparty/openssl.git] / test / ecdhtest.c
CommitLineData
440e5d80
RS
1/*
2 * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
e172d60d
BM
10/* ====================================================================
11 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
12 *
13 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
14 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
15 * to the OpenSSL project.
16 *
17 * The ECC Code is licensed pursuant to the OpenSSL open source
18 * license provided below.
19 *
e172d60d
BM
20 * The ECDH software is originally written by Douglas Stebila of
21 * Sun Microsystems Laboratories.
22 *
23 */
e172d60d
BM
24
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
55f78baf
RL
28
29#include "../e_os.h"
30
10bf4fc2 31#include <openssl/opensslconf.h> /* for OPENSSL_NO_EC */
e172d60d
BM
32#include <openssl/crypto.h>
33#include <openssl/bio.h>
34#include <openssl/bn.h>
e172d60d
BM
35#include <openssl/objects.h>
36#include <openssl/rand.h>
176f31dd 37#include <openssl/sha.h>
e172d60d
BM
38#include <openssl/err.h>
39
10bf4fc2 40#ifdef OPENSSL_NO_EC
e172d60d
BM
41int main(int argc, char *argv[])
42{
43 printf("No ECDH support\n");
0f113f3e 44 return (0);
e172d60d
BM
45}
46#else
0f113f3e 47# include <openssl/ec.h>
e172d60d 48
0f113f3e
MC
49static const char rnd_seed[] =
50 "string to make the random number generator think it has entropy";
176f31dd 51
0f113f3e
MC
52int main(int argc, char *argv[])
53{
5c64c1bf 54 int ret = 1;
0f113f3e
MC
55 BIO *out;
56
bbd86bf5 57 CRYPTO_set_mem_debug(1);
0f113f3e
MC
58 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
59
0f113f3e
MC
60 RAND_seed(rnd_seed, sizeof rnd_seed);
61
62 out = BIO_new(BIO_s_file());
63 if (out == NULL)
64 EXIT(1);
0f81f5f7 65 BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
0f113f3e 66
d663c2db 67 /* NAMED CURVES TESTS: moved to evptests.txt */
b438f0ed 68
29cbf152 69 /* KATs: moved to evptests.txt */
0f113f3e 70
821d6c6d 71 /* NIST SP800-56A co-factor ECDH KATs: moved to evptests.txt */
61f6774e 72
0f113f3e
MC
73 ret = 0;
74
75 err:
76 ERR_print_errors_fp(stderr);
0f113f3e 77 BIO_free(out);
8793f012 78
c2e27310 79#ifndef OPENSSL_NO_CRYPTO_MDEBUG
541e9565
DSH
80 if (CRYPTO_mem_leaks_fp(stderr) <= 0)
81 ret = 1;
bbd86bf5 82#endif
0f113f3e 83 EXIT(ret);
0f113f3e 84}
c787525a 85#endif