projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error handling at openssl_strerror_r
[oweals/openssl.git]
/
crypto
/
rsa
/
rsa_ameth.c
diff --git
a/crypto/rsa/rsa_ameth.c
b/crypto/rsa/rsa_ameth.c
index a6595aec05420e03ee59c7d40fb25efb811e2112..ab5f61518bb1564de3d7c2814dc79432dff159db 100644
(file)
--- a/
crypto/rsa/rsa_ameth.c
+++ b/
crypto/rsa/rsa_ameth.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 2006-201
8
The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-201
9
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
@@
-34,7
+34,7
@@
static int rsa_param_encode(const EVP_PKEY *pkey,
*pstr = NULL;
/* If RSA it's just NULL type */
*pstr = NULL;
/* If RSA it's just NULL type */
- if (pkey->ameth->pkey_id
== EVP_PKEY_RSA
) {
+ if (pkey->ameth->pkey_id
!= EVP_PKEY_RSA_PSS
) {
*pstrtype = V_ASN1_NULL;
return 1;
}
*pstrtype = V_ASN1_NULL;
return 1;
}
@@
-58,7
+58,7
@@
static int rsa_param_decode(RSA *rsa, const X509_ALGOR *alg)
int algptype;
X509_ALGOR_get0(&algoid, &algptype, &algp, alg);
int algptype;
X509_ALGOR_get0(&algoid, &algptype, &algp, alg);
- if (OBJ_obj2nid(algoid)
== EVP_PKEY_RSA
)
+ if (OBJ_obj2nid(algoid)
!= EVP_PKEY_RSA_PSS
)
return 1;
if (algptype == V_ASN1_UNDEF)
return 1;
return 1;
if (algptype == V_ASN1_UNDEF)
return 1;
@@
-109,7
+109,10
@@
static int rsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
RSA_free(rsa);
return 0;
}
RSA_free(rsa);
return 0;
}
- EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa);
+ if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa)) {
+ RSA_free(rsa);
+ return 0;
+ }
return 1;
}
return 1;
}
@@
-580,10
+583,12
@@
static RSA_PSS_PARAMS *rsa_ctx_to_pss(EVP_PKEY_CTX *pkctx)
return NULL;
if (saltlen == -1) {
saltlen = EVP_MD_size(sigmd);
return NULL;
if (saltlen == -1) {
saltlen = EVP_MD_size(sigmd);
- } else if (saltlen == -2) {
+ } else if (saltlen == -2
|| saltlen == -3
) {
saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2;
if ((EVP_PKEY_bits(pk) & 0x7) == 1)
saltlen--;
saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2;
if ((EVP_PKEY_bits(pk) & 0x7) == 1)
saltlen--;
+ if (saltlen < 0)
+ return NULL;
}
return rsa_pss_params_create(sigmd, mgf1md, saltlen);
}
return rsa_pss_params_create(sigmd, mgf1md, saltlen);