projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[EC] Constify internal EC_KEY pointer usage
[openssl.git]
/
crypto
/
ec
/
ec_ameth.c
diff --git
a/crypto/ec/ec_ameth.c
b/crypto/ec/ec_ameth.c
index 6105e6b0874654424f44f2b27a61df67bd56c786..602ff7c557e2f9361b94246fdf7f366d9ca6fa3b 100644
(file)
--- a/
crypto/ec/ec_ameth.c
+++ b/
crypto/ec/ec_ameth.c
@@
-7,6
+7,12
@@
* https://www.openssl.org/source/license.html
*/
* https://www.openssl.org/source/license.html
*/
+/*
+ * ECDH and ECDSA low level APIs are deprecated for public use, but still ok
+ * for internal use.
+ */
+#include "internal/deprecated.h"
+
#include <stdio.h>
#include "internal/cryptlib.h"
#include <openssl/x509.h>
#include <stdio.h>
#include "internal/cryptlib.h"
#include <openssl/x509.h>
@@
-23,7
+29,7
@@
static int ecdh_cms_decrypt(CMS_RecipientInfo *ri);
static int ecdh_cms_encrypt(CMS_RecipientInfo *ri);
#endif
static int ecdh_cms_encrypt(CMS_RecipientInfo *ri);
#endif
-static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
+static int eckey_param2type(int *pptype, void **ppval,
const
EC_KEY *ec_key)
{
const EC_GROUP *group;
int nid;
{
const EC_GROUP *group;
int nid;
@@
-57,7
+63,7
@@
static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
{
static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
{
- EC_KEY *ec_key = pkey->pkey.ec;
+
const
EC_KEY *ec_key = pkey->pkey.ec;
void *pval = NULL;
int ptype;
unsigned char *penc = NULL, *p;
void *pval = NULL;
int ptype;
unsigned char *penc = NULL, *p;
@@
-507,9
+513,9
@@
static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
if (EVP_PKEY_id(pkey) == EVP_PKEY_SM2) {
/* For SM2, the only valid digest-alg is SM3 */
*(int *)arg2 = NID_sm3;
if (EVP_PKEY_id(pkey) == EVP_PKEY_SM2) {
/* For SM2, the only valid digest-alg is SM3 */
*(int *)arg2 = NID_sm3;
- } else {
- *(int *)arg2 = NID_sha256;
+ return 2; /* Make it mandatory */
}
}
+ *(int *)arg2 = NID_sha256;
return 1;
case ASN1_PKEY_CTRL_SET1_TLS_ENCPT:
return 1;
case ASN1_PKEY_CTRL_SET1_TLS_ENCPT: