]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
ASN1 definitions
authorDmitry Belyavskiy <beldmit@gmail.com>
Tue, 4 Sep 2018 08:38:32 +0000 (11:38 +0300)
committerDmitry Belyavskiy <beldmit@gmail.com>
Tue, 4 Sep 2018 08:38:32 +0000 (11:38 +0300)
gost_asn1.c
gost_lcl.h

index 0a1c05a8afd0dd11fdf073d458e43d8c3bba66aa..502d1eb7f75786a5f238ded65fb3223bf531bbee 100644 (file)
@@ -15,47 +15,56 @@ ASN1_NDEF_SEQUENCE(GOST_KEY_TRANSPORT) = {
     ASN1_SIMPLE(GOST_KEY_TRANSPORT, key_info, GOST_KEY_INFO),
     ASN1_IMP(GOST_KEY_TRANSPORT, key_agreement_info,
              GOST_KEY_AGREEMENT_INFO, 0)
-}
-ASN1_NDEF_SEQUENCE_END(GOST_KEY_TRANSPORT)
+} ASN1_NDEF_SEQUENCE_END(GOST_KEY_TRANSPORT)
 IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_TRANSPORT)
 
 ASN1_NDEF_SEQUENCE(GOST_KEY_INFO) =
 {
     ASN1_SIMPLE(GOST_KEY_INFO, encrypted_key, ASN1_OCTET_STRING),
-        ASN1_SIMPLE(GOST_KEY_INFO, imit, ASN1_OCTET_STRING)
+    ASN1_SIMPLE(GOST_KEY_INFO, imit, ASN1_OCTET_STRING)
 } ASN1_NDEF_SEQUENCE_END(GOST_KEY_INFO)
 IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_INFO)
+
 ASN1_NDEF_SEQUENCE(GOST_KEY_AGREEMENT_INFO) =
 {
     ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, cipher, ASN1_OBJECT),
-        ASN1_IMP_OPT(GOST_KEY_AGREEMENT_INFO, ephem_key, X509_PUBKEY, 0),
-        ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, eph_iv, ASN1_OCTET_STRING)
+    ASN1_IMP_OPT(GOST_KEY_AGREEMENT_INFO, ephem_key, X509_PUBKEY, 0),
+    ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, eph_iv, ASN1_OCTET_STRING)
 } ASN1_NDEF_SEQUENCE_END(GOST_KEY_AGREEMENT_INFO)
 IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_AGREEMENT_INFO)
+
 ASN1_NDEF_SEQUENCE(GOST_KEY_PARAMS) =
 {
-ASN1_SIMPLE(GOST_KEY_PARAMS, key_params, ASN1_OBJECT),
-        ASN1_SIMPLE(GOST_KEY_PARAMS, hash_params, ASN1_OBJECT),
-        ASN1_OPT(GOST_KEY_PARAMS, cipher_params,
-                     ASN1_OBJECT),} ASN1_NDEF_SEQUENCE_END(GOST_KEY_PARAMS)
+    ASN1_SIMPLE(GOST_KEY_PARAMS, key_params, ASN1_OBJECT),
+    ASN1_SIMPLE(GOST_KEY_PARAMS, hash_params, ASN1_OBJECT),
+    ASN1_OPT(GOST_KEY_PARAMS, cipher_params, ASN1_OBJECT),
+} ASN1_NDEF_SEQUENCE_END(GOST_KEY_PARAMS)
 IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_PARAMS)
+
 ASN1_NDEF_SEQUENCE(GOST_CIPHER_PARAMS) =
 {
     ASN1_SIMPLE(GOST_CIPHER_PARAMS, iv, ASN1_OCTET_STRING),
     ASN1_SIMPLE(GOST_CIPHER_PARAMS, enc_param_set, ASN1_OBJECT),
-}
-ASN1_NDEF_SEQUENCE_END(GOST_CIPHER_PARAMS)
+} ASN1_NDEF_SEQUENCE_END(GOST_CIPHER_PARAMS)
 IMPLEMENT_ASN1_FUNCTIONS(GOST_CIPHER_PARAMS)
+
 ASN1_NDEF_SEQUENCE(GOST_CLIENT_KEY_EXCHANGE_PARAMS) =
 {                               /* FIXME incomplete */
     ASN1_SIMPLE(GOST_CLIENT_KEY_EXCHANGE_PARAMS, gkt, GOST_KEY_TRANSPORT)
-}
-ASN1_NDEF_SEQUENCE_END(GOST_CLIENT_KEY_EXCHANGE_PARAMS)
+} ASN1_NDEF_SEQUENCE_END(GOST_CLIENT_KEY_EXCHANGE_PARAMS)
 IMPLEMENT_ASN1_FUNCTIONS(GOST_CLIENT_KEY_EXCHANGE_PARAMS)
 
 ASN1_NDEF_SEQUENCE(MASKED_GOST_KEY) =
 {
     ASN1_SIMPLE(MASKED_GOST_KEY, masked_priv_key, ASN1_OCTET_STRING),
-        ASN1_SIMPLE(MASKED_GOST_KEY, public_key, ASN1_OCTET_STRING)
+    ASN1_SIMPLE(MASKED_GOST_KEY, public_key, ASN1_OCTET_STRING)
 } ASN1_NDEF_SEQUENCE_END(MASKED_GOST_KEY)
 IMPLEMENT_ASN1_FUNCTIONS(MASKED_GOST_KEY)
+
+/* draft-smyshlyaev-tls12-gost-suites */
+ASN1_NDEF_SEQUENCE(PSKeyTransport_gost) =
+{
+    ASN1_SIMPLE(PSKeyTransport_gost, psexp, ASN1_OCTET_STRING),
+               ASN1_SIMPLE(PSKeyTransport_gost, ephem_key, X509_PUBKEY)
+} ASN1_NDEF_SEQUENCE_END(PSKeyTransport_gost)
+IMPLEMENT_ASN1_FUNCTIONS(PSKeyTransport_gost)
index 52984a00336ed96a0aebe595a92780aff586fee6..08fe5ce66a39fcbd136bcf415ec2b1b3daf01218 100644 (file)
@@ -114,6 +114,24 @@ typedef struct {                /* FIXME incomplete */
     GOST_KEY_TRANSPORT *gkt;
 } GOST_CLIENT_KEY_EXCHANGE_PARAMS;
 
+/*   PSKeyTransport ::= SEQUENCE {
+       PSEXP OCTET STRING,
+       ephemeralPublicKey SubjectPublicKeyInfo
+   }
+   SubjectPublicKeyInfo ::= SEQUENCE {
+       algorithm AlgorithmIdentifier,
+       subjectPublicKey BITSTRING
+   }
+   AlgorithmIdentifier ::= SEQUENCE {
+       algorithm OBJECT IDENTIFIER,
+       parameters ANY OPTIONAL
+   }*/
+typedef struct PSKeyTransport_st {
+    ASN1_OCTET_STRING *psexp;
+    X509_PUBKEY       *ephem_key;
+} PSKeyTransport_gost;
+
+DECLARE_ASN1_FUNCTIONS(PSKeyTransport_gost)
 /*
  * Hacks to shorten symbols to 31 characters or less, or OpenVMS. This mimics
  * what's done in symhacks.h, but since this is a very local header file, I