projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure RSA PSS correctly returns the right default digest
[oweals/openssl.git]
/
crypto
/
evp
/
bio_enc.c
diff --git
a/crypto/evp/bio_enc.c
b/crypto/evp/bio_enc.c
index a4db4124dae92edda5beef645dbfb053b1e675d4..6639061eae9ae392672881ba10be3cc5cbd613e6 100644
(file)
--- a/
crypto/evp/bio_enc.c
+++ b/
crypto/evp/bio_enc.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 1995-201
6
The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-201
8
The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@
-19,7
+19,7
@@
static int enc_read(BIO *h, char *buf, int size);
static long enc_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int enc_new(BIO *h);
static int enc_free(BIO *data);
static long enc_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int enc_new(BIO *h);
static int enc_free(BIO *data);
-static long enc_callback_ctrl(BIO *h, int cmd,
bio
_info_cb *fps);
+static long enc_callback_ctrl(BIO *h, int cmd,
BIO
_info_cb *fps);
#define ENC_BLOCK_SIZE (1024*4)
#define ENC_MIN_CHUNK (256)
#define BUF_OFFSET (ENC_MIN_CHUNK + EVP_MAX_BLOCK_LENGTH)
#define ENC_BLOCK_SIZE (1024*4)
#define ENC_MIN_CHUNK (256)
#define BUF_OFFSET (ENC_MIN_CHUNK + EVP_MAX_BLOCK_LENGTH)
@@
-40,7
+40,8
@@
typedef struct enc_struct {
} BIO_ENC_CTX;
static const BIO_METHOD methods_enc = {
} BIO_ENC_CTX;
static const BIO_METHOD methods_enc = {
- BIO_TYPE_CIPHER, "cipher",
+ BIO_TYPE_CIPHER,
+ "cipher",
/* TODO: Convert to new style write function */
bwrite_conv,
enc_write,
/* TODO: Convert to new style write function */
bwrite_conv,
enc_write,
@@
-57,16
+58,17
@@
static const BIO_METHOD methods_enc = {
const BIO_METHOD *BIO_f_cipher(void)
{
const BIO_METHOD *BIO_f_cipher(void)
{
- return
(&methods_enc)
;
+ return
&methods_enc
;
}
static int enc_new(BIO *bi)
{
BIO_ENC_CTX *ctx;
}
static int enc_new(BIO *bi)
{
BIO_ENC_CTX *ctx;
- ctx = OPENSSL_zalloc(sizeof(*ctx));
- if (ctx == NULL)
+ if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
+ EVPerr(EVP_F_ENC_NEW, ERR_R_MALLOC_FAILURE);
return 0;
return 0;
+ }
ctx->cipher = EVP_CIPHER_CTX_new();
if (ctx->cipher == NULL) {
ctx->cipher = EVP_CIPHER_CTX_new();
if (ctx->cipher == NULL) {
@@
-108,7
+110,7
@@
static int enc_read(BIO *b, char *out, int outl)
BIO *next;
if (out == NULL)
BIO *next;
if (out == NULL)
- return
(0)
;
+ return
0
;
ctx = BIO_get_data(b);
next = BIO_next(b);
ctx = BIO_get_data(b);
next = BIO_next(b);
@@
-248,7
+250,7
@@
static int enc_write(BIO *b, const char *in, int inl)
i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);
if (i <= 0) {
BIO_copy_next_retry(b);
i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);
if (i <= 0) {
BIO_copy_next_retry(b);
- return
(i)
;
+ return
i
;
}
ctx->buf_off += i;
n -= i;
}
ctx->buf_off += i;
n -= i;
@@
-256,7
+258,7
@@
static int enc_write(BIO *b, const char *in, int inl)
/* at this point all pending data has been written */
if ((in == NULL) || (inl <= 0))
/* at this point all pending data has been written */
if ((in == NULL) || (inl <= 0))
- return
(0)
;
+ return
0
;
ctx->buf_off = 0;
while (inl > 0) {
ctx->buf_off = 0;
while (inl > 0) {
@@
-286,7
+288,7
@@
static int enc_write(BIO *b, const char *in, int inl)
ctx->buf_off = 0;
}
BIO_copy_next_retry(b);
ctx->buf_off = 0;
}
BIO_copy_next_retry(b);
- return
(ret)
;
+ return
ret
;
}
static long enc_ctrl(BIO *b, int cmd, long num, void *ptr)
}
static long enc_ctrl(BIO *b, int cmd, long num, void *ptr)
@@
-381,22
+383,22
@@
static long enc_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = BIO_ctrl(next, cmd, num, ptr);
break;
}
ret = BIO_ctrl(next, cmd, num, ptr);
break;
}
- return
(ret)
;
+ return
ret
;
}
}
-static long enc_callback_ctrl(BIO *b, int cmd,
bio
_info_cb *fp)
+static long enc_callback_ctrl(BIO *b, int cmd,
BIO
_info_cb *fp)
{
long ret = 1;
BIO *next = BIO_next(b);
if (next == NULL)
{
long ret = 1;
BIO *next = BIO_next(b);
if (next == NULL)
- return
(0)
;
+ return
0
;
switch (cmd) {
default:
ret = BIO_callback_ctrl(next, cmd, fp);
break;
}
switch (cmd) {
default:
ret = BIO_callback_ctrl(next, cmd, fp);
break;
}
- return
(ret)
;
+ return
ret
;
}
int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,
}
int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,