<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" ><span style="font-size:12pt;" >Hi,</span></div>
<div dir="ltr" > </div>
<div dir="ltr" ><span style="font-size:12pt;" ><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >I am having an issue where the user uploads a certificate with validity period</span> <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >of 25 years which turns out to be year 2045. But the expiry date value wraps around</span> <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >due to overflow and the final time generated is year 1908.</span><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" > Time value is represented as number of seconds since the start of the Unix epoch.</span> <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" > This happens when certificates are listed in GUI by fetching the properties using Redfish (</span></span><a aria-describedby="slack-kit-tooltip" class="c-link" delay="150" href="https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/certificate_service.hpp#L659" rel="noopener noreferrer" style="box-sizing: inherit; color: rgba(var(--sk_highlight,18,100,163),1); text-decoration: none; font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(248, 248, 248);" target="_blank" >https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/certificate_service.hpp#L659</a>)<br><br><span style="font-size:12pt;" ><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >As time_t data structure is defined as int32 it can hold up to a maximum value</span> <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >of 2147483647 which covers certificate validity up to 2038.</span></span></div>
<div dir="ltr" ><br><span style="font-size:12pt;" ><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >Any certificate which is uploaded with expiry year greater than 2038, the</span> <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >seconds value in time_t wraps around and will generate a negative value, which</span> <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >when used expiry date value will be less than 1970.</span></span></div>
<div dir="ltr" ><br><span style="font-size:12pt;" ><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >Example:</span></span></div>
<div dir="ltr" ><div><em><span style="font-size:12pt;" >Mar 10 15:03:49 w5 bmcweb[170]: bmcweb not after 2366947077<br>Mar 10 15:03:49 w5 bmcweb[170]: bmcweb not after 1908-11-26T22:49:41+00:00</span></em></div>
<div> </div></div>
<div dir="ltr" ><span style="font-size:12pt;" ><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >Probable solutions</span></span></div>
<div dir="ltr" ><span style="font-size:12pt;" >1) Do nothing as the chances of uploading a certificate with expiry date > 18 chances never happen<br style="box-sizing: inherit; color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;" ><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >2) R</span><span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >eturn error to the caller if the expirty</span> <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, appleLogo, sans-serif; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;" >date is greater than 2038.<br><br>Would like community feedback on this</span></span></div>
<div dir="ltr" > </div>
<div dir="ltr" ><div dir="ltr" ><span style="font-size:12pt;" ><a aria-describedby="slack-kit-tooltip" class="c-link" delay="150" href="https://stackoverflow.com/questions/6408914/what-is-year-2038-problem-how-to-find-out-if-the-existing-code-has-that-problem" rel="noopener noreferrer" style="box-sizing: inherit; color: rgba(var(--sk_highlight,18,100,163),1); text-decoration: none; font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" target="_blank" >https://stackoverflow.com/questions/6408914/what-is-year-2038-problem-how-to-find-out-if-the-existing-code-has-that-problem</a></span></div>
<div><span style="font-size:12pt;" ><a href="https://github.com/openbmc/phosphor-certificate-manager/issues/14" >https://github.com/openbmc/phosphor-certificate-manager/issues/14<br><br>Regards</a></span></div>
<div><span style="font-size:12pt;" >Devender</span></div></div></div></div><BR>