LCOV - code coverage report
Current view: top level - bin/default/third_party/heimdal/lib/gssapi - asn1_gssapi_asn1.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 0 89 0.0 %
Date: 2024-04-21 15:09:00 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /* Generated from /builds/eaglegai/samba/third_party/heimdal/lib/gssapi/mech/gssapi.asn1 */
       2             : /* Do not edit */
       3             : 
       4             : #if defined(_WIN32) && !defined(ASN1_LIB)
       5             : # error "ASN1_LIB must be defined"
       6             : #endif
       7             : #include <stdio.h>
       8             : #include <stdlib.h>
       9             : #include <time.h>
      10             : #include <string.h>
      11             : #include <errno.h>
      12             : #include <limits.h>
      13             : #include <krb5-types.h>
      14             : #include "gssapi_asn1.h"
      15             : #include "gssapi_asn1-priv.h"
      16             : #include <asn1_err.h>
      17             : #include <der.h>
      18             : #include <asn1-template.h>
      19             : 
      20             : #include <parse_units.h>
      21             : 
      22             : int ASN1CALL
      23           0 : encode_GSSAPIContextToken(unsigned char *p HEIMDAL_UNUSED_ATTRIBUTE, size_t len HEIMDAL_UNUSED_ATTRIBUTE, const GSSAPIContextToken *data, size_t *size)
      24             : {
      25           0 : size_t ret HEIMDAL_UNUSED_ATTRIBUTE = 0;
      26           0 : size_t l HEIMDAL_UNUSED_ATTRIBUTE;
      27           0 : int i HEIMDAL_UNUSED_ATTRIBUTE, e HEIMDAL_UNUSED_ATTRIBUTE;
      28             : 
      29             : /* innerContextToken */
      30             : {
      31           0 : size_t Top_tag_oldret HEIMDAL_UNUSED_ATTRIBUTE = ret;
      32           0 : ret = 0;
      33           0 : e = encode_HEIM_ANY_SET(p, len, &(data)->innerContextToken, &l);
      34           0 : if (e) return e;
      35           0 : p -= l; len -= l; ret += l;
      36             : 
      37           0 : ret += Top_tag_oldret;
      38             : }
      39             : /* thisMech */
      40             : {
      41           0 : size_t Top_tag_oldret HEIMDAL_UNUSED_ATTRIBUTE = ret;
      42           0 : ret = 0;
      43           0 : e = der_put_oid(p, len, &(data)->thisMech, &l);
      44           0 : if (e) return e;
      45           0 : p -= l; len -= l; ret += l;
      46             : 
      47           0 : e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, PRIM, UT_OID, &l);
      48           0 : if (e) return e;
      49           0 : p -= l; len -= l; ret += l;
      50             : 
      51           0 : ret += Top_tag_oldret;
      52             : }
      53           0 : e = der_put_length_and_tag (p, len, ret, ASN1_C_APPL, CONS, 0, &l);
      54           0 : if (e) return e;
      55           0 : p -= l; len -= l; ret += l;
      56             : 
      57           0 : *size = ret;
      58           0 : return 0;
      59             : }
      60             : 
      61             : int ASN1CALL
      62           0 : decode_GSSAPIContextToken(const unsigned char *p HEIMDAL_UNUSED_ATTRIBUTE, size_t len HEIMDAL_UNUSED_ATTRIBUTE, GSSAPIContextToken *data, size_t *size)
      63             : {
      64           0 : size_t ret = 0;
      65           0 : size_t l HEIMDAL_UNUSED_ATTRIBUTE;
      66           0 : int e HEIMDAL_UNUSED_ATTRIBUTE;
      67             : 
      68           0 : memset(data, 0, sizeof(*data));
      69             : {
      70           0 : size_t Top_datalen;
      71           0 : Der_type Top_type;
      72           0 : size_t Top_oldlen;
      73           0 : e = der_match_tag_and_length(p, len, ASN1_C_APPL, &Top_type, 0, &Top_datalen, &l);
      74           0 : if (e == 0 && Top_type != CONS) { e = ASN1_BAD_ID; }
      75           0 : if (e) goto fail;
      76           0 : p += l; len -= l; ret += l;
      77           0 : Top_oldlen = len;
      78           0 : if (Top_datalen > len) { e = ASN1_OVERRUN; goto fail; }
      79           0 : len = Top_datalen;
      80             : {
      81           0 : size_t thisMech_datalen;
      82           0 : Der_type thisMech_type;
      83           0 : size_t thisMech_oldlen;
      84           0 : e = der_match_tag_and_length(p, len, ASN1_C_UNIV, &thisMech_type, UT_OID, &thisMech_datalen, &l);
      85           0 : if (e == 0 && thisMech_type != PRIM) { e = ASN1_BAD_ID; }
      86           0 : if (e) goto fail;
      87           0 : p += l; len -= l; ret += l;
      88           0 : thisMech_oldlen = len;
      89           0 : if (thisMech_datalen > len) { e = ASN1_OVERRUN; goto fail; }
      90           0 : len = thisMech_datalen;
      91           0 : e = der_get_oid(p, len, &(data)->thisMech, &l);
      92           0 : if(e) goto fail;
      93           0 : p += l; len -= l; ret += l;
      94           0 : len = thisMech_oldlen - thisMech_datalen;
      95             : }
      96           0 : e = decode_HEIM_ANY_SET(p, len, &(data)->innerContextToken, &l);
      97           0 : if(e) goto fail;
      98           0 : p += l; len -= l; ret += l;
      99           0 : len = Top_oldlen - Top_datalen;
     100             : }
     101           0 : if(size) *size = ret;
     102           0 : return 0;
     103           0 : fail:
     104           0 : free_GSSAPIContextToken(data);
     105           0 : return e;
     106             : }
     107             : 
     108             : void ASN1CALL
     109           0 : free_GSSAPIContextToken(GSSAPIContextToken *data)
     110             : {
     111           0 : der_free_oid(&(data)->thisMech);
     112           0 : free_HEIM_ANY_SET(&(data)->innerContextToken);
     113           0 : }
     114             : 
     115             : size_t ASN1CALL
     116           0 : length_GSSAPIContextToken(const GSSAPIContextToken *data)
     117             : {
     118           0 : size_t ret = 0;
     119             : {
     120           0 : size_t Top_tag_oldret = ret;
     121           0 : ret = 0;
     122           0 : ret += der_length_oid(&(data)->thisMech);
     123           0 : ret += 1 + der_length_len (ret);
     124           0 : ret += Top_tag_oldret;
     125             : }
     126             : {
     127           0 : size_t Top_tag_oldret = ret;
     128           0 : ret = 0;
     129           0 : ret += length_HEIM_ANY_SET(&(data)->innerContextToken);
     130           0 : ret += Top_tag_oldret;
     131             : }
     132           0 : ret += 1 + der_length_len (ret);
     133           0 : return ret;
     134             : }
     135             : 
     136             : int ASN1CALL
     137           0 : copy_GSSAPIContextToken(const GSSAPIContextToken *from, GSSAPIContextToken *to)
     138             : {
     139           0 : memset(to, 0, sizeof(*to));
     140           0 : if(der_copy_oid(&(from)->thisMech, &(to)->thisMech)) goto fail;
     141           0 : if(copy_HEIM_ANY_SET(&(from)->innerContextToken, &(to)->innerContextToken)) goto fail;
     142           0 : return 0;
     143           0 : fail:
     144           0 : free_GSSAPIContextToken(to);
     145           0 : return ENOMEM;
     146             : }
     147             : 
     148             : char * ASN1CALL
     149           0 : print_GSSAPIContextToken(const GSSAPIContextToken *data, int flags)
     150           0 : { errno = EINVAL; return 0; }
     151             : 

Generated by: LCOV version 1.14