RTSha256Digest.cpp revision cbf12315646559bf0cb5f12957f6096cb73e30f4
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * IPRT - SHA256 digest creation
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Copyright (C) 2009-2013 Oracle Corporation
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * available from http://www.virtualbox.org. This file is free software;
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * General Public License (GPL) as published by the Free Software
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * The contents of this file may alternatively be used under the terms
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * of the Common Development and Distribution License Version 1.0
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * CDDL are applicable instead of those of the GPL.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * You may elect to license modified versions of this file under the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * terms and conditions of either the GPL or the CDDL or both.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/*******************************************************************************
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync* Header Files *
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync*******************************************************************************/
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncRTR3DECL(int) RTSha256Digest(void* pvBuf, size_t cbBuf, char **ppszDigest, PFNRTPROGRESS pfnProgressCallback, void *pvUser)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync /* Validate input */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync AssertPtrNullReturn(pfnProgressCallback, VERR_INVALID_PARAMETER);
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync /* Initialize OpenSSL. */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync /* Buffer size for progress callback */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync /* Working buffer */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync /* Process the memory in blocks */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync /* Call the progress callback if one is defined */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync rc = pfnProgressCallback((unsigned)(cbReadTotal * rdMulti), pvUser);
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync break; /* canceled */
return VERR_INTERNAL_ERROR;
char *pszDigest;
return rc;
RTR3DECL(int) RTSha256DigestFromFile(const char *pszFile, char **ppszDigest, PFNRTPROGRESS pfnProgressCallback, void *pvUser)
return VERR_INTERNAL_ERROR;
return rc;
double rdMulti = 0;
if (pfnProgressCallback)
return rc;
void *pvBufFree;
if (!pvBuf)
if (pfnProgressCallback)
return rc;
return VERR_INTERNAL_ERROR;
char *pszDigest;
return rc;