Mercurial > dropbear
comparison libtomcrypt/src/misc/pk_get_oid.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1470:8bba51a55704 | 1471:6dba84798cd5 |
---|---|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
2 * | |
3 * LibTomCrypt is a library that provides various cryptographic | |
4 * algorithms in a highly modular and flexible manner. | |
5 * | |
6 * The library is free for all purposes without any express | |
7 * guarantee it works. | |
8 */ | |
9 #include "tomcrypt.h" | |
10 | |
11 #ifdef LTC_DER | |
12 static const oid_st rsa_oid = { | |
13 { 1, 2, 840, 113549, 1, 1, 1 }, | |
14 7, | |
15 }; | |
16 | |
17 static const oid_st dsa_oid = { | |
18 { 1, 2, 840, 10040, 4, 1 }, | |
19 6, | |
20 }; | |
21 | |
22 /* | |
23 Returns the OID of the public key algorithm. | |
24 @return CRYPT_OK if valid | |
25 */ | |
26 int pk_get_oid(int pk, oid_st *st) | |
27 { | |
28 switch (pk) { | |
29 case PKA_RSA: | |
30 XMEMCPY(st, &rsa_oid, sizeof(*st)); | |
31 break; | |
32 case PKA_DSA: | |
33 XMEMCPY(st, &dsa_oid, sizeof(*st)); | |
34 break; | |
35 default: | |
36 return CRYPT_INVALID_ARG; | |
37 } | |
38 return CRYPT_OK; | |
39 } | |
40 #endif | |
41 | |
42 /* ref: $Format:%D$ */ | |
43 /* git commit: $Format:%H$ */ | |
44 /* commit time: $Format:%ai$ */ |