mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 11:02:30 -04:00
added compilable version of openpgp sdk
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5048 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8cb15bdbef
commit
7d06d19e40
67 changed files with 20945 additions and 0 deletions
62
openpgpsdk/src/reader_hashed.c
Normal file
62
openpgpsdk/src/reader_hashed.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2005-2008 Nominet UK (www.nic.uk)
|
||||
* All rights reserved.
|
||||
* Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
|
||||
* their moral rights under the UK Copyright Design and Patents Act 1988 to
|
||||
* be recorded as the authors of this copyright work.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*/
|
||||
|
||||
#include <openpgpsdk/crypto.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <openpgpsdk/final.h>
|
||||
|
||||
static int hash_reader(void *dest,size_t length,ops_error_t **errors,
|
||||
ops_reader_info_t *rinfo,ops_parse_cb_info_t *cbinfo)
|
||||
{
|
||||
ops_hash_t *hash=ops_reader_get_arg(rinfo);
|
||||
int r=ops_stacked_read(dest,length,errors,rinfo,cbinfo);
|
||||
|
||||
if(r <= 0)
|
||||
return r;
|
||||
|
||||
hash->add(hash,dest,r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
\ingroup Internal_Readers_Hash
|
||||
\brief Push hashed data reader on stack
|
||||
*/
|
||||
void ops_reader_push_hash(ops_parse_info_t *pinfo,ops_hash_t *hash)
|
||||
{
|
||||
hash->init(hash);
|
||||
ops_reader_push(pinfo,hash_reader,NULL,hash);
|
||||
}
|
||||
|
||||
/**
|
||||
\ingroup Internal_Readers_Hash
|
||||
\brief Pop hashed data reader from stack
|
||||
*/
|
||||
void ops_reader_pop_hash(ops_parse_info_t *pinfo)
|
||||
{ ops_reader_pop(pinfo); }
|
||||
|
||||
// EOF
|
Loading…
Add table
Add a link
Reference in a new issue