int SHA384_Init(SHA512_CTX *sha) { sha->h[0] = OPENSSL_U64(0xcbbb9d5dc1059ed8); sha->h[1] = OPENSSL_U64(0x629a292a367cd507); sha->h[2] = OPENSSL_U64(0x9159015a3070dd17); sha->h[3] = OPENSSL_U64(0x152fecd8f70e5939); sha->h[4] = OPENSSL_U64(0x67332667ffc00b31); sha->h[5] = OPENSSL_U64(0x8eb44a8768581511); sha->h[6] = OPENSSL_U64(0xdb0c2e0d64f98fa7); sha->h[7] = OPENSSL_U64(0x47b5481dbefa4fa4); sha->Nl = 0; sha->Nh = 0; sha->num = 0; sha->md_len = SHA384_DIGEST_LENGTH; return 1; }
int SHA512_Init(SHA512_CTX *sha) { sha->h[0] = OPENSSL_U64(0x6a09e667f3bcc908); sha->h[1] = OPENSSL_U64(0xbb67ae8584caa73b); sha->h[2] = OPENSSL_U64(0x3c6ef372fe94f82b); sha->h[3] = OPENSSL_U64(0xa54ff53a5f1d36f1); sha->h[4] = OPENSSL_U64(0x510e527fade682d1); sha->h[5] = OPENSSL_U64(0x9b05688c2b3e6c1f); sha->h[6] = OPENSSL_U64(0x1f83d9abfb41bd6b); sha->h[7] = OPENSSL_U64(0x5be0cd19137e2179); sha->Nl = 0; sha->Nh = 0; sha->num = 0; sha->md_len = SHA512_DIGEST_LENGTH; return 1; }
int SHA512_Update(SHA512_CTX *c, const void *in_data, size_t len) { uint64_t l; uint8_t *p = c->u.p; const uint8_t *data = (const uint8_t *)in_data; if (len == 0) { return 1; } l = (c->Nl + (((uint64_t)len) << 3)) & OPENSSL_U64(0xffffffffffffffff); if (l < c->Nl) { c->Nh++; } if (sizeof(len) >= 8) { c->Nh += (((uint64_t)len) >> 61); }
sizeof(kNSSBER)); } typedef struct { uint64_t value; const char *encoding; size_t encoding_len; } ASN1_UINT64_TEST; static const ASN1_UINT64_TEST kAsn1Uint64Tests[] = { {0, "\x02\x01\x00", 3}, {1, "\x02\x01\x01", 3}, {127, "\x02\x01\x7f", 3}, {128, "\x02\x02\x00\x80", 4}, {0xdeadbeef, "\x02\x05\x00\xde\xad\xbe\xef", 7}, {OPENSSL_U64(0x0102030405060708), "\x02\x08\x01\x02\x03\x04\x05\x06\x07\x08", 10}, {OPENSSL_U64(0xffffffffffffffff), "\x02\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff", 11}, }; typedef struct { const char *encoding; size_t encoding_len; } ASN1_INVALID_UINT64_TEST; static const ASN1_INVALID_UINT64_TEST kAsn1InvalidUint64Tests[] = { /* Bad tag. */ {"\x03\x01\x00", 3}, /* Empty contents. */ {"\x02\x00", 2},