GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.bin/ssh/lib/../bufbn.c Lines: 0 12 0.0 %
Date: 2017-11-07 Branches: 0 8 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: bufbn.c,v 1.13 2017/04/30 23:23:54 djm Exp $ */
2
3
/*
4
 * Copyright (c) 2012 Damien Miller <djm@mindrot.org>
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
/* Emulation wrappers for legacy OpenSSH buffer API atop sshbuf */
20
21
#include <sys/types.h>
22
23
#include "buffer.h"
24
#include "log.h"
25
#include "ssherr.h"
26
27
28
int
29
buffer_put_bignum2_ret(Buffer *buffer, const BIGNUM *value)
30
{
31
	int ret;
32
33
	if ((ret = sshbuf_put_bignum2(buffer, value)) != 0) {
34
		error("%s: %s", __func__, ssh_err(ret));
35
		return -1;
36
	}
37
	return 0;
38
}
39
40
void
41
buffer_put_bignum2(Buffer *buffer, const BIGNUM *value)
42
{
43
	if (buffer_put_bignum2_ret(buffer, value) == -1)
44
		fatal("%s: buffer error", __func__);
45
}
46
47
int
48
buffer_get_bignum2_ret(Buffer *buffer, BIGNUM *value)
49
{
50
	int ret;
51
52
	if ((ret = sshbuf_get_bignum2(buffer, value)) != 0) {
53
		error("%s: %s", __func__, ssh_err(ret));
54
		return -1;
55
	}
56
	return 0;
57
}
58
59
void
60
buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
61
{
62
	if (buffer_get_bignum2_ret(buffer, value) == -1)
63
		fatal("%s: buffer error", __func__);
64
}