2018-06-13 13:42:25 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
2021-06-03 08:37:05 +02:00
|
|
|
*
|
2018-06-13 13:42:25 +02:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
* information regarding copyright ownership.
|
|
|
|
*/
|
|
|
|
|
2020-12-17 11:40:29 +01:00
|
|
|
#include <inttypes.h>
|
2018-06-13 13:42:25 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2020-02-12 13:59:18 +01:00
|
|
|
|
2018-06-13 13:42:25 +02:00
|
|
|
#include <openssl/crypto.h>
|
2018-10-26 05:29:56 +02:00
|
|
|
#include <openssl/evp.h>
|
2018-06-13 13:42:25 +02:00
|
|
|
#include <openssl/hmac.h>
|
|
|
|
#include <openssl/opensslv.h>
|
2020-12-17 11:40:29 +01:00
|
|
|
#include <openssl/ssl.h>
|
|
|
|
|
|
|
|
#include "openssl_shim.h"
|
2018-06-13 13:42:25 +02:00
|
|
|
|
2020-12-17 11:40:29 +01:00
|
|
|
#if !HAVE_BIO_READ_EX
|
|
|
|
int
|
|
|
|
BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes) {
|
|
|
|
int rv = BIO_read(b, data, dlen);
|
|
|
|
if (rv > 0) {
|
|
|
|
*readbytes = rv;
|
|
|
|
rv = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rv);
|
|
|
|
}
|
2024-07-01 11:05:18 +02:00
|
|
|
#endif /* !HAVE_BIO_READ_EX */
|
2020-12-17 11:40:29 +01:00
|
|
|
|
|
|
|
#if !HAVE_BIO_WRITE_EX
|
|
|
|
int
|
|
|
|
BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written) {
|
|
|
|
int rv = BIO_write(b, data, dlen);
|
|
|
|
if (rv > 0) {
|
|
|
|
*written = rv;
|
|
|
|
rv = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rv);
|
|
|
|
}
|
2024-07-01 11:05:18 +02:00
|
|
|
#endif /* !HAVE_BIO_WRITE_EX */
|
2022-04-01 11:16:44 +03:00
|
|
|
|
|
|
|
#if !HAVE_SSL_CTX_SET1_CERT_STORE
|
|
|
|
void
|
|
|
|
SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store) {
|
|
|
|
(void)X509_STORE_up_ref(store);
|
|
|
|
|
|
|
|
SSL_CTX_set_cert_store(ctx, store);
|
|
|
|
}
|
|
|
|
#endif /* !HAVE_SSL_CTX_SET1_CERT_STORE */
|