Skip to content

Commit fb7b879

Browse files
committed
rename enum public_key_algorithms to something more generic
1 parent 4cf2e80 commit fb7b879

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/headers/tomcrypt_private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Internal Enums
2020
*/
2121

22-
enum public_key_algorithms {
22+
enum ltc_oid_id {
2323
PKA_RSA,
2424
PKA_DSA,
2525
PKA_EC,
@@ -173,7 +173,7 @@ void copy_or_zeromem(const unsigned char* src, unsigned char* dest, unsigned lon
173173
int rand_bn_bits(void *N, int bits, prng_state *prng, int wprng);
174174
int rand_bn_upto(void *N, void *limit, prng_state *prng, int wprng);
175175

176-
int pk_get_oid(int pk, const char **st);
176+
int pk_get_oid(enum ltc_oid_id id, const char **st);
177177
int pk_oid_str_to_num(const char *OID, unsigned long *oid, unsigned long *oidlen);
178178
int pk_oid_num_to_str(const unsigned long *oid, unsigned long oidlen, char *OID, unsigned long *outlen);
179179

src/pk/asn1/oid/pk_get_oid.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@
1111
#ifdef LTC_DER
1212

1313
typedef struct {
14-
int pka;
14+
enum ltc_oid_id id;
1515
const char* oid;
16-
} pka_oid;
16+
} oid_table_entry;
1717

18-
static const pka_oid oids[] = {
19-
{ PKA_RSA, "1.2.840.113549.1.1.1" },
20-
{ PKA_DSA, "1.2.840.10040.4.1" },
21-
{ PKA_EC, "1.2.840.10045.2.1" },
22-
{ PKA_EC_PRIMEF, "1.2.840.10045.1.1" },
18+
static const oid_table_entry pka_oids[] = {
19+
{ PKA_RSA, "1.2.840.113549.1.1.1" },
20+
{ PKA_DSA, "1.2.840.10040.4.1" },
21+
{ PKA_EC, "1.2.840.10045.2.1" },
22+
{ PKA_EC_PRIMEF, "1.2.840.10045.1.1" },
2323
};
2424

2525
/*
26-
Returns the OID of the public key algorithm.
26+
Returns the OID requested.
2727
@return CRYPT_OK if valid
2828
*/
29-
int pk_get_oid(int pk, const char **st)
29+
int pk_get_oid(enum ltc_oid_id id, const char **st)
3030
{
3131
unsigned int i;
3232
LTC_ARGCHK(st != NULL);
33-
for (i = 0; i < sizeof(oids)/sizeof(oids[0]); ++i) {
34-
if (oids[i].pka == pk) {
35-
*st = oids[i].oid;
33+
for (i = 0; i < sizeof(pka_oids)/sizeof(pka_oids[0]); ++i) {
34+
if (pka_oids[i].id == id) {
35+
*st = pka_oids[i].oid;
3636
return CRYPT_OK;
3737
}
3838
}

0 commit comments

Comments
 (0)