diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Makefile | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/Symbols.list | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/bio/bio.h | 13 | ||||
| -rw-r--r-- | src/lib/libcrypto/bio/bio_meth.c | 82 |
4 files changed, 104 insertions, 3 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index 5432bab176..85e6b0ee8d 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.23 2017/08/28 17:41:59 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.24 2018/02/17 13:57:14 tb Exp $ |
| 2 | 2 | ||
| 3 | LIB= crypto | 3 | LIB= crypto |
| 4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
| @@ -64,7 +64,7 @@ SRCS+= a_time_tm.c | |||
| 64 | SRCS+= bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c | 64 | SRCS+= bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c |
| 65 | 65 | ||
| 66 | # bio/ | 66 | # bio/ |
| 67 | SRCS+= bio_lib.c bio_cb.c bio_err.c | 67 | SRCS+= bio_lib.c bio_cb.c bio_err.c bio_meth.c |
| 68 | SRCS+= bss_mem.c bss_null.c bss_fd.c | 68 | SRCS+= bss_mem.c bss_null.c bss_fd.c |
| 69 | SRCS+= bss_file.c bss_sock.c bss_conn.c | 69 | SRCS+= bss_file.c bss_sock.c bss_conn.c |
| 70 | SRCS+= bf_null.c bf_buff.c b_print.c b_dump.c | 70 | SRCS+= bf_null.c bf_buff.c b_print.c b_dump.c |
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 99930ffa17..bee42ac164 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
| @@ -286,6 +286,14 @@ BIO_gethostbyname | |||
| 286 | BIO_gets | 286 | BIO_gets |
| 287 | BIO_indent | 287 | BIO_indent |
| 288 | BIO_int_ctrl | 288 | BIO_int_ctrl |
| 289 | BIO_meth_free | ||
| 290 | BIO_meth_new | ||
| 291 | BIO_meth_set_create | ||
| 292 | BIO_meth_set_ctrl | ||
| 293 | BIO_meth_set_destroy | ||
| 294 | BIO_meth_set_puts | ||
| 295 | BIO_meth_set_read | ||
| 296 | BIO_meth_set_write | ||
| 289 | BIO_method_name | 297 | BIO_method_name |
| 290 | BIO_method_type | 298 | BIO_method_type |
| 291 | BIO_new | 299 | BIO_new |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index faca125544..3a1577ab37 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio.h,v 1.30 2017/04/06 18:25:38 deraadt Exp $ */ | 1 | /* $OpenBSD: bio.h,v 1.31 2018/02/17 13:57:14 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 | * |
| @@ -327,6 +327,17 @@ typedef struct bio_f_buffer_ctx_struct { | |||
| 327 | /* Prefix and suffix callback in ASN1 BIO */ | 327 | /* Prefix and suffix callback in ASN1 BIO */ |
| 328 | typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg); | 328 | typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg); |
| 329 | 329 | ||
| 330 | /* BIO_METHOD accessors */ | ||
| 331 | BIO_METHOD *BIO_meth_new(int type, const char *name); | ||
| 332 | void BIO_meth_free(BIO_METHOD *biom); | ||
| 333 | int BIO_meth_set_write(BIO_METHOD *biom, | ||
| 334 | int (*write)(BIO *, const char *, int)); | ||
| 335 | int BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int)); | ||
| 336 | int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *)); | ||
| 337 | int BIO_meth_set_ctrl(BIO_METHOD *biom, | ||
| 338 | int long (*ctrl)(BIO *, int, long, void *)); | ||
| 339 | int BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *)); | ||
| 340 | int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *)); | ||
| 330 | 341 | ||
| 331 | /* connect BIO stuff */ | 342 | /* connect BIO stuff */ |
| 332 | #define BIO_CONN_S_BEFORE 1 | 343 | #define BIO_CONN_S_BEFORE 1 |
diff --git a/src/lib/libcrypto/bio/bio_meth.c b/src/lib/libcrypto/bio/bio_meth.c new file mode 100644 index 0000000000..83e5254304 --- /dev/null +++ b/src/lib/libcrypto/bio/bio_meth.c | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* $OpenBSD: bio_meth.c,v 1.1 2018/02/17 13:57:14 tb Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <stdlib.h> | ||
| 19 | |||
| 20 | #include <openssl/bio.h> | ||
| 21 | |||
| 22 | BIO_METHOD * | ||
| 23 | BIO_meth_new(int type, const char *name) | ||
| 24 | { | ||
| 25 | BIO_METHOD *biom; | ||
| 26 | |||
| 27 | if ((biom = calloc(1, sizeof(*biom))) == NULL) | ||
| 28 | return NULL; | ||
| 29 | |||
| 30 | biom->type = type; | ||
| 31 | biom->name = name; | ||
| 32 | |||
| 33 | return biom; | ||
| 34 | } | ||
| 35 | |||
| 36 | void | ||
| 37 | BIO_meth_free(BIO_METHOD *biom) | ||
| 38 | { | ||
| 39 | free(biom); | ||
| 40 | } | ||
| 41 | |||
| 42 | int | ||
| 43 | BIO_meth_set_write(BIO_METHOD *biom, int (*write)(BIO *, const char *, int)) | ||
| 44 | { | ||
| 45 | biom->bwrite = write; | ||
| 46 | return 1; | ||
| 47 | } | ||
| 48 | |||
| 49 | int | ||
| 50 | BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int)) | ||
| 51 | { | ||
| 52 | biom->bread = read; | ||
| 53 | return 1; | ||
| 54 | } | ||
| 55 | |||
| 56 | int | ||
| 57 | BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *)) | ||
| 58 | { | ||
| 59 | biom->bputs = puts; | ||
| 60 | return 1; | ||
| 61 | } | ||
| 62 | |||
| 63 | int | ||
| 64 | BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl)(BIO *, int, long, void *)) | ||
| 65 | { | ||
| 66 | biom->ctrl = ctrl; | ||
| 67 | return 1; | ||
| 68 | } | ||
| 69 | |||
| 70 | int | ||
| 71 | BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *)) | ||
| 72 | { | ||
| 73 | biom->create = create; | ||
| 74 | return 1; | ||
| 75 | } | ||
| 76 | |||
| 77 | int | ||
| 78 | BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *)) | ||
| 79 | { | ||
| 80 | biom->destroy = destroy; | ||
| 81 | return 1; | ||
| 82 | } | ||
