source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/bio/bio_meth.c@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc
File size: 3.1 KB
Line 
1/*
2 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include "bio_lcl.h"
11#include <internal/thread_once.h>
12
13CRYPTO_RWLOCK *bio_type_lock = NULL;
14static CRYPTO_ONCE bio_type_init = CRYPTO_ONCE_STATIC_INIT;
15
16DEFINE_RUN_ONCE_STATIC(do_bio_type_init)
17{
18 bio_type_lock = CRYPTO_THREAD_lock_new();
19 return bio_type_lock != NULL;
20}
21
22int BIO_get_new_index()
23{
24 static int bio_count = BIO_TYPE_START;
25 int newval;
26
27 if (!RUN_ONCE(&bio_type_init, do_bio_type_init)) {
28 BIOerr(BIO_F_BIO_GET_NEW_INDEX, ERR_R_MALLOC_FAILURE);
29 return -1;
30 }
31 if (!CRYPTO_atomic_add(&bio_count, 1, &newval, bio_type_lock))
32 return -1;
33 return newval;
34}
35
36BIO_METHOD *BIO_meth_new(int type, const char *name)
37{
38 BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD));
39
40 if (biom != NULL) {
41 biom->type = type;
42 biom->name = name;
43 }
44 return biom;
45}
46
47void BIO_meth_free(BIO_METHOD *biom)
48{
49 OPENSSL_free(biom);
50}
51
52int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int)
53{
54 return biom->bwrite;
55}
56
57int BIO_meth_set_write(BIO_METHOD *biom,
58 int (*bwrite) (BIO *, const char *, int))
59{
60 biom->bwrite = bwrite;
61 return 1;
62}
63
64int (*BIO_meth_get_read(BIO_METHOD *biom)) (BIO *, char *, int)
65{
66 return biom->bread;
67}
68
69int BIO_meth_set_read(BIO_METHOD *biom,
70 int (*bread) (BIO *, char *, int))
71{
72 biom->bread = bread;
73 return 1;
74}
75
76int (*BIO_meth_get_puts(BIO_METHOD *biom)) (BIO *, const char *)
77{
78 return biom->bputs;
79}
80
81int BIO_meth_set_puts(BIO_METHOD *biom,
82 int (*bputs) (BIO *, const char *))
83{
84 biom->bputs = bputs;
85 return 1;
86}
87
88int (*BIO_meth_get_gets(BIO_METHOD *biom)) (BIO *, char *, int)
89{
90 return biom->bgets;
91}
92
93int BIO_meth_set_gets(BIO_METHOD *biom,
94 int (*bgets) (BIO *, char *, int))
95{
96 biom->bgets = bgets;
97 return 1;
98}
99
100long (*BIO_meth_get_ctrl(BIO_METHOD *biom)) (BIO *, int, long, void *)
101{
102 return biom->ctrl;
103}
104
105int BIO_meth_set_ctrl(BIO_METHOD *biom,
106 long (*ctrl) (BIO *, int, long, void *))
107{
108 biom->ctrl = ctrl;
109 return 1;
110}
111
112int (*BIO_meth_get_create(BIO_METHOD *biom)) (BIO *)
113{
114 return biom->create;
115}
116
117int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *))
118{
119 biom->create = create;
120 return 1;
121}
122
123int (*BIO_meth_get_destroy(BIO_METHOD *biom)) (BIO *)
124{
125 return biom->destroy;
126}
127
128int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *))
129{
130 biom->destroy = destroy;
131 return 1;
132}
133
134long (*BIO_meth_get_callback_ctrl(BIO_METHOD *biom)) (BIO *, int, bio_info_cb *)
135{
136 return biom->callback_ctrl;
137}
138
139int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
140 long (*callback_ctrl) (BIO *, int,
141 bio_info_cb *))
142{
143 biom->callback_ctrl = callback_ctrl;
144 return 1;
145}
Note: See TracBrowser for help on using the repository browser.