Skip to content

Commit d838adb

Browse files
committed
pk: fix some rebase issue related to ECP_LIGHT
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
1 parent 337a348 commit d838adb

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

include/mbedtls/pk.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "mbedtls/rsa.h"
3333
#endif
3434

35-
#if defined(MBEDTLS_ECP_C)
35+
#if defined(MBEDTLS_ECP_LIGHT)
3636
#include "mbedtls/ecp.h"
3737
#endif
3838

@@ -240,12 +240,12 @@ typedef struct mbedtls_pk_info_t mbedtls_pk_info_t;
240240
typedef struct mbedtls_pk_context {
241241
const mbedtls_pk_info_t *MBEDTLS_PRIVATE(pk_info); /**< Public key information */
242242
void *MBEDTLS_PRIVATE(pk_ctx); /**< Underlying public key context */
243-
#if defined(MBEDTLS_ECP_C) && defined(MBEDTLS_USE_PSA_CRYPTO)
243+
#if defined(MBEDTLS_ECP_LIGHT) && defined(MBEDTLS_USE_PSA_CRYPTO)
244244
uint8_t MBEDTLS_PRIVATE(pk_raw)[MBEDTLS_PK_MAX_EC_PUBKEY_RAW_LEN]; /**< Raw public key */
245245
size_t MBEDTLS_PRIVATE(pk_raw_len); /**< Valid bytes in "pk_raw" */
246246
psa_ecc_family_t MBEDTLS_PRIVATE(pk_ec_family); /**< EC family of pk */
247247
size_t MBEDTLS_PRIVATE(pk_bits); /**< Curve's bits of pk */
248-
#endif /* MBEDTLS_ECP_C && MBEDTLS_USE_PSA_CRYPTO */
248+
#endif /* MBEDTLS_ECP_LIGHT && MBEDTLS_USE_PSA_CRYPTO */
249249
} mbedtls_pk_context;
250250

251251
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)

library/pk.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ void mbedtls_pk_init(mbedtls_pk_context *ctx)
6161
{
6262
ctx->pk_info = NULL;
6363
ctx->pk_ctx = NULL;
64-
#if defined(MBEDTLS_ECP_C) && defined(MBEDTLS_USE_PSA_CRYPTO)
64+
#if defined(MBEDTLS_ECP_LIGHT) && defined(MBEDTLS_USE_PSA_CRYPTO)
6565
memset(ctx->pk_raw, 0, sizeof(ctx->pk_raw));
6666
ctx->pk_raw_len = 0;
6767
ctx->pk_ec_family = 0;
6868
ctx->pk_bits = 0;
69-
#endif /* MBEDTLS_ECP_C && MBEDTLS_USE_PSA_CRYPTO */
69+
#endif /* MBEDTLS_ECP_LIGHT && MBEDTLS_USE_PSA_CRYPTO */
7070
}
7171

7272
/*
@@ -857,7 +857,7 @@ mbedtls_pk_type_t mbedtls_pk_get_type(const mbedtls_pk_context *ctx)
857857
}
858858

859859
#if defined(MBEDTLS_USE_PSA_CRYPTO)
860-
#if defined(MBEDTLS_ECP_C)
860+
#if defined(MBEDTLS_ECP_LIGHT)
861861
int mbedtls_pk_get_public_key(mbedtls_pk_context *pk, unsigned char *buf,
862862
size_t buf_size, size_t *key_len)
863863
{
@@ -951,7 +951,7 @@ int mbedtls_pk_update_keypair_from_public_key(mbedtls_pk_context *pk)
951951

952952
return ret;
953953
}
954-
#endif /* MBEDTLS_ECP_C */
954+
#endif /* MBEDTLS_ECP_LIGHT */
955955

956956
/*
957957
* Load the key to a PSA key slot,

library/pk_internal.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525

2626
#include "mbedtls/pk.h"
2727

28-
#if defined(MBEDTLS_ECP_C)
28+
#if defined(MBEDTLS_ECP_LIGHT)
2929
#include "mbedtls/ecp.h"
3030
#endif
3131

3232
#if defined(MBEDTLS_USE_PSA_CRYPTO)
3333
#include "psa/crypto.h"
3434
#endif
3535

36-
#if defined(MBEDTLS_ECP_C) && defined(MBEDTLS_USE_PSA_CRYPTO)
36+
#if defined(MBEDTLS_ECP_LIGHT) && defined(MBEDTLS_USE_PSA_CRYPTO)
3737
/**
3838
* Return the raw public key content on the provided buffer.
3939
*
@@ -93,6 +93,6 @@ int mbedtls_pk_update_public_key_from_keypair(mbedtls_pk_context *pk);
9393
* as input and output.
9494
*/
9595
int mbedtls_pk_update_keypair_from_public_key(mbedtls_pk_context *pk);
96-
#endif /* MBEDTLS_ECP_C && MBEDTLS_USE_PSA_CRYPTO */
96+
#endif /* MBEDTLS_ECP_LIGHT && MBEDTLS_USE_PSA_CRYPTO */
9797

9898
#endif /* MBEDTLS_PK_INTERNAL_H */

library/pk_wrap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/* Even if RSA not activated, for the sake of RSA-alt */
3030
#include "mbedtls/rsa.h"
3131

32-
#if defined(MBEDTLS_ECP_C)
32+
#if defined(MBEDTLS_ECP_LIGHT)
3333
#include "mbedtls/ecp.h"
3434
#endif
3535

library/pkparse.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#if defined(MBEDTLS_RSA_C)
3333
#include "mbedtls/rsa.h"
3434
#endif
35-
#if defined(MBEDTLS_ECP_C)
35+
#if defined(MBEDTLS_ECP_LIGHT)
3636
#include "mbedtls/ecp.h"
3737
#endif
3838
#if defined(MBEDTLS_ECDSA_C)
@@ -1179,7 +1179,7 @@ static int pk_parse_key_pkcs8_unencrypted_der(
11791179
mbedtls_pk_type_t pk_alg = MBEDTLS_PK_NONE;
11801180
const mbedtls_pk_info_t *pk_info;
11811181

1182-
#if !defined(MBEDTLS_ECP_C)
1182+
#if !defined(MBEDTLS_ECP_LIGHT)
11831183
(void) f_rng;
11841184
(void) p_rng;
11851185
#endif
@@ -1564,11 +1564,11 @@ int mbedtls_pk_parse_key(mbedtls_pk_context *pk,
15641564
mbedtls_pk_free(pk);
15651565
#endif /* MBEDTLS_ECP_LIGHT */
15661566

1567-
/* If MBEDTLS_RSA_C is defined but MBEDTLS_ECP_C isn't,
1567+
/* If MBEDTLS_RSA_C is defined but MBEDTLS_ECP_LIGHT isn't,
15681568
* it is ok to leave the PK context initialized but not
15691569
* freed: It is the caller's responsibility to call pk_init()
15701570
* before calling this function, and to call pk_free()
1571-
* when it fails. If MBEDTLS_ECP_C is defined but MBEDTLS_RSA_C
1571+
* when it fails. If MBEDTLS_ECP_LIGHT is defined but MBEDTLS_RSA_C
15721572
* isn't, this leads to mbedtls_pk_free() being called
15731573
* twice, once here and once by the caller, but this is
15741574
* also ok and in line with the mbedtls_pk_free() calls

library/pkwrite.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
#if defined(MBEDTLS_RSA_C)
3333
#include "mbedtls/rsa.h"
3434
#endif
35-
#if defined(MBEDTLS_ECP_C)
35+
#if defined(MBEDTLS_ECP_LIGHT)
3636
#include "mbedtls/bignum.h"
3737
#include "mbedtls/ecp.h"
3838
#include "mbedtls/platform_util.h"
3939
#endif
40-
#if defined(MBEDTLS_RSA_C) || defined(MBEDTLS_ECP_C)
40+
#if defined(MBEDTLS_RSA_C) || defined(MBEDTLS_ECP_LIGHT)
4141
#include "pkwrite.h"
4242
#endif
4343
#if defined(MBEDTLS_ECDSA_C)
@@ -472,7 +472,7 @@ int mbedtls_pk_write_key_der(const mbedtls_pk_context *key, unsigned char *buf,
472472
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&c, buf, MBEDTLS_ASN1_CONSTRUCTED |
473473
MBEDTLS_ASN1_SEQUENCE));
474474
} else
475-
#endif /* MBEDTLS_ECP_C */
475+
#endif /* MBEDTLS_ECP_LIGHT */
476476
return MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE;
477477

478478
return (int) len;

library/pkwrite.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
#endif /* MBEDTLS_RSA_C */
7575

76-
#if defined(MBEDTLS_ECP_C)
76+
#if defined(MBEDTLS_ECP_LIGHT)
7777
/*
7878
* EC public keys:
7979
* SubjectPublicKeyInfo ::= SEQUENCE { 1 + 2
@@ -98,11 +98,11 @@
9898
*/
9999
#define MBEDTLS_PK_ECP_PRV_DER_MAX_BYTES (29 + 3 * MBEDTLS_ECP_MAX_BYTES)
100100

101-
#else /* MBEDTLS_ECP_C */
101+
#else /* MBEDTLS_ECP_LIGHT */
102102

103103
#define MBEDTLS_PK_ECP_PUB_DER_MAX_BYTES 0
104104
#define MBEDTLS_PK_ECP_PRV_DER_MAX_BYTES 0
105105

106-
#endif /* MBEDTLS_ECP_C */
106+
#endif /* MBEDTLS_ECP_LIGHT */
107107

108108
#endif /* MBEDTLS_PK_WRITE_H */

0 commit comments

Comments
 (0)