static void Sha256_Transform(Sha256ContextType *context, uint8_t * data) { uint32_t a,b,c,d,e,f,g,h,i,j,t1,t2,m[64]; for (i = 0, j = 0; i < 16; ++i, j += 4) { m[i] = (data[j] << 24) | (data[j+1] << 16) | (data[j+2] << 8) | (data[j+3]); } for (; i < 64; i++) { m[i] = SIG1(m[i-2]) + m[i-7] + SIG0(m[i-15]) + m[i-16]; } a = context->State[0]; b = context->State[1]; c = context->State[2]; d = context->State[3]; e = context->State[4]; f = context->State[5]; g = context->State[6]; h = context->State[7]; for (i = 0; i < 64; i++) { t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i]; t2 = EP0(a) + MAJ(a,b,c); h = g; g = f; f = e; e = d + t1; d = c; c = b; b = a; a = t1 + t2; } context->State[0] += a; context->State[1] += b; context->State[2] += c; context->State[3] += d; context->State[4] += e; context->State[5] += f; context->State[6] += g; context->State[7] += h; }
InputContext::InputContext(bool use64, const XHCIPortRegister& port, uint32_t portId, uint32_t routeString, uint32_t trRingPtr) { unsigned addr = KERNEL_VIRTUAL_ADDRESS(MemManager::Instance().AllocatePhysicalPage() * PAGE_SIZE); if(use64) { auto context64 = new ((void*)addr)InputContext64(); _control = &context64->_controlContext; _devContext = new DeviceContext(context64->_deviceContext); } else { auto context32 = new ((void*)addr)InputContext32(); _control = &context32->_controlContext; _devContext = new DeviceContext(context32->_deviceContext); } Slot().Init(portId, routeString, port.PortSpeedID()); EP0().EP0Init(trRingPtr, port.MaxPacketSize()); }