source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/bio/bss_null.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: 2.0 KB
Line 
1/*
2 * Copyright 1995-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 <stdio.h>
11#include <errno.h>
12#include "bio_lcl.h"
13#include "internal/cryptlib.h"
14
15static int null_write(BIO *h, const char *buf, int num);
16static int null_read(BIO *h, char *buf, int size);
17static int null_puts(BIO *h, const char *str);
18static int null_gets(BIO *h, char *str, int size);
19static long null_ctrl(BIO *h, int cmd, long arg1, void *arg2);
20static int null_new(BIO *h);
21static int null_free(BIO *data);
22static const BIO_METHOD null_method = {
23 BIO_TYPE_NULL,
24 "NULL",
25 null_write,
26 null_read,
27 null_puts,
28 null_gets,
29 null_ctrl,
30 null_new,
31 null_free,
32 NULL,
33};
34
35const BIO_METHOD *BIO_s_null(void)
36{
37 return (&null_method);
38}
39
40static int null_new(BIO *bi)
41{
42 bi->init = 1;
43 bi->num = 0;
44 bi->ptr = (NULL);
45 return (1);
46}
47
48static int null_free(BIO *a)
49{
50 if (a == NULL)
51 return (0);
52 return (1);
53}
54
55static int null_read(BIO *b, char *out, int outl)
56{
57 return (0);
58}
59
60static int null_write(BIO *b, const char *in, int inl)
61{
62 return (inl);
63}
64
65static long null_ctrl(BIO *b, int cmd, long num, void *ptr)
66{
67 long ret = 1;
68
69 switch (cmd) {
70 case BIO_CTRL_RESET:
71 case BIO_CTRL_EOF:
72 case BIO_CTRL_SET:
73 case BIO_CTRL_SET_CLOSE:
74 case BIO_CTRL_FLUSH:
75 case BIO_CTRL_DUP:
76 ret = 1;
77 break;
78 case BIO_CTRL_GET_CLOSE:
79 case BIO_CTRL_INFO:
80 case BIO_CTRL_GET:
81 case BIO_CTRL_PENDING:
82 case BIO_CTRL_WPENDING:
83 default:
84 ret = 0;
85 break;
86 }
87 return (ret);
88}
89
90static int null_gets(BIO *bp, char *buf, int size)
91{
92 return (0);
93}
94
95static int null_puts(BIO *bp, const char *str)
96{
97 if (str == NULL)
98 return (0);
99 return (strlen(str));
100}
Note: See TracBrowser for help on using the repository browser.