diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bss_null.c')
| -rw-r--r-- | src/lib/libcrypto/bio/bss_null.c | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/src/lib/libcrypto/bio/bss_null.c b/src/lib/libcrypto/bio/bss_null.c index 46b73339df..51aed2ac4b 100644 --- a/src/lib/libcrypto/bio/bss_null.c +++ b/src/lib/libcrypto/bio/bss_null.c | |||
| @@ -68,8 +68,8 @@ static int null_gets(BIO *h, char *str, int size); | |||
| 68 | static long null_ctrl(BIO *h, int cmd, long arg1, void *arg2); | 68 | static long null_ctrl(BIO *h, int cmd, long arg1, void *arg2); |
| 69 | static int null_new(BIO *h); | 69 | static int null_new(BIO *h); |
| 70 | static int null_free(BIO *data); | 70 | static int null_free(BIO *data); |
| 71 | static BIO_METHOD null_method= | 71 | |
| 72 | { | 72 | static BIO_METHOD null_method = { |
| 73 | BIO_TYPE_NULL, | 73 | BIO_TYPE_NULL, |
| 74 | "NULL", | 74 | "NULL", |
| 75 | null_write, | 75 | null_write, |
| @@ -80,50 +80,56 @@ static BIO_METHOD null_method= | |||
| 80 | null_new, | 80 | null_new, |
| 81 | null_free, | 81 | null_free, |
| 82 | NULL, | 82 | NULL, |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | BIO_METHOD *BIO_s_null(void) | 85 | BIO_METHOD |
| 86 | { | 86 | *BIO_s_null(void) |
| 87 | return(&null_method); | 87 | { |
| 88 | } | 88 | return (&null_method); |
| 89 | } | ||
| 89 | 90 | ||
| 90 | static int null_new(BIO *bi) | 91 | static int |
| 91 | { | 92 | null_new(BIO *bi) |
| 92 | bi->init=1; | 93 | { |
| 93 | bi->num=0; | 94 | bi->init = 1; |
| 94 | bi->ptr=(NULL); | 95 | bi->num = 0; |
| 95 | return(1); | 96 | bi->ptr = (NULL); |
| 96 | } | 97 | return (1); |
| 98 | } | ||
| 97 | 99 | ||
| 98 | static int null_free(BIO *a) | 100 | static int |
| 99 | { | 101 | null_free(BIO *a) |
| 100 | if (a == NULL) return(0); | 102 | { |
| 101 | return(1); | 103 | if (a == NULL) |
| 102 | } | 104 | return (0); |
| 103 | 105 | return (1); | |
| 104 | static int null_read(BIO *b, char *out, int outl) | 106 | } |
| 105 | { | ||
| 106 | return(0); | ||
| 107 | } | ||
| 108 | 107 | ||
| 109 | static int null_write(BIO *b, const char *in, int inl) | 108 | static int |
| 110 | { | 109 | null_read(BIO *b, char *out, int outl) |
| 111 | return(inl); | 110 | { |
| 112 | } | 111 | return (0); |
| 112 | } | ||
| 113 | |||
| 114 | static int | ||
| 115 | null_write(BIO *b, const char *in, int inl) | ||
| 116 | { | ||
| 117 | return (inl); | ||
| 118 | } | ||
| 113 | 119 | ||
| 114 | static long null_ctrl(BIO *b, int cmd, long num, void *ptr) | 120 | static long |
| 115 | { | 121 | null_ctrl(BIO *b, int cmd, long num, void *ptr) |
| 116 | long ret=1; | 122 | { |
| 123 | long ret = 1; | ||
| 117 | 124 | ||
| 118 | switch (cmd) | 125 | switch (cmd) { |
| 119 | { | ||
| 120 | case BIO_CTRL_RESET: | 126 | case BIO_CTRL_RESET: |
| 121 | case BIO_CTRL_EOF: | 127 | case BIO_CTRL_EOF: |
| 122 | case BIO_CTRL_SET: | 128 | case BIO_CTRL_SET: |
| 123 | case BIO_CTRL_SET_CLOSE: | 129 | case BIO_CTRL_SET_CLOSE: |
| 124 | case BIO_CTRL_FLUSH: | 130 | case BIO_CTRL_FLUSH: |
| 125 | case BIO_CTRL_DUP: | 131 | case BIO_CTRL_DUP: |
| 126 | ret=1; | 132 | ret = 1; |
| 127 | break; | 133 | break; |
| 128 | case BIO_CTRL_GET_CLOSE: | 134 | case BIO_CTRL_GET_CLOSE: |
| 129 | case BIO_CTRL_INFO: | 135 | case BIO_CTRL_INFO: |
| @@ -131,20 +137,22 @@ static long null_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 131 | case BIO_CTRL_PENDING: | 137 | case BIO_CTRL_PENDING: |
| 132 | case BIO_CTRL_WPENDING: | 138 | case BIO_CTRL_WPENDING: |
| 133 | default: | 139 | default: |
| 134 | ret=0; | 140 | ret = 0; |
| 135 | break; | 141 | break; |
| 136 | } | ||
| 137 | return(ret); | ||
| 138 | } | 142 | } |
| 143 | return (ret); | ||
| 144 | } | ||
| 139 | 145 | ||
| 140 | static int null_gets(BIO *bp, char *buf, int size) | 146 | static int |
| 141 | { | 147 | null_gets(BIO *bp, char *buf, int size) |
| 142 | return(0); | 148 | { |
| 143 | } | 149 | return (0); |
| 144 | 150 | } | |
| 145 | static int null_puts(BIO *bp, const char *str) | ||
| 146 | { | ||
| 147 | if (str == NULL) return(0); | ||
| 148 | return(strlen(str)); | ||
| 149 | } | ||
| 150 | 151 | ||
| 152 | static int | ||
| 153 | null_puts(BIO *bp, const char *str) | ||
| 154 | { | ||
| 155 | if (str == NULL) | ||
| 156 | return (0); | ||
| 157 | return (strlen(str)); | ||
| 158 | } | ||
