source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/x509/x509type.c@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc
File size: 1.8 KB
Line 
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include <stdio.h>
11#include "internal/cryptlib.h"
12#include <openssl/evp.h>
13#include <openssl/objects.h>
14#include <openssl/x509.h>
15
16int X509_certificate_type(const X509 *x, const EVP_PKEY *pkey)
17{
18 const EVP_PKEY *pk;
19 int ret = 0, i;
20
21 if (x == NULL)
22 return (0);
23
24 if (pkey == NULL)
25 pk = X509_get0_pubkey(x);
26 else
27 pk = pkey;
28
29 if (pk == NULL)
30 return (0);
31
32 switch (EVP_PKEY_id(pk)) {
33 case EVP_PKEY_RSA:
34 ret = EVP_PK_RSA | EVP_PKT_SIGN;
35/* if (!sign only extension) */
36 ret |= EVP_PKT_ENC;
37 break;
38 case EVP_PKEY_DSA:
39 ret = EVP_PK_DSA | EVP_PKT_SIGN;
40 break;
41 case EVP_PKEY_EC:
42 ret = EVP_PK_EC | EVP_PKT_SIGN | EVP_PKT_EXCH;
43 break;
44 case EVP_PKEY_DH:
45 ret = EVP_PK_DH | EVP_PKT_EXCH;
46 break;
47 case NID_id_GostR3410_2001:
48 case NID_id_GostR3410_2012_256:
49 case NID_id_GostR3410_2012_512:
50 ret = EVP_PKT_EXCH | EVP_PKT_SIGN;
51 break;
52 default:
53 break;
54 }
55
56 i = X509_get_signature_nid(x);
57 if (i && OBJ_find_sigid_algs(i, NULL, &i)) {
58
59 switch (i) {
60 case NID_rsaEncryption:
61 case NID_rsa:
62 ret |= EVP_PKS_RSA;
63 break;
64 case NID_dsa:
65 case NID_dsa_2:
66 ret |= EVP_PKS_DSA;
67 break;
68 case NID_X9_62_id_ecPublicKey:
69 ret |= EVP_PKS_EC;
70 break;
71 default:
72 break;
73 }
74 }
75
76 return (ret);
77}
Note: See TracBrowser for help on using the repository browser.