File 1446-ssl-Add-missing-specs-for-API-functions.patch of Package erlang
From 2d76a937d92ed35993855f00d89169f85c0e6fb5 Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Wed, 10 Jan 2024 08:31:27 +0100
Subject: [PATCH] ssl: Add missing specs for API functions
---
lib/ssl/doc/src/ssl_crl_cache.xml | 25 ++++++-------------------
lib/ssl/src/ssl_crl_cache.erl | 28 ++++++++++++++++++++++------
2 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/lib/ssl/doc/src/ssl_crl_cache.xml b/lib/ssl/doc/src/ssl_crl_cache.xml
index 6fbc1c1afd..2955cb4986 100644
--- a/lib/ssl/doc/src/ssl_crl_cache.xml
+++ b/lib/ssl/doc/src/ssl_crl_cache.xml
@@ -41,36 +41,23 @@
<datatype>
<name name="crl_src"/>
</datatype>
-
- <datatype>
- <name name="uri"/>
- </datatype>
-
</datatypes>
<funcs>
<func>
<name since="OTP 18.0">delete(Entries) -> ok | {error, Reason} </name>
- <fsummary> </fsummary>
- <type>
- <v> Entries = <seetype marker="#crl_src">crl_src()</seetype>]}</v>
- <v> Reason = crl_reason()</v>
- </type>
+ <fsummary> Delete CRLs from the ssl applications local cache.</fsummary>
<desc>
<p>Delete CRLs from the ssl applications local cache. </p>
</desc>
</func>
<func>
- <name since="OTP 18.0">insert(CRLSrc) -> ok | {error, Reason}</name>
- <name since="OTP 18.0">insert(URI, CRLSrc) -> ok | {error, Reason}</name>
- <fsummary> </fsummary>
- <type>
- <v> CRLSrc = <seetype marker="#crl_src">crl_src()</seetype>]}</v>
- <v> URI = <seetype marker="#uri">uri()</seetype> </v>
- <v> Reason = term()</v>
- </type>
+ <name since="OTP 18.0" name="insert" arity="1"></name>
+ <name since="OTP 18.0" name="insert" arity="2"></name>
+ <fsummary> Insert CRLs into the ssl applications local cache.</fsummary>
<desc>
- <p>Insert CRLs, available to fetch on DER format from <c>URI</c>, into the ssl applications local cache. </p>
+ <p>Insert CRLs into the ssl applications local cache, with or without a distribution point
+ reference URI</p>
</desc>
</func>
</funcs>
diff --git a/lib/ssl/src/ssl_crl_cache.erl b/lib/ssl/src/ssl_crl_cache.erl
index c12d829470..d88ca80d90 100644
--- a/lib/ssl/src/ssl_crl_cache.erl
+++ b/lib/ssl/src/ssl_crl_cache.erl
@@ -72,22 +72,38 @@ fresh_crl(#'DistributionPoint'{distributionPoint = {fullName, Names}}, CRL) ->
%% API
%%====================================================================
-insert(CRLs) ->
- insert(?NO_DIST_POINT, CRLs).
+%%--------------------------------------------------------------------
+-spec insert(CRLSrc) -> ok | {error, Reason} when
+ CRLSrc :: crl_src(),
+ Reason :: term().
+%%--------------------------------------------------------------------
+insert(CRLSrc) ->
+ insert(?NO_DIST_POINT, CRLSrc).
-insert(URI, {file, File}) when is_list(URI) ->
+%%--------------------------------------------------------------------
+-spec insert(DistPointURI, CRLSrc) -> ok | {error, Reason} when
+ DistPointURI :: uri_string:uri_string(),
+ CRLSrc :: crl_src(),
+ Reason :: term().
+%%--------------------------------------------------------------------
+insert(DistPointURI, {file, File}) when is_list(DistPointURI) ->
case file:read_file(File) of
{ok, PemBin} ->
PemEntries = public_key:pem_decode(PemBin),
CRLs = [ CRL || {'CertificateList', CRL, not_encrypted}
<- PemEntries],
- do_insert(URI, CRLs);
+ do_insert(DistPointURI, CRLs);
Error ->
Error
end;
-insert(URI, {der, CRLs}) ->
- do_insert(URI, CRLs).
+insert(DistPointURI, {der, CRLs}) ->
+ do_insert(DistPointURI, CRLs).
+%%--------------------------------------------------------------------
+-spec delete(Entries) -> ok | {error, Reason} when
+ Entries :: crl_src() | uri_string:uri_string(),
+ Reason :: term().
+%%--------------------------------------------------------------------
delete({file, File}) ->
case file:read_file(File) of
{ok, PemBin} ->
--
2.35.3