Lines Matching refs:context

407 isc_sha224_init(isc_sha224_t *context) {
408 if (context == (isc_sha256_t *)0) {
411 memmove(context->state, sha224_initial_hash_value,
413 memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH);
414 context->bitcount = 0;
418 isc_sha224_invalidate(isc_sha224_t *context) {
419 memset(context, 0, sizeof(isc_sha224_t));
423 isc_sha224_update(isc_sha224_t *context, const isc_uint8_t* data, size_t len) {
424 isc_sha256_update((isc_sha256_t *)context, data, len);
428 isc_sha224_final(isc_uint8_t digest[], isc_sha224_t *context) {
430 isc_sha256_final(sha256_digest, (isc_sha256_t *)context);
436 isc_sha224_end(isc_sha224_t *context, char buffer[]) {
441 REQUIRE(context != (isc_sha224_t *)0);
444 isc_sha224_final(digest, context);
453 memset(context, 0, sizeof(*context));
463 isc_sha224_t context;
465 isc_sha224_init(&context);
466 isc_sha224_update(&context, data, len);
467 return (isc_sha224_end(&context, digest));
472 isc_sha256_init(isc_sha256_t *context) {
473 if (context == (isc_sha256_t *)0) {
476 memmove(context->state, sha256_initial_hash_value,
478 memset(context->buffer, 0, ISC_SHA256_BLOCK_LENGTH);
479 context->bitcount = 0;
519 void isc_sha256_transform(isc_sha256_t *context, const isc_uint32_t* data) {
524 W256 = (isc_uint32_t*)context->buffer;
527 a = context->state[0];
528 b = context->state[1];
529 c = context->state[2];
530 d = context->state[3];
531 e = context->state[4];
532 f = context->state[5];
533 g = context->state[6];
534 h = context->state[7];
562 context->state[0] += a;
563 context->state[1] += b;
564 context->state[2] += c;
565 context->state[3] += d;
566 context->state[4] += e;
567 context->state[5] += f;
568 context->state[6] += g;
569 context->state[7] += h;
581 isc_sha256_transform(isc_sha256_t *context, const isc_uint32_t* data) {
586 W256 = (isc_uint32_t*)context->buffer;
589 a = context->state[0];
590 b = context->state[1];
591 c = context->state[2];
592 d = context->state[3];
593 e = context->state[4];
594 f = context->state[5];
595 g = context->state[6];
596 h = context->state[7];
646 context->state[0] += a;
647 context->state[1] += b;
648 context->state[2] += c;
649 context->state[3] += d;
650 context->state[4] += e;
651 context->state[5] += f;
652 context->state[6] += g;
653 context->state[7] += h;
665 isc_sha256_invalidate(isc_sha256_t *context) {
666 memset(context, 0, sizeof(isc_sha256_t));
670 isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) {
679 REQUIRE(context != (isc_sha256_t *)0 && data != (isc_uint8_t*)0);
681 usedspace = (unsigned int)((context->bitcount >> 3) %
689 memmove(&context->buffer[usedspace], data, freespace);
690 context->bitcount += freespace << 3;
693 isc_sha256_transform(context,
694 (isc_uint32_t*)context->buffer);
697 memmove(&context->buffer[usedspace], data, len);
698 context->bitcount += len << 3;
708 memmove(context->buffer, data, ISC_SHA256_BLOCK_LENGTH);
709 isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
710 context->bitcount += ISC_SHA256_BLOCK_LENGTH << 3;
716 memmove(context->buffer, data, len);
717 context->bitcount += len << 3;
726 isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) {
731 REQUIRE(context != (isc_sha256_t *)0);
735 usedspace = (unsigned int)((context->bitcount >> 3) %
739 REVERSE64(context->bitcount,context->bitcount);
743 context->buffer[usedspace++] = 0x80;
747 memset(&context->buffer[usedspace], 0,
751 memset(&context->buffer[usedspace], 0,
756 isc_sha256_transform(context,
757 (isc_uint32_t*)context->buffer);
760 memset(context->buffer, 0,
765 memset(context->buffer, 0, ISC_SHA256_SHORT_BLOCK_LENGTH);
768 *context->buffer = 0x80;
771 *(isc_uint64_t*)&context->buffer[ISC_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
774 isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
781 REVERSE32(context->state[j],context->state[j]);
782 *d++ = context->state[j];
786 memmove(d, context->state, ISC_SHA256_DIGESTLENGTH);
791 memset(context, 0, sizeof(*context));
797 isc_sha256_end(isc_sha256_t *context, char buffer[]) {
802 REQUIRE(context != (isc_sha256_t *)0);
805 isc_sha256_final(digest, context);
814 memset(context, 0, sizeof(*context));
824 isc_sha256_t context;
826 isc_sha256_init(&context);
827 isc_sha256_update(&context, data, len);
828 return (isc_sha256_end(&context, digest));
834 isc_sha512_init(isc_sha512_t *context) {
835 if (context == (isc_sha512_t *)0) {
838 memmove(context->state, sha512_initial_hash_value,
840 memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH);
841 context->bitcount[0] = context->bitcount[1] = 0;
880 void isc_sha512_transform(isc_sha512_t *context, const isc_uint64_t* data) {
882 isc_uint64_t T1, *W512 = (isc_uint64_t*)context->buffer;
886 a = context->state[0];
887 b = context->state[1];
888 c = context->state[2];
889 d = context->state[3];
890 e = context->state[4];
891 f = context->state[5];
892 g = context->state[6];
893 h = context->state[7];
920 context->state[0] += a;
921 context->state[1] += b;
922 context->state[2] += c;
923 context->state[3] += d;
924 context->state[4] += e;
925 context->state[5] += f;
926 context->state[6] += g;
927 context->state[7] += h;
939 isc_sha512_transform(isc_sha512_t *context, const isc_uint64_t* data) {
941 isc_uint64_t T1, T2, *W512 = (isc_uint64_t*)context->buffer;
945 a = context->state[0];
946 b = context->state[1];
947 c = context->state[2];
948 d = context->state[3];
949 e = context->state[4];
950 f = context->state[5];
951 g = context->state[6];
952 h = context->state[7];
1002 context->state[0] += a;
1003 context->state[1] += b;
1004 context->state[2] += c;
1005 context->state[3] += d;
1006 context->state[4] += e;
1007 context->state[5] += f;
1008 context->state[6] += g;
1009 context->state[7] += h;
1021 isc_sha512_invalidate(isc_sha512_t *context) {
1022 memset(context, 0, sizeof(isc_sha512_t));
1026 isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t len) {
1035 REQUIRE(context != (isc_sha512_t *)0 && data != (isc_uint8_t*)0);
1037 usedspace = (unsigned int)((context->bitcount[0] >> 3) %
1045 memmove(&context->buffer[usedspace], data, freespace);
1046 ADDINC128(context->bitcount, freespace << 3);
1049 isc_sha512_transform(context,
1050 (isc_uint64_t*)context->buffer);
1053 memmove(&context->buffer[usedspace], data, len);
1054 ADDINC128(context->bitcount, len << 3);
1064 memmove(context->buffer, data, ISC_SHA512_BLOCK_LENGTH);
1065 isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
1066 ADDINC128(context->bitcount, ISC_SHA512_BLOCK_LENGTH << 3);
1072 memmove(context->buffer, data, len);
1073 ADDINC128(context->bitcount, len << 3);
1081 void isc_sha512_last(isc_sha512_t *context) {
1084 usedspace = (unsigned int)((context->bitcount[0] >> 3) %
1088 REVERSE64(context->bitcount[0],context->bitcount[0]);
1089 REVERSE64(context->bitcount[1],context->bitcount[1]);
1093 context->buffer[usedspace++] = 0x80;
1097 memset(&context->buffer[usedspace], 0,
1101 memset(&context->buffer[usedspace], 0,
1105 isc_sha512_transform(context,
1106 (isc_uint64_t*)context->buffer);
1109 memset(context->buffer, 0, ISC_SHA512_BLOCK_LENGTH - 2);
1113 memset(context->buffer, 0, ISC_SHA512_SHORT_BLOCK_LENGTH);
1116 *context->buffer = 0x80;
1119 *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
1120 *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
1123 isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
1126 void isc_sha512_final(isc_uint8_t digest[], isc_sha512_t *context) {
1130 REQUIRE(context != (isc_sha512_t *)0);
1134 isc_sha512_last(context);
1142 REVERSE64(context->state[j],context->state[j]);
1143 *d++ = context->state[j];
1147 memmove(d, context->state, ISC_SHA512_DIGESTLENGTH);
1152 memset(context, 0, sizeof(*context));
1156 isc_sha512_end(isc_sha512_t *context, char buffer[]) {
1161 REQUIRE(context != (isc_sha512_t *)0);
1164 isc_sha512_final(digest, context);
1173 memset(context, 0, sizeof(*context));
1183 isc_sha512_t context;
1185 isc_sha512_init(&context);
1186 isc_sha512_update(&context, data, len);
1187 return (isc_sha512_end(&context, digest));
1193 isc_sha384_init(isc_sha384_t *context) {
1194 if (context == (isc_sha384_t *)0) {
1197 memmove(context->state, sha384_initial_hash_value,
1199 memset(context->buffer, 0, ISC_SHA384_BLOCK_LENGTH);
1200 context->bitcount[0] = context->bitcount[1] = 0;
1204 isc_sha384_invalidate(isc_sha384_t *context) {
1205 memset(context, 0, sizeof(isc_sha384_t));
1209 isc_sha384_update(isc_sha384_t *context, const isc_uint8_t* data, size_t len) {
1210 isc_sha512_update((isc_sha512_t *)context, data, len);
1214 isc_sha384_final(isc_uint8_t digest[], isc_sha384_t *context) {
1218 REQUIRE(context != (isc_sha384_t *)0);
1222 isc_sha512_last((isc_sha512_t *)context);
1230 REVERSE64(context->state[j],context->state[j]);
1231 *d++ = context->state[j];
1235 memmove(d, context->state, ISC_SHA384_DIGESTLENGTH);
1240 memset(context, 0, sizeof(*context));
1244 isc_sha384_end(isc_sha384_t *context, char buffer[]) {
1249 REQUIRE(context != (isc_sha384_t *)0);
1252 isc_sha384_final(digest, context);
1261 memset(context, 0, sizeof(*context));
1271 isc_sha384_t context;
1273 isc_sha384_init(&context);
1274 isc_sha384_update(&context, data, len);
1275 return (isc_sha384_end(&context, digest));