diff options
| author | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
| commit | 2035faf3f8aa95b888d9416c3cc7328c0ea18beb (patch) | |
| tree | f08a08d357c5d30455c569890f747c1d9b241316 /src/regress/lib/libcrypto/bn/mont | |
| parent | be03b61c1b8f59ccdd34dbe5f6c6b30de697d28b (diff) | |
| download | openbsd-bluhm_20181106.tar.gz openbsd-bluhm_20181106.tar.bz2 openbsd-bluhm_20181106.zip | |
This commit was manufactured by cvs2git to create tag 'bluhm_20181106'.bluhm_20181106
Diffstat (limited to 'src/regress/lib/libcrypto/bn/mont')
| -rw-r--r-- | src/regress/lib/libcrypto/bn/mont/Makefile | 9 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/bn/mont/mont.c | 73 |
2 files changed, 0 insertions, 82 deletions
diff --git a/src/regress/lib/libcrypto/bn/mont/Makefile b/src/regress/lib/libcrypto/bn/mont/Makefile deleted file mode 100644 index 55c48220d4..0000000000 --- a/src/regress/lib/libcrypto/bn/mont/Makefile +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.3 2017/01/21 09:38:58 beck Exp $ | ||
| 2 | |||
| 3 | PROG= mont | ||
| 4 | LDADD= -lcrypto | ||
| 5 | DPADD= ${LIBCRYPTO} | ||
| 6 | WARNINGS= Yes | ||
| 7 | CFLAGS+= -Werror | ||
| 8 | |||
| 9 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libcrypto/bn/mont/mont.c b/src/regress/lib/libcrypto/bn/mont/mont.c deleted file mode 100644 index 30d5317b64..0000000000 --- a/src/regress/lib/libcrypto/bn/mont/mont.c +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | /* $OpenBSD: mont.c,v 1.2 2014/10/22 13:23:05 jsing Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2014 Miodrag Vallat. | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <stdio.h> | ||
| 20 | #include <stdlib.h> | ||
| 21 | #include <string.h> | ||
| 22 | #include <err.h> | ||
| 23 | |||
| 24 | #include <openssl/bn.h> | ||
| 25 | #include <openssl/crypto.h> | ||
| 26 | #include <openssl/dh.h> | ||
| 27 | #include <openssl/err.h> | ||
| 28 | |||
| 29 | /* | ||
| 30 | * Test for proper bn_mul_mont behaviour when operands are of vastly different | ||
| 31 | * sizes. | ||
| 32 | */ | ||
| 33 | |||
| 34 | int | ||
| 35 | main(int argc, char *argv[]) | ||
| 36 | { | ||
| 37 | DH *dh; | ||
| 38 | unsigned char *key, r[32 + 16 * 8]; | ||
| 39 | size_t privsz; | ||
| 40 | |||
| 41 | arc4random_buf(r, sizeof(r)); | ||
| 42 | |||
| 43 | for (privsz = 32; privsz <= sizeof(r); privsz += 8) { | ||
| 44 | dh = DH_new(); | ||
| 45 | if (dh == NULL) | ||
| 46 | goto err; | ||
| 47 | if (DH_generate_parameters_ex(dh, 32, DH_GENERATOR_2, | ||
| 48 | NULL) == 0) | ||
| 49 | goto err; | ||
| 50 | |||
| 51 | /* force private key to be much larger than public one */ | ||
| 52 | dh->priv_key = BN_bin2bn(r, privsz, NULL); | ||
| 53 | if (dh->priv_key == NULL) | ||
| 54 | goto err; | ||
| 55 | |||
| 56 | if (DH_generate_key(dh) == 0) | ||
| 57 | goto err; | ||
| 58 | key = malloc(DH_size(dh)); | ||
| 59 | if (key == NULL) | ||
| 60 | err(1, "malloc"); | ||
| 61 | if (DH_compute_key(key, dh->pub_key, dh) == -1) | ||
| 62 | goto err; | ||
| 63 | |||
| 64 | free(key); | ||
| 65 | DH_free(dh); | ||
| 66 | } | ||
| 67 | |||
| 68 | return 0; | ||
| 69 | |||
| 70 | err: | ||
| 71 | ERR_print_errors_fp(stderr); | ||
| 72 | return 1; | ||
| 73 | } | ||
