packet.c
来自「NIST推荐的素域上的椭圆曲线」· C语言 代码 · 共 44 行
C
44 行
#include "mycrypt.h"#ifdef PACKETvoid packet_store_header(unsigned char *dst, int section, int subsection, unsigned long length){ _ARGCHK(dst != NULL); /* store version number */ dst[0] = CRYPT&255; dst[1] = (CRYPT>>8)&255; /* store section and subsection */ dst[2] = section & 255; dst[3] = subsection & 255; /* store length */ STORE32L(length, &dst[4]);}int packet_valid_header(unsigned char *src, int section, int subsection){ unsigned long ver; _ARGCHK(src != NULL); /* check version */ ver = ((unsigned long)src[0]) | ((unsigned long)src[1] << 8); if (CRYPT < ver) { return CRYPT_INVALID_PACKET; } /* check section and subsection */ if (section != src[2] || subsection != src[3]) { return CRYPT_INVALID_PACKET; } return CRYPT_OK;}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?