diff options
author | beck <> | 2017-01-29 17:49:23 +0000 |
---|---|---|
committer | beck <> | 2017-01-29 17:49:23 +0000 |
commit | 957b11334a7afb14537322f0e4795b2e368b3f59 (patch) | |
tree | 1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/comp | |
parent | df96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff) | |
download | openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2 openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip |
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/comp')
-rw-r--r-- | src/lib/libcrypto/comp/c_zlib.c | 17 | ||||
-rw-r--r-- | src/lib/libcrypto/comp/comp_err.c | 7 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index d9a3359313..1802cffd99 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: c_zlib.c,v 1.18 2015/12/23 20:37:23 mmcc Exp $ */ | 1 | /* $OpenBSD: c_zlib.c,v 1.19 2017/01/29 17:49:22 beck Exp $ */ |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <string.h> | 4 | #include <string.h> |
@@ -257,7 +257,7 @@ bio_zlib_new(BIO *bi) | |||
257 | 257 | ||
258 | ctx = malloc(sizeof(BIO_ZLIB_CTX)); | 258 | ctx = malloc(sizeof(BIO_ZLIB_CTX)); |
259 | if (!ctx) { | 259 | if (!ctx) { |
260 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); | 260 | COMPerror(ERR_R_MALLOC_FAILURE); |
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | ctx->ibuf = NULL; | 263 | ctx->ibuf = NULL; |
@@ -324,7 +324,7 @@ bio_zlib_read(BIO *b, char *out, int outl) | |||
324 | if (!ctx->ibuf) { | 324 | if (!ctx->ibuf) { |
325 | ctx->ibuf = malloc(ctx->ibufsize); | 325 | ctx->ibuf = malloc(ctx->ibufsize); |
326 | if (!ctx->ibuf) { | 326 | if (!ctx->ibuf) { |
327 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); | 327 | COMPerror(ERR_R_MALLOC_FAILURE); |
328 | return 0; | 328 | return 0; |
329 | } | 329 | } |
330 | inflateInit(zin); | 330 | inflateInit(zin); |
@@ -340,8 +340,7 @@ bio_zlib_read(BIO *b, char *out, int outl) | |||
340 | while (zin->avail_in) { | 340 | while (zin->avail_in) { |
341 | ret = inflate(zin, 0); | 341 | ret = inflate(zin, 0); |
342 | if ((ret != Z_OK) && (ret != Z_STREAM_END)) { | 342 | if ((ret != Z_OK) && (ret != Z_STREAM_END)) { |
343 | COMPerr(COMP_F_BIO_ZLIB_READ, | 343 | COMPerror(COMP_R_ZLIB_INFLATE_ERROR); |
344 | COMP_R_ZLIB_INFLATE_ERROR); | ||
345 | ERR_asprintf_error_data("zlib error:%s", | 344 | ERR_asprintf_error_data("zlib error:%s", |
346 | zError(ret)); | 345 | zError(ret)); |
347 | return 0; | 346 | return 0; |
@@ -386,7 +385,7 @@ bio_zlib_write(BIO *b, const char *in, int inl) | |||
386 | ctx->obuf = malloc(ctx->obufsize); | 385 | ctx->obuf = malloc(ctx->obufsize); |
387 | /* Need error here */ | 386 | /* Need error here */ |
388 | if (!ctx->obuf) { | 387 | if (!ctx->obuf) { |
389 | COMPerr(COMP_F_BIO_ZLIB_WRITE, ERR_R_MALLOC_FAILURE); | 388 | COMPerror(ERR_R_MALLOC_FAILURE); |
390 | return 0; | 389 | return 0; |
391 | } | 390 | } |
392 | ctx->optr = ctx->obuf; | 391 | ctx->optr = ctx->obuf; |
@@ -427,8 +426,7 @@ bio_zlib_write(BIO *b, const char *in, int inl) | |||
427 | /* Compress some more */ | 426 | /* Compress some more */ |
428 | ret = deflate(zout, 0); | 427 | ret = deflate(zout, 0); |
429 | if (ret != Z_OK) { | 428 | if (ret != Z_OK) { |
430 | COMPerr(COMP_F_BIO_ZLIB_WRITE, | 429 | COMPerror(COMP_R_ZLIB_DEFLATE_ERROR); |
431 | COMP_R_ZLIB_DEFLATE_ERROR); | ||
432 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); | 430 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); |
433 | return 0; | 431 | return 0; |
434 | } | 432 | } |
@@ -477,8 +475,7 @@ bio_zlib_flush(BIO *b) | |||
477 | if (ret == Z_STREAM_END) | 475 | if (ret == Z_STREAM_END) |
478 | ctx->odone = 1; | 476 | ctx->odone = 1; |
479 | else if (ret != Z_OK) { | 477 | else if (ret != Z_OK) { |
480 | COMPerr(COMP_F_BIO_ZLIB_FLUSH, | 478 | COMPerror(COMP_R_ZLIB_DEFLATE_ERROR); |
481 | COMP_R_ZLIB_DEFLATE_ERROR); | ||
482 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); | 479 | ERR_asprintf_error_data("zlib error:%s", zError(ret)); |
483 | return 0; | 480 | return 0; |
484 | } | 481 | } |
diff --git a/src/lib/libcrypto/comp/comp_err.c b/src/lib/libcrypto/comp/comp_err.c index 3f796d4069..be8a8fc708 100644 --- a/src/lib/libcrypto/comp/comp_err.c +++ b/src/lib/libcrypto/comp/comp_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: comp_err.c,v 1.9 2014/11/03 16:58:28 tedu Exp $ */ | 1 | /* $OpenBSD: comp_err.c,v 1.10 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -67,10 +67,7 @@ | |||
67 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_COMP,0,reason) | 67 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_COMP,0,reason) |
68 | 68 | ||
69 | static ERR_STRING_DATA COMP_str_functs[] = { | 69 | static ERR_STRING_DATA COMP_str_functs[] = { |
70 | {ERR_FUNC(COMP_F_BIO_ZLIB_FLUSH), "BIO_ZLIB_FLUSH"}, | 70 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
71 | {ERR_FUNC(COMP_F_BIO_ZLIB_NEW), "BIO_ZLIB_NEW"}, | ||
72 | {ERR_FUNC(COMP_F_BIO_ZLIB_READ), "BIO_ZLIB_READ"}, | ||
73 | {ERR_FUNC(COMP_F_BIO_ZLIB_WRITE), "BIO_ZLIB_WRITE"}, | ||
74 | {0, NULL} | 71 | {0, NULL} |
75 | }; | 72 | }; |
76 | 73 | ||