Commit 5950d341 authored by Denis Filatov's avatar Denis Filatov
Browse files

fix DENM bitmap

parent 01a9c9e2
......@@ -212,7 +212,7 @@
</xsl:choose>
</xsl:when>
<xsl:when test="@value = 'CAM' or @value=$AID-CAM">01 FF FC</xsl:when>
<xsl:when test="@value = 'DENM' or @value=$AID-DENM">01 FF FF</xsl:when>
<xsl:when test="@value = 'DENM' or @value=$AID-DENM">01 FF FF FF</xsl:when>
<xsl:when test="@value = 'TLM' or @value = 'SPAT' or @value=$AID-SPAT">01 E0</xsl:when>
<xsl:when test="@value = 'RLT' or @value = 'MAP' or @value=$AID-MAP">01 C0</xsl:when>
<xsl:when test="@value = 'IVI' or @value=$AID-IVI">01 00 00 00 FF F8</xsl:when>
......
......@@ -44,10 +44,41 @@ asn_SEQUENCE_specifics_t asn_SPC_PsidSsp_specs_1 = {
1, 0, /* Root/Additions */
-1, /* First extension addition */
};
static int
PsidSsp_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key);
static asn_TYPE_operation_t asn_OP_PsidSsp = {
SEQUENCE_free,
PsidSsp_print,
SEQUENCE_compare,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
SEQUENCE_decode_oer,
SEQUENCE_encode_oer,
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0,
0,
#else
SEQUENCE_decode_uper,
SEQUENCE_encode_uper,
#endif /* ASN_DISABLE_PER_SUPPORT */
SEQUENCE_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_PsidSsp = {
"PsidSsp",
"PsidSsp",
&asn_OP_SEQUENCE,
&asn_OP_PsidSsp,
asn_DEF_PsidSsp_tags_1,
sizeof(asn_DEF_PsidSsp_tags_1)
/sizeof(asn_DEF_PsidSsp_tags_1[0]), /* 1 */
......@@ -60,3 +91,12 @@ asn_TYPE_descriptor_t asn_DEF_PsidSsp = {
&asn_SPC_PsidSsp_specs_1 /* Additional specs */
};
extern Psid_t _global_psid_value;
static int
PsidSsp_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
PsidSsp_t * s = (PsidSsp_t *)sptr;
_global_psid_value = s->psid;
return SEQUENCE_print(td, sptr, ilevel, cb, app_key);
}
......@@ -44,10 +44,42 @@ asn_SEQUENCE_specifics_t asn_SPC_PsidSspRange_specs_1 = {
1, 0, /* Root/Additions */
-1, /* First extension addition */
};
static int PsidSspRange_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key);
Psid_t _global_psid_value = 0;
static asn_TYPE_operation_t asn_OP_PsidSspRange = {
SEQUENCE_free,
PsidSspRange_print,
SEQUENCE_compare,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
SEQUENCE_decode_oer,
SEQUENCE_encode_oer,
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0,
0,
#else
SEQUENCE_decode_uper,
SEQUENCE_encode_uper,
#endif /* ASN_DISABLE_PER_SUPPORT */
SEQUENCE_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_PsidSspRange = {
"PsidSspRange",
"PsidSspRange",
&asn_OP_SEQUENCE,
&asn_OP_PsidSspRange,
asn_DEF_PsidSspRange_tags_1,
sizeof(asn_DEF_PsidSspRange_tags_1)
/sizeof(asn_DEF_PsidSspRange_tags_1[0]), /* 1 */
......@@ -60,3 +92,10 @@ asn_TYPE_descriptor_t asn_DEF_PsidSspRange = {
&asn_SPC_PsidSspRange_specs_1 /* Additional specs */
};
static int
PsidSspRange_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
PsidSspRange_t * s = (PsidSspRange_t *)sptr;
_global_psid_value = s->psid;
return SEQUENCE_print(td, sptr, ilevel, cb, app_key);
}
......@@ -105,7 +105,7 @@ int Time64_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
else
ret = asn_INTEGER2imax(st, &value);
if (ret == 0) {
const char * s = stritsdate32(value);
const char * s = stritsdate64(value);
if (cb(" -- ", 4, app_key) < 0) return -1;
if (cb(s, strlen(s), app_key) < 0) return -1;
}
......
......@@ -59,10 +59,12 @@ void * ecc_key_public_set(ecc_curve_id pk_alg, ecc_point_type ptype, const char
#define sha256_hash_size 32
#define sha384_hash_size 48
int sha256_calculate(char* hash, const char * ptr, size_t len);
int sha384_calculate(char* hash, const char * ptr, size_t len);
int ecc_sign(void * key, const char * hash, int hlength, char *r, char *s);
int ecc_verify(void * key, const char * hash, int hlength, const char *r, const char *s);
#ifdef __cplusplus
}
......
......@@ -445,6 +445,27 @@ int ecc_sign(void * key, const char * hash, int hlength, char *r, char *s)
return -1;
}
int ecc_verify(void * key, const char * hash, int hlength, const char *r, const char *s)
{
int rc = -1;
EC_KEY * eckey;
ECDSA_SIG * ecdsa;
eckey = EC_KEY_dup((EC_KEY*)key);
if (eckey){
BIGNUM* sr;
BIGNUM* ss;
int fsize = (EC_GROUP_get_degree(EC_KEY_get0_group(eckey)) + 7) / 8;
ecdsa = ECDSA_SIG_new();
sr = BN_new(); ss = BN_new();
BN_bin2bn(r, fsize, sr);
BN_bin2bn(s, fsize, ss);
ECDSA_SIG_set0(ecdsa, sr, ss);
rc = ECDSA_do_verify(hash, hlength, ecdsa, eckey);
ECDSA_SIG_free(ecdsa);
BN_free(sr); BN_free(ss);
}
return rc;
}
static const char* _hexDigits = "0123456789ABCDEF";
char * _bin2hex(char * hex, size_t hlen, const char * bin, size_t blen)
......
......@@ -246,6 +246,12 @@ const char * stritsdate32(time_t t)
return strtaidate(t + ITS_UTC_EPOCH);
}
const char * stritsdate64(unsigned long long t)
{
/* this is microseconds */
return stritsdate32(t / 1000000);
}
time_t mkgmtime(struct tm *tim_p)
{
time_t tim = 0;
......
......@@ -40,6 +40,7 @@ extern "C" {
extern unsigned long long unix2itstime64(time_t t);
extern const char * stritsdate32(time_t t);
extern const char * stritsdate64(unsigned long long t);
extern const char * strtaidate(time_t t);
extern const char * strgmtdate(time_t t);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment