source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/cms/cms_att.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: 4.4 KB
Line 
1/*
2 * Copyright 2008-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 <openssl/asn1t.h>
11#include <openssl/pem.h>
12#include <openssl/x509v3.h>
13#include <openssl/err.h>
14#include <openssl/cms.h>
15#include "cms_lcl.h"
16
17/* CMS SignedData Attribute utilities */
18
19int CMS_signed_get_attr_count(const CMS_SignerInfo *si)
20{
21 return X509at_get_attr_count(si->signedAttrs);
22}
23
24int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos)
25{
26 return X509at_get_attr_by_NID(si->signedAttrs, nid, lastpos);
27}
28
29int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
30 int lastpos)
31{
32 return X509at_get_attr_by_OBJ(si->signedAttrs, obj, lastpos);
33}
34
35X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc)
36{
37 return X509at_get_attr(si->signedAttrs, loc);
38}
39
40X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc)
41{
42 return X509at_delete_attr(si->signedAttrs, loc);
43}
44
45int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
46{
47 if (X509at_add1_attr(&si->signedAttrs, attr))
48 return 1;
49 return 0;
50}
51
52int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
53 const ASN1_OBJECT *obj, int type,
54 const void *bytes, int len)
55{
56 if (X509at_add1_attr_by_OBJ(&si->signedAttrs, obj, type, bytes, len))
57 return 1;
58 return 0;
59}
60
61int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
62 int nid, int type, const void *bytes, int len)
63{
64 if (X509at_add1_attr_by_NID(&si->signedAttrs, nid, type, bytes, len))
65 return 1;
66 return 0;
67}
68
69int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
70 const char *attrname, int type,
71 const void *bytes, int len)
72{
73 if (X509at_add1_attr_by_txt(&si->signedAttrs, attrname, type, bytes, len))
74 return 1;
75 return 0;
76}
77
78void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
79 int lastpos, int type)
80{
81 return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type);
82}
83
84int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si)
85{
86 return X509at_get_attr_count(si->unsignedAttrs);
87}
88
89int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
90 int lastpos)
91{
92 return X509at_get_attr_by_NID(si->unsignedAttrs, nid, lastpos);
93}
94
95int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
96 const ASN1_OBJECT *obj, int lastpos)
97{
98 return X509at_get_attr_by_OBJ(si->unsignedAttrs, obj, lastpos);
99}
100
101X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc)
102{
103 return X509at_get_attr(si->unsignedAttrs, loc);
104}
105
106X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc)
107{
108 return X509at_delete_attr(si->unsignedAttrs, loc);
109}
110
111int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
112{
113 if (X509at_add1_attr(&si->unsignedAttrs, attr))
114 return 1;
115 return 0;
116}
117
118int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
119 const ASN1_OBJECT *obj, int type,
120 const void *bytes, int len)
121{
122 if (X509at_add1_attr_by_OBJ(&si->unsignedAttrs, obj, type, bytes, len))
123 return 1;
124 return 0;
125}
126
127int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
128 int nid, int type,
129 const void *bytes, int len)
130{
131 if (X509at_add1_attr_by_NID(&si->unsignedAttrs, nid, type, bytes, len))
132 return 1;
133 return 0;
134}
135
136int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
137 const char *attrname, int type,
138 const void *bytes, int len)
139{
140 if (X509at_add1_attr_by_txt(&si->unsignedAttrs, attrname,
141 type, bytes, len))
142 return 1;
143 return 0;
144}
145
146void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
147 int lastpos, int type)
148{
149 return X509at_get0_data_by_OBJ(si->unsignedAttrs, oid, lastpos, type);
150}
151
152/* Specific attribute cases */
Note: See TracBrowser for help on using the repository browser.