Logo Search packages:      
Sourcecode: openssl version File versions  Download package

int ECDSA_size ( const EC_KEY eckey)

Returns the maximum length of the DER encoded signature

Parameters:
eckeyEC_KEY object
Returns:
numbers of bytes required for the DER encoded signature

Definition at line 201 of file ecs_lib.c.

References EC_GROUP_get_order(), EC_KEY_get0_group(), and ECDSA_size().

Referenced by ECDSA_size().

{
      int ret,i;
      ASN1_INTEGER bs;
      BIGNUM      *order=NULL;
      unsigned char buf[4];
      const EC_GROUP *group;

      if (r == NULL)
            return 0;
      group = EC_KEY_get0_group(r);
      if (group == NULL)
            return 0;

      if ((order = BN_new()) == NULL) return 0;
      if (!EC_GROUP_get_order(group,order,NULL))
      {
            BN_clear_free(order);
            return 0;
      } 
      i=BN_num_bits(order);
      bs.length=(i+7)/8;
      bs.data=buf;
      bs.type=V_ASN1_INTEGER;
      /* If the top bit is set the asn1 encoding is 1 larger. */
      buf[0]=0xff;      

      i=i2d_ASN1_INTEGER(&bs,NULL);
      i+=i; /* r and s */
      ret=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
      BN_clear_free(order);
      return(ret);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index