gost_asn1.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**********************************************************************
  2. * gost_keytrans.c *
  3. * Copyright (c) 2005-2006 Cryptocom LTD *
  4. * This file is distributed under the same license as OpenSSL *
  5. * *
  6. * ASN1 structure definition for GOST key transport *
  7. * Requires OpenSSL 0.9.9 for compilation *
  8. **********************************************************************/
  9. #include <stdio.h>
  10. #include <openssl/asn1t.h>
  11. #include <openssl/x509.h>
  12. #include "gost_lcl.h"
  13. ASN1_NDEF_SEQUENCE(GOST_KEY_TRANSPORT) = {
  14. ASN1_SIMPLE(GOST_KEY_TRANSPORT, key_info, GOST_KEY_INFO),
  15. ASN1_IMP(GOST_KEY_TRANSPORT, key_agreement_info, GOST_KEY_AGREEMENT_INFO, 0)
  16. } ASN1_NDEF_SEQUENCE_END(GOST_KEY_TRANSPORT)
  17. IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_TRANSPORT)
  18. ASN1_NDEF_SEQUENCE(GOST_KEY_INFO) = {
  19. ASN1_SIMPLE(GOST_KEY_INFO, encrypted_key, ASN1_OCTET_STRING),
  20. ASN1_SIMPLE(GOST_KEY_INFO, imit, ASN1_OCTET_STRING)
  21. } ASN1_NDEF_SEQUENCE_END(GOST_KEY_INFO)
  22. IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_INFO)
  23. ASN1_NDEF_SEQUENCE(GOST_KEY_AGREEMENT_INFO) = {
  24. ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, cipher, ASN1_OBJECT),
  25. ASN1_IMP_OPT(GOST_KEY_AGREEMENT_INFO, ephem_key, X509_PUBKEY, 0),
  26. ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, eph_iv, ASN1_OCTET_STRING)
  27. } ASN1_NDEF_SEQUENCE_END(GOST_KEY_AGREEMENT_INFO)
  28. IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_AGREEMENT_INFO)
  29. ASN1_NDEF_SEQUENCE(GOST_KEY_PARAMS) = {
  30. ASN1_SIMPLE(GOST_KEY_PARAMS, key_params, ASN1_OBJECT),
  31. ASN1_SIMPLE(GOST_KEY_PARAMS, hash_params, ASN1_OBJECT),
  32. ASN1_OPT(GOST_KEY_PARAMS, cipher_params, ASN1_OBJECT),
  33. } ASN1_NDEF_SEQUENCE_END(GOST_KEY_PARAMS)
  34. IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_PARAMS)
  35. ASN1_NDEF_SEQUENCE(GOST_CIPHER_PARAMS) = {
  36. ASN1_SIMPLE(GOST_CIPHER_PARAMS, iv, ASN1_OCTET_STRING),
  37. ASN1_SIMPLE(GOST_CIPHER_PARAMS, enc_param_set, ASN1_OBJECT),
  38. } ASN1_NDEF_SEQUENCE_END(GOST_CIPHER_PARAMS)
  39. IMPLEMENT_ASN1_FUNCTIONS(GOST_CIPHER_PARAMS)
  40. ASN1_NDEF_SEQUENCE(GOST_CLIENT_KEY_EXCHANGE_PARAMS) = { /*FIXME incomplete*/
  41. ASN1_SIMPLE(GOST_CLIENT_KEY_EXCHANGE_PARAMS, gkt, GOST_KEY_TRANSPORT)
  42. } ASN1_NDEF_SEQUENCE_END(GOST_CLIENT_KEY_EXCHANGE_PARAMS)
  43. IMPLEMENT_ASN1_FUNCTIONS(GOST_CLIENT_KEY_EXCHANGE_PARAMS)