2 * $OpenBSD: mem.c,v 1.4 2004/07/11 06:41:48 otto Exp $
3 * $DragonFly: src/usr.bin/dc/mem.c,v 1.1 2004/09/20 04:20:39 dillon Exp $
7 * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 #include <openssl/err.h>
35 n = bmalloc(sizeof(*n));
38 if (n->number == NULL)
44 free_number(struct number *n)
51 dup_number(const struct number *a)
55 n = bmalloc(sizeof(*n));
57 n->number = BN_dup(a->number);
74 brealloc(void *p, size_t sz)
85 bstrdup(const char *p)
99 err(1, "big number failure %lx", ERR_get_error());
103 bn_checkp(const void *p) \
106 err(1, "allocation failure %lx", ERR_get_error());