Compare commits
143
Commits
master
...
RC_20240322
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67d5fefcf2 | ||
|
|
aad017be9e | ||
|
|
4543dbf3ff | ||
|
|
b1cb7e0a8f | ||
|
|
1c6d21c97d | ||
|
|
fc42fb38c9 | ||
|
|
618068c15b | ||
|
|
808516a0a8 | ||
|
|
7d6b806040 | ||
|
|
6b4e2c9d73 | ||
|
|
787883f6a4 | ||
|
|
7f02753c04 | ||
|
|
8fa38b3445 | ||
|
|
541c5f9f45 | ||
|
|
4b6bd4976a | ||
|
|
a0843d52b4 | ||
|
|
977a8cbed8 | ||
|
|
1e85085305 | ||
|
|
188f61505f | ||
|
|
a514d7f6a4 | ||
|
|
47c2c75ceb | ||
|
|
7082ec8a9a | ||
|
|
2907a84362 | ||
|
|
b8d1ee05c3 | ||
|
|
0b625e624a | ||
|
|
a4da712f91 | ||
|
|
185f124e87 | ||
|
|
8633077691 | ||
|
|
39a1899045 | ||
|
|
4dc011a187 | ||
|
|
ccb12e1dda | ||
|
|
63f0d3e295 | ||
|
|
09d598c496 | ||
|
|
7e60482d80 | ||
|
|
10b3237e52 | ||
|
|
99af7cc028 | ||
|
|
76b360b5d1 | ||
|
|
4001b58a3e | ||
|
|
134a8aac87 | ||
|
|
3e2e48872a | ||
|
|
622b43cbc5 | ||
|
|
75b44ef620 | ||
|
|
00084ea49c | ||
|
|
b6fae24296 | ||
|
|
13c6b7422d | ||
|
|
24f2e663cd | ||
|
|
f96b155988 | ||
|
|
d5cc24e916 | ||
|
|
8eba271c5f | ||
|
|
19955c82b3 | ||
|
|
80ae8aec7c | ||
|
|
d8441d7c81 | ||
|
|
c2446f2478 | ||
|
|
6efb7a1904 | ||
|
|
fa0b03a10f | ||
|
|
3ae2972950 | ||
|
|
2d48de9998 | ||
|
|
3b029cdfe4 | ||
|
|
ea9077a8a5 | ||
|
|
b4af6b6265 | ||
|
|
ae1d53ceb1 | ||
|
|
c3f4709d5e | ||
|
|
a7bb3fc175 | ||
|
|
6a0203f25f | ||
|
|
b0dfcb147f | ||
|
|
06fd4c9357 | ||
|
|
b9ea7fd9ee | ||
|
|
58308a5c7a | ||
|
|
88c7d54975 | ||
|
|
eadb5678b3 | ||
|
|
54e3e60796 | ||
|
|
2a05494abe | ||
|
|
bc89e58def | ||
|
|
3a009b97f6 | ||
|
|
a105f6d5e9 | ||
|
|
5db241c0c0 | ||
|
|
d38dca10e5 | ||
|
|
54fc723126 | ||
|
|
9b8ca17ee4 | ||
|
|
cddc95b39b | ||
|
|
5676529793 | ||
|
|
ce68156cf4 | ||
|
|
5032ad9593 | ||
|
|
b55f765f2e | ||
|
|
856078d435 | ||
|
|
c74c262d2f | ||
|
|
787e29e374 | ||
|
|
e439896c9b | ||
|
|
15b508f1fb | ||
|
|
5651ebfc76 | ||
|
|
593bfc1ce8 | ||
|
|
28953cda7a | ||
|
|
516f3f545d | ||
|
|
83aff65a42 | ||
|
|
5bd97df957 | ||
|
|
8772711181 | ||
|
|
dc9526f4c6 | ||
|
|
9ab36e7ae0 | ||
|
|
e8d30841e7 | ||
|
|
9faf29374e | ||
|
|
75e4818d36 | ||
|
|
a65144e9e0 | ||
|
|
4f29548526 | ||
|
|
528db2cbd8 | ||
|
|
84e6bcc1e6 | ||
|
|
0dc9ff518d | ||
|
|
a2e3bd44aa | ||
|
|
163a0e7caf | ||
|
|
49a86db5f3 | ||
|
|
2640953d8b | ||
|
|
7eb7d67f7a | ||
|
|
e28860ba7f | ||
|
|
49a96b1d91 | ||
|
|
3130812693 | ||
|
|
71ae69aea8 | ||
|
|
9e34d697c7 | ||
|
|
8fa9125d02 | ||
|
|
4b4488c3e4 | ||
|
|
248db7d301 | ||
|
|
e199f2949b | ||
|
|
456b5450a4 | ||
|
|
d8e629c4a3 | ||
|
|
4898c4f297 | ||
|
|
7cd578bbc6 | ||
|
|
1e91df628a | ||
|
|
b110549cbd | ||
|
|
971047835a | ||
|
|
dd4d9eb032 | ||
|
|
8b94f1e480 | ||
|
|
c89610a5c7 | ||
|
|
217963cbed | ||
|
|
c4f4e18340 | ||
|
|
8a7c0e7345 | ||
|
|
52e304d450 | ||
|
|
cfc0eeca53 | ||
|
|
ebd3dd9228 | ||
|
|
cb40e4e7ef | ||
|
|
662dba55fd | ||
|
|
8760ce023c | ||
|
|
b86e148bb7 | ||
|
|
9e83721e5e | ||
|
|
dc2d6c2e60 | ||
|
|
4ada6f6762 |
No files matched your search
@@ -46,8 +46,6 @@ loader.lazyRequireGetter(this, "InspectorFront",
|
||||
"devtools/shared/fronts/inspector", true);
|
||||
loader.lazyRequireGetter(this, "flags",
|
||||
"devtools/shared/flags");
|
||||
loader.lazyRequireGetter(this, "showDoorhanger",
|
||||
"devtools/client/shared/doorhanger", true);
|
||||
loader.lazyRequireGetter(this, "createPerformanceFront",
|
||||
"devtools/shared/fronts/performance", true);
|
||||
loader.lazyRequireGetter(this, "system",
|
||||
@@ -2184,14 +2182,16 @@ Toolbox.prototype = {
|
||||
.then(() => {
|
||||
this._removeHostListeners();
|
||||
|
||||
// `location` may already be null if the toolbox document is already
|
||||
// in process of destruction. Otherwise if it is still around, ensure
|
||||
// releasing toolbox document and triggering cleanup thanks to unload
|
||||
// event. We do that precisely here, before nullifying the target as
|
||||
// various cleanup code depends on the target attribute to be still
|
||||
// defined.
|
||||
if (win.location) {
|
||||
// `location` may already be invalid if the toolbox document is
|
||||
// already in process of destruction. Otherwise if it is still
|
||||
// around, ensure releasing toolbox document and triggering cleanup
|
||||
// thanks to unload event. We do that precisely here, before
|
||||
// nullifying the target as various cleanup code depends on the
|
||||
// target attribute to be still defined.
|
||||
try {
|
||||
win.location.replace("about:blank");
|
||||
} catch (e) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
// Targets need to be notified that the toolbox is being torn down.
|
||||
|
||||
@@ -8,7 +8,6 @@ const Cu = Components.utils;
|
||||
|
||||
var {loader, require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||
var Telemetry = require("devtools/client/shared/telemetry");
|
||||
var {showDoorhanger} = require("devtools/client/shared/doorhanger");
|
||||
var {TouchEventSimulator} = require("devtools/shared/touch/simulator");
|
||||
var {Task} = require("devtools/shared/task");
|
||||
var promise = require("promise");
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { Ci, Cc } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm");
|
||||
const { Task } = require("devtools/shared/task");
|
||||
const defer = require("devtools/shared/defer");
|
||||
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
|
||||
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const LOCALE = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIXULChromeRegistry)
|
||||
.getSelectedLocale("global");
|
||||
|
||||
var TYPES = {
|
||||
// We don't support any doorhanger types at the moment.
|
||||
// This is vestigial from the FF dev edition promo.
|
||||
};
|
||||
|
||||
var panelAttrs = {
|
||||
orient: "vertical",
|
||||
hidden: "false",
|
||||
consumeoutsideclicks: "true",
|
||||
noautofocus: "true",
|
||||
align: "start",
|
||||
role: "alert"
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to call a doorhanger, defined in `TYPES`, with defined conditions,
|
||||
* success handlers and loads its own XUL in a frame. Takes an object with
|
||||
* several properties:
|
||||
*
|
||||
* @param {XULWindow} window
|
||||
* The window that should house the doorhanger.
|
||||
* @param {String} type
|
||||
* The type of doorhanger to be displayed is, using the `TYPES`
|
||||
* definition.
|
||||
* @param {String} selector
|
||||
* The selector that the doorhanger should be appended to within
|
||||
* `window`. Defaults to a XUL Document's `window` element.
|
||||
*/
|
||||
exports.showDoorhanger = Task.async(function* ({ window, type, anchor }) {
|
||||
let { predicate, success, url, action } = TYPES[type];
|
||||
// Abort if predicate fails
|
||||
if (!predicate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Call success function to set preferences/cleanup immediately,
|
||||
// so if triggered multiple times, only happens once (Windows/Linux)
|
||||
success();
|
||||
|
||||
// Wait 200ms to prevent flickering where the popup is displayed
|
||||
// before the underlying window (Windows 7, 64bit)
|
||||
yield wait(200);
|
||||
|
||||
let document = window.document;
|
||||
|
||||
let panel = document.createElementNS(XULNS, "panel");
|
||||
let frame = document.createElementNS(XULNS, "iframe");
|
||||
let parentEl = document.querySelector("window");
|
||||
|
||||
frame.setAttribute("src", url);
|
||||
let close = () => parentEl.removeChild(panel);
|
||||
|
||||
setDoorhangerStyle(panel, frame);
|
||||
|
||||
panel.appendChild(frame);
|
||||
parentEl.appendChild(panel);
|
||||
|
||||
yield onFrameLoad(frame);
|
||||
|
||||
panel.openPopup(anchor);
|
||||
|
||||
let closeBtn = frame.contentDocument.querySelector("#close");
|
||||
if (closeBtn) {
|
||||
closeBtn.addEventListener("click", close);
|
||||
}
|
||||
|
||||
let goBtn = frame.contentDocument.querySelector("#go");
|
||||
if (goBtn) {
|
||||
goBtn.addEventListener("click", () => {
|
||||
if (action) {
|
||||
action();
|
||||
}
|
||||
close();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function setDoorhangerStyle(panel, frame) {
|
||||
Object.keys(panelAttrs).forEach(prop => {
|
||||
return panel.setAttribute(prop, panelAttrs[prop]);
|
||||
});
|
||||
panel.style.margin = "20px";
|
||||
panel.style.borderRadius = "5px";
|
||||
panel.style.border = "none";
|
||||
panel.style.MozAppearance = "none";
|
||||
panel.style.backgroundColor = "transparent";
|
||||
|
||||
frame.style.borderRadius = "5px";
|
||||
frame.setAttribute("flex", "1");
|
||||
frame.setAttribute("width", "450");
|
||||
frame.setAttribute("height", "179");
|
||||
}
|
||||
|
||||
function onFrameLoad(frame) {
|
||||
let { resolve, promise } = defer();
|
||||
|
||||
if (frame.contentWindow) {
|
||||
let domHelper = new DOMHelpers(frame.contentWindow);
|
||||
domHelper.onceDOMReady(resolve);
|
||||
} else {
|
||||
let callback = () => {
|
||||
frame.removeEventListener("DOMContentLoaded", callback);
|
||||
resolve();
|
||||
};
|
||||
frame.addEventListener("DOMContentLoaded", callback);
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
function getGBrowser() {
|
||||
return getMostRecentBrowserWindow().gBrowser;
|
||||
}
|
||||
|
||||
function wait(n) {
|
||||
let { resolve, promise } = defer();
|
||||
setTimeout(resolve, n);
|
||||
return promise;
|
||||
}
|
||||
@@ -26,7 +26,6 @@ DevToolsModules(
|
||||
'devices.js',
|
||||
'devtools-file-watcher.js',
|
||||
'DOMHelpers.jsm',
|
||||
'doorhanger.js',
|
||||
'file-watcher-worker.js',
|
||||
'file-watcher.js',
|
||||
'getjson.js',
|
||||
|
||||
@@ -19,7 +19,6 @@ loader.lazyRequireGetter(this, "WebConsoleFrame", "devtools/client/webconsole/we
|
||||
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
|
||||
loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
|
||||
loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/main", true);
|
||||
loader.lazyRequireGetter(this, "showDoorhanger", "devtools/client/shared/doorhanger", true);
|
||||
loader.lazyRequireGetter(this, "viewSource", "devtools/client/shared/view-source");
|
||||
|
||||
const STRINGS_URI = "devtools/client/locales/webconsole.properties";
|
||||
|
||||
@@ -426,6 +426,17 @@ SVGUseElement::LookupHref()
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
|
||||
GetComposedDoc(), baseURI);
|
||||
|
||||
// Do not allow 'data:' schemes in <use> elements.
|
||||
// See spec update: https://github.com/w3c/svgwg/pull/901
|
||||
if (targetURI) {
|
||||
bool isData;
|
||||
mozilla::Unused << targetURI->SchemeIs("data", &isData);
|
||||
if (isData) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mSource.Reset(this, targetURI);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ WORKER_SIMPLE_PREF("browser.dom.window.dump.enabled", DumpEnabled, DUMP)
|
||||
WORKER_SIMPLE_PREF("canvas.imagebitmap_extensions.enabled", ImageBitmapExtensionsEnabled, IMAGEBITMAP_EXTENSIONS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.caches.enabled", DOMCachesEnabled, DOM_CACHES)
|
||||
WORKER_SIMPLE_PREF("dom.caches.testing.enabled", DOMCachesTestingEnabled, DOM_CACHES_TESTING)
|
||||
WORKER_SIMPLE_PREF("dom.min_timeout_value", DOMMinTimeoutValue, DOM_MIN_TIMEOUT_VALUE)
|
||||
WORKER_SIMPLE_PREF("dom.performance.enable_user_timing_logging", PerformanceLoggingEnabled, PERFORMANCE_LOGGING_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.webnotifications.enabled", DOMWorkerNotificationEnabled, DOM_WORKERNOTIFICATION)
|
||||
WORKER_SIMPLE_PREF("dom.webnotifications.serviceworker.enabled", DOMServiceWorkerNotificationEnabled, DOM_SERVICEWORKERNOTIFICATION)
|
||||
|
||||
@@ -171,6 +171,8 @@ const nsIID kDEBUGWorkerEventTargetIID = {
|
||||
|
||||
// The number of nested timeouts before we start clamping. HTML says 5.
|
||||
const uint32_t kClampTimeoutNestingLevel = 5u;
|
||||
// The minimum interval we clamp timers in workers to. HTML says 4ms.
|
||||
const uint32_t kClampTimeoutInterval = 4u;
|
||||
|
||||
template <class T>
|
||||
class AutoPtrComparator
|
||||
@@ -1997,20 +1999,10 @@ struct WorkerPrivate::TimeoutInfo
|
||||
|
||||
void CalculateTargetTime(JSContext* aCx) {
|
||||
auto target = mInterval;
|
||||
int32_t minTimeoutValue;
|
||||
|
||||
// We're on a worker thread; go through WorkerPrivate for the pref.
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (workerPrivate) {
|
||||
minTimeoutValue = workerPrivate->DOMMinTimeoutValue();
|
||||
} else {
|
||||
// fall back to default 4 ms
|
||||
minTimeoutValue = 4;
|
||||
}
|
||||
|
||||
|
||||
// Clamp timeout for workers, except chrome workers
|
||||
if (mNestingLevel >= kClampTimeoutNestingLevel && !mOnChromeWorker) {
|
||||
target = TimeDuration::Max(mInterval,TimeDuration::FromMilliseconds(minTimeoutValue));
|
||||
target = TimeDuration::Max(mInterval, TimeDuration::FromMilliseconds(kClampTimeoutInterval));
|
||||
}
|
||||
mTargetTime = TimeStamp::Now() + target;
|
||||
}
|
||||
@@ -5169,7 +5161,9 @@ WorkerPrivate::ScheduleDeletion(WorkerRanOrNot aRanOrNot)
|
||||
if (WorkerRan == aRanOrNot) {
|
||||
nsIThread* currentThread = NS_GetCurrentThread();
|
||||
MOZ_ASSERT(currentThread);
|
||||
MOZ_ASSERT(!NS_HasPendingEvents(currentThread));
|
||||
// On the worker thread WorkerRunnable will refuse to run if not nested
|
||||
// on top of a WorkerThreadPrimaryRunnable.
|
||||
Unused << NS_WARN_IF(NS_HasPendingEvents(currentThread));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/Unused.h"
|
||||
@@ -231,6 +232,19 @@ WorkerRunnable::Run()
|
||||
bool targetIsWorkerThread = mBehavior == WorkerThreadModifyBusyCount ||
|
||||
mBehavior == WorkerThreadUnchangedBusyCount;
|
||||
|
||||
if (targetIsWorkerThread) {
|
||||
// On a worker thread, a WorkerRunnable should only run when there is an
|
||||
// underlying WorkerThreadPrimaryRunnable active, which means we should
|
||||
// find a CycleCollectedJSContext.
|
||||
if (!CycleCollectedJSContext::Get()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false,
|
||||
"A WorkerRunnable was executed after "
|
||||
"WorkerThreadPrimaryRunnable ended.");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT_IF(mCallingCancelWithinRun, targetIsWorkerThread);
|
||||
if (targetIsWorkerThread) {
|
||||
|
||||
@@ -591,8 +591,16 @@ gfxFontShaper::GetRoundOffsetsToPixels(DrawTarget* aDrawTarget,
|
||||
}
|
||||
|
||||
// Sometimes hint metrics gets set for us, most notably for printing.
|
||||
#ifdef MOZ_TREE_CAIRO
|
||||
cairo_hint_metrics_t hint_metrics =
|
||||
cairo_scaled_font_get_hint_metrics(scaled_font);
|
||||
#else
|
||||
cairo_font_options_t* font_options = cairo_font_options_create();
|
||||
cairo_scaled_font_get_font_options(scaled_font, font_options);
|
||||
cairo_hint_metrics_t hint_metrics =
|
||||
cairo_font_options_get_hint_metrics(font_options);
|
||||
cairo_font_options_destroy(font_options);
|
||||
#endif
|
||||
|
||||
switch (hint_metrics) {
|
||||
case CAIRO_HINT_METRICS_OFF:
|
||||
|
||||
@@ -52,7 +52,7 @@ function ModuleGetExportedNames(exportStarSet = [])
|
||||
for (let i = 0; i < starExportEntries.length; i++) {
|
||||
let e = starExportEntries[i];
|
||||
let requestedModule = CallModuleResolveHook(module, e.moduleRequest,
|
||||
MODULE_STATE_INSTANTIATED);
|
||||
MODULE_STATUS_INSTANTIATED);
|
||||
let starNames = callFunction(requestedModule.getExportedNames, requestedModule,
|
||||
exportStarSet);
|
||||
for (let j = 0; j < starNames.length; j++) {
|
||||
|
||||
@@ -529,7 +529,7 @@ void PolyArea::Draw(nsIFrame* aFrame, DrawTarget& aDrawTarget,
|
||||
Point p1(pc->CSSPixelsToDevPixels(mCoords[0]),
|
||||
pc->CSSPixelsToDevPixels(mCoords[1]));
|
||||
Point p2, p1snapped, p2snapped;
|
||||
for (int32_t i = 2; i < mNumCoords; i += 2) {
|
||||
for (int32_t i = 2; i < mNumCoords - 1; i += 2) {
|
||||
p2.x = pc->CSSPixelsToDevPixels(mCoords[i]);
|
||||
p2.y = pc->CSSPixelsToDevPixels(mCoords[i+1]);
|
||||
p1snapped = p1;
|
||||
@@ -556,7 +556,7 @@ void PolyArea::GetRect(nsIFrame* aFrame, nsRect& aRect)
|
||||
nscoord x1, x2, y1, y2, xtmp, ytmp;
|
||||
x1 = x2 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
|
||||
y1 = y2 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
|
||||
for (int32_t i = 2; i < mNumCoords; i += 2) {
|
||||
for (int32_t i = 2; i < mNumCoords - 1; i += 2) {
|
||||
xtmp = nsPresContext::CSSPixelsToAppUnits(mCoords[i]);
|
||||
ytmp = nsPresContext::CSSPixelsToAppUnits(mCoords[i+1]);
|
||||
x1 = x1 < xtmp ? x1 : xtmp;
|
||||
|
||||
+1
-2
@@ -214,8 +214,7 @@ public:
|
||||
RefPtr<T>&
|
||||
operator=(RefPtr<T> && aRefPtr)
|
||||
{
|
||||
assign_assuming_AddRef(aRefPtr.mRawPtr);
|
||||
aRefPtr.mRawPtr = nullptr;
|
||||
assign_assuming_AddRef(aRefPtr.forget().take());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -3891,7 +3891,7 @@ pref("browser.drag_out_of_frame_style", 1);
|
||||
|
||||
// Middle-mouse handling
|
||||
pref("middlemouse.paste", true);
|
||||
pref("middlemouse.contentLoadURL", true);
|
||||
pref("middlemouse.contentLoadURL", false);
|
||||
pref("middlemouse.openNewWindow", true);
|
||||
pref("middlemouse.scrollbarPosition", true);
|
||||
|
||||
|
||||
@@ -1018,11 +1018,14 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("content-disposition")) {
|
||||
mContentDisposition = headerVal;
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("set-cookie")) {
|
||||
// Do not allow cookies to be set from multipart/mixed content parts
|
||||
// as a mitigation to CVE-2024-1551
|
||||
/*
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpInternal =
|
||||
do_QueryInterface(aChannel);
|
||||
if (httpInternal) {
|
||||
httpInternal->SetCookie(headerVal.get());
|
||||
}
|
||||
}*/
|
||||
} else if (headerStr.LowerCaseEqualsLiteral("content-range") ||
|
||||
headerStr.LowerCaseEqualsLiteral("range") ) {
|
||||
// something like: Content-range: bytes 7000-7999/8000
|
||||
|
||||
@@ -330,6 +330,8 @@ nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
|
||||
nsHtml5HtmlAttributes* aAttributes,
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
MOZ_ASSERT(aNode->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::html));
|
||||
|
||||
dom::Element* node = aNode->AsElement();
|
||||
nsHtml5OtherDocUpdate update(node->OwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
@@ -342,7 +344,8 @@ nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
|
||||
nsCOMPtr<nsIAtom> localName =
|
||||
Reget(aAttributes->getLocalNameNoBoundsCheck(i));
|
||||
int32_t nsuri = aAttributes->getURINoBoundsCheck(i);
|
||||
if (!node->HasAttr(nsuri, localName)) {
|
||||
if (!node->HasAttr(nsuri, localName) &&
|
||||
!(nsuri == kNameSpaceID_None && localName == nsGkAtoms::nonce)) {
|
||||
// prefix doesn't need regetting. it is always null or a static atom
|
||||
// local name is never null
|
||||
nsString value; // Not Auto, because using it to hold nsStringBuffer*
|
||||
|
||||
@@ -38,7 +38,7 @@ tasks:
|
||||
description: |
|
||||
The task that creates all of the other tasks in the task graph
|
||||
|
||||
workerType: "linux"
|
||||
workerType: "linux-gcp"
|
||||
provisionerId: "nss-${repository.level}"
|
||||
|
||||
scopes:
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
1 Added function:
|
||||
|
||||
'function PRStatus PR_GetPrefLoopbackAddrInfo(PRNetAddr*, PRUint16)' {PR_GetPrefLoopbackAddrInfo}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
1 Added function:
|
||||
|
||||
'function PRBool SECMOD_LockedModuleHasRemovableSlots(SECMODModule*)' {SECMOD_LockedModuleHasRemovableSlots@@NSS_3.79}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
1 Added function:
|
||||
|
||||
'function void NSS_SecureSelect(void*, void*, void*, size_t, unsigned char)' {NSS_SecureSelect@@NSSUTIL_3.90}
|
||||
|
||||
@@ -1 +1 @@
|
||||
NSS_3_78_BRANCH
|
||||
NSS_3_89_BRANCH
|
||||
@@ -5,7 +5,7 @@ LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
clang-format-3.9 \
|
||||
clang-format-10 \
|
||||
locales \
|
||||
python-dev \
|
||||
python-pip \
|
||||
@@ -19,7 +19,7 @@ RUN pip install mercurial==6.1.1
|
||||
|
||||
|
||||
RUN update-alternatives --install /usr/bin/clang-format \
|
||||
clang-format $(which clang-format-3.9) 10
|
||||
clang-format $(which clang-format-10) 10
|
||||
|
||||
ENV SHELL /bin/bash
|
||||
ENV USER worker
|
||||
|
||||
@@ -13,7 +13,7 @@ set -e
|
||||
# Any differences between formatted and unformatted files is printed to stdout to give a hint what's wrong.
|
||||
|
||||
# Includes a default set of directories NOT to clang-format on.
|
||||
blacklist=(
|
||||
blocklist=(
|
||||
"./automation" \
|
||||
"./coreconf" \
|
||||
"./doc" \
|
||||
@@ -37,8 +37,8 @@ fi
|
||||
|
||||
format_folder()
|
||||
{
|
||||
for black in "${blacklist[@]}"; do
|
||||
if [[ "$1" == "$black"* ]]; then
|
||||
for block in "${blocklist[@]}"; do
|
||||
if [[ "$1" == "$block"* ]]; then
|
||||
echo "skip $1"
|
||||
return 1
|
||||
fi
|
||||
@@ -54,7 +54,7 @@ for dir in "${dirs[@]}"; do
|
||||
if [ "${#c}" == "1" ]; then
|
||||
depth+=(-maxdepth 1)
|
||||
fi
|
||||
find "$dir" "${depth[@]}" -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -i {} \+
|
||||
find "$dir" "${depth[@]}" -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -sort-includes=false -i {} \+
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
4.34.1
|
||||
4.35
|
||||
|
||||
# The first line of this file must contain the human readable NSPR
|
||||
# version number, which is the minimum required version of NSPR
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
bmul : {n,m} (fin n, n >= 1, m == n*2 - 1) => [n] -> [n] -> ([n], [n])
|
||||
bmul a b = (take`{n} prod, drop`{n} prod)
|
||||
where prod = pad (pmult a b : [m])
|
||||
pad x = zero # x
|
||||
@@ -1,26 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import "bmul.cry";
|
||||
|
||||
print "Loading LLVM bitcode...";
|
||||
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
|
||||
|
||||
let SpecBinaryMul n = do {
|
||||
x <- llvm_var "x" (llvm_int n);
|
||||
y <- llvm_var "y" (llvm_int n);
|
||||
llvm_ptr "r_high" (llvm_int n);
|
||||
r_high <- llvm_var "*r_high" (llvm_int n);
|
||||
llvm_ptr "r_low" (llvm_int n);
|
||||
r_low <- llvm_var "*r_low" (llvm_int n);
|
||||
|
||||
let res = {{ bmul x y }};
|
||||
llvm_ensure_eq "*r_high" {{ res.0 }};
|
||||
llvm_ensure_eq "*r_low" {{ res.1 }};
|
||||
|
||||
llvm_verify_tactic abc;
|
||||
};
|
||||
|
||||
print "Proving equality for 32-bit bmul()...";
|
||||
time (llvm_verify m "bmul32" [] (SpecBinaryMul 32));
|
||||
@@ -1,357 +0,0 @@
|
||||
/*
|
||||
** ChaCha20 specification
|
||||
** Author: Austin Seipp <aseipp@pobox.com>. Released in the Public Domain.
|
||||
**
|
||||
** Based on RFC 7539 - "ChaCha20 and Poly1305 for IETF Protocols"
|
||||
** https://tools.ietf.org/html/rfc7539
|
||||
*/
|
||||
module chacha20 where
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -- Implementation -------------------------------------------------------- */
|
||||
|
||||
type Round = [16][32] // An input to the ChaCha20 core function
|
||||
type Block = [64][8] // An output block from the ChaCha20 core function.
|
||||
type Key = [32][8] // A 32-byte input key
|
||||
type Nonce = [12][8] // A 12-byte nonce
|
||||
type Counter = [32] // Starting block counter. Usually 1 or 0.
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* -- Quarter Round ----------------- */
|
||||
|
||||
// The quarter round. This takes 4 32-bit integers and diffuses them
|
||||
// appropriately, and is the core of the column and diagonal round.
|
||||
qround : [4][32] -> [4][32]
|
||||
qround [ a0, b0, c0, d0 ] = [ a2, b4, c2, d4 ]
|
||||
where
|
||||
a1 = a0 + b0 /* a += b; d ^= a; d <<<= 16 */
|
||||
d1 = d0 ^ a1
|
||||
d2 = d1 <<< 16
|
||||
|
||||
c1 = c0 + d2 /* c += d; b ^= c; b <<<= 12 */
|
||||
b1 = b0 ^ c1
|
||||
b2 = b1 <<< 12
|
||||
|
||||
a2 = a1 + b2 /* a += b; d ^= a; d <<<= 8 */
|
||||
d3 = d2 ^ a2
|
||||
d4 = d3 <<< 8
|
||||
|
||||
c2 = c1 + d4 /* c += d; b ^= c; b <<<= 7 */
|
||||
b3 = b2 ^ c2
|
||||
b4 = b3 <<< 7
|
||||
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* -- Column and diagonal rounds ---- */
|
||||
|
||||
// Perform the column round, followed by the diagonal round on the
|
||||
// input state, which are both defined in terms of the quarter
|
||||
// round. ChaCha20 requires 20 total rounds of interleaving
|
||||
// column/diagonal passes on the state, and therefore `cdround` actually
|
||||
// does two passes at once (mostly for simplicity).
|
||||
cdround : Round -> Round
|
||||
cdround [ x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15 ]
|
||||
= [ z0, z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13, z14, z15 ]
|
||||
where
|
||||
// Column round
|
||||
[ y0, y4, y8, y12 ] = qround [ x0, x4, x8, x12 ]
|
||||
[ y1, y5, y9, y13 ] = qround [ x1, x5, x9, x13 ]
|
||||
[ y2, y6, y10, y14 ] = qround [ x2, x6, x10, x14 ]
|
||||
[ y3, y7, y11, y15 ] = qround [ x3, x7, x11, x15 ]
|
||||
|
||||
// Diagonal round
|
||||
[ z0, z5, z10, z15 ] = qround [ y0, y5, y10, y15 ]
|
||||
[ z1, z6, z11, z12 ] = qround [ y1, y6, y11, y12 ]
|
||||
[ z2, z7, z8, z13 ] = qround [ y2, y7, y8, y13 ]
|
||||
[ z3, z4, z9, z14 ] = qround [ y3, y4, y9, y14 ]
|
||||
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* -- Block encryption -------------- */
|
||||
|
||||
// Given an input round, calculate the core ChaCha20 algorithm over
|
||||
// the round and return an output block. These output blocks form the
|
||||
// stream which you XOR your plaintext with, and successive iterations of
|
||||
// the core algorithm result in an infinite stream you can use as a
|
||||
// cipher.
|
||||
core : Round -> Block
|
||||
core x = block
|
||||
where
|
||||
rounds = iterate cdround x // Do a bunch of column/diagonal passes...
|
||||
result = rounds @ 10 // And grab the 10th result (20 total passes)
|
||||
block = blocked (x + result) // Add to input, convert to output block
|
||||
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* -- Key Expansion ----------------- */
|
||||
|
||||
// Key expansion. Given a nonce and a key, compute a round (which is
|
||||
// fed to the core algorithm above) by taking the initial round state and
|
||||
// mixing in the key and nonce appropriately.
|
||||
kexp : Key -> Counter -> Nonce -> Round
|
||||
kexp k c n = [ c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15 ]
|
||||
where
|
||||
// The following describes the layout of the output round, which
|
||||
// is fed into the core algorithm successively.
|
||||
|
||||
// Bytes 0-3: Constants
|
||||
[ c0, c1, c2, c3 ] = [ 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574 ]
|
||||
|
||||
// Bytes 4-11: Key
|
||||
[ c4, c5, c6, c7 ] = map rjoin (groupBy`{4} kslice1 : [4][4][8]) : [4][32]
|
||||
[ c8, c9, c10, c11 ] = map rjoin (groupBy`{4} kslice2 : [4][4][8]) : [4][32]
|
||||
kslice1 = k @@ ([ 0 .. 15 ] : [16][32]) // Top half
|
||||
kslice2 = k @@ ([ 16 .. 31 ] : [16][32]) // Bottom half
|
||||
|
||||
// Bytes 12: Counter, starts off with whatever the user specified
|
||||
// (usually 0 or 1)
|
||||
[ c12 ] = [ c ]
|
||||
|
||||
// Bytes 14-15: Nonce
|
||||
[ c13, c14, c15 ] = map rjoin (groupBy`{4} n)
|
||||
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* -- Round increments -------------- */
|
||||
|
||||
// Take a given number of iterations and the input round (after key
|
||||
// expansion!), and calculate the input round for the core algorithm
|
||||
// function. This allows you to index into a particular Round which
|
||||
// can be passed to the 'core' function.
|
||||
iround : [64] -> Round -> Round
|
||||
iround n r = (iterate once r) @ n where
|
||||
// Given a round, increment the counter inside (index no 12)
|
||||
once [ x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15 ]
|
||||
= [ x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12+1, x13, x14, x15 ]
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* -- ChaCha20 encryption ----------- */
|
||||
|
||||
// Produce a psuedo-random stream given a nonce and a key, which can
|
||||
// be XOR'd with your data to encrypt it.
|
||||
stream : {n} (fin n) => Key -> Counter -> Nonce -> [n][8]
|
||||
stream k c n = take`{n} (join rounds) // Take n bytes from the final result
|
||||
where
|
||||
// Expand key
|
||||
key = kexp k c n
|
||||
|
||||
// Produce the stream by successively incrementing the input round
|
||||
// by `i`, and running the core algorithm to get the resulting
|
||||
// stream for the `i`th input. Once these are concatenated, you have
|
||||
// an infinite list representing the ChaCha20 stream.
|
||||
rounds = [ core (iround i key) | i <- [ 0, 1 ... ] ]
|
||||
|
||||
|
||||
// Given an message, a nonce, and a key, produce an encrypted
|
||||
// message. This is simply defined as the XOR of the message and the
|
||||
// corresponding encryption stream.
|
||||
encrypt : {n} (fin n) => Key -> Counter -> Nonce -> [n][8] -> [n][8]
|
||||
encrypt k c n m = m ^ (stream k c n)
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -- Theorems, tests ------------------------------------------------------- */
|
||||
|
||||
// Tests are private
|
||||
private
|
||||
qround01 = qround in == out
|
||||
where
|
||||
in = [ 0x11111111, 0x01020304, 0x9b8d6f43, 0x01234567 ]
|
||||
out = [ 0xea2a92f4, 0xcb1cf8ce, 0x4581472e, 0x5881c4bb ]
|
||||
|
||||
core01 = kexp k 1 n == out
|
||||
where
|
||||
n = [ 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4a,
|
||||
0x00, 0x00, 0x00, 0x00 ]
|
||||
k = [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f ]
|
||||
out = [ 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574,
|
||||
0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c,
|
||||
0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c,
|
||||
0x00000001, 0x09000000, 0x4a000000, 0x00000000 ]
|
||||
|
||||
core02 = core (kexp k 1 n) == out
|
||||
where
|
||||
n = [ 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4a,
|
||||
0x00, 0x00, 0x00, 0x00 ]
|
||||
k = [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f ]
|
||||
out = [ 0x10, 0xf1, 0xe7, 0xe4, 0xd1, 0x3b, 0x59, 0x15,
|
||||
0x50, 0x0f, 0xdd, 0x1f, 0xa3, 0x20, 0x71, 0xc4,
|
||||
0xc7, 0xd1, 0xf4, 0xc7, 0x33, 0xc0, 0x68, 0x03,
|
||||
0x04, 0x22, 0xaa, 0x9a, 0xc3, 0xd4, 0x6c, 0x4e,
|
||||
0xd2, 0x82, 0x64, 0x46, 0x07, 0x9f, 0xaa, 0x09,
|
||||
0x14, 0xc2, 0xd7, 0x05, 0xd9, 0x8b, 0x02, 0xa2,
|
||||
0xb5, 0x12, 0x9c, 0xd1, 0xde, 0x16, 0x4e, 0xb9,
|
||||
0xcb, 0xd0, 0x83, 0xe8, 0xa2, 0x50, 0x3c, 0x4e ]
|
||||
|
||||
rfctest01 = encrypt zero zero zero zero
|
||||
== [ 0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90, 0x40, 0x5d,
|
||||
0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28, 0xbd, 0xd2, 0x19, 0xb8,
|
||||
0xa0, 0x8d, 0xed, 0x1a, 0xa8, 0x36, 0xef, 0xcc, 0x8b, 0x77,
|
||||
0x0d, 0xc7, 0xda, 0x41, 0x59, 0x7c, 0x51, 0x57, 0x48, 0x8d,
|
||||
0x77, 0x24, 0xe0, 0x3f, 0xb8, 0xd8, 0x4a, 0x37, 0x6a, 0x43,
|
||||
0xb8, 0xf4, 0x15, 0x18, 0xa1, 0x1c, 0xc3, 0x87, 0xb6, 0x69,
|
||||
0xb2, 0xee, 0x65, 0x86 ]
|
||||
|
||||
rfctest02 = encrypt (zero # [1]) 1 (zero # [2]) msg == out
|
||||
where
|
||||
out = [ 0xa3, 0xfb, 0xf0, 0x7d, 0xf3, 0xfa, 0x2f, 0xde, 0x4f, 0x37,
|
||||
0x6c, 0xa2, 0x3e, 0x82, 0x73, 0x70, 0x41, 0x60, 0x5d, 0x9f,
|
||||
0x4f, 0x4f, 0x57, 0xbd, 0x8c, 0xff, 0x2c, 0x1d, 0x4b, 0x79,
|
||||
0x55, 0xec, 0x2a, 0x97, 0x94, 0x8b, 0xd3, 0x72, 0x29, 0x15,
|
||||
0xc8, 0xf3, 0xd3, 0x37, 0xf7, 0xd3, 0x70, 0x05, 0x0e, 0x9e,
|
||||
0x96, 0xd6, 0x47, 0xb7, 0xc3, 0x9f, 0x56, 0xe0, 0x31, 0xca,
|
||||
0x5e, 0xb6, 0x25, 0x0d, 0x40, 0x42, 0xe0, 0x27, 0x85, 0xec,
|
||||
0xec, 0xfa, 0x4b, 0x4b, 0xb5, 0xe8, 0xea, 0xd0, 0x44, 0x0e,
|
||||
0x20, 0xb6, 0xe8, 0xdb, 0x09, 0xd8, 0x81, 0xa7, 0xc6, 0x13,
|
||||
0x2f, 0x42, 0x0e, 0x52, 0x79, 0x50, 0x42, 0xbd, 0xfa, 0x77,
|
||||
0x73, 0xd8, 0xa9, 0x05, 0x14, 0x47, 0xb3, 0x29, 0x1c, 0xe1,
|
||||
0x41, 0x1c, 0x68, 0x04, 0x65, 0x55, 0x2a, 0xa6, 0xc4, 0x05,
|
||||
0xb7, 0x76, 0x4d, 0x5e, 0x87, 0xbe, 0xa8, 0x5a, 0xd0, 0x0f,
|
||||
0x84, 0x49, 0xed, 0x8f, 0x72, 0xd0, 0xd6, 0x62, 0xab, 0x05,
|
||||
0x26, 0x91, 0xca, 0x66, 0x42, 0x4b, 0xc8, 0x6d, 0x2d, 0xf8,
|
||||
0x0e, 0xa4, 0x1f, 0x43, 0xab, 0xf9, 0x37, 0xd3, 0x25, 0x9d,
|
||||
0xc4, 0xb2, 0xd0, 0xdf, 0xb4, 0x8a, 0x6c, 0x91, 0x39, 0xdd,
|
||||
0xd7, 0xf7, 0x69, 0x66, 0xe9, 0x28, 0xe6, 0x35, 0x55, 0x3b,
|
||||
0xa7, 0x6c, 0x5c, 0x87, 0x9d, 0x7b, 0x35, 0xd4, 0x9e, 0xb2,
|
||||
0xe6, 0x2b, 0x08, 0x71, 0xcd, 0xac, 0x63, 0x89, 0x39, 0xe2,
|
||||
0x5e, 0x8a, 0x1e, 0x0e, 0xf9, 0xd5, 0x28, 0x0f, 0xa8, 0xca,
|
||||
0x32, 0x8b, 0x35, 0x1c, 0x3c, 0x76, 0x59, 0x89, 0xcb, 0xcf,
|
||||
0x3d, 0xaa, 0x8b, 0x6c, 0xcc, 0x3a, 0xaf, 0x9f, 0x39, 0x79,
|
||||
0xc9, 0x2b, 0x37, 0x20, 0xfc, 0x88, 0xdc, 0x95, 0xed, 0x84,
|
||||
0xa1, 0xbe, 0x05, 0x9c, 0x64, 0x99, 0xb9, 0xfd, 0xa2, 0x36,
|
||||
0xe7, 0xe8, 0x18, 0xb0, 0x4b, 0x0b, 0xc3, 0x9c, 0x1e, 0x87,
|
||||
0x6b, 0x19, 0x3b, 0xfe, 0x55, 0x69, 0x75, 0x3f, 0x88, 0x12,
|
||||
0x8c, 0xc0, 0x8a, 0xaa, 0x9b, 0x63, 0xd1, 0xa1, 0x6f, 0x80,
|
||||
0xef, 0x25, 0x54, 0xd7, 0x18, 0x9c, 0x41, 0x1f, 0x58, 0x69,
|
||||
0xca, 0x52, 0xc5, 0xb8, 0x3f, 0xa3, 0x6f, 0xf2, 0x16, 0xb9,
|
||||
0xc1, 0xd3, 0x00, 0x62, 0xbe, 0xbc, 0xfd, 0x2d, 0xc5, 0xbc,
|
||||
0xe0, 0x91, 0x19, 0x34, 0xfd, 0xa7, 0x9a, 0x86, 0xf6, 0xe6,
|
||||
0x98, 0xce, 0xd7, 0x59, 0xc3, 0xff, 0x9b, 0x64, 0x77, 0x33,
|
||||
0x8f, 0x3d, 0xa4, 0xf9, 0xcd, 0x85, 0x14, 0xea, 0x99, 0x82,
|
||||
0xcc, 0xaf, 0xb3, 0x41, 0xb2, 0x38, 0x4d, 0xd9, 0x02, 0xf3,
|
||||
0xd1, 0xab, 0x7a, 0xc6, 0x1d, 0xd2, 0x9c, 0x6f, 0x21, 0xba,
|
||||
0x5b, 0x86, 0x2f, 0x37, 0x30, 0xe3, 0x7c, 0xfd, 0xc4, 0xfd,
|
||||
0x80, 0x6c, 0x22, 0xf2, 0x21 ]
|
||||
|
||||
msg = [ 0x41, 0x6e, 0x79, 0x20, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68,
|
||||
0x65, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x69, 0x6e, 0x74,
|
||||
0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62,
|
||||
0x75, 0x74, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70,
|
||||
0x75, 0x62, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x20, 0x61, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x72,
|
||||
0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61,
|
||||
0x6e, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x49, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x44, 0x72, 0x61, 0x66,
|
||||
0x74, 0x20, 0x6f, 0x72, 0x20, 0x52, 0x46, 0x43, 0x20, 0x61,
|
||||
0x6e, 0x64, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x74, 0x61,
|
||||
0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x61, 0x64,
|
||||
0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
|
||||
0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x49, 0x45, 0x54,
|
||||
0x46, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79,
|
||||
0x20, 0x69, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64,
|
||||
0x65, 0x72, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x22, 0x49,
|
||||
0x45, 0x54, 0x46, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69,
|
||||
0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2e, 0x20, 0x53,
|
||||
0x75, 0x63, 0x68, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75,
|
||||
0x64, 0x65, 0x20, 0x6f, 0x72, 0x61, 0x6c, 0x20, 0x73, 0x74,
|
||||
0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x69,
|
||||
0x6e, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x73, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x73, 0x20,
|
||||
0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20, 0x77, 0x72,
|
||||
0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20,
|
||||
0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63,
|
||||
0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x64, 0x65,
|
||||
0x20, 0x61, 0x74, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x6c, 0x61, 0x63,
|
||||
0x65, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61,
|
||||
0x72, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x65, 0x64, 0x20, 0x74, 0x6f ]
|
||||
|
||||
rfctest03 = encrypt key 42 (zero # [2]) msg == out
|
||||
where
|
||||
key = [ 0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, 0x8a, 0xf3, 0x33,
|
||||
0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0, 0x47, 0x39, 0x17, 0xc1,
|
||||
0x40, 0x2b, 0x80, 0x09, 0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70,
|
||||
0x75, 0xc0 ]
|
||||
out = [ 0x27, 0x54, 0x77, 0x61, 0x73, 0x20, 0x62, 0x72, 0x69, 0x6c,
|
||||
0x6c, 0x69, 0x67, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x73, 0x6c, 0x69, 0x74, 0x68, 0x79, 0x20,
|
||||
0x74, 0x6f, 0x76, 0x65, 0x73, 0x0a, 0x44, 0x69, 0x64, 0x20,
|
||||
0x67, 0x79, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x67,
|
||||
0x69, 0x6d, 0x62, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x77, 0x61, 0x62, 0x65, 0x3a, 0x0a, 0x41,
|
||||
0x6c, 0x6c, 0x20, 0x6d, 0x69, 0x6d, 0x73, 0x79, 0x20, 0x77,
|
||||
0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6f,
|
||||
0x72, 0x6f, 0x67, 0x6f, 0x76, 0x65, 0x73, 0x2c, 0x0a, 0x41,
|
||||
0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x6f, 0x6d,
|
||||
0x65, 0x20, 0x72, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6f, 0x75,
|
||||
0x74, 0x67, 0x72, 0x61, 0x62, 0x65, 0x2e ]
|
||||
|
||||
msg = [ 0x62, 0xe6, 0x34, 0x7f, 0x95, 0xed, 0x87, 0xa4, 0x5f, 0xfa,
|
||||
0xe7, 0x42, 0x6f, 0x27, 0xa1, 0xdf, 0x5f, 0xb6, 0x91, 0x10,
|
||||
0x04, 0x4c, 0x0d, 0x73, 0x11, 0x8e, 0xff, 0xa9, 0x5b, 0x01,
|
||||
0xe5, 0xcf, 0x16, 0x6d, 0x3d, 0xf2, 0xd7, 0x21, 0xca, 0xf9,
|
||||
0xb2, 0x1e, 0x5f, 0xb1, 0x4c, 0x61, 0x68, 0x71, 0xfd, 0x84,
|
||||
0xc5, 0x4f, 0x9d, 0x65, 0xb2, 0x83, 0x19, 0x6c, 0x7f, 0xe4,
|
||||
0xf6, 0x05, 0x53, 0xeb, 0xf3, 0x9c, 0x64, 0x02, 0xc4, 0x22,
|
||||
0x34, 0xe3, 0x2a, 0x35, 0x6b, 0x3e, 0x76, 0x43, 0x12, 0xa6,
|
||||
0x1a, 0x55, 0x32, 0x05, 0x57, 0x16, 0xea, 0xd6, 0x96, 0x25,
|
||||
0x68, 0xf8, 0x7d, 0x3f, 0x3f, 0x77, 0x04, 0xc6, 0xa8, 0xd1,
|
||||
0xbc, 0xd1, 0xbf, 0x4d, 0x50, 0xd6, 0x15, 0x4b, 0x6d, 0xa7,
|
||||
0x31, 0xb1, 0x87, 0xb5, 0x8d, 0xfd, 0x72, 0x8a, 0xfa, 0x36,
|
||||
0x75, 0x7a, 0x79, 0x7a, 0xc1, 0x88, 0xd1 ]
|
||||
|
||||
property allTestsPass =
|
||||
([ // Basic tests
|
||||
qround01, core01, core02
|
||||
// Full RFC test vectors
|
||||
, rfctest01, rfctest02, rfctest03
|
||||
] : [_]Bit) == ~zero // All test bits should equal one
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -- Private utilities ----------------------------------------------------- */
|
||||
|
||||
private
|
||||
// Convert a round into a block, by splitting every 32-bit round entry
|
||||
// into 4 bytes, and then serialize those values into a full block.
|
||||
blocked : Round -> Block
|
||||
blocked x = join (map toBytes x)
|
||||
where
|
||||
// This essentially splits a 32-bit number into 4-byte
|
||||
// little-endian form, where 'rjoin' is the inverse and would merge
|
||||
// 4 bytes as a 32-bit little endian number.
|
||||
toBytes : [32] -> [4][8]
|
||||
toBytes v = reverse (groupBy`{8} v)
|
||||
|
||||
// Map a function over a finite list.
|
||||
map : { a, b, c }
|
||||
(a -> b) -> [c]a -> [c]b
|
||||
map f xs = [ f x | x <- xs ]
|
||||
|
||||
// Map a function iteratively over a seed value, producing an infinite
|
||||
// list of successive function applications:
|
||||
//
|
||||
// iterate f 0 == [ 0, f 0, f (f 0), f (f (f 0)), ... ]
|
||||
iterate : { a } (a -> a) -> a -> [inf]a
|
||||
iterate f x = [x] # [ f v | v <- iterate f x ]
|
||||
where
|
||||
// NB: Needs a binded name in order to tie the recursive knot.
|
||||
xs = [x] # [ f v | v <- xs ]
|
||||
|
||||
// rjoin = join . reverse
|
||||
// This encodes a sequence of values as a little endian number
|
||||
// e.g. [ 0xaa, 0xbb, 0xcc, 0xdd ] is serialized as \xdd\xcc\xbb\xaa
|
||||
rjoin : {a, b, c}
|
||||
( fin a, fin c
|
||||
) => [c][a]b -> [a * c]b
|
||||
rjoin x = join (reverse x)
|
||||
@@ -1,40 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import "chacha20.cry" as chacha20;
|
||||
|
||||
print "Proving ChaCha20 spec...";
|
||||
prove_print abc {{ chacha20::allTestsPass }};
|
||||
|
||||
print "Loading LLVM bitcode...";
|
||||
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
|
||||
|
||||
let SpecChaCha20 n = do {
|
||||
llvm_ptr "output" (llvm_array n (llvm_int 8));
|
||||
output <- llvm_var "*output" (llvm_array n (llvm_int 8));
|
||||
|
||||
llvm_ptr "plain" (llvm_array n (llvm_int 8));
|
||||
plain <- llvm_var "*plain" (llvm_array n (llvm_int 8));
|
||||
|
||||
len <- llvm_var "len" (llvm_int 32);
|
||||
llvm_assert_eq "len" {{ `n : [32] }};
|
||||
|
||||
llvm_ptr "k" (llvm_array 32 (llvm_int 8));
|
||||
k <- llvm_var "*k" (llvm_array 32 (llvm_int 8));
|
||||
|
||||
llvm_ptr "n1" (llvm_array 12 (llvm_int 8));
|
||||
n1 <- llvm_var "*n1" (llvm_array 12 (llvm_int 8));
|
||||
|
||||
ctr <- llvm_var "ctr" (llvm_int 32);
|
||||
|
||||
llvm_ensure_eq "*output" {{ chacha20::encrypt k ctr n1 plain }};
|
||||
|
||||
llvm_verify_tactic abc;
|
||||
};
|
||||
|
||||
print "Proving equality for a single block...";
|
||||
time (llvm_verify m "Hacl_Chacha20_chacha20_encrypt" [] (SpecChaCha20 64));
|
||||
|
||||
print "Proving equality for multiple blocks...";
|
||||
time (llvm_verify m "Hacl_Chacha20_chacha20_encrypt" [] (SpecChaCha20 256));
|
||||
@@ -1,38 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import "poly1305.cry" as poly1305;
|
||||
|
||||
print "Proving Poly1305 spec...";
|
||||
prove_print abc {{ poly1305::allTestsPass }};
|
||||
|
||||
print "Loading LLVM bitcode...";
|
||||
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
|
||||
|
||||
let SpecPoly1305 n = do {
|
||||
llvm_ptr "output" (llvm_array 16 (llvm_int 8));
|
||||
output <- llvm_var "*output" (llvm_array 16 (llvm_int 8));
|
||||
|
||||
llvm_ptr "input" (llvm_array n (llvm_int 8));
|
||||
input <- llvm_var "*input" (llvm_array n (llvm_int 8));
|
||||
|
||||
llvm_var "len1" (llvm_int 64);
|
||||
llvm_ptr "k1" (llvm_array 32 (llvm_int 8));
|
||||
k1 <- llvm_var "*k1" (llvm_array 32 (llvm_int 8));
|
||||
|
||||
llvm_assert_eq "*input" {{ zero : [n][8] }};
|
||||
llvm_assert_eq "len1" {{ `n : [64] }};
|
||||
|
||||
llvm_assert_eq "*k1" {{ zero : [32][8] }};
|
||||
|
||||
let res = {{ poly1305::Poly1305 input (take`{16} k1) (drop`{16} k1) }};
|
||||
llvm_ensure_eq "*output" {{ res }};
|
||||
|
||||
llvm_verify_tactic abc;
|
||||
};
|
||||
|
||||
print "Proving equality for a single block...";
|
||||
// This is currently disabled as it takes way too long. We need to help Z3
|
||||
// prove this before we can enable it on Taskcluster.
|
||||
//time (llvm_verify m "Hacl_Poly1305_64_crypto_onetimeauth" [] (SpecPoly1305 16));
|
||||
@@ -1,336 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* This file provides a spec of the Poly1305 one-time authenticator.
|
||||
* See <https://tools.ietf.org/html/rfc7539> for details. */
|
||||
|
||||
module poly1305 where
|
||||
|
||||
P : [136]
|
||||
P = 2^^130 - 5
|
||||
|
||||
Poly1305 : {n} (fin n) => [n][8] -> [16][8] -> [16][8] -> [16][8]
|
||||
Poly1305 msg r s = reverse (groupBy (drop ((rounds ! 0) + s')))
|
||||
where
|
||||
rounds = [zero] # [ Poly1305_block acc r' b | b <- blocks | acc <- rounds ]
|
||||
r' = zero # (Poly1305_clamp (join (reverse r)))
|
||||
s' = zero # (join (reverse s))
|
||||
blocks = Poly1305_split msg
|
||||
|
||||
private
|
||||
// 0x0f - for r[3], r[7], r[11], r[15]
|
||||
// 0xfc - for r[4], r[8], r[12]
|
||||
Poly1305_clamp r = r && 0x0ffffffc0ffffffc0ffffffc0fffffff
|
||||
|
||||
// Poly1305_block : ((acc + msg) * r) % P
|
||||
Poly1305_block : [136] -> [136] -> [136] -> [136]
|
||||
Poly1305_block acc r msg = drop (prod % (zero # P))
|
||||
where
|
||||
acc' : [137]
|
||||
// Add the current block to the accumulator.
|
||||
acc' = (zero # acc) + (zero # msg)
|
||||
prod : [273]
|
||||
// Multiply the new accumulator value by r.
|
||||
prod = ((zero : [137]) # r) * ((zero : [136]) # acc')
|
||||
|
||||
Poly1305_split : {n, nb, nf} (fin n, nf == n / 16, nb == (n + 15) / 16) => [n][8] -> [nb][136]
|
||||
Poly1305_split msg = take ((h1 : [nf][136]) # h2)
|
||||
where
|
||||
// Split all full 16-byte blocks and append 0x01, then convert to LE.
|
||||
h1 = [ join (reverse (b # [0x01])) | b <- groupBy`{16} (take msg)]
|
||||
// Pad the remaining bytes (if any) and convert to LE.
|
||||
h2 = [join (reverse ((drop`{nf * 16} msg) # [0x01] # zero))]
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -- Tests ----------------------------------------------------------------- */
|
||||
|
||||
private
|
||||
// https://tools.ietf.org/html/rfc7539#section-2.5.2
|
||||
rval1 = [0x85, 0xd6, 0xbe, 0x78, 0x57, 0x55, 0x6d, 0x33,
|
||||
0x7f, 0x44, 0x52, 0xfe, 0x42, 0xd5, 0x06, 0xa8]
|
||||
sval1 = [0x01, 0x03, 0x80, 0x8a, 0xfb, 0x0d, 0xb2, 0xfd,
|
||||
0x4a, 0xbf, 0xf6, 0xaf, 0x41, 0x49, 0xf5, 0x1b]
|
||||
text1 = [0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x67, 0x72,
|
||||
0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x46, 0x6f,
|
||||
0x72, 0x75, 0x6d, 0x20, 0x52, 0x65, 0x73, 0x65,
|
||||
0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6f,
|
||||
0x75, 0x70]
|
||||
|
||||
rfctest01 = Poly1305 text1 rval1 sval1
|
||||
== [0xa8, 0x06, 0x1d, 0xc1, 0x30, 0x51, 0x36, 0xc6,
|
||||
0xc2, 0x2b, 0x8b, 0xaf, 0x0c, 0x01, 0x27, 0xa9]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #1
|
||||
rval2 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval2 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text2 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
rfctest02 = Poly1305 text2 rval2 sval2
|
||||
== [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #2
|
||||
rval3 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval3 = [0x36, 0xe5, 0xf6, 0xb5, 0xc5, 0xe0, 0x60, 0x70,
|
||||
0xf0, 0xef, 0xca, 0x96, 0x22, 0x7a, 0x86, 0x3e]
|
||||
text3 = [0x41, 0x6e, 0x79, 0x20, 0x73, 0x75, 0x62, 0x6d,
|
||||
0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74,
|
||||
0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x49, 0x45,
|
||||
0x54, 0x46, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x20, 0x66,
|
||||
0x6f, 0x72, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61,
|
||||
0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x72,
|
||||
0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66,
|
||||
0x20, 0x61, 0x6e, 0x20, 0x49, 0x45, 0x54, 0x46,
|
||||
0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
|
||||
0x74, 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x20,
|
||||
0x6f, 0x72, 0x20, 0x52, 0x46, 0x43, 0x20, 0x61,
|
||||
0x6e, 0x64, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73,
|
||||
0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x20, 0x6d, 0x61, 0x64, 0x65, 0x20, 0x77, 0x69,
|
||||
0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
|
||||
0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
|
||||
0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x49,
|
||||
0x45, 0x54, 0x46, 0x20, 0x61, 0x63, 0x74, 0x69,
|
||||
0x76, 0x69, 0x74, 0x79, 0x20, 0x69, 0x73, 0x20,
|
||||
0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72,
|
||||
0x65, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x22, 0x49,
|
||||
0x45, 0x54, 0x46, 0x20, 0x43, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x22, 0x2e, 0x20, 0x53, 0x75, 0x63, 0x68, 0x20,
|
||||
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75,
|
||||
0x64, 0x65, 0x20, 0x6f, 0x72, 0x61, 0x6c, 0x20,
|
||||
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45,
|
||||
0x54, 0x46, 0x20, 0x73, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x73, 0x20,
|
||||
0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20,
|
||||
0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20,
|
||||
0x61, 0x6e, 0x64, 0x20, 0x65, 0x6c, 0x65, 0x63,
|
||||
0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x20, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61,
|
||||
0x64, 0x65, 0x20, 0x61, 0x74, 0x20, 0x61, 0x6e,
|
||||
0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x6f,
|
||||
0x72, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2c,
|
||||
0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61,
|
||||
0x72, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f]
|
||||
|
||||
rfctest03 = Poly1305 text3 rval3 sval3
|
||||
== [0x36, 0xe5, 0xf6, 0xb5, 0xc5, 0xe0, 0x60, 0x70,
|
||||
0xf0, 0xef, 0xca, 0x96, 0x22, 0x7a, 0x86, 0x3e]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #3
|
||||
rval4 = [0x36, 0xe5, 0xf6, 0xb5, 0xc5, 0xe0, 0x60, 0x70,
|
||||
0xf0, 0xef, 0xca, 0x96, 0x22, 0x7a, 0x86, 0x3e]
|
||||
sval4 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text4 = [0x41, 0x6e, 0x79, 0x20, 0x73, 0x75, 0x62, 0x6d,
|
||||
0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74,
|
||||
0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x49, 0x45,
|
||||
0x54, 0x46, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x20, 0x66,
|
||||
0x6f, 0x72, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61,
|
||||
0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x72,
|
||||
0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66,
|
||||
0x20, 0x61, 0x6e, 0x20, 0x49, 0x45, 0x54, 0x46,
|
||||
0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
|
||||
0x74, 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x20,
|
||||
0x6f, 0x72, 0x20, 0x52, 0x46, 0x43, 0x20, 0x61,
|
||||
0x6e, 0x64, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73,
|
||||
0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x20, 0x6d, 0x61, 0x64, 0x65, 0x20, 0x77, 0x69,
|
||||
0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
|
||||
0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
|
||||
0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x49,
|
||||
0x45, 0x54, 0x46, 0x20, 0x61, 0x63, 0x74, 0x69,
|
||||
0x76, 0x69, 0x74, 0x79, 0x20, 0x69, 0x73, 0x20,
|
||||
0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72,
|
||||
0x65, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x22, 0x49,
|
||||
0x45, 0x54, 0x46, 0x20, 0x43, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x22, 0x2e, 0x20, 0x53, 0x75, 0x63, 0x68, 0x20,
|
||||
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75,
|
||||
0x64, 0x65, 0x20, 0x6f, 0x72, 0x61, 0x6c, 0x20,
|
||||
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45,
|
||||
0x54, 0x46, 0x20, 0x73, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x73, 0x20,
|
||||
0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20,
|
||||
0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20,
|
||||
0x61, 0x6e, 0x64, 0x20, 0x65, 0x6c, 0x65, 0x63,
|
||||
0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x20, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61,
|
||||
0x64, 0x65, 0x20, 0x61, 0x74, 0x20, 0x61, 0x6e,
|
||||
0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x6f,
|
||||
0x72, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2c,
|
||||
0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61,
|
||||
0x72, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f]
|
||||
|
||||
rfctest04 = Poly1305 text4 rval4 sval4
|
||||
== [0xf3, 0x47, 0x7e, 0x7c, 0xd9, 0x54, 0x17, 0xaf,
|
||||
0x89, 0xa6, 0xb8, 0x79, 0x4c, 0x31, 0x0c, 0xf0]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #4
|
||||
rval5 = [0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, 0x8a,
|
||||
0xf3, 0x33, 0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0]
|
||||
sval5 = [0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80, 0x09,
|
||||
0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70, 0x75, 0xc0]
|
||||
text5 = [0x27, 0x54, 0x77, 0x61, 0x73, 0x20, 0x62, 0x72,
|
||||
0x69, 0x6c, 0x6c, 0x69, 0x67, 0x2c, 0x20, 0x61,
|
||||
0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73,
|
||||
0x6c, 0x69, 0x74, 0x68, 0x79, 0x20, 0x74, 0x6f,
|
||||
0x76, 0x65, 0x73, 0x0a, 0x44, 0x69, 0x64, 0x20,
|
||||
0x67, 0x79, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64,
|
||||
0x20, 0x67, 0x69, 0x6d, 0x62, 0x6c, 0x65, 0x20,
|
||||
0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77,
|
||||
0x61, 0x62, 0x65, 0x3a, 0x0a, 0x41, 0x6c, 0x6c,
|
||||
0x20, 0x6d, 0x69, 0x6d, 0x73, 0x79, 0x20, 0x77,
|
||||
0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
|
||||
0x62, 0x6f, 0x72, 0x6f, 0x67, 0x6f, 0x76, 0x65,
|
||||
0x73, 0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x6d, 0x6f, 0x6d, 0x65, 0x20,
|
||||
0x72, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6f, 0x75,
|
||||
0x74, 0x67, 0x72, 0x61, 0x62, 0x65, 0x2e]
|
||||
|
||||
rfctest05 = Poly1305 text5 rval5 sval5
|
||||
== [0x45, 0x41, 0x66, 0x9a, 0x7e, 0xaa, 0xee, 0x61,
|
||||
0xe7, 0x08, 0xdc, 0x7c, 0xbc, 0xc5, 0xeb, 0x62]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #5
|
||||
rval6 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval6 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text6 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
|
||||
|
||||
rfctest06 = Poly1305 text6 rval6 sval6
|
||||
== [0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #6
|
||||
rval7 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval7 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
|
||||
text7 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
rfctest07 = Poly1305 text7 rval7 sval7
|
||||
== [0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #7
|
||||
rval8 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval8 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text8 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
rfctest08 = Poly1305 text8 rval8 sval8
|
||||
== [0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #8
|
||||
rval9 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval9 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text9 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xfb, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
|
||||
0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01]
|
||||
|
||||
rfctest09 = Poly1305 text9 rval9 sval9
|
||||
== [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #9
|
||||
rval10 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval10 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text10 = [0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
|
||||
|
||||
rfctest10 = Poly1305 text10 rval10 sval10
|
||||
== [0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #10
|
||||
rval11 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval11 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text11 = [0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
rfctest11 = Poly1305 text11 rval11 sval11
|
||||
== [0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
// https://tools.ietf.org/html/rfc7539#appendix-A.3
|
||||
// Test Vector #11
|
||||
rval12 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
sval12 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
text12 = [0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
rfctest12 = Poly1305 text12 rval12 sval12
|
||||
== [0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
||||
property allTestsPass =
|
||||
([ // Full RFC test vectors
|
||||
rfctest01, rfctest02, rfctest03, rfctest04,
|
||||
rfctest05, rfctest06, rfctest07, rfctest08,
|
||||
rfctest09, rfctest10, rfctest11, rfctest12
|
||||
] : [_]Bit) == ~zero // All test bits should equal one
|
||||
@@ -1,47 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import "poly1305.cry" as poly1305;
|
||||
|
||||
print "Proving Poly1305 spec...";
|
||||
prove_print abc {{ poly1305::allTestsPass }};
|
||||
|
||||
print "Loading LLVM bitcode...";
|
||||
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
|
||||
|
||||
let SpecPoly1305 n = do {
|
||||
llvm_ptr "out" (llvm_array 16 (llvm_int 8));
|
||||
out <- llvm_var "*out" (llvm_array 16 (llvm_int 8));
|
||||
|
||||
llvm_ptr "ad" (llvm_array 16 (llvm_int 8));
|
||||
ad <- llvm_var "*ad" (llvm_array 16 (llvm_int 8));
|
||||
|
||||
adLen <- llvm_var "adLen" (llvm_int 32);
|
||||
|
||||
llvm_ptr "ciphertext" (llvm_array n (llvm_int 8));
|
||||
ciphertext <- llvm_var "*ciphertext" (llvm_array n (llvm_int 8));
|
||||
|
||||
ciphertextLen <- llvm_var "ciphertextLen" (llvm_int 32);
|
||||
|
||||
llvm_ptr "key" (llvm_array 32 (llvm_int 8));
|
||||
key <- llvm_var "*key" (llvm_array 32 (llvm_int 8));
|
||||
|
||||
llvm_assert_eq "*ad" {{ zero : [16][8] }};
|
||||
llvm_assert_eq "adLen" {{ 16 : [32] }};
|
||||
|
||||
llvm_assert_eq "*ciphertext" {{ zero : [n][8] }};
|
||||
llvm_assert_eq "ciphertextLen" {{ `n : [32] }};
|
||||
|
||||
llvm_assert_eq "*key" {{ zero : [32][8] }};
|
||||
|
||||
let res = {{ poly1305::Poly1305 (ad # ciphertext # [16, 0, 0, 0, 0, 0, 0, 0] # [`n, 0, 0, 0, 0, 0, 0, 0]) (take`{16} key) (drop`{16} key) }};
|
||||
llvm_ensure_eq "*out" {{ res }};
|
||||
|
||||
llvm_verify_tactic abc;
|
||||
};
|
||||
|
||||
print "Proving equality for a single block...";
|
||||
// This is currently disabled as it takes way too long. We need to help Z3
|
||||
// prove this before we can enable it on Taskcluster.
|
||||
//time (llvm_verify m "Poly1305Do" [] (SpecPoly1305 16));
|
||||
@@ -0,0 +1,50 @@
|
||||
# Minimal image with clang-format 3.9.
|
||||
FROM rust:1.64
|
||||
LABEL maintainer="iaroslav.gridin@tuni.fi"
|
||||
|
||||
# for new clang/llvm
|
||||
RUN echo "deb http://ftp.debian.org/debian/ sid main" > /etc/apt/sources.list.d/sid.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
locales \
|
||||
python-dev-is-python3 \
|
||||
mercurial \
|
||||
python3-pip \
|
||||
python-setuptools \
|
||||
build-essential \
|
||||
cargo \
|
||||
rustc \
|
||||
git \
|
||||
gyp \
|
||||
clang-15 \
|
||||
libclang-rt-15-dev \
|
||||
llvm-15 \
|
||||
ninja-build \
|
||||
binutils \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get autoremove -y && apt-get clean -y
|
||||
|
||||
ENV SHELL /bin/bash
|
||||
ENV USER worker
|
||||
ENV LOGNAME $USER
|
||||
ENV HOME /home/$USER
|
||||
ENV HOSTNAME taskcluster-worker
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
ENV HOST localhost
|
||||
ENV DOMSUF localdomain
|
||||
|
||||
RUN locale-gen $LANG \
|
||||
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
|
||||
|
||||
RUN useradd -d $HOME -s $SHELL -m $USER
|
||||
WORKDIR $HOME
|
||||
|
||||
ADD bin $HOME/bin
|
||||
RUN chmod +x $HOME/bin/*
|
||||
|
||||
USER $USER
|
||||
|
||||
# Set a default command for debugging.
|
||||
CMD ["/bin/bash", "--login"]
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -v -e -x
|
||||
|
||||
if [ $(id -u) = 0 ]; then
|
||||
# Drop privileges by re-running this script.
|
||||
exec su worker $0
|
||||
fi
|
||||
|
||||
# Default values for testing.
|
||||
REVISION=${NSS_HEAD_REVISION:-default}
|
||||
REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
|
||||
|
||||
# Clone NSS.
|
||||
hg clone -r $REVISION $REPOSITORY nss
|
||||
|
||||
# Clone NSPR if needed.
|
||||
hg clone -r default https://hg.mozilla.org/projects/nspr
|
||||
|
||||
if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
|
||||
pushd nspr
|
||||
cat ../nss/nspr.patch | patch -p1
|
||||
popd
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash -eu
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
################################################################################
|
||||
export NSS_PATH=$PWD NSS_SOURCES_PATH=$PWD/nss
|
||||
export LD_LIBRARY_PATH=$PWD/dist/Debug/lib/
|
||||
export RUST_LOG=warn
|
||||
export RUSTFLAGS="-C instrument-coverage"
|
||||
cd nss
|
||||
CC=clang-15 CXX=clang++-15 ./build.sh -g -v --sourcecov --static --disable-tests
|
||||
|
||||
git clone --depth=1 https://gitlab.com/nisec/nss-project/acvp-rust.git
|
||||
cd acvp-rust
|
||||
cargo build
|
||||
TESTRUN="cargo run --bin test -- --profdata-command llvm-profdata-15"
|
||||
echo "AES-GCM:"
|
||||
$TESTRUN acvp-rust/samples/aes-gcm.json symmetric nss
|
||||
echo "ECDSA:"
|
||||
$TESTRUN acvp-rust/samples/ecdsa.json ecdsa nss
|
||||
echo "RSA:"
|
||||
$TESTRUN acvp-rust/samples/rsa.json rsa nss
|
||||
echo "SHA-256:"
|
||||
$TESTRUN acvp-rust/samples/sha256.json sha nss
|
||||
@@ -2,7 +2,7 @@
|
||||
# default image, so it's a fair bit bigger. Only use this for builds where
|
||||
# the smaller docker image is missing something. These builds will run on
|
||||
# the leaner configuration.
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:bionic-20221215
|
||||
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||
|
||||
RUN dpkg --add-architecture i386
|
||||
@@ -11,12 +11,12 @@ RUN apt-get update \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
clang-4.0 \
|
||||
clang-10 \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
g++-4.8-multilib \
|
||||
g++-5-multilib \
|
||||
g++-6-multilib \
|
||||
g++-multilib \
|
||||
git \
|
||||
gyp \
|
||||
@@ -34,7 +34,7 @@ RUN apt-get update \
|
||||
pkg-config \
|
||||
valgrind \
|
||||
zlib1g-dev \
|
||||
clang-format-3.9 \
|
||||
clang-format-10 \
|
||||
sqlite3 \
|
||||
libabigail-dev \
|
||||
abigail-tools \
|
||||
@@ -42,21 +42,13 @@ RUN apt-get update \
|
||||
&& add-apt-repository ppa:ubuntu-toolchain-r/test -y \
|
||||
&& apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
gcc-9 \
|
||||
g++-9 \
|
||||
gcc-9-multilib \
|
||||
g++-9-multilib \
|
||||
gcc-10 \
|
||||
g++-10 \
|
||||
gcc-10-multilib \
|
||||
g++-10-multilib \
|
||||
gcc-11-multilib \
|
||||
g++-11-multilib \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get autoremove -y && apt-get clean -y
|
||||
|
||||
RUN update-alternatives --install /usr/bin/clang-format \
|
||||
clang-format $(which clang-format-3.9) 10
|
||||
clang-format $(which clang-format-10) 10
|
||||
|
||||
ENV SHELL /bin/bash
|
||||
ENV USER worker
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
# Minimal image with clang-format 3.9.
|
||||
FROM ubuntu:18.04
|
||||
# Minimal image with clang-format 10
|
||||
FROM ubuntu:bionic-20221215
|
||||
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
clang-format-3.9 \
|
||||
clang-format-10 \
|
||||
locales \
|
||||
mercurial \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get autoremove -y && apt-get clean -y
|
||||
|
||||
RUN update-alternatives --install /usr/bin/clang-format \
|
||||
clang-format $(which clang-format-3.9) 10
|
||||
clang-format $(which clang-format-10) 10
|
||||
|
||||
ENV SHELL /bin/bash
|
||||
ENV USER worker
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Minimal image for running the decision task.
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:bionic-20221215
|
||||
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||
|
||||
RUN apt-get update \
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Minimal image with clang-format 3.9.
|
||||
FROM ubuntu:bionic-20221215
|
||||
LABEL maintainer="iaroslav.gridin@tuni.fi"
|
||||
|
||||
# for new clang/llvm
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
locales \
|
||||
cmake \
|
||||
build-essential \
|
||||
git \
|
||||
clang-10 \
|
||||
mercurial \
|
||||
unifdef \
|
||||
python3-mako \
|
||||
libgmp-dev \
|
||||
jq \
|
||||
python3-setuptools \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
clang-format-10 \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get autoremove -y && apt-get clean -y
|
||||
|
||||
RUN pip3 install fastecdsa
|
||||
|
||||
ENV SHELL /bin/bash
|
||||
ENV USER worker
|
||||
ENV LOGNAME $USER
|
||||
ENV HOME /home/$USER
|
||||
ENV HOSTNAME taskcluster-worker
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
ENV HOST localhost
|
||||
ENV DOMSUF localdomain
|
||||
|
||||
RUN locale-gen $LANG \
|
||||
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
|
||||
|
||||
RUN useradd -d $HOME -s $SHELL -m $USER
|
||||
WORKDIR $HOME
|
||||
|
||||
ADD bin $HOME/bin
|
||||
RUN chmod +x $HOME/bin/*
|
||||
|
||||
USER $USER
|
||||
|
||||
# Set a default command for debugging.
|
||||
CMD ["/bin/bash", "--login"]
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -v -e -x
|
||||
|
||||
if [ $(id -u) = 0 ]; then
|
||||
# Drop privileges by re-running this script.
|
||||
exec su worker $0
|
||||
fi
|
||||
|
||||
# Default values for testing.
|
||||
REVISION=${NSS_HEAD_REVISION:-default}
|
||||
REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
|
||||
|
||||
# Clone NSS.
|
||||
hg clone -r $REVISION $REPOSITORY nss
|
||||
|
||||
# Clone NSPR if needed.
|
||||
hg clone -r default https://hg.mozilla.org/projects/nspr
|
||||
|
||||
if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
|
||||
pushd nspr
|
||||
cat ../nss/nspr.patch | patch -p1
|
||||
popd
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -v -e -x
|
||||
|
||||
if [ $(id -u) = 0 ]; then
|
||||
# Drop privileges by re-running this script.
|
||||
exec su worker $0
|
||||
fi
|
||||
|
||||
git clone --depth=1 https://gitlab.com/nisec/ecckiila.git
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash -eu
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
set -e -x -v
|
||||
|
||||
cd $HOME/ecckiila
|
||||
cp $HOME/nss/.clang-format ./
|
||||
for c in secp384r1 secp521r1; do (cd ecp/$c && cmake . && make && unifdef ecp_$c.c -URIG_NULL -DRIG_NSS -URIG_GOST -UOPENSSL_BUILDING_OPENSSL -UKIILA_OPENSSL_EMIT_CURVEDEF -UKIILA_UNUSED -UOPENSSL_NO_ASM -ULIB_TEST -x2 > tmp_ecp_$c.c && clang-format-10 -i tmp_ecp_$c.c && diff $HOME/nss/lib/freebl/ecl/ecp_$c.c tmp_ecp_$c.c); done;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# docker invocation or ASAN won't work.
|
||||
# On taskcluster for ASAN use `features: ["allowPtrace"]`.
|
||||
# See https://github.com/google/sanitizers/issues/764#issuecomment-276700920
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:bionic-20221215
|
||||
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||
|
||||
RUN dpkg --add-architecture i386
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# Dockerfile for running interop tests.
|
||||
# This includes Rust, golang, and nodejs.
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:focal-20221130
|
||||
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
clang \
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
MAINTAINER Tim Taubert <ttaubert@mozilla.com>
|
||||
|
||||
RUN useradd -d /home/worker -s /bin/bash -m worker
|
||||
WORKDIR /home/worker
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
binutils \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
clang-3.8 \
|
||||
curl \
|
||||
gcc-multilib \
|
||||
g++-multilib \
|
||||
gyp \
|
||||
lib32z1-dev \
|
||||
mercurial \
|
||||
ninja-build \
|
||||
unzip \
|
||||
zlib1g-dev
|
||||
|
||||
# Add missing LLVM plugin for gold linker.
|
||||
ADD LLVMgold.so.zip /usr/lib/llvm-3.8/lib/LLVMgold.so.zip
|
||||
RUN unzip /usr/lib/llvm-3.8/lib/LLVMgold.so.zip -d /usr/lib/llvm-3.8/lib/
|
||||
|
||||
# Install SAW/Cryptol.
|
||||
RUN curl -LO https://saw.galois.com/builds/nightly/saw-0.2-2018-01-14-Ubuntu14.04-64.tar.gz && \
|
||||
tar xzvf saw-*.tar.gz -C /usr/local --strip-components=1 && \
|
||||
rm saw-*.tar.gz
|
||||
|
||||
# Install Z3.
|
||||
RUN curl -LO https://github.com/Z3Prover/z3/releases/download/z3-4.6.0/z3-4.6.0-x64-ubuntu-16.04.zip && \
|
||||
unzip z3*.zip && \
|
||||
cp -r z3*/* /usr/local/ && \
|
||||
rm -fr z3*
|
||||
|
||||
ADD bin /home/worker/bin
|
||||
RUN chmod +x /home/worker/bin/*
|
||||
|
||||
# Change user.
|
||||
USER worker
|
||||
|
||||
# Set a default command useful for debugging
|
||||
CMD ["/bin/bash", "--login"]
|
||||
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -v -e -x
|
||||
|
||||
# Default values for testing.
|
||||
REVISION=${NSS_HEAD_REVISION:-default}
|
||||
REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
|
||||
|
||||
# Clone NSS.
|
||||
for i in 0 2 5; do
|
||||
sleep $i
|
||||
hg clone -r $REVISION $REPOSITORY nss && exit 0
|
||||
rm -rf nss
|
||||
done
|
||||
exit 1
|
||||
@@ -1,5 +1,5 @@
|
||||
# Lean image for running the bulk of the NSS CI tests on taskcluster.
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:bionic-20221215
|
||||
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||
|
||||
RUN dpkg --add-architecture i386
|
||||
|
||||
@@ -20,6 +20,16 @@ const LINUX_INTEROP_IMAGE = {
|
||||
path: "automation/taskcluster/docker-interop"
|
||||
};
|
||||
|
||||
const ACVP_IMAGE = {
|
||||
name: "acvp",
|
||||
path: "automation/taskcluster/docker-acvp"
|
||||
};
|
||||
|
||||
const ECCKIILA_IMAGE = {
|
||||
name: "ecckiila",
|
||||
path: "automation/taskcluster/docker-ecckiila"
|
||||
};
|
||||
|
||||
const CLANG_FORMAT_IMAGE = {
|
||||
name: "clang-format",
|
||||
path: "automation/taskcluster/docker-clang-format"
|
||||
@@ -41,11 +51,6 @@ const FUZZ_IMAGE_32 = {
|
||||
path: "automation/taskcluster/docker-fuzz32"
|
||||
};
|
||||
|
||||
const SAW_IMAGE = {
|
||||
name: "saw",
|
||||
path: "automation/taskcluster/docker-saw"
|
||||
};
|
||||
|
||||
const WINDOWS_CHECKOUT_CMD =
|
||||
"bash -c \"hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss || " +
|
||||
"(sleep 2; hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss) || " +
|
||||
@@ -262,6 +267,11 @@ export default async function main() {
|
||||
collection: "debug"
|
||||
}, "build_gyp.sh");
|
||||
|
||||
await scheduleWindows("Windows 2012 64 Static (opt)", {
|
||||
platform: "windows2012-64",
|
||||
collection: "opt-static"
|
||||
}, "build_gyp.sh --opt --static");
|
||||
|
||||
await scheduleWindows("Windows 2012 32 (opt)", {
|
||||
platform: "windows2012-32",
|
||||
}, "build_gyp.sh --opt -t ia32");
|
||||
@@ -319,6 +329,7 @@ export default async function main() {
|
||||
);
|
||||
|
||||
await scheduleMac("Mac (opt)", {collection: "opt"}, "--opt");
|
||||
await scheduleMac("Mac Static (opt)", {collection: "opt-static"}, "--opt --static -Ddisable_libpkix=1");
|
||||
await scheduleMac("Mac (debug)", {collection: "debug"});
|
||||
|
||||
// Must be executed after all other tasks are scheduled
|
||||
@@ -525,7 +536,9 @@ async function scheduleLinux(name, overrides, args = "") {
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_tests.sh"
|
||||
]
|
||||
],
|
||||
provisioner: "nss-t",
|
||||
workerType: "t-linux-xlarge-gcp"
|
||||
}));
|
||||
|
||||
// Extra builds.
|
||||
@@ -541,7 +554,14 @@ async function scheduleLinux(name, overrides, args = "") {
|
||||
},
|
||||
symbol: "clang-4"
|
||||
}));
|
||||
|
||||
queue.scheduleTask(merge(extra_base, {
|
||||
name: `${name} w/ clang-10`,
|
||||
env: {
|
||||
CC: "clang-10",
|
||||
CCC: "clang++-10",
|
||||
},
|
||||
symbol: "clang-10"
|
||||
}));
|
||||
queue.scheduleTask(merge(extra_base, {
|
||||
name: `${name} w/ gcc-4.4`,
|
||||
image: LINUX_GCC44_IMAGE,
|
||||
@@ -589,33 +609,6 @@ async function scheduleLinux(name, overrides, args = "") {
|
||||
symbol: "gcc-5"
|
||||
}));
|
||||
|
||||
queue.scheduleTask(merge(extra_base, {
|
||||
name: `${name} w/ gcc-6`,
|
||||
env: {
|
||||
CC: "gcc-6",
|
||||
CCC: "g++-6"
|
||||
},
|
||||
symbol: "gcc-6"
|
||||
}));
|
||||
|
||||
queue.scheduleTask(merge(extra_base, {
|
||||
name: `${name} w/ gcc-9`,
|
||||
env: {
|
||||
CC: "gcc-9",
|
||||
CCC: "g++-9"
|
||||
},
|
||||
symbol: "gcc-9"
|
||||
}));
|
||||
|
||||
queue.scheduleTask(merge(extra_base, {
|
||||
name: `${name} w/ gcc-10`,
|
||||
env: {
|
||||
CC: "gcc-10",
|
||||
CCC: "g++-10",
|
||||
},
|
||||
symbol: "gcc-10"
|
||||
}));
|
||||
|
||||
queue.scheduleTask(merge(extra_base, {
|
||||
name: `${name} w/ gcc-11`,
|
||||
env: {
|
||||
@@ -674,6 +667,8 @@ function scheduleFuzzingRun(base, name, target, max_len, symbol = null, corpus =
|
||||
`-max_total_time=${MAX_FUZZ_TIME} ` +
|
||||
`-max_len=${max_len}`
|
||||
],
|
||||
provisioner: "nss-t",
|
||||
workerType: "t-linux-xlarge-gcp",
|
||||
symbol: symbol || name
|
||||
}));
|
||||
}
|
||||
@@ -891,14 +886,14 @@ async function scheduleFuzzing32() {
|
||||
|
||||
async function scheduleWindows(name, base, build_script) {
|
||||
base = merge(base, {
|
||||
workerType: "win2012r2",
|
||||
workerType: "b-win2012-azure",
|
||||
env: {
|
||||
PATH: "c:\\mozilla-build\\bin;c:\\mozilla-build\\python;" +
|
||||
"c:\\mozilla-build\\msys\\local\\bin;c:\\mozilla-build\\7zip;" +
|
||||
"c:\\mozilla-build\\info-zip;c:\\mozilla-build\\python\\Scripts;" +
|
||||
"c:\\mozilla-build\\yasm;c:\\mozilla-build\\msys\\bin;" +
|
||||
"c:\\Windows\\system32;c:\\mozilla-build\\upx391w;" +
|
||||
"c:\\mozilla-build\\moztools-x64\\bin;c:\\mozilla-build\\wget",
|
||||
"c:\\mozilla-build\\moztools-x64\\bin;c:\\mozilla-build\\wget;c:\\Program Files\\Mercurial",
|
||||
DOMSUF: "localdomain",
|
||||
HOST: "localhost",
|
||||
},
|
||||
@@ -1155,6 +1150,18 @@ async function scheduleTools() {
|
||||
]
|
||||
}));
|
||||
|
||||
queue.scheduleTask(merge(base, {
|
||||
symbol: "acvp",
|
||||
name: "acvp",
|
||||
image: ACVP_IMAGE,
|
||||
command: [
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"bin/checkout.sh && bin/run.sh"
|
||||
]
|
||||
}));
|
||||
|
||||
|
||||
queue.scheduleTask(merge(base, {
|
||||
symbol: "scan-build",
|
||||
name: "scan-build",
|
||||
@@ -1188,72 +1195,15 @@ async function scheduleTools() {
|
||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_hacl.sh"
|
||||
]
|
||||
}));
|
||||
|
||||
let task_saw = queue.scheduleTask(merge(base, {
|
||||
symbol: "B",
|
||||
group: "SAW",
|
||||
name: "LLVM bitcode build (32 bit)",
|
||||
image: SAW_IMAGE,
|
||||
kind: "build",
|
||||
env: {
|
||||
AR: "llvm-ar-3.8",
|
||||
CC: "clang-3.8",
|
||||
CCC: "clang++-3.8"
|
||||
},
|
||||
artifacts: {
|
||||
public: {
|
||||
expires: 24 * 7,
|
||||
type: "directory",
|
||||
path: "/home/worker/artifacts"
|
||||
}
|
||||
},
|
||||
command: [
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/build_gyp.sh --disable-tests --emit-llvm -t ia32"
|
||||
]
|
||||
}));
|
||||
|
||||
|
||||
queue.scheduleTask(merge(base, {
|
||||
parent: task_saw,
|
||||
symbol: "bmul",
|
||||
group: "SAW",
|
||||
name: "bmul.saw",
|
||||
image: SAW_IMAGE,
|
||||
symbol: "ecckiila",
|
||||
name: "ecckiila",
|
||||
image: ECCKIILA_IMAGE,
|
||||
command: [
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_saw.sh bmul"
|
||||
]
|
||||
}));
|
||||
|
||||
// TODO: The ChaCha20 saw verification is currently disabled because the new
|
||||
// HACL 32-bit code can't be verified by saw right now to the best of
|
||||
// my knowledge.
|
||||
// Bug 1604130
|
||||
// queue.scheduleTask(merge(base, {
|
||||
// parent: task_saw,
|
||||
// symbol: "ChaCha20",
|
||||
// group: "SAW",
|
||||
// name: "chacha20.saw",
|
||||
// image: SAW_IMAGE,
|
||||
// command: [
|
||||
// "/bin/bash",
|
||||
// "-c",
|
||||
// "bin/checkout.sh && nss/automation/taskcluster/scripts/run_saw.sh chacha20"
|
||||
// ]
|
||||
// }));
|
||||
|
||||
queue.scheduleTask(merge(base, {
|
||||
parent: task_saw,
|
||||
symbol: "Poly1305",
|
||||
group: "SAW",
|
||||
name: "poly1305.saw",
|
||||
image: SAW_IMAGE,
|
||||
command: [
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_saw.sh poly1305"
|
||||
"bin/checkout.sh && bin/ecckiila.sh && bin/run.sh"
|
||||
]
|
||||
}));
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import taskcluster from "taskcluster-client";
|
||||
async function taskHasImageArtifact(taskId) {
|
||||
let queue = new taskcluster.Queue(taskcluster.fromEnvVars());
|
||||
let {artifacts} = await queue.listLatestArtifacts(taskId);
|
||||
return artifacts.some(artifact => artifact.name == "public/image.tar");
|
||||
return artifacts.some(artifact => artifact.name == "public/image.tar.zst");
|
||||
}
|
||||
|
||||
async function findTaskWithImageArtifact(ns) {
|
||||
@@ -41,10 +41,10 @@ export async function buildTask({name, path}) {
|
||||
HASH: hash
|
||||
},
|
||||
artifacts: {
|
||||
"public/image.tar": {
|
||||
"public/image.tar.zst": {
|
||||
type: "file",
|
||||
expires: 24 * 90,
|
||||
path: "/artifacts/image.tar"
|
||||
path: "/artifacts/image.tar.zst"
|
||||
}
|
||||
},
|
||||
command: [
|
||||
@@ -56,6 +56,6 @@ export async function buildTask({name, path}) {
|
||||
features: ["dind"],
|
||||
maxRunTime: 7200,
|
||||
kind: "build",
|
||||
symbol: "I"
|
||||
symbol: `I(${name})`
|
||||
};
|
||||
}
|
||||
@@ -157,7 +157,7 @@ function convertTask(def) {
|
||||
|
||||
return {
|
||||
provisionerId: def.provisioner || `nss-${process.env.MOZ_SCM_LEVEL}`,
|
||||
workerType: def.workerType || "linux",
|
||||
workerType: def.workerType || "linux-gcp",
|
||||
schedulerId: process.env.TC_SCHEDULER_ID,
|
||||
taskGroupId: process.env.TASK_ID,
|
||||
|
||||
@@ -277,7 +277,7 @@ export async function submit() {
|
||||
}
|
||||
|
||||
task.payload.image = {
|
||||
path: "public/image.tar",
|
||||
path: "public/image.tar.zst",
|
||||
taskId: data.taskId,
|
||||
type: "task-image"
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@ function parseOptions(opts) {
|
||||
}
|
||||
|
||||
// Parse tools.
|
||||
let allTools = ["clang-format", "scan-build", "hacl", "saw", "abi", "coverage"];
|
||||
let allTools = ["clang-format", "scan-build", "hacl", "ecckiila", "saw", "abi", "coverage"];
|
||||
let tools = intersect(opts.tools.split(/\s*,\s*/), allTools);
|
||||
|
||||
// If the given value is "all" run all tools.
|
||||
|
||||
@@ -18,7 +18,10 @@ CONTEXT_PATH="/home/worker/nss/$CONTEXT_PATH"
|
||||
test -d "$CONTEXT_PATH" || raise_error "Context Path $CONTEXT_PATH does not exist."
|
||||
test -f "$CONTEXT_PATH/Dockerfile" || raise_error "Dockerfile must be present in $CONTEXT_PATH."
|
||||
|
||||
apt-get update
|
||||
apt-get -y install zstd
|
||||
|
||||
docker build -t "$PROJECT:$HASH" "$CONTEXT_PATH"
|
||||
|
||||
mkdir /artifacts
|
||||
docker save "$PROJECT:$HASH" > /artifacts/image.tar
|
||||
docker save "$PROJECT:$HASH" | zstd > /artifacts/image.tar.zst
|
||||
@@ -89,7 +89,7 @@ check_abi()
|
||||
abi_diff
|
||||
}
|
||||
|
||||
#Slightly modified from builbot-slave/build.sh
|
||||
#Slightly modified from build.sh in this directory
|
||||
abi_diff()
|
||||
{
|
||||
ABI_PROBLEM_FOUND=0
|
||||
@@ -123,7 +123,7 @@ abi_diff()
|
||||
# If abidiff reports an error, or a usage error, or if it sets a result
|
||||
# bit value this script doesn't know yet about, we'll report failure.
|
||||
# For ABI changes, we don't yet report an error. We'll compare the
|
||||
# result report with our whitelist. This allows us to silence changes
|
||||
# result report with our allowlist. This allows us to silence changes
|
||||
# that we're already aware of and have been declared acceptable.
|
||||
|
||||
REPORT_RET_AS_FAILURE=0
|
||||
@@ -141,10 +141,10 @@ abi_diff()
|
||||
fi
|
||||
|
||||
if [ $ABIDIFF_ABI_CHANGE -ne 0 ]; then
|
||||
echo "Ignoring abidiff result ABI_CHANGE, instead we'll check for non-whitelisted differences."
|
||||
echo "Ignoring abidiff result ABI_CHANGE, instead we'll check for non-allowlisted differences."
|
||||
fi
|
||||
if [ $ABIDIFF_ABI_INCOMPATIBLE_CHANGE -ne 0 ]; then
|
||||
echo "Ignoring abidiff result ABIDIFF_ABI_INCOMPATIBLE_CHANGE, instead we'll check for non-whitelisted differences."
|
||||
echo "Ignoring abidiff result ABIDIFF_ABI_INCOMPATIBLE_CHANGE, instead we'll check for non-allowlisted differences."
|
||||
fi
|
||||
|
||||
if [ $REPORT_RET_AS_FAILURE -ne 0 ]; then
|
||||
|
||||
@@ -11,22 +11,34 @@ set -e -x -v
|
||||
# The docker image this is running in has NSS sources.
|
||||
# Get the HACL* source, containing a snapshot of the C code, extracted on the
|
||||
# HACL CI.
|
||||
# When bug 1593647 is resolved, extract the code on CI again.
|
||||
git clone -q "https://github.com/project-everest/hacl-star" ~/hacl-star
|
||||
git -C ~/hacl-star checkout -q c95ab70fcb2bc21025d8845281bc4bc8987ca683
|
||||
git clone -q "https://github.com/hacl-star/hacl-star" ~/hacl-star
|
||||
git -C ~/hacl-star checkout -q 51a72a953a4ee6f91e63b2816ae5c4e62edf35d6
|
||||
|
||||
# Format the C snapshot.
|
||||
cd ~/hacl-star/dist/mozilla
|
||||
cp ~/nss/.clang-format .
|
||||
find . -type f -name '*.[ch]' -exec clang-format -i {} \+
|
||||
cd ~/hacl-star/dist/kremlin
|
||||
cd ~/hacl-star/dist/karamel
|
||||
cp ~/nss/.clang-format .
|
||||
find . -type f -name '*.[ch]' -exec clang-format -i {} \+
|
||||
|
||||
# These diff commands will return 1 if there are differences and stop the script.
|
||||
files=($(find ~/nss/lib/freebl/verified/ -type f -name '*.[ch]'))
|
||||
|
||||
# We have two checks in the script.
|
||||
# The first one only checks the files in the verified/internal folder; the second one does for all the rest
|
||||
# It was implemented like this due to not uniqueness of the names in the verified folders
|
||||
# For instance, the files Hacl_Chacha20.h are present in both directories, but the content differs.
|
||||
|
||||
files=($(find ~/nss/lib/freebl/verified/internal -type f -name '*.[ch]'))
|
||||
for f in "${files[@]}"; do
|
||||
file_name=$(basename "$f")
|
||||
hacl_file=($(find ~/hacl-star/dist/mozilla/ ~/hacl-star/dist/kremlin/ -type f -name $file_name))
|
||||
hacl_file=($(find ~/hacl-star/dist/mozilla/internal/ -type f -name $file_name))
|
||||
diff $hacl_file $f
|
||||
done
|
||||
|
||||
files=($(find ~/nss/lib/freebl/verified/ -type f -name '*.[ch]' -not -path "*/freebl/verified/internal/*" -not -path "*/freebl/verified/config.h"))
|
||||
for f in "${files[@]}"; do
|
||||
file_name=$(basename "$f")
|
||||
hacl_file=($(find ~/hacl-star/dist/mozilla/ ~/hacl-star/dist/karamel/ -type f -name $file_name -not -path "*/hacl-star/dist/mozilla/internal/*"))
|
||||
diff $hacl_file $f
|
||||
done
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source $(dirname "$0")/tools.sh
|
||||
|
||||
# Fetch artifact if needed.
|
||||
fetch_dist
|
||||
|
||||
# Run SAW.
|
||||
saw "nss/automation/saw/$1.saw"
|
||||
@@ -30,11 +30,11 @@ run_verbose()
|
||||
if [ "$verbose" = 1 ]; then
|
||||
echo "$@"
|
||||
exec 3>&1
|
||||
"$@" 1>&3 2>&3
|
||||
exec 3>&-
|
||||
else
|
||||
exec 3>/dev/null
|
||||
"$@" >/dev/null
|
||||
fi
|
||||
"$@" 1>&3 2>&3
|
||||
exec 3>&-
|
||||
}
|
||||
|
||||
# The prehistoric bash on Mac doesn't support @Q quoting.
|
||||
@@ -104,6 +104,7 @@ while [ $# -gt 0 ]; do
|
||||
--pprof) gyp_params+=(-Duse_pprof=1) ;;
|
||||
--asan) enable_sanitizer asan ;;
|
||||
--msan) enable_sanitizer msan ;;
|
||||
--sourcecov) enable_sourcecov ;;
|
||||
--ubsan) enable_ubsan ;;
|
||||
--ubsan=?*) enable_ubsan "${1#*=}" ;;
|
||||
--fuzz) fuzz=1 ;;
|
||||
|
||||
@@ -74,7 +74,6 @@ getTrustString(unsigned int trust)
|
||||
return "CKT_NSS_MUST_VERIFY_TRUST";
|
||||
}
|
||||
}
|
||||
return "CKT_NSS_TRUST_UNKNOWN"; /* not reached */
|
||||
}
|
||||
|
||||
static const SEC_ASN1Template serialTemplate[] = {
|
||||
|
||||
+197
-194
@@ -393,88 +393,87 @@ typedef struct curveNameTagPairStr {
|
||||
SECOidTag curveOidTag;
|
||||
} CurveNameTagPair;
|
||||
|
||||
static CurveNameTagPair nameTagPair[] =
|
||||
{
|
||||
{ "sect163k1", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "nistk163", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "sect163r1", SEC_OID_SECG_EC_SECT163R1 },
|
||||
{ "sect163r2", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "nistb163", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "sect193r1", SEC_OID_SECG_EC_SECT193R1 },
|
||||
{ "sect193r2", SEC_OID_SECG_EC_SECT193R2 },
|
||||
{ "sect233k1", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "nistk233", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "sect233r1", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "nistb233", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "sect239k1", SEC_OID_SECG_EC_SECT239K1 },
|
||||
{ "sect283k1", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "nistk283", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "sect283r1", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "nistb283", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "sect409k1", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "nistk409", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "sect409r1", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "nistb409", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "sect571k1", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "nistk571", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "sect571r1", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "nistb571", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "secp160k1", SEC_OID_SECG_EC_SECP160K1 },
|
||||
{ "secp160r1", SEC_OID_SECG_EC_SECP160R1 },
|
||||
{ "secp160r2", SEC_OID_SECG_EC_SECP160R2 },
|
||||
{ "secp192k1", SEC_OID_SECG_EC_SECP192K1 },
|
||||
{ "secp192r1", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "nistp192", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "secp224k1", SEC_OID_SECG_EC_SECP224K1 },
|
||||
{ "secp224r1", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "nistp224", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "secp256k1", SEC_OID_SECG_EC_SECP256K1 },
|
||||
{ "secp256r1", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "nistp256", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "secp384r1", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "nistp384", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "secp521r1", SEC_OID_SECG_EC_SECP521R1 },
|
||||
{ "nistp521", SEC_OID_SECG_EC_SECP521R1 },
|
||||
static CurveNameTagPair nameTagPair[] = {
|
||||
{ "sect163k1", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "nistk163", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "sect163r1", SEC_OID_SECG_EC_SECT163R1 },
|
||||
{ "sect163r2", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "nistb163", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "sect193r1", SEC_OID_SECG_EC_SECT193R1 },
|
||||
{ "sect193r2", SEC_OID_SECG_EC_SECT193R2 },
|
||||
{ "sect233k1", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "nistk233", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "sect233r1", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "nistb233", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "sect239k1", SEC_OID_SECG_EC_SECT239K1 },
|
||||
{ "sect283k1", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "nistk283", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "sect283r1", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "nistb283", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "sect409k1", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "nistk409", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "sect409r1", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "nistb409", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "sect571k1", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "nistk571", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "sect571r1", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "nistb571", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "secp160k1", SEC_OID_SECG_EC_SECP160K1 },
|
||||
{ "secp160r1", SEC_OID_SECG_EC_SECP160R1 },
|
||||
{ "secp160r2", SEC_OID_SECG_EC_SECP160R2 },
|
||||
{ "secp192k1", SEC_OID_SECG_EC_SECP192K1 },
|
||||
{ "secp192r1", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "nistp192", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "secp224k1", SEC_OID_SECG_EC_SECP224K1 },
|
||||
{ "secp224r1", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "nistp224", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "secp256k1", SEC_OID_SECG_EC_SECP256K1 },
|
||||
{ "secp256r1", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "nistp256", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "secp384r1", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "nistp384", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "secp521r1", SEC_OID_SECG_EC_SECP521R1 },
|
||||
{ "nistp521", SEC_OID_SECG_EC_SECP521R1 },
|
||||
|
||||
{ "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 },
|
||||
{ "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 },
|
||||
{ "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 },
|
||||
{ "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 },
|
||||
{ "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 },
|
||||
{ "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 },
|
||||
{ "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 },
|
||||
{ "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 },
|
||||
{ "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 },
|
||||
{ "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 },
|
||||
{ "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 },
|
||||
{ "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 },
|
||||
|
||||
{ "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 },
|
||||
{ "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 },
|
||||
{ "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 },
|
||||
{ "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 },
|
||||
{ "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 },
|
||||
{ "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 },
|
||||
{ "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 },
|
||||
{ "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 },
|
||||
{ "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 },
|
||||
{ "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 },
|
||||
{ "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 },
|
||||
{ "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 },
|
||||
{ "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 },
|
||||
{ "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 },
|
||||
{ "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 },
|
||||
{ "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 },
|
||||
{ "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 },
|
||||
{ "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 },
|
||||
{ "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 },
|
||||
{ "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 },
|
||||
{ "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 },
|
||||
{ "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 },
|
||||
{ "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 },
|
||||
{ "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 },
|
||||
{ "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 },
|
||||
{ "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 },
|
||||
{ "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 },
|
||||
{ "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 },
|
||||
{ "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 },
|
||||
{ "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 },
|
||||
{ "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 },
|
||||
{ "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 },
|
||||
{ "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 },
|
||||
{ "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 },
|
||||
{ "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 },
|
||||
{ "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 },
|
||||
{ "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 },
|
||||
{ "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 },
|
||||
{ "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 },
|
||||
{ "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 },
|
||||
|
||||
{ "secp112r1", SEC_OID_SECG_EC_SECP112R1 },
|
||||
{ "secp112r2", SEC_OID_SECG_EC_SECP112R2 },
|
||||
{ "secp128r1", SEC_OID_SECG_EC_SECP128R1 },
|
||||
{ "secp128r2", SEC_OID_SECG_EC_SECP128R2 },
|
||||
{ "secp112r1", SEC_OID_SECG_EC_SECP112R1 },
|
||||
{ "secp112r2", SEC_OID_SECG_EC_SECP112R2 },
|
||||
{ "secp128r1", SEC_OID_SECG_EC_SECP128R1 },
|
||||
{ "secp128r2", SEC_OID_SECG_EC_SECP128R2 },
|
||||
|
||||
{ "sect113r1", SEC_OID_SECG_EC_SECT113R1 },
|
||||
{ "sect113r2", SEC_OID_SECG_EC_SECT113R2 },
|
||||
{ "sect131r1", SEC_OID_SECG_EC_SECT131R1 },
|
||||
{ "sect131r2", SEC_OID_SECG_EC_SECT131R2 },
|
||||
{ "curve25519", SEC_OID_CURVE25519 },
|
||||
};
|
||||
{ "sect113r1", SEC_OID_SECG_EC_SECT113R1 },
|
||||
{ "sect113r2", SEC_OID_SECG_EC_SECT113R2 },
|
||||
{ "sect131r1", SEC_OID_SECG_EC_SECT131R1 },
|
||||
{ "sect131r2", SEC_OID_SECG_EC_SECT131R2 },
|
||||
{ "curve25519", SEC_OID_CURVE25519 },
|
||||
};
|
||||
|
||||
static SECItem *
|
||||
getECParams(const char *curve)
|
||||
@@ -646,48 +645,47 @@ typedef enum {
|
||||
NUMMODES
|
||||
} bltestCipherMode;
|
||||
|
||||
static char *mode_strings[] =
|
||||
{
|
||||
"des_ecb",
|
||||
"des_cbc",
|
||||
"des3_ecb",
|
||||
"des3_cbc",
|
||||
static char *mode_strings[] = {
|
||||
"des_ecb",
|
||||
"des_cbc",
|
||||
"des3_ecb",
|
||||
"des3_cbc",
|
||||
#ifndef NSS_DISABLE_DEPRECATED_RC2
|
||||
"rc2_ecb",
|
||||
"rc2_cbc",
|
||||
"rc2_ecb",
|
||||
"rc2_cbc",
|
||||
#endif
|
||||
"rc4",
|
||||
"rc4",
|
||||
#ifdef NSS_SOFTOKEN_DOES_RC5
|
||||
"rc5_ecb",
|
||||
"rc5_cbc",
|
||||
"rc5_ecb",
|
||||
"rc5_cbc",
|
||||
#endif
|
||||
"aes_ecb",
|
||||
"aes_cbc",
|
||||
"aes_cts",
|
||||
"aes_ctr",
|
||||
"aes_gcm",
|
||||
"camellia_ecb",
|
||||
"camellia_cbc",
|
||||
"aes_ecb",
|
||||
"aes_cbc",
|
||||
"aes_cts",
|
||||
"aes_ctr",
|
||||
"aes_gcm",
|
||||
"camellia_ecb",
|
||||
"camellia_cbc",
|
||||
#ifndef NSS_DISABLE_DEPRECATED_SEED
|
||||
"seed_ecb",
|
||||
"seed_cbc",
|
||||
"seed_ecb",
|
||||
"seed_cbc",
|
||||
#endif
|
||||
"chacha20_ctr",
|
||||
"chacha20_poly1305",
|
||||
"rsa",
|
||||
"rsa_oaep",
|
||||
"rsa_pss",
|
||||
"ecdsa",
|
||||
/*"pqg",*/
|
||||
"dsa",
|
||||
"md2",
|
||||
"md5",
|
||||
"sha1",
|
||||
"sha224",
|
||||
"sha256",
|
||||
"sha384",
|
||||
"sha512",
|
||||
};
|
||||
"chacha20_ctr",
|
||||
"chacha20_poly1305",
|
||||
"rsa",
|
||||
"rsa_oaep",
|
||||
"rsa_pss",
|
||||
"ecdsa",
|
||||
/*"pqg",*/
|
||||
"dsa",
|
||||
"md2",
|
||||
"md5",
|
||||
"sha1",
|
||||
"sha224",
|
||||
"sha256",
|
||||
"sha384",
|
||||
"sha512",
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -2321,9 +2319,9 @@ cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt)
|
||||
case bltestRC5_CBC:
|
||||
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
|
||||
cipherInfo->input.pBuf.len);
|
||||
#endif
|
||||
return bltest_rc5_init(cipherInfo, encrypt);
|
||||
break;
|
||||
#endif
|
||||
case bltestAES_ECB:
|
||||
case bltestAES_CBC:
|
||||
case bltestAES_CTS:
|
||||
@@ -3011,7 +3009,7 @@ get_params(PLArenaPool *arena, bltestParams *params,
|
||||
switch (mode) {
|
||||
case bltestAES_GCM:
|
||||
case bltestCHACHA20:
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "aad", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "aad", j);
|
||||
load_file_data(arena, ¶ms->ask.aad, filename, bltestBinary);
|
||||
case bltestDES_CBC:
|
||||
case bltestDES_EDE_CBC:
|
||||
@@ -3025,7 +3023,7 @@ get_params(PLArenaPool *arena, bltestParams *params,
|
||||
#ifndef NSS_DISABLE_DEPRECATED_SEED
|
||||
case bltestSEED_CBC:
|
||||
#endif
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "iv", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "iv", j);
|
||||
load_file_data(arena, ¶ms->sk.iv, filename, bltestBinary);
|
||||
case bltestDES_ECB:
|
||||
case bltestDES_EDE_ECB:
|
||||
@@ -3038,18 +3036,18 @@ get_params(PLArenaPool *arena, bltestParams *params,
|
||||
#ifndef NSS_DISABLE_DEPRECATED_SEED
|
||||
case bltestSEED_ECB:
|
||||
#endif
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
load_file_data(arena, ¶ms->sk.key, filename, bltestBinary);
|
||||
break;
|
||||
#ifdef NSS_SOFTOKEN_DOES_RC5
|
||||
case bltestRC5_ECB:
|
||||
case bltestRC5_CBC:
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "iv", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "iv", j);
|
||||
load_file_data(arena, ¶ms->sk.iv, filename, bltestBinary);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
load_file_data(arena, ¶ms->sk.key, filename, bltestBinary);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr,
|
||||
"params", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr,
|
||||
"params", j);
|
||||
file = fopen(filename, "r");
|
||||
if (!file)
|
||||
return;
|
||||
@@ -3072,59 +3070,59 @@ get_params(PLArenaPool *arena, bltestParams *params,
|
||||
break;
|
||||
#endif
|
||||
case bltestRSA_PSS:
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
|
||||
load_file_data(arena, ¶ms->asymk.sig, filename, bltestBase64Encoded);
|
||||
/* fall through */
|
||||
case bltestRSA_OAEP:
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "seed", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "seed", j);
|
||||
load_file_data(arena, ¶ms->asymk.cipherParams.rsa.seed,
|
||||
filename, bltestBase64Encoded);
|
||||
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "hash", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "hash", j);
|
||||
load_file_data(arena, &tempIO, filename, bltestBinary);
|
||||
params->asymk.cipherParams.rsa.hashAlg =
|
||||
mode_str_to_hash_alg(&tempIO.buf);
|
||||
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "maskhash", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "maskhash", j);
|
||||
load_file_data(arena, &tempIO, filename, bltestBinary);
|
||||
params->asymk.cipherParams.rsa.maskHashAlg =
|
||||
mode_str_to_hash_alg(&tempIO.buf);
|
||||
/* fall through */
|
||||
case bltestRSA:
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
load_file_data(arena, ¶ms->asymk.key, filename,
|
||||
bltestBase64Encoded);
|
||||
params->asymk.privKey =
|
||||
(void *)rsakey_from_filedata(arena, ¶ms->asymk.key.buf);
|
||||
break;
|
||||
case bltestDSA:
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
load_file_data(arena, ¶ms->asymk.key, filename, bltestBase64Encoded);
|
||||
params->asymk.privKey =
|
||||
(void *)dsakey_from_filedata(arena, ¶ms->asymk.key.buf);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "pqg", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "pqg", j);
|
||||
load_file_data(arena, ¶ms->asymk.cipherParams.dsa.pqgdata, filename,
|
||||
bltestBase64Encoded);
|
||||
params->asymk.cipherParams.dsa.pqg =
|
||||
pqg_from_filedata(arena, ¶ms->asymk.cipherParams.dsa.pqgdata.buf);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "keyseed", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "keyseed", j);
|
||||
load_file_data(arena, ¶ms->asymk.cipherParams.dsa.keyseed, filename,
|
||||
bltestBase64Encoded);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j);
|
||||
load_file_data(arena, ¶ms->asymk.cipherParams.dsa.sigseed, filename,
|
||||
bltestBase64Encoded);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
|
||||
load_file_data(arena, ¶ms->asymk.sig, filename, bltestBase64Encoded);
|
||||
break;
|
||||
case bltestECDSA:
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
|
||||
load_file_data(arena, ¶ms->asymk.key, filename, bltestBase64Encoded);
|
||||
params->asymk.privKey =
|
||||
(void *)eckey_from_filedata(arena, ¶ms->asymk.key.buf);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j);
|
||||
load_file_data(arena, ¶ms->asymk.cipherParams.ecdsa.sigseed,
|
||||
filename, bltestBase64Encoded);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
|
||||
load_file_data(arena, ¶ms->asymk.sig, filename, bltestBase64Encoded);
|
||||
break;
|
||||
case bltestMD2:
|
||||
@@ -3240,7 +3238,7 @@ blapi_selftest(bltestCipherMode *modes, int numModes, int inoff, int outoff,
|
||||
cipherInfo.mode = mode;
|
||||
params = &cipherInfo.params;
|
||||
/* get the number of tests in the directory */
|
||||
sprintf(filename, "%s/tests/%s/%s", testdir, modestr, "numtests");
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s", testdir, modestr, "numtests");
|
||||
if (ReadFileToItem(arena, &item, filename) != SECSuccess) {
|
||||
fprintf(stderr, "%s: Cannot read file %s.\n", progName, filename);
|
||||
rv = SECFailure;
|
||||
@@ -3256,13 +3254,13 @@ blapi_selftest(bltestCipherMode *modes, int numModes, int inoff, int outoff,
|
||||
numtests += (int)(item.data[j] - '0');
|
||||
}
|
||||
for (j = 0; j < numtests; j++) {
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr,
|
||||
"plaintext", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr,
|
||||
"plaintext", j);
|
||||
load_file_data(arena, &pt, filename,
|
||||
is_sigCipher(mode) ? bltestBase64Encoded
|
||||
: bltestBinary);
|
||||
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr,
|
||||
"ciphertext", j);
|
||||
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr,
|
||||
"ciphertext", j);
|
||||
load_file_data(arena, &ct, filename, bltestBase64Encoded);
|
||||
|
||||
get_params(arena, params, mode, j);
|
||||
@@ -3661,57 +3659,55 @@ enum {
|
||||
opt_CmdLine
|
||||
};
|
||||
|
||||
static secuCommandFlag bltest_commands[] =
|
||||
{
|
||||
{ /* cmd_Decrypt */ 'D', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Encrypt */ 'E', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_FIPS */ 'F', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Hash */ 'H', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Nonce */ 'N', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Dump */ 'P', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_RSAPopulate */ 'R', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_RSAPopulateKV */ 'K', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Sign */ 'S', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_SelfTest */ 'T', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Verify */ 'V', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
static secuCommandFlag bltest_commands[] = {
|
||||
{ /* cmd_Decrypt */ 'D', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Encrypt */ 'E', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_FIPS */ 'F', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Hash */ 'H', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Nonce */ 'N', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Dump */ 'P', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_RSAPopulate */ 'R', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_RSAPopulateKV */ 'K', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Sign */ 'S', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_SelfTest */ 'T', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Verify */ 'V', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
|
||||
static secuCommandFlag bltest_options[] =
|
||||
{
|
||||
{ /* opt_B64 */ 'a', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_BufSize */ 'b', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Restart */ 'c', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_SelfTestDir */ 'd', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Exponent */ 'e', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SigFile */ 'f', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Hex */ 'h', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_PQGFile */ 'j', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Key */ 'k', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_HexWSpc */ 'l', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Mode */ 'm', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CurveName */ 'n', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Output */ 'o', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Repetitions */ 'p', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_ZeroBuf */ 'q', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Rounds */ 'r', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Seed */ 's', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SigSeedFile */ 't', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CXReps */ 'u', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_IV */ 'v', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_WordSize */ 'w', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_UseSeed */ 'x', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_UseSigSeed */ 'y', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_SeedFile */ 'z', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AAD */ 0, PR_TRUE, 0, PR_FALSE, "aad" },
|
||||
{ /* opt_InputOffset */ '1', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OutputOffset */ '2', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_MonteCarlo */ '3', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_ThreadNum */ '4', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SecondsToRun */ '5', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CmdLine */ '-', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
static secuCommandFlag bltest_options[] = {
|
||||
{ /* opt_B64 */ 'a', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_BufSize */ 'b', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Restart */ 'c', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_SelfTestDir */ 'd', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Exponent */ 'e', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SigFile */ 'f', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Hex */ 'h', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_PQGFile */ 'j', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Key */ 'k', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_HexWSpc */ 'l', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Mode */ 'm', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CurveName */ 'n', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Output */ 'o', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Repetitions */ 'p', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_ZeroBuf */ 'q', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Rounds */ 'r', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Seed */ 's', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SigSeedFile */ 't', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CXReps */ 'u', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_IV */ 'v', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_WordSize */ 'w', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_UseSeed */ 'x', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_UseSigSeed */ 'y', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_SeedFile */ 'z', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AAD */ 0, PR_TRUE, 0, PR_FALSE, "aad" },
|
||||
{ /* opt_InputOffset */ '1', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OutputOffset */ '2', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_MonteCarlo */ '3', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_ThreadNum */ '4', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SecondsToRun */ '5', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CmdLine */ '-', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@@ -3875,12 +3871,19 @@ main(int argc, char **argv)
|
||||
|
||||
/* Do FIPS self-test */
|
||||
if (bltest.commands[cmd_FIPS].activated) {
|
||||
CK_RV ckrv = sftk_FIPSEntryOK();
|
||||
fprintf(stdout, "CK_RV: %ld.\n", ckrv);
|
||||
PORT_Free(cipherInfo);
|
||||
if (ckrv == CKR_OK)
|
||||
return SECSuccess;
|
||||
#ifdef NSS_FIPS_DISABLED
|
||||
fprintf(stdout, "FIPS self-test failed with: NSS_FIPS_DISABLED\n");
|
||||
return SECFailure;
|
||||
#else
|
||||
CK_RV ckrv = sftk_FIPSEntryOK(PR_FALSE);
|
||||
if (ckrv == CKR_OK) {
|
||||
fprintf(stdout, "FIPS self-test was successful.\n");
|
||||
return SECSuccess;
|
||||
}
|
||||
fprintf(stdout, "FIPS self-test failed with the CK_RV: %ld.\n", ckrv);
|
||||
return SECFailure;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -34,7 +34,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -85,7 +86,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -136,7 +138,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -187,7 +190,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -238,7 +242,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -289,7 +294,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -340,7 +346,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -394,7 +401,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -445,7 +453,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -496,7 +505,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -547,7 +557,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -598,7 +609,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -649,7 +661,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -700,7 +713,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
@@ -751,7 +765,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
|
||||
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
|
||||
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
|
||||
128,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3,
|
||||
(unsigned char[]){ 0x01, 0x00, 0x01 },
|
||||
3,
|
||||
(unsigned char[]){
|
||||
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
|
||||
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
The test vectors in this folder are used to test the RSA-PSS code. The tests 0-17 use the SHA-1 hash function, the tests 18-19 use the SHA-256 hash function, the tests 20-21 use the SHA-384 hash function.
|
||||
@@ -0,0 +1 @@
|
||||
lIqC19k21FCCvK9St7rh1YBrWugJI76xgKSh7XuuV0/AH6lIukcqCkODU5zIza9sRz6VluOKEvNOkscaqkCjbPVVQeNa/II0iwjcRG/XNgj1J9vNi9Lt+UiKRcO/YMoAz+UmqJTL9nbKVJEbAX3ckjDnMZZ/XzQJS87WyUFw7Ak=
|
||||
@@ -0,0 +1 @@
|
||||
oNSdYElIrvVdpPuXWr+eDKcy2DaBoRPdCitzmoorhd2e3nc0V1VSjun5/x/UxUojVe11tcVzDhXXmZFDLT1DEF1ZIq4BUBg9Og0bHXsd93BAC8P1M15I3O1Tsw8fs711XfRy2ONarnyUF+yI2pMSvI95eKB/tPaOVyWVgkgwpm5LssAoRjxP0zE/OIVMH+jIvVeg+gf1uVh7QncCv7VuCgEOViH4mjd05Zydc6YMwbjeH5AZM778l38eZtz6Vg50x1yB/0r09KKDc9D7awIbPSU3GiDy2fbmfPIyBqwNvtZbVd1rEdCUEJiSvXOhW7Fle9FSYekTyH3Rfr/R0GKiTQ==
|
||||
@@ -0,0 +1 @@
|
||||
L3Ad3lcyjzUFWRLBB6V8LvizEEbKA9+gBKarSAG8LViCtuoJJ5jrXTv8BMdV121JJIFNMF6YsHPa+o7n1tMwVasRCiLirvP9yORL/2THHhcNxX+AO1kpvz6IdgTueior3zRjutR3wzrwxYaJSo8WlCYSlSoDLJt4wt5aw1eOh1U=
|
||||
@@ -0,0 +1 @@
|
||||
l3HCE9I9e21NAXYVhsvJySQVu2+pfHP+0e82Vr7ke7htBg21AsG/jWd+JpEhpVwNyA2cqDBLDQZn4YigM6HX+AqhEXxcMeFccGleb3NF5qXwtmuaFQBJyuU9/gXFEip3mldECMuLdZono0zdDgiCpz/Ep3x43aD/RzVK/tLKSbSyUROw3bKifpaSIAMYPeJ1iA2AMv2c1ON1oaKjb0GUH5bv/ZHF0uCbuShoxJHu8aYrYkeL3y1b8RQRO/e/mjpGNNZTGZTCEa6UFv7GdBO5bYZBFsfgAMkCyut74aDSNTpyr68gfGY4XXglKwpXUFw6/pkOWOG6GB+m5g0ULSrBqg==
|
||||
@@ -0,0 +1 @@
|
||||
sha256
|
||||
@@ -0,0 +1 @@
|
||||
sha256
|
||||
@@ -0,0 +1 @@
|
||||
sha384
|
||||
@@ -0,0 +1 @@
|
||||
sha384
|
||||
@@ -0,0 +1 @@
|
||||
AAAAAQAAAACApW5KDnAQF1iaUYfcfqhB0Vby7A42rVKkTf6x5h962ZHYxRBW/+2xYrTA8oOhKoijlN/1JqtykcuzB86r/OCx39XNlQgJbVsri2311nHvY3fAkhyyPCcKcOJZjm/4nRnxBazC0/DLNfKSgOE4a29kxO8i4eHyDQzoz/siSb2aITcAAAADAQABAAAAgDOlBCqQsn1PVFHKm7vQtEdxoQGviENArvmIXypLvpLolKckrDxWjI+XhTrQfAJmyMajygkp8ejxEjGIRCn8TZrlX+6JahDOcHw+1+c05Ecno5V0UBpTJoMQnCq6yrooPDG0vS9Tw+4341LO40+eUDvYDAYirXnG3O6INUfGo7MlAAAAQOfolCcgqHdRcnOjVgU+oqG8DJSqctVcboYpay38lnlIwKcsvMyn6ss1cG4Jod9VoVNb2bPMNBYLO23NPtqOZEMAAABAtp3KHPfU1+yB51uQ/MqHSrzeEj/ScAGAqpBHm25I3o1n7ST58Z2FuidYdPVCzSDccj5pYzZKH5QlRSsmmmeZ/QAAAEAo+hOThlW+H4oVnLrKWnLqGQwwCJ4ZzSdKVW82xPbhn1VLNMB3eQQnu92N0+3iRIMo84XYGzDo5Dsv/6Anhhl5AAAAQBqLOPOY+nEgSYmNf7ee4Kd2aHkSmc36Ce/A5Qessh7XQwHvW/1IvkVerrbhZ4JVgnWAqOTo4UFR0VEKgqPy5ykAAABAJxVqukEm0kqB86Uoy/sn9WiG+ECp9uhuF6RLlP6TGVhLjiL93h5aLjvYqluo2FhBlOshkKz4MrhH8To9JKefTQ==
|
||||
@@ -0,0 +1 @@
|
||||
AAAAAQAAAAEApd2GesTLAvkLlFfUjBSncO+ZHFbDnA7GX9Ea+ok3zqV7m+esc7RcABdhW4LWIuMYdTtgJ8D9FXvhL4CQ/uKnrc0O73WfiLpJl8ekLVjJqhLLma4AH+UhwTu1QxRFqNWuT15MfpSKwifTYEBx8g5XfpBfvrFd+vBtHeWuYlPWOmohILMaXaXavJVQYA4g8n03OeJieSX+o8xQnyHf8E5u6kVJxUDWgJ/5MH7t6R//WHM9g4WiN9bTcFoz45GQCZIHDfet8TV89+NwDONmfeg/F7jfF3jbOB3OCctK0FilEQAac4GY7ifPVaE7dUU5kGWC7IsXS9WNXR89dnxhNyGuBQAAAAMBAAEAAAEALS/1Z7P+dOBhkbf97W3hEikMZwaSQw1ZaRhAR9ojTJaT3u0Wc+1ClTnJadNywE1rR+D1uM7ghD5cIoNdvTsFoJl5hK5gWLEbxJB8v2fthPqa4lLfsNDNSeYY4139/lm8o93WbDPOu8d61EGqaV4T4yS1GPAcYPWoXJlK0XnyprX76TQCsRdnvgG/BzRE1rod0rylvQdNSl+uNTGtEwPYSzDYlzGMu7oE4DwuZt5tkfgvluodS7VKWq4QLVlGV/XJeJVTUSspbeop2AIxljV+PjpulY8548I0QDjqYEsx7cbw9/9ucYGlfJKCaiaPhnaOlvh4Vi/HHYXWnkSGEvcEjwAAAIDP1QKD/u65f28I1zy8ezg2+Cu81JlHn15vdv38uLOMT3Hcnoi9am92Nxr9ZdKvGGKzKvs0qV9xuLEyBD/+vjqVK691kkSBSMA/nGmx1o5M5c8yyGuvRv7TAcoatAMGmzL0VrkfcYmKsIHNjEJS71JxkVyXlLjylYUdp1EPmctz6wAAAIDMTpDSobOgZdOy0fWo/OMbVER1Zk6rVh0pcbmft774ROjsHzYLjCrINZaSlx6mo49yP8whH128sXeg/axRZKHU/3+7ToKZhjU8uYNlmhSM3UIMfTG6OCLqkKMr5GwDDowX4foK03hZ4GsKpvo7IW2cvmwOIjOXacCmFZE+XacZzwAAAIAcLR/DL2vEAE/YXf3g+7+aTDj5x8TkHeoaqII0ogHNkvO32lJlg6mK2FuzYPuYO3EeI0SdVh0XeNelFUhry/R7Rsnp4aOh93AA776wmor+R+W4V82pnLFtf/+bcS471gypbZx5c9YW1Gk0qcBQKBwAQ5nO/x233aeHZqipucsIcwAAAIDLOzwEyqWMYL59my3rs+OWQ/T1c5e+CCNqHp6vqnBlNuccOs/gHMZR8jyeBYWP7hO7aor8R99O3JpLowvOy3PQFXhSMn7niQFcLo3ue58FoPMayU62FzFkdAxclRR81fO1riy0qDeH8B2Ksx8nwtDuot2KEauQarogfEPG7hJTMQAAAIAS9rLPE3SnNvrQVhYFD5arS2HRF3x/nVJaKfPRgOd2Z+mdmavwUl0HWGYPN1JlWw8luN+EMdmo/3fBbBKgpRIqnwv3z9WiZqNcFZ+ZEgi5Axb/RE8+C2vQ6TuKeiRI6Vfj3abPzyJmsQYBOsRoCNOziHs7ADRLqslTC0znCPwytg==
|
||||
@@ -0,0 +1 @@
|
||||
AAAAAQAAAACApW5KDnAQF1iaUYfcfqhB0Vby7A42rVKkTf6x5h962ZHYxRBW/+2xYrTA8oOhKoijlN/1JqtykcuzB86r/OCx39XNlQgJbVsri2311nHvY3fAkhyyPCcKcOJZjm/4nRnxBazC0/DLNfKSgOE4a29kxO8i4eHyDQzoz/siSb2aITcAAAADAQABAAAAgDOlBCqQsn1PVFHKm7vQtEdxoQGviENArvmIXypLvpLolKckrDxWjI+XhTrQfAJmyMajygkp8ejxEjGIRCn8TZrlX+6JahDOcHw+1+c05Ecno5V0UBpTJoMQnCq6yrooPDG0vS9Tw+4341LO40+eUDvYDAYirXnG3O6INUfGo7MlAAAAQOfolCcgqHdRcnOjVgU+oqG8DJSqctVcboYpay38lnlIwKcsvMyn6ss1cG4Jod9VoVNb2bPMNBYLO23NPtqOZEMAAABAtp3KHPfU1+yB51uQ/MqHSrzeEj/ScAGAqpBHm25I3o1n7ST58Z2FuidYdPVCzSDccj5pYzZKH5QlRSsmmmeZ/QAAAEAo+hOThlW+H4oVnLrKWnLqGQwwCJ4ZzSdKVW82xPbhn1VLNMB3eQQnu92N0+3iRIMo84XYGzDo5Dsv/6Anhhl5AAAAQBqLOPOY+nEgSYmNf7ee4Kd2aHkSmc36Ce/A5Qessh7XQwHvW/1IvkVerrbhZ4JVgnWAqOTo4UFR0VEKgqPy5ykAAABAJxVqukEm0kqB86Uoy/sn9WiG+ECp9uhuF6RLlP6TGVhLjiL93h5aLjvYqluo2FhBlOshkKz4MrhH8To9JKefTQ==
|
||||
@@ -0,0 +1 @@
|
||||
AAAAAQAAAAEApd2GesTLAvkLlFfUjBSncO+ZHFbDnA7GX9Ea+ok3zqV7m+esc7RcABdhW4LWIuMYdTtgJ8D9FXvhL4CQ/uKnrc0O73WfiLpJl8ekLVjJqhLLma4AH+UhwTu1QxRFqNWuT15MfpSKwifTYEBx8g5XfpBfvrFd+vBtHeWuYlPWOmohILMaXaXavJVQYA4g8n03OeJieSX+o8xQnyHf8E5u6kVJxUDWgJ/5MH7t6R//WHM9g4WiN9bTcFoz45GQCZIHDfet8TV89+NwDONmfeg/F7jfF3jbOB3OCctK0FilEQAac4GY7ifPVaE7dUU5kGWC7IsXS9WNXR89dnxhNyGuBQAAAAMBAAEAAAEALS/1Z7P+dOBhkbf97W3hEikMZwaSQw1ZaRhAR9ojTJaT3u0Wc+1ClTnJadNywE1rR+D1uM7ghD5cIoNdvTsFoJl5hK5gWLEbxJB8v2fthPqa4lLfsNDNSeYY4139/lm8o93WbDPOu8d61EGqaV4T4yS1GPAcYPWoXJlK0XnyprX76TQCsRdnvgG/BzRE1rod0rylvQdNSl+uNTGtEwPYSzDYlzGMu7oE4DwuZt5tkfgvluodS7VKWq4QLVlGV/XJeJVTUSspbeop2AIxljV+PjpulY8548I0QDjqYEsx7cbw9/9ucYGlfJKCaiaPhnaOlvh4Vi/HHYXWnkSGEvcEjwAAAIDP1QKD/u65f28I1zy8ezg2+Cu81JlHn15vdv38uLOMT3Hcnoi9am92Nxr9ZdKvGGKzKvs0qV9xuLEyBD/+vjqVK691kkSBSMA/nGmx1o5M5c8yyGuvRv7TAcoatAMGmzL0VrkfcYmKsIHNjEJS71JxkVyXlLjylYUdp1EPmctz6wAAAIDMTpDSobOgZdOy0fWo/OMbVER1Zk6rVh0pcbmft774ROjsHzYLjCrINZaSlx6mo49yP8whH128sXeg/axRZKHU/3+7ToKZhjU8uYNlmhSM3UIMfTG6OCLqkKMr5GwDDowX4foK03hZ4GsKpvo7IW2cvmwOIjOXacCmFZE+XacZzwAAAIAcLR/DL2vEAE/YXf3g+7+aTDj5x8TkHeoaqII0ogHNkvO32lJlg6mK2FuzYPuYO3EeI0SdVh0XeNelFUhry/R7Rsnp4aOh93AA776wmor+R+W4V82pnLFtf/+bcS471gypbZx5c9YW1Gk0qcBQKBwAQ5nO/x233aeHZqipucsIcwAAAIDLOzwEyqWMYL59my3rs+OWQ/T1c5e+CCNqHp6vqnBlNuccOs/gHMZR8jyeBYWP7hO7aor8R99O3JpLowvOy3PQFXhSMn7niQFcLo3ue58FoPMayU62FzFkdAxclRR81fO1riy0qDeH8B2Ksx8nwtDuot2KEauQarogfEPG7hJTMQAAAIAS9rLPE3SnNvrQVhYFD5arS2HRF3x/nVJaKfPRgOd2Z+mdmavwUl0HWGYPN1JlWw8luN+EMdmo/3fBbBKgpRIqnwv3z9WiZqNcFZ+ZEgi5Axb/RE8+C2vQ6TuKeiRI6Vfj3abPzyJmsQYBOsRoCNOziHs7ADRLqslTC0znCPwytg==
|
||||
@@ -0,0 +1 @@
|
||||
sha256
|
||||
@@ -0,0 +1 @@
|
||||
sha256
|
||||
@@ -0,0 +1 @@
|
||||
sha384
|
||||
@@ -0,0 +1 @@
|
||||
sha384
|
||||
@@ -1 +1 @@
|
||||
18
|
||||
22
|
||||
@@ -0,0 +1 @@
|
||||
sHTPDreX8OBy2HI7TTylTgcp23MHZaDCzD2EvH2a2eU=
|
||||
@@ -0,0 +1 @@
|
||||
+7ollkbnkxPBlmn44TwIqunTc/mhZKZBSEw+8sVi6Do=
|
||||
@@ -0,0 +1 @@
|
||||
X5EfOb/yrZEPkVDoFO8tcT+SoSb12FF81pFkh496bjQxOsTR+JB0117SKnMlETrs
|
||||
@@ -0,0 +1 @@
|
||||
9c/VD/5YZylCA6IiXXail2FiXvTM0eE0kDpqyGwqBaROdiYWxPXGIKjoueke7jpB
|
||||
@@ -0,0 +1 @@
|
||||
GFt1LMXU6mtkIJwKMP+Nm3l2Z9CJ1KUVKpjF9WZ+5WY=
|
||||
@@ -0,0 +1 @@
|
||||
xa78saDnF7JsnT1IOUVcvZvd1wXaiWMZdQ80MB41H3s=
|
||||
@@ -0,0 +1 @@
|
||||
taPFMNUYb279NTjWAWJUeFKsN3c4aRO0B2zcV4VfXlZenae7NRFD1GV+kivVIBk3
|
||||
@@ -0,0 +1 @@
|
||||
kegGyCeVFDJ2DtrL/DKfeTFjodxhcehNAjtluf09+2WS0uD3Lce3V9Knl4I1VlBS
|
||||
@@ -50,6 +50,35 @@
|
||||
|
||||
char *progName;
|
||||
|
||||
static SECStatus
|
||||
ChangeCertTrust(CERTCertDBHandle *handle, CERTCertificate *cert,
|
||||
CERTCertTrust *trust, PK11SlotInfo *slot, void *pwdata)
|
||||
{
|
||||
SECStatus rv;
|
||||
|
||||
rv = CERT_ChangeCertTrust(handle, cert, trust);
|
||||
if (rv != SECSuccess) {
|
||||
if (PORT_GetError() == SEC_ERROR_TOKEN_NOT_LOGGED_IN) {
|
||||
rv = PK11_Authenticate(slot, PR_TRUE, pwdata);
|
||||
if (PORT_GetError() == SEC_ERROR_TOKEN_NOT_LOGGED_IN) {
|
||||
PK11SlotInfo *internalslot;
|
||||
internalslot = PK11_GetInternalKeySlot();
|
||||
rv = PK11_Authenticate(internalslot, PR_TRUE, pwdata);
|
||||
if (rv != SECSuccess) {
|
||||
SECU_PrintError(progName,
|
||||
"could not authenticate to token %s.",
|
||||
PK11_GetTokenName(internalslot));
|
||||
PK11_FreeSlot(internalslot);
|
||||
return SECFailure;
|
||||
}
|
||||
PK11_FreeSlot(internalslot);
|
||||
}
|
||||
rv = CERT_ChangeCertTrust(handle, cert, trust);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static CERTCertificateRequest *
|
||||
GetCertRequest(const SECItem *reqDER, void *pwarg)
|
||||
{
|
||||
@@ -149,24 +178,11 @@ AddCert(PK11SlotInfo *slot, CERTCertDBHandle *handle, char *name, char *trusts,
|
||||
GEN_BREAK(SECFailure);
|
||||
}
|
||||
}
|
||||
|
||||
rv = CERT_ChangeCertTrust(handle, cert, trust);
|
||||
rv = ChangeCertTrust(handle, cert, trust, slot, pwdata);
|
||||
if (rv != SECSuccess) {
|
||||
if (PORT_GetError() == SEC_ERROR_TOKEN_NOT_LOGGED_IN) {
|
||||
rv = PK11_Authenticate(slot, PR_TRUE, pwdata);
|
||||
if (rv != SECSuccess) {
|
||||
SECU_PrintError(progName,
|
||||
"could not authenticate to token %s.",
|
||||
PK11_GetTokenName(slot));
|
||||
GEN_BREAK(SECFailure);
|
||||
}
|
||||
rv = CERT_ChangeCertTrust(handle, cert, trust);
|
||||
}
|
||||
if (rv != SECSuccess) {
|
||||
SECU_PrintError(progName,
|
||||
"could not change trust on certificate");
|
||||
GEN_BREAK(SECFailure);
|
||||
}
|
||||
SECU_PrintError(progName,
|
||||
"could not change trust on certificate");
|
||||
GEN_BREAK(SECFailure);
|
||||
}
|
||||
|
||||
if (emailcert) {
|
||||
@@ -426,21 +442,10 @@ ChangeTrustAttributes(CERTCertDBHandle *handle, PK11SlotInfo *slot,
|
||||
* a context, so NSS can't prompt for the password if it needs to.
|
||||
* check to see if the failure was token not logged in and
|
||||
* log in if need be. */
|
||||
rv = CERT_ChangeCertTrust(handle, cert, trust);
|
||||
rv = ChangeCertTrust(handle, cert, trust, slot, pwdata);
|
||||
if (rv != SECSuccess) {
|
||||
if (PORT_GetError() == SEC_ERROR_TOKEN_NOT_LOGGED_IN) {
|
||||
rv = PK11_Authenticate(slot, PR_TRUE, pwdata);
|
||||
if (rv != SECSuccess) {
|
||||
SECU_PrintError(progName, "could not authenticate to token %s.",
|
||||
PK11_GetTokenName(slot));
|
||||
return SECFailure;
|
||||
}
|
||||
rv = CERT_ChangeCertTrust(handle, cert, trust);
|
||||
}
|
||||
if (rv != SECSuccess) {
|
||||
SECU_PrintError(progName, "unable to modify trust attributes");
|
||||
return SECFailure;
|
||||
}
|
||||
SECU_PrintError(progName, "unable to modify trust attributes");
|
||||
return SECFailure;
|
||||
}
|
||||
CERT_DestroyCertificate(cert);
|
||||
PORT_Free(trust);
|
||||
@@ -852,7 +857,7 @@ SECItemToHex(const SECItem *item, char *dst)
|
||||
unsigned char *src = item->data;
|
||||
unsigned int len = item->len;
|
||||
for (; len > 0; --len, dst += 2) {
|
||||
sprintf(dst, "%02x", *src++);
|
||||
snprintf(dst, 3, "%02x", *src++);
|
||||
}
|
||||
*dst = '\0';
|
||||
}
|
||||
@@ -900,8 +905,6 @@ PrintKey(PRFileDesc *out, const char *nickName, int count,
|
||||
CERTCertificate *cert;
|
||||
KeyType keyType;
|
||||
|
||||
pwarg = NULL;
|
||||
|
||||
formatPrivateKeyID(key, ckaIDbuf);
|
||||
cert = PK11_GetCertFromPrivateKey(key);
|
||||
if (cert) {
|
||||
@@ -2346,7 +2349,7 @@ getObjectClass(CK_ULONG classType)
|
||||
if (classType >= CKO_NSS && classType <= CKO_NSS_BUILTIN_ROOT_LIST) {
|
||||
return objNSSClassArray[classType - CKO_NSS];
|
||||
}
|
||||
sprintf(buf, "0x%lx", classType);
|
||||
snprintf(buf, sizeof(buf), "0x%lx", classType);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -2358,34 +2361,32 @@ typedef struct {
|
||||
|
||||
#define NAME_SIZE(x) #x, sizeof(#x) - 1
|
||||
|
||||
flagArray opFlagsArray[] =
|
||||
{
|
||||
{ NAME_SIZE(encrypt), CKF_ENCRYPT },
|
||||
{ NAME_SIZE(decrypt), CKF_DECRYPT },
|
||||
{ NAME_SIZE(sign), CKF_SIGN },
|
||||
{ NAME_SIZE(sign_recover), CKF_SIGN_RECOVER },
|
||||
{ NAME_SIZE(verify), CKF_VERIFY },
|
||||
{ NAME_SIZE(verify_recover), CKF_VERIFY_RECOVER },
|
||||
{ NAME_SIZE(wrap), CKF_WRAP },
|
||||
{ NAME_SIZE(unwrap), CKF_UNWRAP },
|
||||
{ NAME_SIZE(derive), CKF_DERIVE }
|
||||
};
|
||||
flagArray opFlagsArray[] = {
|
||||
{ NAME_SIZE(encrypt), CKF_ENCRYPT },
|
||||
{ NAME_SIZE(decrypt), CKF_DECRYPT },
|
||||
{ NAME_SIZE(sign), CKF_SIGN },
|
||||
{ NAME_SIZE(sign_recover), CKF_SIGN_RECOVER },
|
||||
{ NAME_SIZE(verify), CKF_VERIFY },
|
||||
{ NAME_SIZE(verify_recover), CKF_VERIFY_RECOVER },
|
||||
{ NAME_SIZE(wrap), CKF_WRAP },
|
||||
{ NAME_SIZE(unwrap), CKF_UNWRAP },
|
||||
{ NAME_SIZE(derive), CKF_DERIVE }
|
||||
};
|
||||
|
||||
int opFlagsCount = PR_ARRAY_SIZE(opFlagsArray);
|
||||
|
||||
flagArray attrFlagsArray[] =
|
||||
{
|
||||
{ NAME_SIZE(token), PK11_ATTR_TOKEN },
|
||||
{ NAME_SIZE(session), PK11_ATTR_SESSION },
|
||||
{ NAME_SIZE(private), PK11_ATTR_PRIVATE },
|
||||
{ NAME_SIZE(public), PK11_ATTR_PUBLIC },
|
||||
{ NAME_SIZE(modifiable), PK11_ATTR_MODIFIABLE },
|
||||
{ NAME_SIZE(unmodifiable), PK11_ATTR_UNMODIFIABLE },
|
||||
{ NAME_SIZE(sensitive), PK11_ATTR_SENSITIVE },
|
||||
{ NAME_SIZE(insensitive), PK11_ATTR_INSENSITIVE },
|
||||
{ NAME_SIZE(extractable), PK11_ATTR_EXTRACTABLE },
|
||||
{ NAME_SIZE(unextractable), PK11_ATTR_UNEXTRACTABLE }
|
||||
};
|
||||
flagArray attrFlagsArray[] = {
|
||||
{ NAME_SIZE(token), PK11_ATTR_TOKEN },
|
||||
{ NAME_SIZE(session), PK11_ATTR_SESSION },
|
||||
{ NAME_SIZE(private), PK11_ATTR_PRIVATE },
|
||||
{ NAME_SIZE(public), PK11_ATTR_PUBLIC },
|
||||
{ NAME_SIZE(modifiable), PK11_ATTR_MODIFIABLE },
|
||||
{ NAME_SIZE(unmodifiable), PK11_ATTR_UNMODIFIABLE },
|
||||
{ NAME_SIZE(sensitive), PK11_ATTR_SENSITIVE },
|
||||
{ NAME_SIZE(insensitive), PK11_ATTR_INSENSITIVE },
|
||||
{ NAME_SIZE(extractable), PK11_ATTR_EXTRACTABLE },
|
||||
{ NAME_SIZE(unextractable), PK11_ATTR_UNEXTRACTABLE }
|
||||
};
|
||||
|
||||
int attrFlagsCount = PR_ARRAY_SIZE(attrFlagsArray);
|
||||
|
||||
@@ -2601,130 +2602,128 @@ enum certutilOpts {
|
||||
opt_Help
|
||||
};
|
||||
|
||||
static const secuCommandFlag commands_init[] =
|
||||
{
|
||||
{ /* cmd_AddCert */ 'A', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CreateNewCert */ 'C', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_DeleteCert */ 'D', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_AddEmailCert */ 'E', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_DeleteKey */ 'F', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_GenKeyPair */ 'G', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_PrintHelp */ 'H', PR_FALSE, 0, PR_FALSE, "help" },
|
||||
{ /* cmd_PrintSyntax */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"syntax" },
|
||||
{ /* cmd_ListKeys */ 'K', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ListCerts */ 'L', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ModifyCertTrust */ 'M', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_NewDBs */ 'N', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_DumpChain */ 'O', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CertReq */ 'R', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CreateAndAddCert */ 'S', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_TokenReset */ 'T', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ListModules */ 'U', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CheckCertValidity */ 'V', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ChangePassword */ 'W', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Version */ 'Y', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Batch */ 'B', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Merge */ 0, PR_FALSE, 0, PR_FALSE, "merge" },
|
||||
{ /* cmd_UpgradeMerge */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"upgrade-merge" },
|
||||
{ /* cmd_Rename */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"rename" },
|
||||
{ /* cmd_BuildFlags */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"build-flags" }
|
||||
};
|
||||
static const secuCommandFlag commands_init[] = {
|
||||
{ /* cmd_AddCert */ 'A', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CreateNewCert */ 'C', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_DeleteCert */ 'D', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_AddEmailCert */ 'E', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_DeleteKey */ 'F', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_GenKeyPair */ 'G', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_PrintHelp */ 'H', PR_FALSE, 0, PR_FALSE, "help" },
|
||||
{ /* cmd_PrintSyntax */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"syntax" },
|
||||
{ /* cmd_ListKeys */ 'K', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ListCerts */ 'L', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ModifyCertTrust */ 'M', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_NewDBs */ 'N', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_DumpChain */ 'O', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CertReq */ 'R', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CreateAndAddCert */ 'S', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_TokenReset */ 'T', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ListModules */ 'U', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CheckCertValidity */ 'V', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ChangePassword */ 'W', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Version */ 'Y', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Batch */ 'B', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Merge */ 0, PR_FALSE, 0, PR_FALSE, "merge" },
|
||||
{ /* cmd_UpgradeMerge */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"upgrade-merge" },
|
||||
{ /* cmd_Rename */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"rename" },
|
||||
{ /* cmd_BuildFlags */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"build-flags" }
|
||||
};
|
||||
#define NUM_COMMANDS ((sizeof commands_init) / (sizeof commands_init[0]))
|
||||
|
||||
static const secuCommandFlag options_init[] =
|
||||
{
|
||||
{ /* opt_SSOPass */ '0', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_AddKeyUsageExt */ '1', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddBasicConstraintExt*/ '2', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddAuthorityKeyIDExt*/ '3', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddCRLDistPtsExt */ '4', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddNSCertTypeExt */ '5', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddExtKeyUsageExt */ '6', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_ExtendedEmailAddrs */ '7', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_ExtendedDNSNames */ '8', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_ASCIIForIO */ 'a', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_ValidityTime */ 'b', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_IssuerName */ 'c', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CertDir */ 'd', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_VerifySig */ 'e', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_PasswordFile */ 'f', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_TokenName */ 'h', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_InputFile */ 'i', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Emailaddress */ 0, PR_TRUE, 0, PR_FALSE, "email" },
|
||||
{ /* opt_KeyIndex */ 'j', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_KeyType */ 'k', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_DetailedInfo */ 'l', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_SerialNumber */ 'm', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Nickname */ 'n', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OutputFile */ 'o', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_PhoneNumber */ 'p', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_DBPrefix */ 'P', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_PQGFile */ 'q', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_BinaryDER */ 'r', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Subject */ 's', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Trust */ 't', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Usage */ 'u', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Validity */ 'v', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OffsetMonths */ 'w', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SelfSign */ 'x', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_RW */ 'X', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Exponent */ 'y', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_NoiseFile */ 'z', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Hash */ 'Z', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_NewPasswordFile */ '@', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_AddAuthInfoAccExt */ 0, PR_FALSE, 0, PR_FALSE, "extAIA" },
|
||||
{ /* opt_AddSubjInfoAccExt */ 0, PR_FALSE, 0, PR_FALSE, "extSIA" },
|
||||
{ /* opt_AddCertPoliciesExt */ 0, PR_FALSE, 0, PR_FALSE, "extCP" },
|
||||
{ /* opt_AddPolicyMapExt */ 0, PR_FALSE, 0, PR_FALSE, "extPM" },
|
||||
{ /* opt_AddPolicyConstrExt */ 0, PR_FALSE, 0, PR_FALSE, "extPC" },
|
||||
{ /* opt_AddInhibAnyExt */ 0, PR_FALSE, 0, PR_FALSE, "extIA" },
|
||||
{ /* opt_AddNameConstraintsExt*/ 0, PR_FALSE, 0, PR_FALSE, "extNC" },
|
||||
{ /* opt_AddSubjectKeyIDExt */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"extSKID" },
|
||||
{ /* opt_AddCmdKeyUsageExt */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyUsage" },
|
||||
{ /* opt_AddCmdNSCertTypeExt */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"nsCertType" },
|
||||
{ /* opt_AddCmdExtKeyUsageExt*/ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"extKeyUsage" },
|
||||
static const secuCommandFlag options_init[] = {
|
||||
{ /* opt_SSOPass */ '0', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_AddKeyUsageExt */ '1', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddBasicConstraintExt*/ '2', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddAuthorityKeyIDExt*/ '3', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddCRLDistPtsExt */ '4', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddNSCertTypeExt */ '5', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_AddExtKeyUsageExt */ '6', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_ExtendedEmailAddrs */ '7', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_ExtendedDNSNames */ '8', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_ASCIIForIO */ 'a', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_ValidityTime */ 'b', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_IssuerName */ 'c', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_CertDir */ 'd', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_VerifySig */ 'e', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_PasswordFile */ 'f', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_TokenName */ 'h', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_InputFile */ 'i', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Emailaddress */ 0, PR_TRUE, 0, PR_FALSE, "email" },
|
||||
{ /* opt_KeyIndex */ 'j', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_KeyType */ 'k', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_DetailedInfo */ 'l', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_SerialNumber */ 'm', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Nickname */ 'n', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OutputFile */ 'o', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_PhoneNumber */ 'p', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_DBPrefix */ 'P', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_PQGFile */ 'q', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_BinaryDER */ 'r', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Subject */ 's', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Trust */ 't', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Usage */ 'u', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Validity */ 'v', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OffsetMonths */ 'w', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_SelfSign */ 'x', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_RW */ 'X', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Exponent */ 'y', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_NoiseFile */ 'z', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Hash */ 'Z', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_NewPasswordFile */ '@', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_AddAuthInfoAccExt */ 0, PR_FALSE, 0, PR_FALSE, "extAIA" },
|
||||
{ /* opt_AddSubjInfoAccExt */ 0, PR_FALSE, 0, PR_FALSE, "extSIA" },
|
||||
{ /* opt_AddCertPoliciesExt */ 0, PR_FALSE, 0, PR_FALSE, "extCP" },
|
||||
{ /* opt_AddPolicyMapExt */ 0, PR_FALSE, 0, PR_FALSE, "extPM" },
|
||||
{ /* opt_AddPolicyConstrExt */ 0, PR_FALSE, 0, PR_FALSE, "extPC" },
|
||||
{ /* opt_AddInhibAnyExt */ 0, PR_FALSE, 0, PR_FALSE, "extIA" },
|
||||
{ /* opt_AddNameConstraintsExt*/ 0, PR_FALSE, 0, PR_FALSE, "extNC" },
|
||||
{ /* opt_AddSubjectKeyIDExt */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"extSKID" },
|
||||
{ /* opt_AddCmdKeyUsageExt */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyUsage" },
|
||||
{ /* opt_AddCmdNSCertTypeExt */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"nsCertType" },
|
||||
{ /* opt_AddCmdExtKeyUsageExt*/ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"extKeyUsage" },
|
||||
|
||||
{ /* opt_SourceDir */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"source-dir" },
|
||||
{ /* opt_SourcePrefix */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"source-prefix" },
|
||||
{ /* opt_UpgradeID */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"upgrade-id" },
|
||||
{ /* opt_UpgradeTokenName */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"upgrade-token-name" },
|
||||
{ /* opt_KeyOpFlagsOn */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyOpFlagsOn" },
|
||||
{ /* opt_KeyOpFlagsOff */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyOpFlagsOff" },
|
||||
{ /* opt_KeyAttrFlags */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyAttrFlags" },
|
||||
{ /* opt_EmptyPassword */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"empty-password" },
|
||||
{ /* opt_CertVersion */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"certVersion" },
|
||||
{ /* opt_AddSubjectAltExt */ 0, PR_TRUE, 0, PR_FALSE, "extSAN" },
|
||||
{ /* opt_DumpExtensionValue */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"dump-ext-val" },
|
||||
{ /* opt_GenericExtensions */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"extGeneric" },
|
||||
{ /* opt_NewNickname */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"new-n" },
|
||||
{ /* opt_Pss */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"pss" },
|
||||
{ /* opt_PssSign */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"pss-sign" },
|
||||
{ /* opt_SimpleSelfSigned */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"simple-self-signed" },
|
||||
};
|
||||
{ /* opt_SourceDir */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"source-dir" },
|
||||
{ /* opt_SourcePrefix */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"source-prefix" },
|
||||
{ /* opt_UpgradeID */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"upgrade-id" },
|
||||
{ /* opt_UpgradeTokenName */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"upgrade-token-name" },
|
||||
{ /* opt_KeyOpFlagsOn */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyOpFlagsOn" },
|
||||
{ /* opt_KeyOpFlagsOff */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyOpFlagsOff" },
|
||||
{ /* opt_KeyAttrFlags */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"keyAttrFlags" },
|
||||
{ /* opt_EmptyPassword */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"empty-password" },
|
||||
{ /* opt_CertVersion */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"certVersion" },
|
||||
{ /* opt_AddSubjectAltExt */ 0, PR_TRUE, 0, PR_FALSE, "extSAN" },
|
||||
{ /* opt_DumpExtensionValue */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"dump-ext-val" },
|
||||
{ /* opt_GenericExtensions */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"extGeneric" },
|
||||
{ /* opt_NewNickname */ 0, PR_TRUE, 0, PR_FALSE,
|
||||
"new-n" },
|
||||
{ /* opt_Pss */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"pss" },
|
||||
{ /* opt_PssSign */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"pss-sign" },
|
||||
{ /* opt_SimpleSelfSigned */ 0, PR_FALSE, 0, PR_FALSE,
|
||||
"simple-self-signed" },
|
||||
};
|
||||
#define NUM_OPTIONS ((sizeof options_init) / (sizeof options_init[0]))
|
||||
|
||||
static secuCommandFlag certutil_commands[NUM_COMMANDS];
|
||||
|
||||
@@ -44,7 +44,9 @@ static int
|
||||
UpdateRNG(void)
|
||||
{
|
||||
char randbuf[RAND_BUF_SIZE];
|
||||
#ifdef XP_UNIX
|
||||
int fd;
|
||||
#endif
|
||||
int c;
|
||||
int rv = 0;
|
||||
size_t count;
|
||||
@@ -72,10 +74,10 @@ UpdateRNG(void)
|
||||
FPS "%s", meter);
|
||||
FPS "\r|");
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
/* turn off echo on stdin & return on 1 char instead of NL */
|
||||
fd = fileno(stdin);
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
tcgetattr(fd, &tio);
|
||||
orig_lflag = tio.c_lflag;
|
||||
orig_cc_min = tio.c_cc[VMIN];
|
||||
@@ -385,88 +387,87 @@ typedef struct curveNameTagPairStr {
|
||||
SECOidTag curveOidTag;
|
||||
} CurveNameTagPair;
|
||||
|
||||
static CurveNameTagPair nameTagPair[] =
|
||||
{
|
||||
{ "sect163k1", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "nistk163", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "sect163r1", SEC_OID_SECG_EC_SECT163R1 },
|
||||
{ "sect163r2", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "nistb163", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "sect193r1", SEC_OID_SECG_EC_SECT193R1 },
|
||||
{ "sect193r2", SEC_OID_SECG_EC_SECT193R2 },
|
||||
{ "sect233k1", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "nistk233", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "sect233r1", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "nistb233", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "sect239k1", SEC_OID_SECG_EC_SECT239K1 },
|
||||
{ "sect283k1", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "nistk283", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "sect283r1", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "nistb283", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "sect409k1", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "nistk409", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "sect409r1", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "nistb409", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "sect571k1", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "nistk571", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "sect571r1", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "nistb571", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "secp160k1", SEC_OID_SECG_EC_SECP160K1 },
|
||||
{ "secp160r1", SEC_OID_SECG_EC_SECP160R1 },
|
||||
{ "secp160r2", SEC_OID_SECG_EC_SECP160R2 },
|
||||
{ "secp192k1", SEC_OID_SECG_EC_SECP192K1 },
|
||||
{ "secp192r1", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "nistp192", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "secp224k1", SEC_OID_SECG_EC_SECP224K1 },
|
||||
{ "secp224r1", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "nistp224", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "secp256k1", SEC_OID_SECG_EC_SECP256K1 },
|
||||
{ "secp256r1", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "nistp256", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "secp384r1", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "nistp384", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "secp521r1", SEC_OID_SECG_EC_SECP521R1 },
|
||||
{ "nistp521", SEC_OID_SECG_EC_SECP521R1 },
|
||||
static CurveNameTagPair nameTagPair[] = {
|
||||
{ "sect163k1", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "nistk163", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "sect163r1", SEC_OID_SECG_EC_SECT163R1 },
|
||||
{ "sect163r2", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "nistb163", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "sect193r1", SEC_OID_SECG_EC_SECT193R1 },
|
||||
{ "sect193r2", SEC_OID_SECG_EC_SECT193R2 },
|
||||
{ "sect233k1", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "nistk233", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "sect233r1", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "nistb233", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "sect239k1", SEC_OID_SECG_EC_SECT239K1 },
|
||||
{ "sect283k1", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "nistk283", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "sect283r1", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "nistb283", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "sect409k1", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "nistk409", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "sect409r1", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "nistb409", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "sect571k1", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "nistk571", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "sect571r1", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "nistb571", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "secp160k1", SEC_OID_SECG_EC_SECP160K1 },
|
||||
{ "secp160r1", SEC_OID_SECG_EC_SECP160R1 },
|
||||
{ "secp160r2", SEC_OID_SECG_EC_SECP160R2 },
|
||||
{ "secp192k1", SEC_OID_SECG_EC_SECP192K1 },
|
||||
{ "secp192r1", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "nistp192", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "secp224k1", SEC_OID_SECG_EC_SECP224K1 },
|
||||
{ "secp224r1", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "nistp224", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "secp256k1", SEC_OID_SECG_EC_SECP256K1 },
|
||||
{ "secp256r1", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "nistp256", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "secp384r1", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "nistp384", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "secp521r1", SEC_OID_SECG_EC_SECP521R1 },
|
||||
{ "nistp521", SEC_OID_SECG_EC_SECP521R1 },
|
||||
|
||||
{ "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 },
|
||||
{ "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 },
|
||||
{ "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 },
|
||||
{ "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 },
|
||||
{ "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 },
|
||||
{ "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 },
|
||||
{ "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 },
|
||||
{ "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 },
|
||||
{ "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 },
|
||||
{ "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 },
|
||||
{ "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 },
|
||||
{ "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 },
|
||||
|
||||
{ "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 },
|
||||
{ "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 },
|
||||
{ "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 },
|
||||
{ "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 },
|
||||
{ "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 },
|
||||
{ "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 },
|
||||
{ "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 },
|
||||
{ "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 },
|
||||
{ "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 },
|
||||
{ "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 },
|
||||
{ "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 },
|
||||
{ "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 },
|
||||
{ "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 },
|
||||
{ "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 },
|
||||
{ "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 },
|
||||
{ "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 },
|
||||
{ "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 },
|
||||
{ "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 },
|
||||
{ "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 },
|
||||
{ "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 },
|
||||
{ "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 },
|
||||
{ "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 },
|
||||
{ "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 },
|
||||
{ "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 },
|
||||
{ "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 },
|
||||
{ "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 },
|
||||
{ "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 },
|
||||
{ "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 },
|
||||
{ "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 },
|
||||
{ "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 },
|
||||
{ "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 },
|
||||
{ "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 },
|
||||
{ "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 },
|
||||
{ "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 },
|
||||
{ "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 },
|
||||
{ "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 },
|
||||
{ "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 },
|
||||
{ "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 },
|
||||
{ "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 },
|
||||
{ "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 },
|
||||
|
||||
{ "secp112r1", SEC_OID_SECG_EC_SECP112R1 },
|
||||
{ "secp112r2", SEC_OID_SECG_EC_SECP112R2 },
|
||||
{ "secp128r1", SEC_OID_SECG_EC_SECP128R1 },
|
||||
{ "secp128r2", SEC_OID_SECG_EC_SECP128R2 },
|
||||
{ "secp112r1", SEC_OID_SECG_EC_SECP112R1 },
|
||||
{ "secp112r2", SEC_OID_SECG_EC_SECP112R2 },
|
||||
{ "secp128r1", SEC_OID_SECG_EC_SECP128R1 },
|
||||
{ "secp128r2", SEC_OID_SECG_EC_SECP128R2 },
|
||||
|
||||
{ "sect113r1", SEC_OID_SECG_EC_SECT113R1 },
|
||||
{ "sect113r2", SEC_OID_SECG_EC_SECT113R2 },
|
||||
{ "sect131r1", SEC_OID_SECG_EC_SECT131R1 },
|
||||
{ "sect131r2", SEC_OID_SECG_EC_SECT131R2 },
|
||||
{ "curve25519", SEC_OID_CURVE25519 },
|
||||
};
|
||||
{ "sect113r1", SEC_OID_SECG_EC_SECT113R1 },
|
||||
{ "sect113r2", SEC_OID_SECG_EC_SECT113R2 },
|
||||
{ "sect131r1", SEC_OID_SECG_EC_SECT131R1 },
|
||||
{ "sect131r2", SEC_OID_SECG_EC_SECT131R2 },
|
||||
{ "curve25519", SEC_OID_CURVE25519 },
|
||||
};
|
||||
|
||||
static SECKEYECParams *
|
||||
getECParams(const char *curve)
|
||||
|
||||
@@ -1279,7 +1279,7 @@ input()
|
||||
/* Reset buffer status. */
|
||||
yyrestart(yyin);
|
||||
|
||||
/* fall through */
|
||||
/* fall through */
|
||||
|
||||
case EOB_ACT_END_OF_FILE: {
|
||||
if (yywrap())
|
||||
|
||||
@@ -1007,7 +1007,7 @@ processChallengeResponse(CGIVarTable *varTable, const char *certRepContent)
|
||||
rv = ERROR_RETRIEVING_CLIENT_RESPONSE_TO_CHALLENGE;
|
||||
goto loser;
|
||||
}
|
||||
sprintf(cgiChalVar, "chal%d", i + 1);
|
||||
snprintf(cgiChalVar, sizeof(cgiChalVar), "chal%d", i + 1);
|
||||
formChalValue = CGITableFindValue(varTable, cgiChalVar);
|
||||
if (formChalValue == NULL) {
|
||||
rv = REQ_CGI_VAR_NOT_PRESENT;
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
#include "sechash.h"
|
||||
#endif
|
||||
|
||||
#define MAX_KEY_LEN 512
|
||||
#define MAX_KEY_LEN 1024
|
||||
#define PATH_LEN 150
|
||||
#define BUFF_SIZE 150
|
||||
#define UID_BITS 800
|
||||
|
||||
@@ -1129,27 +1129,25 @@ enum {
|
||||
opt_KeepExpired
|
||||
};
|
||||
|
||||
static secuCommandFlag dbck_commands[] =
|
||||
{
|
||||
{ /* cmd_Debug, */ 'D', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_LongUsage,*/ 'H', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Recover, */ 'R', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
static secuCommandFlag dbck_commands[] = {
|
||||
{ /* cmd_Debug, */ 'D', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_LongUsage,*/ 'H', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Recover, */ 'R', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
|
||||
static secuCommandFlag dbck_options[] =
|
||||
{
|
||||
{ /* opt_KeepAll, */ 'a', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_CertDir, */ 'd', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Dumpfile, */ 'f', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_InputDB, */ 'i', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OutputDB, */ 'o', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Mailfile, */ 'm', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Prompt, */ 'p', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_KeepRedundant, */ 'r', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_KeepNoSMimeProfile,*/ 's', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Verbose, */ 'v', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_KeepExpired, */ 'x', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
static secuCommandFlag dbck_options[] = {
|
||||
{ /* opt_KeepAll, */ 'a', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_CertDir, */ 'd', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Dumpfile, */ 'f', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_InputDB, */ 'i', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_OutputDB, */ 'o', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Mailfile, */ 'm', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Prompt, */ 'p', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_KeepRedundant, */ 'r', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_KeepNoSMimeProfile,*/ 's', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Verbose, */ 'v', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_KeepExpired, */ 'x', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
|
||||
#define CERT_DB_FMT "%s/cert%s.db"
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ addCertToDB(certDBEntryCert *certEntry, dbRestoreInfo *info,
|
||||
/* Determine if cert is S/MIME and get its email if so. */
|
||||
email = IsEmailCert(oldCert);
|
||||
|
||||
/*
|
||||
/*
|
||||
XXX Just create empty profiles?
|
||||
if (email) {
|
||||
SECItem *profile = CERT_FindSMimeProfile(oldCert);
|
||||
|
||||
@@ -53,6 +53,7 @@ PKCS11Thread(void *data)
|
||||
SECItem sig;
|
||||
CK_SESSION_HANDLE session;
|
||||
CK_RV crv;
|
||||
void *tmp = NULL;
|
||||
|
||||
threadData->status = SECSuccess;
|
||||
threadData->count = 0;
|
||||
@@ -68,6 +69,7 @@ PKCS11Thread(void *data)
|
||||
if (threadData->isSign) {
|
||||
sig.data = sigData;
|
||||
sig.len = sizeof(sigData);
|
||||
tmp = threadData->p2;
|
||||
threadData->p2 = (void *)&sig;
|
||||
}
|
||||
|
||||
@@ -79,6 +81,10 @@ PKCS11Thread(void *data)
|
||||
}
|
||||
threadData->count++;
|
||||
}
|
||||
|
||||
if (threadData->isSign) {
|
||||
threadData->p2 = tmp;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,6 +95,7 @@ genericThread(void *data)
|
||||
int iters = threadData->iters;
|
||||
unsigned char sigData[256];
|
||||
SECItem sig;
|
||||
void *tmp = NULL;
|
||||
|
||||
threadData->status = SECSuccess;
|
||||
threadData->count = 0;
|
||||
@@ -96,6 +103,7 @@ genericThread(void *data)
|
||||
if (threadData->isSign) {
|
||||
sig.data = sigData;
|
||||
sig.len = sizeof(sigData);
|
||||
tmp = threadData->p2;
|
||||
threadData->p2 = (void *)&sig;
|
||||
}
|
||||
|
||||
@@ -107,6 +115,10 @@ genericThread(void *data)
|
||||
}
|
||||
threadData->count++;
|
||||
}
|
||||
|
||||
if (threadData->isSign) {
|
||||
threadData->p2 = tmp;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -589,7 +589,7 @@ tdea_mct_test(int mode, unsigned char *key, unsigned int numKeys,
|
||||
for (i = 0; i < 400; i++) {
|
||||
/* if i == 0 CV[0] = IV not necessary */
|
||||
/* record the count and key values and plainText */
|
||||
sprintf(buf, "COUNT = %d\n", i);
|
||||
snprintf(buf, sizeof(buf), "COUNT = %d\n", i);
|
||||
fputs(buf, resp);
|
||||
/* Output KEY1[i] */
|
||||
fputs("KEY1 = ", resp);
|
||||
@@ -1511,7 +1511,7 @@ aes_ecb_mct(char *reqfn)
|
||||
}
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
sprintf(buf, "COUNT = %d\n", i);
|
||||
snprintf(buf, sizeof(buf), "COUNT = %d\n", i);
|
||||
fputs(buf, aesresp);
|
||||
/* Output Key[i] */
|
||||
fputs("KEY = ", aesresp);
|
||||
@@ -1609,7 +1609,7 @@ aes_ecb_mct(char *reqfn)
|
||||
}
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
sprintf(buf, "COUNT = %d\n", i);
|
||||
snprintf(buf, sizeof(buf), "COUNT = %d\n", i);
|
||||
fputs(buf, aesresp);
|
||||
/* Output Key[i] */
|
||||
fputs("KEY = ", aesresp);
|
||||
@@ -1808,7 +1808,7 @@ aes_cbc_mct(char *reqfn)
|
||||
}
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
sprintf(buf, "COUNT = %d\n", i);
|
||||
snprintf(buf, sizeof(buf), "COUNT = %d\n", i);
|
||||
fputs(buf, aesresp);
|
||||
/* Output Key[i] */
|
||||
fputs("KEY = ", aesresp);
|
||||
@@ -1920,7 +1920,7 @@ aes_cbc_mct(char *reqfn)
|
||||
}
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
sprintf(buf, "COUNT = %d\n", i);
|
||||
snprintf(buf, sizeof(buf), "COUNT = %d\n", i);
|
||||
fputs(buf, aesresp);
|
||||
/* Output Key[i] */
|
||||
fputs("KEY = ", aesresp);
|
||||
@@ -2105,87 +2105,86 @@ typedef struct curveNameTagPairStr {
|
||||
#define DEFAULT_CURVE_OID_TAG SEC_OID_SECG_EC_SECP192R1
|
||||
/* #define DEFAULT_CURVE_OID_TAG SEC_OID_SECG_EC_SECP160R1 */
|
||||
|
||||
static CurveNameTagPair nameTagPair[] =
|
||||
{
|
||||
{ "sect163k1", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "nistk163", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "sect163r1", SEC_OID_SECG_EC_SECT163R1 },
|
||||
{ "sect163r2", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "nistb163", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "sect193r1", SEC_OID_SECG_EC_SECT193R1 },
|
||||
{ "sect193r2", SEC_OID_SECG_EC_SECT193R2 },
|
||||
{ "sect233k1", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "nistk233", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "sect233r1", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "nistb233", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "sect239k1", SEC_OID_SECG_EC_SECT239K1 },
|
||||
{ "sect283k1", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "nistk283", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "sect283r1", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "nistb283", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "sect409k1", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "nistk409", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "sect409r1", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "nistb409", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "sect571k1", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "nistk571", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "sect571r1", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "nistb571", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "secp160k1", SEC_OID_SECG_EC_SECP160K1 },
|
||||
{ "secp160r1", SEC_OID_SECG_EC_SECP160R1 },
|
||||
{ "secp160r2", SEC_OID_SECG_EC_SECP160R2 },
|
||||
{ "secp192k1", SEC_OID_SECG_EC_SECP192K1 },
|
||||
{ "secp192r1", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "nistp192", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "secp224k1", SEC_OID_SECG_EC_SECP224K1 },
|
||||
{ "secp224r1", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "nistp224", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "secp256k1", SEC_OID_SECG_EC_SECP256K1 },
|
||||
{ "secp256r1", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "nistp256", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "secp384r1", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "nistp384", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "secp521r1", SEC_OID_SECG_EC_SECP521R1 },
|
||||
{ "nistp521", SEC_OID_SECG_EC_SECP521R1 },
|
||||
static CurveNameTagPair nameTagPair[] = {
|
||||
{ "sect163k1", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "nistk163", SEC_OID_SECG_EC_SECT163K1 },
|
||||
{ "sect163r1", SEC_OID_SECG_EC_SECT163R1 },
|
||||
{ "sect163r2", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "nistb163", SEC_OID_SECG_EC_SECT163R2 },
|
||||
{ "sect193r1", SEC_OID_SECG_EC_SECT193R1 },
|
||||
{ "sect193r2", SEC_OID_SECG_EC_SECT193R2 },
|
||||
{ "sect233k1", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "nistk233", SEC_OID_SECG_EC_SECT233K1 },
|
||||
{ "sect233r1", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "nistb233", SEC_OID_SECG_EC_SECT233R1 },
|
||||
{ "sect239k1", SEC_OID_SECG_EC_SECT239K1 },
|
||||
{ "sect283k1", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "nistk283", SEC_OID_SECG_EC_SECT283K1 },
|
||||
{ "sect283r1", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "nistb283", SEC_OID_SECG_EC_SECT283R1 },
|
||||
{ "sect409k1", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "nistk409", SEC_OID_SECG_EC_SECT409K1 },
|
||||
{ "sect409r1", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "nistb409", SEC_OID_SECG_EC_SECT409R1 },
|
||||
{ "sect571k1", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "nistk571", SEC_OID_SECG_EC_SECT571K1 },
|
||||
{ "sect571r1", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "nistb571", SEC_OID_SECG_EC_SECT571R1 },
|
||||
{ "secp160k1", SEC_OID_SECG_EC_SECP160K1 },
|
||||
{ "secp160r1", SEC_OID_SECG_EC_SECP160R1 },
|
||||
{ "secp160r2", SEC_OID_SECG_EC_SECP160R2 },
|
||||
{ "secp192k1", SEC_OID_SECG_EC_SECP192K1 },
|
||||
{ "secp192r1", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "nistp192", SEC_OID_SECG_EC_SECP192R1 },
|
||||
{ "secp224k1", SEC_OID_SECG_EC_SECP224K1 },
|
||||
{ "secp224r1", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "nistp224", SEC_OID_SECG_EC_SECP224R1 },
|
||||
{ "secp256k1", SEC_OID_SECG_EC_SECP256K1 },
|
||||
{ "secp256r1", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "nistp256", SEC_OID_SECG_EC_SECP256R1 },
|
||||
{ "secp384r1", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "nistp384", SEC_OID_SECG_EC_SECP384R1 },
|
||||
{ "secp521r1", SEC_OID_SECG_EC_SECP521R1 },
|
||||
{ "nistp521", SEC_OID_SECG_EC_SECP521R1 },
|
||||
|
||||
{ "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 },
|
||||
{ "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 },
|
||||
{ "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 },
|
||||
{ "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 },
|
||||
{ "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 },
|
||||
{ "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 },
|
||||
{ "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 },
|
||||
{ "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 },
|
||||
{ "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 },
|
||||
{ "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 },
|
||||
{ "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 },
|
||||
{ "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 },
|
||||
|
||||
{ "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 },
|
||||
{ "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 },
|
||||
{ "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 },
|
||||
{ "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 },
|
||||
{ "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 },
|
||||
{ "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 },
|
||||
{ "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 },
|
||||
{ "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 },
|
||||
{ "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 },
|
||||
{ "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 },
|
||||
{ "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 },
|
||||
{ "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 },
|
||||
{ "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 },
|
||||
{ "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 },
|
||||
{ "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 },
|
||||
{ "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 },
|
||||
{ "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 },
|
||||
{ "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 },
|
||||
{ "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 },
|
||||
{ "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 },
|
||||
{ "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 },
|
||||
{ "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 },
|
||||
{ "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 },
|
||||
{ "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 },
|
||||
{ "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 },
|
||||
{ "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 },
|
||||
{ "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 },
|
||||
{ "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 },
|
||||
{ "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 },
|
||||
{ "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 },
|
||||
{ "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 },
|
||||
{ "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 },
|
||||
{ "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 },
|
||||
{ "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 },
|
||||
{ "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 },
|
||||
{ "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 },
|
||||
{ "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 },
|
||||
{ "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 },
|
||||
{ "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 },
|
||||
{ "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 },
|
||||
|
||||
{ "secp112r1", SEC_OID_SECG_EC_SECP112R1 },
|
||||
{ "secp112r2", SEC_OID_SECG_EC_SECP112R2 },
|
||||
{ "secp128r1", SEC_OID_SECG_EC_SECP128R1 },
|
||||
{ "secp128r2", SEC_OID_SECG_EC_SECP128R2 },
|
||||
{ "secp112r1", SEC_OID_SECG_EC_SECP112R1 },
|
||||
{ "secp112r2", SEC_OID_SECG_EC_SECP112R2 },
|
||||
{ "secp128r1", SEC_OID_SECG_EC_SECP128R1 },
|
||||
{ "secp128r2", SEC_OID_SECG_EC_SECP128R2 },
|
||||
|
||||
{ "sect113r1", SEC_OID_SECG_EC_SECT113R1 },
|
||||
{ "sect113r2", SEC_OID_SECG_EC_SECT113R2 },
|
||||
{ "sect131r1", SEC_OID_SECG_EC_SECT131R1 },
|
||||
{ "sect131r2", SEC_OID_SECG_EC_SECT131R2 },
|
||||
};
|
||||
{ "sect113r1", SEC_OID_SECG_EC_SECT113R1 },
|
||||
{ "sect113r2", SEC_OID_SECG_EC_SECT113R2 },
|
||||
{ "sect131r1", SEC_OID_SECG_EC_SECT131R1 },
|
||||
{ "sect131r2", SEC_OID_SECG_EC_SECT131R2 },
|
||||
};
|
||||
|
||||
static SECItem *
|
||||
getECParams(const char *curve)
|
||||
@@ -4663,7 +4662,7 @@ sha_mct_test(unsigned int MDLen, unsigned char *seed, FILE *resp)
|
||||
/* seed = MD_i */
|
||||
memcpy(seed, MD_i, MDLen);
|
||||
|
||||
sprintf(buf, "COUNT = %d\n", j);
|
||||
snprintf(buf, sizeof(buf), "COUNT = %d\n", j);
|
||||
fputs(buf, resp);
|
||||
|
||||
/* output MD_i */
|
||||
@@ -6660,12 +6659,9 @@ tls(char *reqfn)
|
||||
};
|
||||
CK_ULONG derive_template_count =
|
||||
sizeof(derive_template) / sizeof(derive_template[0]);
|
||||
CK_ATTRIBUTE master_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE kb1_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE kb2_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE master_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE kb1_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE kb2_template = { CKA_VALUE, NULL, 0 };
|
||||
|
||||
CK_MECHANISM master_mech = { CKM_TLS_MASTER_KEY_DERIVE, NULL, 0 };
|
||||
CK_MECHANISM key_block_mech = { CKM_TLS_KEY_AND_MAC_DERIVE, NULL, 0 };
|
||||
@@ -6990,14 +6986,10 @@ ikev1(char *reqfn)
|
||||
};
|
||||
CK_ULONG derive_template_count =
|
||||
sizeof(derive_template) / sizeof(derive_template[0]);
|
||||
CK_ATTRIBUTE skeyid_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_d_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_a_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_e_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_d_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_a_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_e_template = { CKA_VALUE, NULL, 0 };
|
||||
unsigned char skeyid_secret[HASH_LENGTH_MAX];
|
||||
unsigned char skeyid_d_secret[HASH_LENGTH_MAX];
|
||||
unsigned char skeyid_a_secret[HASH_LENGTH_MAX];
|
||||
@@ -7384,14 +7376,10 @@ ikev1_psk(char *reqfn)
|
||||
};
|
||||
CK_ULONG derive_template_count =
|
||||
sizeof(derive_template) / sizeof(derive_template[0]);
|
||||
CK_ATTRIBUTE skeyid_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_d_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_a_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_e_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_d_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_a_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyid_e_template = { CKA_VALUE, NULL, 0 };
|
||||
unsigned char skeyid_secret[HASH_LENGTH_MAX];
|
||||
unsigned char skeyid_d_secret[HASH_LENGTH_MAX];
|
||||
unsigned char skeyid_a_secret[HASH_LENGTH_MAX];
|
||||
@@ -7817,12 +7805,9 @@ ikev2(char *reqfn)
|
||||
};
|
||||
CK_ULONG derive_template_count =
|
||||
sizeof(derive_template) / sizeof(derive_template[0]);
|
||||
CK_ATTRIBUTE skeyseed_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE dkm_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE dkm_child_template =
|
||||
{ CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE skeyseed_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE dkm_template = { CKA_VALUE, NULL, 0 };
|
||||
CK_ATTRIBUTE dkm_child_template = { CKA_VALUE, NULL, 0 };
|
||||
unsigned char skeyseed_secret[HASH_LENGTH_MAX];
|
||||
|
||||
CK_MECHANISM ike_mech = { CKM_NSS_IKE_PRF_DERIVE, NULL, 0 };
|
||||
|
||||
@@ -37,10 +37,6 @@
|
||||
#include "ocspti.h"
|
||||
#include "ocspi.h"
|
||||
|
||||
#ifndef PORT_Sprintf
|
||||
#define PORT_Sprintf sprintf
|
||||
#endif
|
||||
|
||||
#ifndef PORT_Strstr
|
||||
#define PORT_Strstr strstr
|
||||
#endif
|
||||
@@ -687,7 +683,7 @@ handle_connection(
|
||||
if (!request || !request->tbsRequest ||
|
||||
!request->tbsRequest->requestList ||
|
||||
!request->tbsRequest->requestList[0]) {
|
||||
PORT_Sprintf(msgBuf, "Cannot decode OCSP request.\r\n");
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Cannot decode OCSP request.\r\n");
|
||||
|
||||
iovs[numIOVs].iov_base = msgBuf;
|
||||
iovs[numIOVs].iov_len = PORT_Strlen(msgBuf);
|
||||
@@ -781,7 +777,7 @@ handle_connection(
|
||||
singleResponses, &pwdata);
|
||||
|
||||
if (!ocspResponse) {
|
||||
PORT_Sprintf(msgBuf, "Failed to encode response\r\n");
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Failed to encode response\r\n");
|
||||
iovs[numIOVs].iov_base = msgBuf;
|
||||
iovs[numIOVs].iov_len = PORT_Strlen(msgBuf);
|
||||
numIOVs++;
|
||||
@@ -818,15 +814,15 @@ handle_connection(
|
||||
iovs[numIOVs].iov_len = PORT_Strlen(msgBuf);
|
||||
numIOVs++;
|
||||
} else if (reqLen <= 0) { /* hit eof */
|
||||
PORT_Sprintf(msgBuf, "Get or Post incomplete after %d bytes.\r\n",
|
||||
bufDat);
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Get or Post incomplete after %d bytes.\r\n",
|
||||
bufDat);
|
||||
|
||||
iovs[numIOVs].iov_base = msgBuf;
|
||||
iovs[numIOVs].iov_len = PORT_Strlen(msgBuf);
|
||||
numIOVs++;
|
||||
} else if (reqLen < bufDat) {
|
||||
PORT_Sprintf(msgBuf, "Discarded %d characters.\r\n",
|
||||
bufDat - reqLen);
|
||||
snprintf(msgBuf, sizeof(msgBuf), "Discarded %d characters.\r\n",
|
||||
bufDat - reqLen);
|
||||
|
||||
iovs[numIOVs].iov_base = msgBuf;
|
||||
iovs[numIOVs].iov_len = PORT_Strlen(msgBuf);
|
||||
|
||||
@@ -679,9 +679,8 @@ SECU_SECItemToHex(const SECItem *item, char *dst)
|
||||
unsigned char *src = item->data;
|
||||
unsigned int len = item->len;
|
||||
for (; len > 0; --len, dst += 2) {
|
||||
sprintf(dst, "%02x", *src++);
|
||||
snprintf(dst, 3, "%02x", *src++);
|
||||
}
|
||||
*dst = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +52,11 @@ const int constTypeCount = sizeof(_constTypeString) / sizeof(_constTypeString[0]
|
||||
|
||||
#define mkEntry(x, t) \
|
||||
{ \
|
||||
#x, x, Const##t, ConstNone \
|
||||
#x, x, Const##t, ConstNone \
|
||||
}
|
||||
#define mkEntry2(x, t, t2) \
|
||||
{ \
|
||||
#x, x, Const##t, Const##t2 \
|
||||
#x, x, Const##t, Const##t2 \
|
||||
}
|
||||
|
||||
const Constant _consts[] = {
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
#include <unistd.h> /* for isatty() */
|
||||
#endif
|
||||
|
||||
@@ -28,31 +25,29 @@ static char *quiet_fgets(char *buf, int length, FILE *input);
|
||||
#define QUIET_FGETS fgets
|
||||
#endif
|
||||
|
||||
#if !defined(_WINDOWS)
|
||||
static void
|
||||
echoOff(int fd)
|
||||
{
|
||||
#if defined(XP_UNIX)
|
||||
if (isatty(fd)) {
|
||||
struct termios tio;
|
||||
tcgetattr(fd, &tio);
|
||||
tio.c_lflag &= ~ECHO;
|
||||
tcsetattr(fd, TCSAFLUSH, &tio);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
echoOn(int fd)
|
||||
{
|
||||
#if defined(XP_UNIX)
|
||||
if (isatty(fd)) {
|
||||
struct termios tio;
|
||||
tcgetattr(fd, &tio);
|
||||
tio.c_lflag |= ECHO;
|
||||
tcsetattr(fd, TCSAFLUSH, &tio);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
char *
|
||||
SEC_GetPassword(FILE *input, FILE *output, char *prompt,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "secpkcs7.h"
|
||||
#include "secpkcs5.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
@@ -232,15 +233,15 @@ SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg)
|
||||
|
||||
switch (pwdata->source) {
|
||||
case PW_NONE:
|
||||
sprintf(prompt, "Enter Password or Pin for \"%s\":",
|
||||
PK11_GetTokenName(slot));
|
||||
snprintf(prompt, sizeof(prompt), "Enter Password or Pin for \"%s\":",
|
||||
PK11_GetTokenName(slot));
|
||||
return SECU_GetPasswordString(NULL, prompt);
|
||||
case PW_FROMFILE:
|
||||
return SECU_FilePasswd(slot, retry, pwdata->data);
|
||||
case PW_EXTERNAL:
|
||||
sprintf(prompt,
|
||||
"Press Enter, then enter PIN for \"%s\" on external device.\n",
|
||||
PK11_GetTokenName(slot));
|
||||
snprintf(prompt, sizeof(prompt),
|
||||
"Press Enter, then enter PIN for \"%s\" on external device.\n",
|
||||
PK11_GetTokenName(slot));
|
||||
char *pw = SECU_GetPasswordString(NULL, prompt);
|
||||
PORT_Free(pw);
|
||||
/* Fall Through */
|
||||
@@ -436,7 +437,7 @@ SECU_DefaultSSLDir(void)
|
||||
if (strlen(dir) >= PR_ARRAY_SIZE(sslDir)) {
|
||||
return NULL;
|
||||
}
|
||||
sprintf(sslDir, "%s", dir);
|
||||
snprintf(sslDir, sizeof(sslDir), "%s", dir);
|
||||
|
||||
if (sslDir[strlen(sslDir) - 1] == '/')
|
||||
sslDir[strlen(sslDir) - 1] = 0;
|
||||
@@ -450,9 +451,9 @@ SECU_AppendFilenameToDir(char *dir, char *filename)
|
||||
static char path[1000];
|
||||
|
||||
if (dir[strlen(dir) - 1] == '/')
|
||||
sprintf(path, "%s%s", dir, filename);
|
||||
snprintf(path, sizeof(path), "%s%s", dir, filename);
|
||||
else
|
||||
sprintf(path, "%s/%s", dir, filename);
|
||||
snprintf(path, sizeof(path), "%s/%s", dir, filename);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -473,11 +474,11 @@ SECU_ConfigDirectory(const char *base)
|
||||
home = "";
|
||||
|
||||
if (*home && home[strlen(home) - 1] == '/')
|
||||
sprintf(buf, "%.900s%s", home, dir);
|
||||
snprintf(buf, sizeof(buf), "%.900s%s", home, dir);
|
||||
else
|
||||
sprintf(buf, "%.900s/%s", home, dir);
|
||||
snprintf(buf, sizeof(buf), "%.900s/%s", home, dir);
|
||||
} else {
|
||||
sprintf(buf, "%.900s", base);
|
||||
snprintf(buf, sizeof(buf), "%.900s", base);
|
||||
if (buf[strlen(buf) - 1] == '/')
|
||||
buf[strlen(buf) - 1] = 0;
|
||||
}
|
||||
@@ -1419,7 +1420,7 @@ secu_PrintAttribute(FILE *out, SEC_PKCS7Attribute *attr, char *m, int level)
|
||||
if (attr->values != NULL) {
|
||||
i = 0;
|
||||
while ((value = attr->values[i++]) != NULL) {
|
||||
sprintf(om, "Value (%d)%s", i, attr->encoded ? " (encoded)" : "");
|
||||
snprintf(om, sizeof(om), "Value (%d)%s", i, attr->encoded ? " (encoded)" : "");
|
||||
if (attr->encoded || attr->typeTag == NULL) {
|
||||
SECU_PrintAny(out, value, om, level + 1);
|
||||
} else {
|
||||
@@ -2708,7 +2709,7 @@ secu_PrintSignerInfo(FILE *out, SEC_PKCS7SignerInfo *info,
|
||||
fprintf(out, "Authenticated Attributes:\n");
|
||||
iv = 0;
|
||||
while ((attr = info->authAttr[iv++]) != NULL) {
|
||||
sprintf(om, "Attribute (%d)", iv);
|
||||
snprintf(om, sizeof(om), "Attribute (%d)", iv);
|
||||
secu_PrintAttribute(out, attr, om, level + 2);
|
||||
}
|
||||
}
|
||||
@@ -2723,7 +2724,7 @@ secu_PrintSignerInfo(FILE *out, SEC_PKCS7SignerInfo *info,
|
||||
fprintf(out, "Unauthenticated Attributes:\n");
|
||||
iv = 0;
|
||||
while ((attr = info->unAuthAttr[iv++]) != NULL) {
|
||||
sprintf(om, "Attribute (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Attribute (%x)", iv);
|
||||
secu_PrintAttribute(out, attr, om, level + 2);
|
||||
}
|
||||
}
|
||||
@@ -2757,7 +2758,7 @@ SECU_PrintCRLInfo(FILE *out, CERTCrl *crl, char *m, int level)
|
||||
if (crl->entries != NULL) {
|
||||
iv = 0;
|
||||
while ((entry = crl->entries[iv++]) != NULL) {
|
||||
sprintf(om, "Entry %d (0x%x):\n", iv, iv);
|
||||
snprintf(om, sizeof(om), "Entry %d (0x%x):\n", iv, iv);
|
||||
SECU_Indent(out, level + 1);
|
||||
fputs(om, out);
|
||||
SECU_PrintInteger(out, &(entry->serialNumber), "Serial Number",
|
||||
@@ -2796,7 +2797,7 @@ secu_PrintPKCS7Signed(FILE *out, SEC_PKCS7SignedData *src,
|
||||
fprintf(out, "Digest Algorithm List:\n");
|
||||
iv = 0;
|
||||
while ((digAlg = src->digestAlgorithms[iv++]) != NULL) {
|
||||
sprintf(om, "Digest Algorithm (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Digest Algorithm (%x)", iv);
|
||||
SECU_PrintAlgorithmID(out, digAlg, om, level + 2);
|
||||
}
|
||||
}
|
||||
@@ -2813,7 +2814,7 @@ secu_PrintPKCS7Signed(FILE *out, SEC_PKCS7SignedData *src,
|
||||
fprintf(out, "Certificate List:\n");
|
||||
iv = 0;
|
||||
while ((aCert = src->rawCerts[iv++]) != NULL) {
|
||||
sprintf(om, "Certificate (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Certificate (%x)", iv);
|
||||
rv = SECU_PrintSignedData(out, aCert, om, level + 2,
|
||||
(SECU_PPFunc)SECU_PrintCertificate);
|
||||
if (rv)
|
||||
@@ -2827,7 +2828,7 @@ secu_PrintPKCS7Signed(FILE *out, SEC_PKCS7SignedData *src,
|
||||
fprintf(out, "Signed Revocation Lists:\n");
|
||||
iv = 0;
|
||||
while ((aCrl = src->crls[iv++]) != NULL) {
|
||||
sprintf(om, "Signed Revocation List (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Signed Revocation List (%x)", iv);
|
||||
SECU_Indent(out, level + 2);
|
||||
fprintf(out, "%s:\n", om);
|
||||
SECU_PrintAlgorithmID(out, &aCrl->signatureWrap.signatureAlgorithm,
|
||||
@@ -2846,7 +2847,7 @@ secu_PrintPKCS7Signed(FILE *out, SEC_PKCS7SignedData *src,
|
||||
fprintf(out, "Signer Information List:\n");
|
||||
iv = 0;
|
||||
while ((sigInfo = src->signerInfos[iv++]) != NULL) {
|
||||
sprintf(om, "Signer Information (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Signer Information (%x)", iv);
|
||||
secu_PrintSignerInfo(out, sigInfo, om, level + 2);
|
||||
}
|
||||
}
|
||||
@@ -2876,7 +2877,7 @@ secu_PrintPKCS7Enveloped(FILE *out, SEC_PKCS7EnvelopedData *src,
|
||||
fprintf(out, "Recipient Information List:\n");
|
||||
iv = 0;
|
||||
while ((recInfo = src->recipientInfos[iv++]) != NULL) {
|
||||
sprintf(om, "Recipient Information (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Recipient Information (%x)", iv);
|
||||
secu_PrintRecipientInfo(out, recInfo, om, level + 2);
|
||||
}
|
||||
}
|
||||
@@ -2913,7 +2914,7 @@ secu_PrintPKCS7SignedAndEnveloped(FILE *out,
|
||||
fprintf(out, "Recipient Information List:\n");
|
||||
iv = 0;
|
||||
while ((recInfo = src->recipientInfos[iv++]) != NULL) {
|
||||
sprintf(om, "Recipient Information (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Recipient Information (%x)", iv);
|
||||
secu_PrintRecipientInfo(out, recInfo, om, level + 2);
|
||||
}
|
||||
}
|
||||
@@ -2924,7 +2925,7 @@ secu_PrintPKCS7SignedAndEnveloped(FILE *out,
|
||||
fprintf(out, "Digest Algorithm List:\n");
|
||||
iv = 0;
|
||||
while ((digAlg = src->digestAlgorithms[iv++]) != NULL) {
|
||||
sprintf(om, "Digest Algorithm (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Digest Algorithm (%x)", iv);
|
||||
SECU_PrintAlgorithmID(out, digAlg, om, level + 2);
|
||||
}
|
||||
}
|
||||
@@ -2940,7 +2941,7 @@ secu_PrintPKCS7SignedAndEnveloped(FILE *out,
|
||||
fprintf(out, "Certificate List:\n");
|
||||
iv = 0;
|
||||
while ((aCert = src->rawCerts[iv++]) != NULL) {
|
||||
sprintf(om, "Certificate (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Certificate (%x)", iv);
|
||||
rv = SECU_PrintSignedData(out, aCert, om, level + 2,
|
||||
(SECU_PPFunc)SECU_PrintCertificate);
|
||||
if (rv)
|
||||
@@ -2954,7 +2955,7 @@ secu_PrintPKCS7SignedAndEnveloped(FILE *out,
|
||||
fprintf(out, "Signed Revocation Lists:\n");
|
||||
iv = 0;
|
||||
while ((aCrl = src->crls[iv++]) != NULL) {
|
||||
sprintf(om, "Signed Revocation List (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Signed Revocation List (%x)", iv);
|
||||
SECU_Indent(out, level + 2);
|
||||
fprintf(out, "%s:\n", om);
|
||||
SECU_PrintAlgorithmID(out, &aCrl->signatureWrap.signatureAlgorithm,
|
||||
@@ -2973,7 +2974,7 @@ secu_PrintPKCS7SignedAndEnveloped(FILE *out,
|
||||
fprintf(out, "Signer Information List:\n");
|
||||
iv = 0;
|
||||
while ((sigInfo = src->signerInfos[iv++]) != NULL) {
|
||||
sprintf(om, "Signer Information (%x)", iv);
|
||||
snprintf(om, sizeof(om), "Signer Information (%x)", iv);
|
||||
secu_PrintSignerInfo(out, sigInfo, om, level + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +410,8 @@ cleanup:
|
||||
PKIX_TEST_RETURN();
|
||||
}
|
||||
|
||||
static void testPolicyMatch(
|
||||
static void
|
||||
testPolicyMatch(
|
||||
PKIX_List *certs,
|
||||
PKIX_PL_Cert *NIST1Cert, /* a source for policy NIST1 */
|
||||
PKIX_PL_Cert *NIST2Cert, /* a source for policy NIST2 */
|
||||
@@ -860,8 +861,9 @@ cleanup:
|
||||
PKIX_TEST_RETURN();
|
||||
}
|
||||
|
||||
static void test_customCallback2(PKIX_List *certs,
|
||||
PKIX_PL_Cert *anyPolicyCert) /* a source for policy anyPolicy */
|
||||
static void
|
||||
test_customCallback2(PKIX_List *certs,
|
||||
PKIX_PL_Cert *anyPolicyCert) /* a source for policy anyPolicy */
|
||||
{
|
||||
PKIX_CertSelector *selector = NULL;
|
||||
PKIX_List *anyPolicyList = NULL; /* OIDs */
|
||||
@@ -1423,12 +1425,10 @@ test_CertSelector_Duplicate(PKIX_CertSelector *selector)
|
||||
PKIX_TRUE,
|
||||
plContext);
|
||||
} else {
|
||||
if
|
||||
PKIX_EXACTLY_ONE_NULL(goodSubject, equalSubject)
|
||||
{
|
||||
pkixTestErrorMsg = "Subject Names are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
if PKIX_EXACTLY_ONE_NULL (goodSubject, equalSubject) {
|
||||
pkixTestErrorMsg = "Subject Names are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_ComCertSelParams_GetPolicy(goodParams, &goodPolicy, plContext));
|
||||
@@ -1439,12 +1439,10 @@ test_CertSelector_Duplicate(PKIX_CertSelector *selector)
|
||||
PKIX_TRUE,
|
||||
plContext);
|
||||
} else {
|
||||
if
|
||||
PKIX_EXACTLY_ONE_NULL(goodPolicy, equalPolicy)
|
||||
{
|
||||
pkixTestErrorMsg = "Policy Lists are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
if PKIX_EXACTLY_ONE_NULL (goodPolicy, equalPolicy) {
|
||||
pkixTestErrorMsg = "Policy Lists are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_ComCertSelParams_GetCertificate(goodParams, &goodCert, plContext));
|
||||
@@ -1455,12 +1453,10 @@ test_CertSelector_Duplicate(PKIX_CertSelector *selector)
|
||||
PKIX_TRUE,
|
||||
plContext);
|
||||
} else {
|
||||
if
|
||||
PKIX_EXACTLY_ONE_NULL(goodCert, equalCert)
|
||||
{
|
||||
pkixTestErrorMsg = "Cert Lists are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
if PKIX_EXACTLY_ONE_NULL (goodCert, equalCert) {
|
||||
pkixTestErrorMsg = "Cert Lists are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_ComCertSelParams_GetCertificateValid(goodParams, &goodDate, plContext));
|
||||
@@ -1471,12 +1467,10 @@ test_CertSelector_Duplicate(PKIX_CertSelector *selector)
|
||||
PKIX_TRUE,
|
||||
plContext);
|
||||
} else {
|
||||
if
|
||||
PKIX_EXACTLY_ONE_NULL(goodDate, equalDate)
|
||||
{
|
||||
pkixTestErrorMsg = "Date Lists are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
if PKIX_EXACTLY_ONE_NULL (goodDate, equalDate) {
|
||||
pkixTestErrorMsg = "Date Lists are not equal!";
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_ComCertSelParams_GetBasicConstraints(goodParams, &goodBasicConstraints, plContext));
|
||||
|
||||
Loaded 100 of 918 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user