summaryrefslogtreecommitdiffstats
path: root/libtomcrypt/hashes/hash_get_oid.c
blob: e31e055f492f2630e93a514711a46ce080af8b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* LibTomCrypt, modular cryptographic library
 *
 * LibTomCrypt is a library that provides various cryptographic
 * algorithms in a highly modular and flexible manner.
 *
 * The library is free for all purposes without any express
 * guarantee it works.
 *
 */
#include "tomcrypt.h"
#include <ncr-int.h>

/*
   Returns the OID of the hash.
   @param idx   The hash identifier of the hash to search for
   @return CRYPT_OK if valid
*/

int hash_get_oid(const struct algo_properties_st *hash, oid_st * st)
{
	if (hash->can_digest == 0 || hash->oids[0].key_size != -1) { 
		/* not a digest */
		return CRYPT_INVALID_ARG;
	}
	
	memcpy(st, &hash->oids[0].oid, sizeof(*st));

	return CRYPT_OK;
}

/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c,v $ */
/* $Revision: 1.6 $ */
/* $Date: 2006/12/28 01:27:24 $ */