• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/ntp/lib/isc/

Lines Matching refs:context

69 isc_sha224_init(isc_sha224_t *context) {
70 if (context == (isc_sha224_t *)0) {
73 EVP_DigestInit(context, EVP_sha224());
77 isc_sha224_invalidate(isc_sha224_t *context) {
78 EVP_MD_CTX_cleanup(context);
82 isc_sha224_update(isc_sha224_t *context, const isc_uint8_t* data, size_t len) {
89 REQUIRE(context != (isc_sha224_t *)0 && data != (isc_uint8_t*)0);
91 EVP_DigestUpdate(context, (const void *) data, len);
95 isc_sha224_final(isc_uint8_t digest[], isc_sha224_t *context) {
97 REQUIRE(context != (isc_sha224_t *)0);
101 EVP_DigestFinal(context, digest, NULL);
103 EVP_MD_CTX_cleanup(context);
108 isc_sha256_init(isc_sha256_t *context) {
109 if (context == (isc_sha256_t *)0) {
112 EVP_DigestInit(context, EVP_sha256());
116 isc_sha256_invalidate(isc_sha256_t *context) {
117 EVP_MD_CTX_cleanup(context);
121 isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
128 REQUIRE(context != (isc_sha256_t *)0 && data != (isc_uint8_t*)0);
130 EVP_DigestUpdate(context, (const void *) data, len);
134 isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) {
136 REQUIRE(context != (isc_sha256_t *)0);
140 EVP_DigestFinal(context, digest, NULL);
142 EVP_MD_CTX_cleanup(context);
147 isc_sha512_init(isc_sha512_t *context) {
148 if (context == (isc_sha512_t *)0) {
151 EVP_DigestInit(context, EVP_sha512());
155 isc_sha512_invalidate(isc_sha512_t *context) {
156 EVP_MD_CTX_cleanup(context);
159 void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t len) {
166 REQUIRE(context != (isc_sha512_t *)0 && data != (isc_uint8_t*)0);
168 EVP_DigestUpdate(context, (const void *) data, len);
171 void isc_sha512_final(isc_uint8_t digest[], isc_sha512_t *context) {
173 REQUIRE(context != (isc_sha512_t *)0);
177 EVP_DigestFinal(context, digest, NULL);
179 EVP_MD_CTX_cleanup(context);
184 isc_sha384_init(isc_sha384_t *context) {
185 if (context == (isc_sha384_t *)0) {
188 EVP_DigestInit(context, EVP_sha384());
192 isc_sha384_invalidate(isc_sha384_t *context) {
193 EVP_MD_CTX_cleanup(context);
197 isc_sha384_update(isc_sha384_t *context, const isc_uint8_t* data, size_t len) {
204 REQUIRE(context != (isc_sha512_t *)0 && data != (isc_uint8_t*)0);
206 EVP_DigestUpdate(context, (const void *) data, len);
210 isc_sha384_final(isc_uint8_t digest[], isc_sha384_t *context) {
212 REQUIRE(context != (isc_sha384_t *)0);
216 EVP_DigestFinal(context, digest, NULL);
218 EVP_MD_CTX_cleanup(context);
559 isc_sha224_init(isc_sha224_t *context) {
560 if (context == (isc_sha256_t *)0) {
563 memcpy(context->state, sha224_initial_hash_value,
565 memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH);
566 context->bitcount = 0;
570 isc_sha224_invalidate(isc_sha224_t *context) {
571 memset(context, 0, sizeof(isc_sha224_t));
575 isc_sha224_update(isc_sha224_t *context, const isc_uint8_t* data, size_t len) {
576 isc_sha256_update((isc_sha256_t *)context, data, len);
580 isc_sha224_final(isc_uint8_t digest[], isc_sha224_t *context) {
582 isc_sha256_final(sha256_digest, (isc_sha256_t *)context);
589 isc_sha256_init(isc_sha256_t *context) {
590 if (context == (isc_sha256_t *)0) {
593 memcpy(context->state, sha256_initial_hash_value,
595 memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH);
596 context->bitcount = 0;
600 isc_sha256_invalidate(isc_sha256_t *context) {
601 memset(context, 0, sizeof(isc_sha256_t));
641 void isc_sha256_transform(isc_sha256_t *context, const isc_uint32_t* data) {
646 W256 = (isc_uint32_t*)context->buffer;
649 a = context->state[0];
650 b = context->state[1];
651 c = context->state[2];
652 d = context->state[3];
653 e = context->state[4];
654 f = context->state[5];
655 g = context->state[6];
656 h = context->state[7];
684 context->state[0] += a;
685 context->state[1] += b;
686 context->state[2] += c;
687 context->state[3] += d;
688 context->state[4] += e;
689 context->state[5] += f;
690 context->state[6] += g;
691 context->state[7] += h;
703 isc_sha256_transform(isc_sha256_t *context, const isc_uint32_t* data) {
708 W256 = (isc_uint32_t*)context->buffer;
711 a = context->state[0];
712 b = context->state[1];
713 c = context->state[2];
714 d = context->state[3];
715 e = context->state[4];
716 f = context->state[5];
717 g = context->state[6];
718 h = context->state[7];
768 context->state[0] += a;
769 context->state[1] += b;
770 context->state[2] += c;
771 context->state[3] += d;
772 context->state[4] += e;
773 context->state[5] += f;
774 context->state[6] += g;
775 context->state[7] += h;
787 isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
796 REQUIRE(context != (isc_sha256_t *)0 && data != (isc_uint8_t*)0);
798 usedspace = (unsigned int)((context->bitcount >> 3) %
806 memcpy(&context->buffer[usedspace], data, freespace);
807 context->bitcount += freespace << 3;
810 isc_sha256_transform(context,
811 (isc_uint32_t*)context->buffer);
814 memcpy(&context->buffer[usedspace], data, len);
815 context->bitcount += len << 3;
825 memcpy(context->buffer, data, ISC_SHA256_BLOCK_LENGTH);
826 isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
827 context->bitcount += ISC_SHA256_BLOCK_LENGTH << 3;
833 memcpy(context->buffer, data, len);
834 context->bitcount += len << 3;
843 isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) {
848 REQUIRE(context != (isc_sha256_t *)0);
852 usedspace = (unsigned int)((context->bitcount >> 3) %
856 REVERSE64(context->bitcount,context->bitcount);
860 context->buffer[usedspace++] = 0x80;
864 memset(&context->buffer[usedspace], 0,
868 memset(&context->buffer[usedspace], 0,
873 isc_sha256_transform(context,
874 (isc_uint32_t*)context->buffer);
877 memset(context->buffer, 0,
882 memset(context->buffer, 0, ISC_SHA256_SHORT_BLOCK_LENGTH);
885 *context->buffer = 0x80;
888 *(isc_uint64_t*)&context->buffer[ISC_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
891 isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
898 REVERSE32(context->state[j],context->state[j]);
899 *d++ = context->state[j];
903 memcpy(d, context->state, ISC_SHA256_DIGESTLENGTH);
908 memset(context, 0, sizeof(*context));
915 isc_sha512_init(isc_sha512_t *context) {
916 if (context == (isc_sha512_t *)0) {
919 memcpy(context->state, sha512_initial_hash_value,
921 memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH);
922 context->bitcount[0] = context->bitcount[1] = 0;
926 isc_sha512_invalidate(isc_sha512_t *context) {
927 memset(context, 0, sizeof(isc_sha512_t));
966 void isc_sha512_transform(isc_sha512_t *context, const isc_uint64_t* data) {
968 isc_uint64_t T1, *W512 = (isc_uint64_t*)context->buffer;
972 a = context->state[0];
973 b = context->state[1];
974 c = context->state[2];
975 d = context->state[3];
976 e = context->state[4];
977 f = context->state[5];
978 g = context->state[6];
979 h = context->state[7];
1006 context->state[0] += a;
1007 context->state[1] += b;
1008 context->state[2] += c;
1009 context->state[3] += d;
1010 context->state[4] += e;
1011 context->state[5] += f;
1012 context->state[6] += g;
1013 context->state[7] += h;
1025 isc_sha512_transform(isc_sha512_t *context, const isc_uint64_t* data) {
1027 isc_uint64_t T1, T2, *W512 = (isc_uint64_t*)context->buffer;
1031 a = context->state[0];
1032 b = context->state[1];
1033 c = context->state[2];
1034 d = context->state[3];
1035 e = context->state[4];
1036 f = context->state[5];
1037 g = context->state[6];
1038 h = context->state[7];
1088 context->state[0] += a;
1089 context->state[1] += b;
1090 context->state[2] += c;
1091 context->state[3] += d;
1092 context->state[4] += e;
1093 context->state[5] += f;
1094 context->state[6] += g;
1095 context->state[7] += h;
1106 void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t len) {
1115 REQUIRE(context != (isc_sha512_t *)0 && data != (isc_uint8_t*)0);
1117 usedspace = (unsigned int)((context->bitcount[0] >> 3) %
1125 memcpy(&context->buffer[usedspace], data, freespace);
1126 ADDINC128(context->bitcount, freespace << 3);
1129 isc_sha512_transform(context,
1130 (isc_uint64_t*)context->buffer);
1133 memcpy(&context->buffer[usedspace], data, len);
1134 ADDINC128(context->bitcount, len << 3);
1144 memcpy(context->buffer, data, ISC_SHA512_BLOCK_LENGTH);
1145 isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
1146 ADDINC128(context->bitcount, ISC_SHA512_BLOCK_LENGTH << 3);
1152 memcpy(context->buffer, data, len);
1153 ADDINC128(context->bitcount, len << 3);
1161 void isc_sha512_last(isc_sha512_t *context) {
1164 usedspace = (unsigned int)((context->bitcount[0] >> 3) %
1168 REVERSE64(context->bitcount[0],context->bitcount[0]);
1169 REVERSE64(context->bitcount[1],context->bitcount[1]);
1173 context->buffer[usedspace++] = 0x80;
1177 memset(&context->buffer[usedspace], 0,
1181 memset(&context->buffer[usedspace], 0,
1185 isc_sha512_transform(context,
1186 (isc_uint64_t*)context->buffer);
1189 memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH - 2);
1193 memset(context->buffer, 0, ISC_SHA512_SHORT_BLOCK_LENGTH);
1196 *context->buffer = 0x80;
1199 *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
1200 *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
1203 isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
1206 void isc_sha512_final(isc_uint8_t digest[], isc_sha512_t *context) {
1210 REQUIRE(context != (isc_sha512_t *)0);
1214 isc_sha512_last(context);
1222 REVERSE64(context->state[j],context->state[j]);
1223 *d++ = context->state[j];
1227 memcpy(d, context->state, ISC_SHA512_DIGESTLENGTH);
1232 memset(context, 0, sizeof(*context));
1238 isc_sha384_init(isc_sha384_t *context) {
1239 if (context == (isc_sha384_t *)0) {
1242 memcpy(context->state, sha384_initial_hash_value,
1244 memset(context->buffer, 0, ISC_SHA384_BLOCK_LENGTH);
1245 context->bitcount[0] = context->bitcount[1] = 0;
1249 isc_sha384_invalidate(isc_sha384_t *context) {
1250 memset(context, 0, sizeof(isc_sha384_t));
1254 isc_sha384_update(isc_sha384_t *context, const isc_uint8_t* data, size_t len) {
1255 isc_sha512_update((isc_sha512_t *)context, data, len);
1259 isc_sha384_final(isc_uint8_t digest[], isc_sha384_t *context) {
1263 REQUIRE(context != (isc_sha384_t *)0);
1267 isc_sha512_last((isc_sha512_t *)context);
1275 REVERSE64(context->state[j],context->state[j]);
1276 *d++ = context->state[j];
1280 memcpy(d, context->state, ISC_SHA384_DIGESTLENGTH);
1285 memset(context, 0, sizeof(*context));
1296 isc_sha224_end(isc_sha224_t *context, char buffer[]) {
1301 REQUIRE(context != (isc_sha224_t *)0);
1304 isc_sha224_final(digest, context);
1314 EVP_MD_CTX_cleanup(context);
1316 memset(context, 0, sizeof(*context));
1327 isc_sha224_t context;
1329 isc_sha224_init(&context);
1330 isc_sha224_update(&context, data, len);
1331 return (isc_sha224_end(&context, digest));
1335 isc_sha256_end(isc_sha256_t *context, char buffer[]) {
1340 REQUIRE(context != (isc_sha256_t *)0);
1343 isc_sha256_final(digest, context);
1353 EVP_MD_CTX_cleanup(context);
1355 memset(context, 0, sizeof(*context));
1366 isc_sha256_t context;
1368 isc_sha256_init(&context);
1369 isc_sha256_update(&context, data, len);
1370 return (isc_sha256_end(&context, digest));
1374 isc_sha512_end(isc_sha512_t *context, char buffer[]) {
1379 REQUIRE(context != (isc_sha512_t *)0);
1382 isc_sha512_final(digest, context);
1392 EVP_MD_CTX_cleanup(context);
1394 memset(context, 0, sizeof(*context));
1405 isc_sha512_t context;
1407 isc_sha512_init(&context);
1408 isc_sha512_update(&context, data, len);
1409 return (isc_sha512_end(&context, digest));
1413 isc_sha384_end(isc_sha384_t *context, char buffer[]) {
1418 REQUIRE(context != (isc_sha384_t *)0);
1421 isc_sha384_final(digest, context);
1431 EVP_MD_CTX_cleanup(context);
1433 memset(context, 0, sizeof(*context));
1444 isc_sha384_t context;
1446 isc_sha384_init(&context);
1447 isc_sha384_update(&context, data, len);
1448 return (isc_sha384_end(&context, digest));