Skip to content

Commit a24af5f

Browse files
committed
correctly prefix enum ltc_oid_id members
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent 0bfa7d0 commit a24af5f

26 files changed

Lines changed: 43 additions & 43 deletions

src/headers/tomcrypt_private.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
*/
1515

1616
enum ltc_oid_id {
17-
PKA_RSA,
18-
PKA_DSA,
19-
PKA_EC,
20-
PKA_EC_PRIMEF,
21-
PKA_X25519,
22-
PKA_ED25519,
17+
LTC_OID_RSA,
18+
LTC_OID_DSA,
19+
LTC_OID_EC,
20+
LTC_OID_EC_PRIMEF,
21+
LTC_OID_X25519,
22+
LTC_OID_ED25519,
2323
};
2424

2525
/*

src/pk/asn1/oid/pk_get_oid.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ typedef struct {
1010
} oid_table_entry;
1111

1212
static const oid_table_entry pka_oids[] = {
13-
{ PKA_RSA, "1.2.840.113549.1.1.1" },
14-
{ PKA_DSA, "1.2.840.10040.4.1" },
15-
{ PKA_EC, "1.2.840.10045.2.1" },
16-
{ PKA_EC_PRIMEF, "1.2.840.10045.1.1" },
17-
{ PKA_X25519, "1.3.101.110" },
18-
{ PKA_ED25519, "1.3.101.112" },
13+
{ LTC_OID_RSA, "1.2.840.113549.1.1.1" },
14+
{ LTC_OID_DSA, "1.2.840.10040.4.1" },
15+
{ LTC_OID_EC, "1.2.840.10045.2.1" },
16+
{ LTC_OID_EC_PRIMEF, "1.2.840.10045.1.1" },
17+
{ LTC_OID_X25519, "1.3.101.110" },
18+
{ LTC_OID_ED25519, "1.3.101.112" },
1919
};
2020

2121
/*

src/pk/asn1/x509/x509_decode_public_key_from_certificate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned lo
8181
if ((l->type == LTC_ASN1_SEQUENCE)
8282
&& (l->data != NULL)
8383
&& LOOKS_LIKE_SPKI(l->child)) {
84-
if (algorithm == PKA_EC) {
84+
if (algorithm == LTC_OID_EC) {
8585
err = callback(l->data, l->size, ctx);
8686
} else {
8787
err = x509_decode_subject_public_key_info(l->data, l->size,

src/pk/dsa/dsa_export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int dsa_export(unsigned char *out, unsigned long *outlen, int type, const dsa_ke
7575
LTC_SET_ASN1(int_list, 1, LTC_ASN1_INTEGER, key->q, 1UL);
7676
LTC_SET_ASN1(int_list, 2, LTC_ASN1_INTEGER, key->g, 1UL);
7777

78-
err = x509_encode_subject_public_key_info(out, outlen, PKA_DSA, tmp,
78+
err = x509_encode_subject_public_key_info(out, outlen, LTC_OID_DSA, tmp,
7979
tmplen, LTC_ASN1_SEQUENCE, int_list,
8080
sizeof(int_list) / sizeof(int_list[0]));
8181

src/pk/dsa/dsa_import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key)
9797
}
9898

9999
len = 3;
100-
err = x509_decode_subject_public_key_info(in, inlen, PKA_DSA,
100+
err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_DSA,
101101
tmpbuf, &tmpbuf_len,
102102
LTC_ASN1_SEQUENCE, params, &len);
103103
if (err != CRYPT_OK) {

src/pk/ecc/ecc_export_openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int ecc_export_openssl(unsigned char *out, unsigned long *outlen, int type, cons
7070
if (err != CRYPT_OK) { goto error; }
7171

7272
/* we support only prime-field EC */
73-
if ((err = pk_get_oid(PKA_EC_PRIMEF, &OID)) != CRYPT_OK) { goto error; }
73+
if ((err = pk_get_oid(LTC_OID_EC_PRIMEF, &OID)) != CRYPT_OK) { goto error; }
7474

7575
/* http://tools.ietf.org/html/rfc3279
7676
ECParameters ::= SEQUENCE { # SEQUENCE
@@ -156,7 +156,7 @@ int ecc_export_openssl(unsigned char *out, unsigned long *outlen, int type, cons
156156
subjectPublicKey BIT STRING # BIT STRING
157157
}
158158
*/
159-
err = x509_encode_subject_public_key_info( out, outlen, PKA_EC, bin_xy, len_xy,
159+
err = x509_encode_subject_public_key_info( out, outlen, LTC_OID_EC, bin_xy, len_xy,
160160
ecparams.type, ecparams.data, ecparams.size );
161161
}
162162

src/pk/ecc/ecc_import_pkcs8.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen,
5656
LTC_ARGCHK(ltc_mp.name != NULL);
5757

5858
/* get EC alg oid */
59-
err = pk_get_oid(PKA_EC, &pka_ec_oid);
59+
err = pk_get_oid(LTC_OID_EC, &pka_ec_oid);
6060
if (err != CRYPT_OK) return err;
6161

6262
/* init key */

src/pk/ecc/ecc_import_x509.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static int s_ecc_import_x509_with_oid(const unsigned char *in, unsigned long inl
1515

1616
len_xy = sizeof(bin_xy);
1717
len_oid = 16;
18-
err = x509_decode_subject_public_key_info(in, inlen, PKA_EC, bin_xy, &len_xy,
18+
err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_EC, bin_xy, &len_xy,
1919
LTC_ASN1_OBJECT_IDENTIFIER, (void *)curveoid, &len_oid);
2020
if (err == CRYPT_OK) {
2121
/* load curve parameters for given curve OID */
@@ -63,7 +63,7 @@ static int s_ecc_import_x509_with_curve(const unsigned char *in, unsigned long i
6363
/* try to load public key */
6464
len_xy = sizeof(bin_xy);
6565
len = 6;
66-
err = x509_decode_subject_public_key_info(in, inlen, PKA_EC, bin_xy, &len_xy, LTC_ASN1_SEQUENCE, seq_ecparams, &len);
66+
err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_EC, bin_xy, &len_xy, LTC_ASN1_SEQUENCE, seq_ecparams, &len);
6767

6868
if (err == CRYPT_OK) {
6969
len_a = seq_curve[0].size;
@@ -107,7 +107,7 @@ int ecc_import_subject_public_key_info(const unsigned char *in, unsigned long in
107107
int ecc_import_x509(const unsigned char *in, unsigned long inlen, ecc_key *key)
108108
{
109109
return x509_decode_public_key_from_certificate(in, inlen,
110-
PKA_EC,
110+
LTC_OID_EC,
111111
LTC_ASN1_EOL, NULL, NULL,
112112
(public_key_decode_cb)ecc_import_subject_public_key_info, key);
113113
}

src/pk/ed25519/ed25519_export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int ed25519_export( unsigned char *out, unsigned long *outlen,
2323
{
2424
LTC_ARGCHK(key != NULL);
2525

26-
if (key->algo != PKA_ED25519) return CRYPT_PK_INVALID_TYPE;
26+
if (key->algo != LTC_OID_ED25519) return CRYPT_PK_INVALID_TYPE;
2727

2828
return ec25519_export(out, outlen, which, key);
2929
}

src/pk/ed25519/ed25519_import.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ int ed25519_import(const unsigned char *in, unsigned long inlen, curve25519_key
2525
LTC_ARGCHK(key != NULL);
2626

2727
key_len = sizeof(key->pub);
28-
if ((err = x509_decode_subject_public_key_info(in, inlen, PKA_ED25519, key->pub, &key_len, LTC_ASN1_EOL, NULL, 0uL)) == CRYPT_OK) {
28+
if ((err = x509_decode_subject_public_key_info(in, inlen, LTC_OID_ED25519, key->pub, &key_len, LTC_ASN1_EOL, NULL, 0uL)) == CRYPT_OK) {
2929
key->type = PK_PUBLIC;
30-
key->algo = PKA_ED25519;
30+
key->algo = LTC_OID_ED25519;
3131
}
3232
return err;
3333
}

0 commit comments

Comments
 (0)