⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 der_decode_short_integer.c

📁 该压缩包中包括 tom的加密函数库及pdf说明 ,以及Rinick s ECC:椭圆曲线非对称加密密钥生成器
💻 C
字号:
/* LibTomCrypt, modular cryptographic library -- Tom St Denis * * LibTomCrypt is a library that provides various cryptographic * algorithms in a highly modular and flexible manner. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org */#include "tomcrypt.h"/**  @file der_decode_short_integer.c  ASN.1 DER, decode an integer, Tom St Denis*/#ifdef LTC_DER/**  Read a mp_int integer  @param in       The DER encoded data  @param inlen    Size of data  @param num      [out] The integer to decode  @return CRYPT_OK if successful*/int der_decode_short_integer(const unsigned char *in, unsigned long inlen, unsigned long *num){   unsigned long len, x, y;   LTC_ARGCHK(num    != NULL);   LTC_ARGCHK(in     != NULL);   /* check length */   if (inlen < 2) {      return CRYPT_INVALID_PACKET;   }   /* check header */   x = 0;   if ((in[x++] & 0x1F) != 0x02) {      return CRYPT_INVALID_PACKET;   }   /* get the packet len */   len = in[x++];   if (x + len > inlen) {      return CRYPT_INVALID_PACKET;   }   /* read number */   y = 0;   while (len--) {      y = (y<<8) | (unsigned long)in[x++];   }   *num = y;   return CRYPT_OK;}#endif/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c,v $ *//* $Revision: 1.4 $ *//* $Date: 2005/05/23 01:04:13 $ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -