summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-11-15 00:52:44 +0000
committertb <>2023-11-15 00:52:44 +0000
commite3f899de90d4f2798ee77f62ca92c00288424580 (patch)
tree38b64ba2fa90a75e1105922e606ceb07ffc6f572
parentdafc9641de7c842b3e4f4f884ba8c77ccf9b1052 (diff)
downloadopenbsd-e3f899de90d4f2798ee77f62ca92c00288424580.tar.gz
openbsd-e3f899de90d4f2798ee77f62ca92c00288424580.tar.bz2
openbsd-e3f899de90d4f2798ee77f62ca92c00288424580.zip
Shuffle getters and adders down a bit
These use static helper functions which don't need prototypes this way.
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_doit.c64
1 files changed, 30 insertions, 34 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c
index d5edaedbd0..5050780206 100644
--- a/src/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/src/lib/libcrypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_doit.c,v 1.52 2023/03/09 18:20:10 tb Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.53 2023/11/15 00:52:44 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -68,10 +68,6 @@
68#include "evp_local.h" 68#include "evp_local.h"
69#include "x509_local.h" 69#include "x509_local.h"
70 70
71static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype,
72 void *value);
73static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid);
74
75static int 71static int
76PKCS7_type_is_other(PKCS7* p7) 72PKCS7_type_is_other(PKCS7* p7)
77{ 73{
@@ -1120,20 +1116,6 @@ PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
1120} 1116}
1121LCRYPTO_ALIAS(PKCS7_get_issuer_and_serial); 1117LCRYPTO_ALIAS(PKCS7_get_issuer_and_serial);
1122 1118
1123ASN1_TYPE *
1124PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid)
1125{
1126 return (get_attribute(si->auth_attr, nid));
1127}
1128LCRYPTO_ALIAS(PKCS7_get_signed_attribute);
1129
1130ASN1_TYPE *
1131PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid)
1132{
1133 return (get_attribute(si->unauth_attr, nid));
1134}
1135LCRYPTO_ALIAS(PKCS7_get_attribute);
1136
1137static ASN1_TYPE * 1119static ASN1_TYPE *
1138get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid) 1120get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid)
1139{ 1121{
@@ -1152,6 +1134,20 @@ get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid)
1152 return (NULL); 1134 return (NULL);
1153} 1135}
1154 1136
1137ASN1_TYPE *
1138PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid)
1139{
1140 return (get_attribute(si->auth_attr, nid));
1141}
1142LCRYPTO_ALIAS(PKCS7_get_signed_attribute);
1143
1144ASN1_TYPE *
1145PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid)
1146{
1147 return (get_attribute(si->unauth_attr, nid));
1148}
1149LCRYPTO_ALIAS(PKCS7_get_attribute);
1150
1155ASN1_OCTET_STRING * 1151ASN1_OCTET_STRING *
1156PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk) 1152PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk)
1157{ 1153{
@@ -1208,21 +1204,6 @@ PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk)
1208} 1204}
1209LCRYPTO_ALIAS(PKCS7_set_attributes); 1205LCRYPTO_ALIAS(PKCS7_set_attributes);
1210 1206
1211int
1212PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
1213 void *value)
1214{
1215 return (add_attribute(&(p7si->auth_attr), nid, atrtype, value));
1216}
1217LCRYPTO_ALIAS(PKCS7_add_signed_attribute);
1218
1219int
1220PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value)
1221{
1222 return (add_attribute(&(p7si->unauth_attr), nid, atrtype, value));
1223}
1224LCRYPTO_ALIAS(PKCS7_add_attribute);
1225
1226static int 1207static int
1227add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) 1208add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value)
1228{ 1209{
@@ -1262,3 +1243,18 @@ new_attrib:
1262end: 1243end:
1263 return (1); 1244 return (1);
1264} 1245}
1246
1247int
1248PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
1249 void *value)
1250{
1251 return (add_attribute(&(p7si->auth_attr), nid, atrtype, value));
1252}
1253LCRYPTO_ALIAS(PKCS7_add_signed_attribute);
1254
1255int
1256PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value)
1257{
1258 return (add_attribute(&(p7si->unauth_attr), nid, atrtype, value));
1259}
1260LCRYPTO_ALIAS(PKCS7_add_attribute);