• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ des_ecb_encrypt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中des_ecb_encrypt函数的典型用法代码示例。如果您正苦于以下问题:C++ des_ecb_encrypt函数的具体用法?C++ des_ecb_encrypt怎么用?C++ des_ecb_encrypt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了des_ecb_encrypt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ATF_TC_BODY

ATF_TC_BODY(ecb, tc)
{
	int i;
	des_cblock in, out, outin;
	des_key_schedule ks;

	for (i = 0; i < NUM_TESTS; i++) {
		des_set_key_unchecked(&key_data[i], ks);
		memcpy(in, plain_data[i], 8);
		memset(out, 0, 8);
		memset(outin, 0, 8);
		des_ecb_encrypt(&in, &out, ks, DES_ENCRYPT);
		des_ecb_encrypt(&out, &outin, ks, DES_DECRYPT);

		if (memcmp(out, cipher_data[i], 8) != 0) {
			atf_tc_fail_nonfatal("Encryption error %2d\nk=%s p=%s "
					     "o=%s act=%s\n", i + 1,
					     pt(key_data[i]), pt(in),
					     pt(cipher_data[i]), pt(out));
		}
		if (memcmp(in, outin, 8) != 0) {
			atf_tc_fail_nonfatal("Decryption error %2d\nk=%s p=%s "
					     "o=%s act=%s\n", i + 1,
					     pt(key_data[i]), pt(out), pt(in),
					     pt(outin));
		}
	}
}
开发者ID:2asoft,项目名称:freebsd,代码行数:28,代码来源:t_des.c


示例2: desDecryptCBC

int desDecryptCBC( CRYPT_INFO *cryptInfo, BYTE *buffer, int noBytes )
	{
	BYTE temp[ DES_BLOCKSIZE ];
	int blockCount = noBytes / DES_BLOCKSIZE;

	/* Make sure the data length is a multiple of the block size */
	if( noBytes % DES_BLOCKSIZE )
		return( CRYPT_BADPARM3 );

	while( blockCount-- )
		{
		int i;

		/* Save the ciphertext */
		memcpy( temp, buffer, DES_BLOCKSIZE );

		/* Decrypt a block of data */
		des_ecb_encrypt( ( C_Block * ) buffer, ( C_Block * ) buffer,
						 cryptInfo->key, DES_DECRYPT );

		/* XOR the buffer contents with the encrypted IV */
		for( i = 0; i < DES_BLOCKSIZE; i++ )
			buffer[ i ] ^= cryptInfo->currentIV[ i ];

		/* Shift the ciphertext into the IV */
		memcpy( cryptInfo->currentIV, temp, DES_BLOCKSIZE );

		/* Move on to next block of data */
		buffer += DES_BLOCKSIZE;
		}

	return( CRYPT_OK );
	}
开发者ID:bgreenlee,项目名称:PassKeeper,代码行数:33,代码来源:LIB_DES.C


示例3: ofb64_decrypt

int
ofb64_decrypt(int data)
{
	struct stinfo *stp = &fb[OFB].streams[DIR_DECRYPT-1];
	int idx;

	if (data == -1) {
		/*
		 * Back up one byte.  It is assumed that we will
		 * never back up more than one byte.  If we do, this
		 * may or may not work.
		 */
		if (stp->str_index)
			--stp->str_index;
		return(0);
	}

	idx = stp->str_index++;
	if (idx == sizeof(Block)) {
		Block b;
		des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
		memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
		stp->str_index = 1;	/* Next time will be 1 */
		idx = 0;		/* But now use 0 */
	}

	return(data ^ stp->str_feed[idx]);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:28,代码来源:enc_des.c


示例4: DesEncrypt

static void DesEncrypt(
	u_char *clear,	/* IN  8 octets */
	u_char *key,	/* IN  7 octets */
	u_char *cipher	/* OUT 8 octets */
)
{
	des_cblock		des_key;
	des_key_schedule	key_schedule;
	
	MakeKey(key, des_key);
	
	des_set_key(&des_key, key_schedule);
	
#if 0
	CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n",
	       clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
#endif
	
	des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
	
#if 0
	CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n",
	       cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
#endif
}
开发者ID:BlueSkyGjj,项目名称:nRF52,代码行数:25,代码来源:chpms.c


示例5: block_encrypt

static void block_encrypt(struct block_state *self, const uint8_t *in, uint8_t *out)
{
#ifdef PCT_DES3_MODULE
    des3_ecb_encrypt(in, out, &self->sk);
#else
    des_ecb_encrypt(in, out, &self->sk);
#endif
}
开发者ID:Legrandin,项目名称:pycryptodome,代码行数:8,代码来源:DES.c


示例6: des1_decrypt

static void
des1_decrypt(caddr_t key, u_int8_t *blk)
{
	des_cblock *cb = (des_cblock *) blk;
	des_key_schedule *p = (des_key_schedule *) key;

	des_ecb_encrypt(cb, cb, p[0], DES_DECRYPT);
}
开发者ID:JabirTech,项目名称:Source,代码行数:8,代码来源:xform.c


示例7: des1_encrypt

static void
des1_encrypt(void *key, u_int8_t *blk)
{
	des_cblock *cb = (des_cblock *) blk;
	des_key_schedule *p = (des_key_schedule *) key;

	des_ecb_encrypt(cb, cb, p[0], DES_ENCRYPT);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:8,代码来源:cryptosoft_xform.c


示例8: fb64_start

static int
fb64_start(struct fb *fbp, int dir, int server __unused)
{
	size_t x;
	unsigned char *p;
	int state;

	switch (dir) {
	case DIR_DECRYPT:
		/*
		 * This is simply a request to have the other side
		 * start output (our input).  He will negotiate an
		 * IV so we need not look for it.
		 */
		state = fbp->state[dir-1];
		if (state == FAILED)
			state = IN_PROGRESS;
		break;

	case DIR_ENCRYPT:
		state = fbp->state[dir-1];
		if (state == FAILED)
			state = IN_PROGRESS;
		else if ((state & NO_SEND_IV) == 0)
			break;

		if (!VALIDKEY(fbp->krbdes_key)) {
			fbp->need_start = 1;
			break;
		}
		state &= ~NO_SEND_IV;
		state |= NO_RECV_IV;
		if (encrypt_debug_mode)
			printf("Creating new feed\r\n");
		/*
		 * Create a random feed and send it over.
		 */
		des_random_key((Block *)fbp->temp_feed);
		des_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
				fbp->krbdes_sched, 1);
		p = fbp->fb_feed + 3;
		*p++ = ENCRYPT_IS;
		p++;
		*p++ = FB64_IV;
		for (x = 0; x < sizeof(Block); ++x) {
			if ((*p++ = fbp->temp_feed[x]) == IAC)
				*p++ = IAC;
		}
		*p++ = IAC;
		*p++ = SE;
		printsub('>', &fbp->fb_feed[2], p - &fbp->fb_feed[2]);
		net_write(fbp->fb_feed, p - fbp->fb_feed);
		break;
	default:
		return(FAILED);
	}
	return(fbp->state[dir-1] = state);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:58,代码来源:enc_des.c


示例9: desDecryptCFB

int desDecryptCFB( CRYPT_INFO *cryptInfo, BYTE *buffer, int noBytes )
	{
	BYTE temp[ DES_BLOCKSIZE ];
	int i, ivCount = cryptInfo->ivCount;

	/* If there's any encrypted material left in the IV, use it now */
	if( ivCount )
		{
		int bytesToUse;

		/* Find out how much material left in the encrypted IV we can use */
		bytesToUse = DES_BLOCKSIZE - ivCount;
		if( noBytes < bytesToUse )
			bytesToUse = noBytes;

		/* Decrypt the data */
		memcpy( temp, buffer, bytesToUse );
		for( i = 0; i < bytesToUse; i++ )
			buffer[ i ] ^= cryptInfo->currentIV[ i + ivCount ];
		memcpy( cryptInfo->currentIV + ivCount, temp, bytesToUse );

		/* Adjust the byte count and buffer position */
		noBytes -= bytesToUse;
		buffer += bytesToUse;
		ivCount += bytesToUse;
		}

	while( noBytes )
		{
		ivCount = ( noBytes > DES_BLOCKSIZE ) ? DES_BLOCKSIZE : noBytes;

		/* Encrypt the IV */
		des_ecb_encrypt( ( C_Block * ) cryptInfo->currentIV,
        				 ( C_Block * ) cryptInfo->currentIV,
						 cryptInfo->key, DES_ENCRYPT );

		/* Save the ciphertext */
		memcpy( temp, buffer, ivCount );

		/* XOR the buffer contents with the encrypted IV */
		for( i = 0; i < ivCount; i++ )
			buffer[ i ] ^= cryptInfo->currentIV[ i ];

		/* Shift the ciphertext into the IV */
		memcpy( cryptInfo->currentIV, temp, ivCount );

		/* Move on to next block of data */
		noBytes -= ivCount;
		buffer += ivCount;
		}

	/* Remember how much of the IV is still available for use */
	cryptInfo->ivCount = ( ivCount % DES_BLOCKSIZE );

	return( CRYPT_OK );
	}
开发者ID:bgreenlee,项目名称:PassKeeper,代码行数:56,代码来源:LIB_DES.C


示例10: DesEncrypt

/* Do the DesEncryption */
void
DesEncrypt(unsigned char *clear, unsigned char *key, unsigned char *cipher)
{
  des_cblock des_key;
  des_key_schedule key_schedule;

  MakeKey(key, des_key);
  des_set_key(&des_key, key_schedule);
  des_ecb_encrypt((des_cblock *) clear, (des_cblock *) cipher, key_schedule, 1);
}
开发者ID:ggd543,项目名称:hydra,代码行数:11,代码来源:hydra-smbnt.c


示例11: block_encrypt

static void block_encrypt(block_state *self, unsigned char *in, unsigned char *out)
{
    int rc;
#ifdef PCT_DES3_MODULE
    rc = des3_ecb_encrypt(in, out, &self->sk);
#else
    rc = des_ecb_encrypt(in, out, &self->sk);
#endif
    assert(rc == CRYPT_OK);
}
开发者ID:26618929,项目名称:pycrypto,代码行数:10,代码来源:DES.c


示例12: ofb64_encrypt

/*
 * DES 64 bit Output Feedback
 *
 * key --->+-----+
 *	+->| DES |--+
 *	|  +-----+  |
 *	+-----------+
 *	            v
 *  INPUT -------->(+) ----> DATA
 *
 * Given:
 *	iV: Initial vector, 64 bits (8 bytes) long.
 *	Dn: the nth chunk of 64 bits (8 bytes) of data to encrypt (decrypt).
 *	On: the nth chunk of 64 bits (8 bytes) of encrypted (decrypted) output.
 *
 *	V0 = DES(iV, key)
 *	V(n+1) = DES(Vn, key)
 *	On = Dn ^ Vn
 */
void
ofb64_encrypt(unsigned char *s, int c)
{
	struct stinfo *stp = &fb[OFB].streams[DIR_ENCRYPT-1];
	int idx;

	idx = stp->str_index;
	while (c-- > 0) {
		if (idx == sizeof(Block)) {
			Block b;
			des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
			memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
			idx = 0;
		}
		*s++ ^= stp->str_feed[idx];
		idx++;
	}
	stp->str_index = idx;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:38,代码来源:enc_des.c


示例13: desTestLoop

static int desTestLoop( DES_TEST *testData, int iterations, int operation )
	{
	BYTE temp[ DES_BLOCKSIZE ];
	BYTE key[ DES_EXPANDED_KEYSIZE ];
	int i;

	for( i = 0; i < iterations; i++ )
		{
		memcpy( temp, testData[ i ].plaintext, DES_BLOCKSIZE );
		key_sched( ( C_Block * ) testData[ i ].key,
				   *( ( Key_schedule * ) key ) );
		des_ecb_encrypt( ( C_Block * ) temp, ( C_Block * ) temp,
						 *( ( Key_schedule * ) key ), operation );
		if( memcmp( testData[ i ].ciphertext, temp, DES_BLOCKSIZE ) )
			return( CRYPT_ERROR );
		}

	return( CRYPT_OK );
	}
开发者ID:bgreenlee,项目名称:PassKeeper,代码行数:19,代码来源:LIB_DES.C


示例14: des_string_to_key

char *XTRAMangle(char *xtrace, char *cryptpw)
{
	static char res[256];
	char *rptr, *xptr;
	int count;
	unsigned char plain[8], enc[8];
	des_cblock key;
	des_key_schedule sched;

	des_string_to_key(cryptpw, &key);
	des_set_key(&key, sched);

	rptr = res;

	/* Overflow protect; 192 chars expands to 256, overflowing res */
	if (strlen(xtrace) > 191) {
		xtrace[191] = '\0';
	}

	/* Step thru 'xtrace' 8 chars at a time, encrypt as we go */
	xptr = xtrace;
	count = 0;
	bzero(plain, sizeof(plain));
	while (*xptr) {
	    plain[count++ % 8] = *xptr++;
	    if (! *xptr || (count % 8) == 0) {
		/* Encrypt block of (up to) 8 and pump out coded ASCII */
		des_ecb_encrypt((des_cblock *)plain,(des_cblock *)enc, sched, 1);
		bzero(plain, sizeof(plain));
		*rptr++ = '0' + (enc[0] & 0x3f);
		*rptr++ = '0' + (enc[0] >> 6) + ((enc[1] & 0x0f) << 2);
		*rptr++ = '0' + (enc[1] >> 4) + ((enc[2] & 0x03) << 4);
		*rptr++ = '0' + (enc[2] >> 2);
		*rptr++ = '0' + (enc[3] & 0x3f);
		*rptr++ = '0' + (enc[3] >> 6) + ((enc[4] & 0x0f) << 2);
		*rptr++ = '0' + (enc[4] >> 4) + ((enc[5] & 0x03) << 4);
		*rptr++ = '0' + (enc[5] >> 2);
		*rptr++ = '0' + (enc[6] & 0x3f);
		*rptr++ = '0' + (enc[6] >> 6) + ((enc[7] & 0x0f) << 2);
		*rptr++ = '0' + (enc[7] >> 4) + ((time(NULL) & 0x03) << 4);
	    }
	}
开发者ID:jpmens,项目名称:diablo,代码行数:42,代码来源:post.c


示例15: desDecryptECB

int desDecryptECB( CRYPT_INFO *cryptInfo, BYTE *buffer, int noBytes )
	{
	int blockCount = noBytes / DES_BLOCKSIZE;

	/* Make sure the data length is a multiple of the block size */
	if( noBytes % DES_BLOCKSIZE )
		return( CRYPT_BADPARM3 );

	while( blockCount-- )
		{
		/* Decrypt a block of data */
		des_ecb_encrypt( ( C_Block * ) buffer, ( C_Block * ) buffer,
						 cryptInfo->key, DES_DECRYPT );

		/* Move on to next block of data */
		buffer += DES_BLOCKSIZE;
		}

	return( CRYPT_OK );
	}
开发者ID:bgreenlee,项目名称:PassKeeper,代码行数:20,代码来源:LIB_DES.C


示例16: cfb64_encrypt

void
cfb64_encrypt(unsigned char *s, int c)
{
	struct stinfo *stp = &fb[CFB].streams[DIR_ENCRYPT-1];
	int idx;

	idx = stp->str_index;
	while (c-- > 0) {
		if (idx == sizeof(Block)) {
			Block b;
			des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
			memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
			idx = 0;
		}

		/* On encryption, we store (feed ^ data) which is cypher */
		*s = stp->str_output[idx] = (stp->str_feed[idx] ^ *s);
		s++;
		idx++;
	}
	stp->str_index = idx;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:22,代码来源:enc_des.c


示例17: scMultiflexCompareAuth

BOOLEAN scMultiflexCompareAuth( const BYTE *key, const BYTE *chall,
	const BYTE *auth )
{
#ifdef WITH_DES
	des_key_schedule schedule;
	des_cblock out;

	des_check_key=0;

	des_set_key( (des_cblock *) key, schedule );
	des_ecb_encrypt( (des_cblock *) chall, &out, schedule, DES_ENCRYPT );

	memset( &schedule, 0, sizeof(schedule) );

	if( memcmp( auth, out, 6 ) ) return( FALSE );

	memset( out, 0, sizeof(out) );

	return( TRUE );
#else
	return( FALSE );
#endif /* WITH_DES */
}
开发者ID:12019,项目名称:scez-ng,代码行数:23,代码来源:scmultiflex.c


示例18: des_generate_random_block

/*
 * des_generate_random_block: routine to return the next random number
 *                            from the current random number stream.
 *                            The returned number is 64 bits long.
 *
 * Requires: des_set_random_generator_seed must have been called at least once
 *           before this routine is called.
 */
static afs_int32
des_generate_random_block(des_cblock block)
{
    int i;

    /*
     * Encrypt the sequence number to get the new random block:
     */
    LOCK_RANDOM;
    des_ecb_encrypt(sequence_number, block, random_sequence_key.d, 1);

    /*
     * Increment the sequence number as an 8 byte unsigned number with wrap:
     * (using LSB here)
     */
    for (i = 0; i < 8; i++) {
	sequence_number[i] = (sequence_number[i] + 1) & 0xff;
	if (sequence_number[i])
	    break;
    }
    UNLOCK_RANDOM;
    return 0;
}
开发者ID:adeason,项目名称:openafs,代码行数:31,代码来源:new_rnd_key.c


示例19: main

int main(int argc, char *argv[])
	{
	int i,j,err=0;
	des_cblock in,out,outin,iv3,iv2;
	des_key_schedule ks,ks2,ks3;
	unsigned char cbc_in[40];
	unsigned char cbc_out[40];
	DES_LONG cs;
	unsigned char cret[8];
#ifdef _CRAY
        struct {
            int a:32;
            int b:32;
        } lqret[2];
#else
        DES_LONG lqret[4];
#endif
	int num;
	char *str;

#ifndef NO_DESCBCM
	printf("Doing cbcm\n");
	if ((j=des_set_key_checked(&cbc_key,ks)) != 0)
		{
		printf("Key error %d\n",j);
		err=1;
		}
	if ((j=des_set_key_checked(&cbc2_key,ks2)) != 0)
		{
		printf("Key error %d\n",j);
		err=1;
		}
	if ((j=des_set_key_checked(&cbc3_key,ks3)) != 0)
		{
		printf("Key error %d\n",j);
		err=1;
		}
	memset(cbc_out,0,40);
	memset(cbc_in,0,40);
	i=strlen((char *)cbc_data)+1;
	/* i=((i+7)/8)*8; */
	memcpy(iv3,cbc_iv,sizeof(cbc_iv));
	memset(iv2,'\0',sizeof iv2);

	des_ede3_cbcm_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3,&iv2,
			      DES_ENCRYPT);
	des_ede3_cbcm_encrypt(&cbc_data[16],&cbc_out[16],i-16,ks,ks2,ks3,
			      &iv3,&iv2,DES_ENCRYPT);
	/*	if (memcmp(cbc_out,cbc3_ok,
		(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
		{
		printf("des_ede3_cbc_encrypt encrypt error\n");
		err=1;
		}
	*/
	memcpy(iv3,cbc_iv,sizeof(cbc_iv));
	memset(iv2,'\0',sizeof iv2);
	des_ede3_cbcm_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,&iv2,DES_DECRYPT);
	if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
		{
		int n;

		printf("des_ede3_cbcm_encrypt decrypt error\n");
		for(n=0 ; n < i ; ++n)
		    printf(" %02x",cbc_data[n]);
		printf("\n");
		for(n=0 ; n < i ; ++n)
		    printf(" %02x",cbc_in[n]);
		printf("\n");
		err=1;
		}
#endif

	printf("Doing ecb\n");
	for (i=0; i<NUM_TESTS; i++)
		{
		des_set_key_unchecked(&key_data[i],ks);
		memcpy(in,plain_data[i],8);
		memset(out,0,8);
		memset(outin,0,8);
		des_ecb_encrypt(&in,&out,ks,DES_ENCRYPT);
		des_ecb_encrypt(&out,&outin,ks,DES_DECRYPT);

		if (memcmp(out,cipher_data[i],8) != 0)
			{
			printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n",
				i+1,pt(key_data[i]),pt(in),pt(cipher_data[i]),
				pt(out));
			err=1;
			}
		if (memcmp(in,outin,8) != 0)
			{
			printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n",
				i+1,pt(key_data[i]),pt(out),pt(in),pt(outin));
			err=1;
			}
		}

#ifndef LIBDES_LIT
	printf("Doing ede ecb\n");
//.........这里部分代码省略.........
开发者ID:medusade,项目名称:mxde,代码行数:101,代码来源:destest.c


示例20: verify_data

/** Verify a signature 
   @param hashname	[in] String naming the hash
   @param keydatalen	[in] The length of the public key
   @param keydata	[in] The public key of the signer
   @param sigdatalen	[in] The length of the signature data
   @param sigdata	[in] The signature data
   @param filedatalen	[in] The length of the file in octets
   @param filedata	[in] The contents of the file being verified
   @param ...           [in] Additional len,data pairs until len is 0
   @return nonzero on error [or invalid], 0 on success
   If 
*/
int verify_data(
   char  *hashname,
         unsigned long  keydatalen,
         unsigned char *keydata,
         unsigned long  sigdatalen,
         unsigned char *sigdata,
         unsigned long  filedatalen,
   const unsigned char *filedata, ...)
{
   rsa_key rsakey;
   unsigned char rsabuf[2048], md[MAXBLOCKSIZE];
   unsigned long rsalen, mdlen;
   int           stat;
   int           res;
   va_list args;
   const unsigned char *dataptr;
   unsigned long datalen;
   hash_state hs;
   struct ltc_hash_descriptor *hd;
   int hashid;

   heap_start(heap_mem, HEAP_SIZE);

   if (strcmp(hashname,"des") == 0) {
       symmetric_key skey;
       DO(des_setup(keydata, keydatalen, 0, &skey),0x400000);
       DO(des_ecb_encrypt(filedata, sigdata, &skey),0x500000);
       return res;
   }

   register_hash(&sha256_desc);
//   register_hash(&sha512_desc);
//   register_hash(&whirlpool_desc);
   register_hash(&rmd160_desc);
   register_hash(&md4_desc);
   register_hash(&ltc_md5_desc);
   register_hash(&sha1_desc);
   ltc_mp = tfm_desc;

   hashid = find_hash(hashname);
   if ((res = hash_is_valid(hashid)) != CRYPT_OK)
      return res;

   hd = &hash_descriptor[hashid];
   if ((res = hd->init(&hs)) != CRYPT_OK)
      return res;

   va_start(args, filedata);
   dataptr = filedata;
   datalen = filedatalen;

   for(;;) {
      if((res = hd->process(&hs, dataptr, datalen)) != 0)
         return res;
      if((datalen = va_arg(args, unsigned long)) == 0)
         break;
      if((dataptr = va_arg(args, unsigned char *)) == NULL)
         break;
   }
   va_end(args);

   if (keydatalen == 0) {
       res = hd->done(&hs, sigdata);
       *keydata = hd->hashsize;
       return res+0x100000;
   }

   if((res = hd->done(&hs, md)) != 0)
      return res+0x200000;

   mdlen = hd->hashsize;

   DO(rsa_import(keydata, keydatalen, &rsakey),0x300000);
   DO(rsa_verify_hash(sigdata, sigdatalen, md, mdlen, find_hash(hashname), 8, &stat, &rsakey),0x400000);
   rsa_free(&rsakey);
   return (stat == 0) ? -1 : 0;
}
开发者ID:WWWWWWWWWWWWWWWWW,项目名称:Bios-crypto,代码行数:89,代码来源:bios_verify.c



注:本文中的des_ecb_encrypt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ desc函数代码示例发布时间:2022-05-30
下一篇:
C++ des2src函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap