Browse Source

Merge pull request #355 from MilkywayPwns/develop

renamed class -> klass
Steffen Jaeckel 7 years ago
parent
commit
2c07ff6fbe

+ 1 - 1
doc/crypt.tex

@@ -5568,7 +5568,7 @@ typedef struct {
    unsigned long          size;
    unsigned long          size;
    int                    used;
    int                    used;
    int                    optional;
    int                    optional;
-   ltc_asn1_class         class;
+   ltc_asn1_class         klass;
    ltc_asn1_pc            pc;
    ltc_asn1_pc            pc;
    ulong64                tag;
    ulong64                tag;
    struct ltc_asn1_list_ *prev,  *next,
    struct ltc_asn1_list_ *prev,  *next,

+ 3 - 3
src/headers/tomcrypt_pk.h

@@ -545,7 +545,7 @@ typedef struct ltc_asn1_list_ {
    /** Flag used to indicate optional items in ASN.1 sequences */
    /** Flag used to indicate optional items in ASN.1 sequences */
    int           optional;
    int           optional;
    /** ASN.1 identifier */
    /** ASN.1 identifier */
-   ltc_asn1_class class;
+   ltc_asn1_class klass;
    ltc_asn1_pc    pc;
    ltc_asn1_pc    pc;
    ulong64        tag;
    ulong64        tag;
    /** prev/next entry in the list */
    /** prev/next entry in the list */
@@ -561,7 +561,7 @@ typedef struct ltc_asn1_list_ {
       LTC_MACRO_list[LTC_MACRO_temp].size = (Size);  \
       LTC_MACRO_list[LTC_MACRO_temp].size = (Size);  \
       LTC_MACRO_list[LTC_MACRO_temp].used = 0;       \
       LTC_MACRO_list[LTC_MACRO_temp].used = 0;       \
       LTC_MACRO_list[LTC_MACRO_temp].optional = 0;   \
       LTC_MACRO_list[LTC_MACRO_temp].optional = 0;   \
-      LTC_MACRO_list[LTC_MACRO_temp].class = 0;      \
+      LTC_MACRO_list[LTC_MACRO_temp].klass = 0;      \
       LTC_MACRO_list[LTC_MACRO_temp].pc = 0;         \
       LTC_MACRO_list[LTC_MACRO_temp].pc = 0;         \
       LTC_MACRO_list[LTC_MACRO_temp].tag = 0;        \
       LTC_MACRO_list[LTC_MACRO_temp].tag = 0;        \
    } while (0)
    } while (0)
@@ -571,7 +571,7 @@ typedef struct ltc_asn1_list_ {
       int LTC_MACRO_temp            = (index);                    \
       int LTC_MACRO_temp            = (index);                    \
       ltc_asn1_list *LTC_MACRO_list = (list);                     \
       ltc_asn1_list *LTC_MACRO_list = (list);                     \
       LTC_MACRO_list[LTC_MACRO_temp].type = LTC_ASN1_CUSTOM_TYPE; \
       LTC_MACRO_list[LTC_MACRO_temp].type = LTC_ASN1_CUSTOM_TYPE; \
-      LTC_MACRO_list[LTC_MACRO_temp].class = (Class);             \
+      LTC_MACRO_list[LTC_MACRO_temp].klass = (Class);             \
       LTC_MACRO_list[LTC_MACRO_temp].pc = (Pc);                   \
       LTC_MACRO_list[LTC_MACRO_temp].pc = (Pc);                   \
       LTC_MACRO_list[LTC_MACRO_temp].tag = (Tag);                 \
       LTC_MACRO_list[LTC_MACRO_temp].tag = (Tag);                 \
    } while (0)
    } while (0)

+ 1 - 1
src/pk/asn1/der/custom_type/der_decode_custom_type.c

@@ -93,7 +93,7 @@ int der_decode_custom_type_ex(const unsigned char *in,   unsigned long  inlen,
          goto LBL_ERR;
          goto LBL_ERR;
       }
       }
       if ((ident.type != root->type) ||
       if ((ident.type != root->type) ||
-            (ident.class != root->class) ||
+            (ident.klass != root->klass) ||
             (ident.pc != root->pc) ||
             (ident.pc != root->pc) ||
             (ident.tag != root->tag)) {
             (ident.tag != root->tag)) {
          err = CRYPT_INVALID_PACKET;
          err = CRYPT_INVALID_PACKET;

+ 4 - 4
src/pk/asn1/der/general/der_decode_asn1_identifier.c

@@ -77,7 +77,7 @@ int der_decode_asn1_identifier(const unsigned char *in, unsigned long *inlen, lt
    }
    }
 
 
    tag_len = 1;
    tag_len = 1;
-   id->class = (in[0] >> 6) & 0x3;
+   id->klass = (in[0] >> 6) & 0x3;
    id->pc = (in[0] >> 5) & 0x1;
    id->pc = (in[0] >> 5) & 0x1;
    id->tag = in[0] & 0x1f;
    id->tag = in[0] & 0x1f;
 
 
@@ -105,17 +105,17 @@ int der_decode_asn1_identifier(const unsigned char *in, unsigned long *inlen, lt
 
 
    if (err != CRYPT_OK) {
    if (err != CRYPT_OK) {
       id->pc = 0;
       id->pc = 0;
-      id->class = 0;
+      id->klass = 0;
       id->tag = 0;
       id->tag = 0;
    } else {
    } else {
       *inlen = tag_len;
       *inlen = tag_len;
-      if ((id->class == LTC_ASN1_CL_UNIVERSAL) &&
+      if ((id->klass == LTC_ASN1_CL_UNIVERSAL) &&
             (id->tag < der_asn1_tag_to_type_map_sz) &&
             (id->tag < der_asn1_tag_to_type_map_sz) &&
             (id->tag < tag_constructed_map_sz) &&
             (id->tag < tag_constructed_map_sz) &&
             (id->pc == tag_constructed_map[id->tag])) {
             (id->pc == tag_constructed_map[id->tag])) {
          id->type = der_asn1_tag_to_type_map[id->tag];
          id->type = der_asn1_tag_to_type_map[id->tag];
       } else {
       } else {
-         if ((id->class == LTC_ASN1_CL_UNIVERSAL) && (id->tag == 0)) {
+         if ((id->klass == LTC_ASN1_CL_UNIVERSAL) && (id->tag == 0)) {
             id->type = LTC_ASN1_EOL;
             id->type = LTC_ASN1_EOL;
          } else {
          } else {
             id->type = LTC_ASN1_CUSTOM_TYPE;
             id->type = LTC_ASN1_CUSTOM_TYPE;

+ 2 - 2
src/pk/asn1/der/general/der_encode_asn1_identifier.c

@@ -42,7 +42,7 @@ int der_encode_asn1_identifier(const ltc_asn1_list *id, unsigned char *out, unsi
       *outlen = 1;
       *outlen = 1;
       return CRYPT_OK;
       return CRYPT_OK;
    } else {
    } else {
-      if (id->class < LTC_ASN1_CL_UNIVERSAL || id->class > LTC_ASN1_CL_PRIVATE) {
+      if (id->klass < LTC_ASN1_CL_UNIVERSAL || id->klass > LTC_ASN1_CL_PRIVATE) {
          return CRYPT_INVALID_ARG;
          return CRYPT_INVALID_ARG;
       }
       }
       if (id->pc < LTC_ASN1_PC_PRIMITIVE || id->pc > LTC_ASN1_PC_CONSTRUCTED) {
       if (id->pc < LTC_ASN1_PC_PRIMITIVE || id->pc > LTC_ASN1_PC_CONSTRUCTED) {
@@ -58,7 +58,7 @@ int der_encode_asn1_identifier(const ltc_asn1_list *id, unsigned char *out, unsi
          return CRYPT_BUFFER_OVERFLOW;
          return CRYPT_BUFFER_OVERFLOW;
       }
       }
 
 
-      out[0] = id->class << 6 | id->pc << 5;
+      out[0] = id->klass << 6 | id->pc << 5;
    }
    }
 
 
    if (id->tag < 0x1f) {
    if (id->tag < 0x1f) {