diff options
author | Jeremy Barton <jbarton@microsoft.com> | 2015-06-22 09:11:49 -0700 |
---|---|---|
committer | bartonjs <jbarton@microsoft.com> | 2015-06-22 09:34:27 -0700 |
commit | 3401c614641d8e086eb250c1031f12fb75f41327 (patch) | |
tree | df6587782e993266c8b256ed1efce64747959658 | |
parent | 646bcd7b284bf1b3f5659cb3392316154c084b68 (diff) | |
download | coreclr-3401c614641d8e086eb250c1031f12fb75f41327.tar.gz coreclr-3401c614641d8e086eb250c1031f12fb75f41327.tar.bz2 coreclr-3401c614641d8e086eb250c1031f12fb75f41327.zip |
Add methods for interacting with STACK_OF(X509)
-rw-r--r-- | src/corefx/System.Security.Cryptography.Native/openssl.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/corefx/System.Security.Cryptography.Native/openssl.c b/src/corefx/System.Security.Cryptography.Native/openssl.c index 5dd64b23eb..e00a5fc0bf 100644 --- a/src/corefx/System.Security.Cryptography.Native/openssl.c +++ b/src/corefx/System.Security.Cryptography.Native/openssl.c @@ -623,3 +623,54 @@ GetX509NameInfo( return NULL; } + +/* +Function: +GetX509StackFieldCount + +Used by System.Security.Cryptography.X509Certificates' OpenSslX509ChainProcessor to identify the +number of certificates returned in the built chain. + +Return values: +0 if the field count cannot be determined, or the count of certificates in STACK_OF(X509) +Note that 0 does not always indicate an error, merely that GetX509StackField should not be called. +*/ +int +GetX509StackFieldCount( + STACK_OF(X509)* stack) +{ + return sk_X509_num(stack); +} + +/* +Function: +GetX509StackField + +Used by System.Security.Cryptography.X509Certificates' OpenSslX509ChainProcessor to get a pointer to +the indexed member of a chain. + +Return values: +NULL if stack is NULL or loc is out of bounds, otherwise a pointer to the X509 structure encoding +that particular element. +*/ +X509* +GetX509StackField( + STACK_OF(X509)* stack, + int loc) +{ + return sk_X509_value(stack, loc); +} + +/* +Function: +RecursiveFreeX509Stack + +Used by System.Security.Cryptography.X509Certificates' OpenSslX509ChainProcessor to free a stack +when done with it. +*/ +void +RecursiveFreeX509Stack( + STACK_OF(X509)* stack) +{ + sk_X509_pop_free(stack, X509_free); +} |