summaryrefslogtreecommitdiffstats
path: root/crypto/pkcs12/p12_mutl.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-09-27 13:28:26 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-02-08 18:43:48 +0000
commit293042c9d9411bd785d3f951ffe02ff6573e4854 (patch)
tree5273edfc7491a572ca6db43cbcb29e47c37ad768 /crypto/pkcs12/p12_mutl.c
parent1e1b48d151a9e87592e3ba9303031c5ec0ebec8f (diff)
Reorganise functions.
Move all PKCS12_SAFEBAG functions into new file p12_sbag.c. Move MAC functions into p12_mutl.c Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/pkcs12/p12_mutl.c')
-rw-r--r--crypto/pkcs12/p12_mutl.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c
index 726e7f1360..62a62cbe9b 100644
--- a/crypto/pkcs12/p12_mutl.c
+++ b/crypto/pkcs12/p12_mutl.c
@@ -64,6 +64,36 @@
# include <openssl/pkcs12.h>
# include "p12_lcl.h"
+int PKCS12_mac_present(PKCS12 *p12)
+{
+return p12->mac ? 1 : 0;
+}
+
+void PKCS12_get0_mac(ASN1_OCTET_STRING **pmac, X509_ALGOR **pmacalg,
+ ASN1_OCTET_STRING **psalt, ASN1_INTEGER **piter,
+ PKCS12 *p12)
+{
+ if (p12->mac) {
+ if (pmac)
+ *pmac = p12->mac->dinfo->digest;
+ if (pmacalg)
+ *pmacalg = p12->mac->dinfo->algor;
+ if (psalt)
+ *psalt = p12->mac->salt;
+ if (piter)
+ *piter = p12->mac->iter;
+ } else {
+ if (pmac)
+ *pmac = NULL;
+ if (pmacalg)
+ *pmacalg = NULL;
+ if (psalt)
+ *psalt = NULL;
+ if (piter)
+ *piter = NULL;
+ }
+}
+
# define TK26_MAC_KEY_LEN 32
static int pkcs12_gen_gost_mac_key(const char *pass, int passlen,